Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 18 additions & 15 deletions REST_APIs.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DOME Search REST APIs

**Version:** 1.1.4
**Version:** 1.2.0
**Description:** DOME Search REST APIs Swagger documentation


Expand All @@ -11,29 +11,32 @@
|------|------|------|
| POST | `/api/RandomizedProductOfferings` | postRandomizedProductOfferings |

### search-resource
### provider-resource
| Verb | Path | Task |
|------|------|------|
| POST | `/api/SearchProduct/{query}` | searchProduct |
| POST | `/api/SearchProductByFilterCategory` | searchProductByFilterCategory |
| GET | `/api/offerings/clearRepository` | clearRepository |
| POST | `/api/SearchOrganizations` | searchOrganizations |
| GET | `/api/categories` | getCategories |
| GET | `/api/complianceLevels` | getComplianceLevels |
| GET | `/api/countries` | getCountries |
| GET | `/api/organizations/clearRepository` | clearRepository |

### provider-resource
### search-resource
| Verb | Path | Task |
|------|------|------|
| POST | `/api/providersByCategories` | getProvidersByCategories |
| POST | `/api/searchOrganizations` | searchOrganizations |
| POST | `/api/SearchProduct/{query}` | searchProduct |
| POST | `/api/SearchProductByFilterCategory` | searchProductByFilterCategory |
| GET | `/api/offerings/clearRepository` | clearRepositoryUsingGET_1 |

### basic-error-controller
| Verb | Path | Task |
|------|------|------|
| GET | `/error` | error |
| HEAD | `/error` | error |
| POST | `/error` | error |
| PUT | `/error` | error |
| DELETE | `/error` | error |
| OPTIONS | `/error` | error |
| PATCH | `/error` | error |
| GET | `/error` | errorHtml |
| HEAD | `/error` | errorHtml |
| POST | `/error` | errorHtml |
| PUT | `/error` | errorHtml |
| DELETE | `/error` | errorHtml |
| OPTIONS | `/error` | errorHtml |
| PATCH | `/error` | errorHtml |

### info-search-controller
| Verb | Path | Task |
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<groupId>it.eng.dome</groupId>
<artifactId>search</artifactId>
<version>1.1.4</version>
<version>1.2.0</version>
<name>Search and Browsing</name>
<description>Demo for DOME Project</description>

Expand Down Expand Up @@ -82,7 +82,7 @@
<dependency>
<groupId>it.eng.dome.brokerage</groupId>
<artifactId>brokerage-utils</artifactId>
<version>2.2.7</version>
<version>2.2.8</version>
</dependency>

<!-- TMF SDK dependencies -->
Expand Down
12 changes: 12 additions & 0 deletions release_note.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

**Release Notes** for the *Search*:

### <code>1.2.0</code>
**Feature**
* Introduced new Elasticsearch index `provider-index` dedicated to Organizations (providers) indexing.
* Implemented `ProviderIndexingService` to manage the indexing process of Organizations in the `provider-index` based on ProductOfferings store in ES (`Launched` status only) and considering only DOME Catalog Categories.
* Added orchestration layer to manage the indexing process of both ProductOfferings and Organizations.
* Update REST APIs to support and expose the new `provider-index` for search and retrieval of Organizations.
* Added new attribute `considerAllOrgs` in REST APIs to allow users to choose whether to consider all indexed Organizations or only those Organizations that have at least one ProductOffering on the Marketplace.

**Improvement**
* Usage of the `Brokerage Utils 2.2.8`.
* Set `catalog url` using `DOME_BASE_URL` variable in application.yaml.

### <code>1.1.4</code>
**Bug Fix**
* Set `ReadTimeout` using `timeout` variable in application.yaml.
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/it/eng/dome/search/config/RestTemplateConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package it.eng.dome.search.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

@Configuration
public class RestTemplateConfig {

@Bean
public RestTemplate restTemplate() {
return new RestTemplate();
}
}
42 changes: 42 additions & 0 deletions src/main/java/it/eng/dome/search/domain/ProviderIndex.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package it.eng.dome.search.domain;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import it.eng.dome.search.domain.dto.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.List;

@AllArgsConstructor
@NoArgsConstructor
@Data
@Document(indexName = "provider-index")
@JsonIgnoreProperties(ignoreUnknown = true)
public class ProviderIndex {

@Id
protected String id;

@Field(type = FieldType.Text)
private String tradingName;

@Field(type = FieldType.Object)
private OrganizationDTO organization;

@Field(type = FieldType.Nested)
private List<CategoryDTO> categories;

@Field(type = FieldType.Keyword)
private String country;

@Field(type = FieldType.Keyword)
private List<String> complianceLevels;

@Field(type = FieldType.Integer)
private Integer publishedOfferingsCount;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package it.eng.dome.search.domain.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ExternalReferenceDTO {
private String externalReferenceType;
private String name;
}
19 changes: 19 additions & 0 deletions src/main/java/it/eng/dome/search/domain/dto/OrganizationDTO.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package it.eng.dome.search.domain.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class OrganizationDTO {
private String id;
private String href;
private String tradingName;
private List<ExternalReferenceDTO> externalReference;
private List<OrganizationIdentificationDTO> organizationIdentification;
private List<PartyCharacteristicDTO> partyCharacteristic;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package it.eng.dome.search.domain.dto;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class OrganizationIdentificationDTO {
private String identificationId;
private String identificationType;
private String issuingAuthority;
// private OffsetDateTime issuingDate;
// private AttachmentRefOrValue attachment;
// private TimePeriod validFor;
// private String atBaseType;
// private URI atSchemaLocation;
@JsonProperty("@type")
private String atType;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package it.eng.dome.search.domain.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class PartyCharacteristicDTO {
private String name;
private Object value;
}
27 changes: 27 additions & 0 deletions src/main/java/it/eng/dome/search/indexing/IndexingManager.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package it.eng.dome.search.indexing;

import it.eng.dome.search.domain.IndexingObject;
import it.eng.dome.search.domain.ProviderIndex;
import it.eng.dome.search.service.TmfDataRetriever;
import it.eng.dome.tmforum.tmf620.v4.model.*;
import it.eng.dome.tmforum.tmf632.v4.model.Organization;
Expand Down Expand Up @@ -114,6 +115,32 @@ private IndexingObject mapResourceSpec(ProductSpecification productSpec, Indexin
return objToIndex;
}

public ProviderIndex processProviderFromIndexingObject(Organization organization, List<IndexingObject> offerings, ProviderIndex objToIndex, List<String> domeCatalogCategories) {
try {

if (organization == null || organization.getId() == null) {
log.warn("Organization is null or has no ID. Skipping.");
return objToIndex;
}

// ---- Map Organization basic metadata ----
objToIndex = mappingManager.prepareOrganizationMetadata(organization, objToIndex);

// ---- Aggregation from offerings ----
objToIndex = mappingManager.prepareProviderAggregationMetadata(offerings, objToIndex, domeCatalogCategories);

// ---- Published offerings count ----
int publishedCount = (offerings != null) ? offerings.size() : 0;
objToIndex.setPublishedOfferingsCount(publishedCount);

} catch (Exception e) {
log.warn("Exception - Error during processProviderFromTMForum(). Skipped: {}",
e.getMessage(), e);
}

return objToIndex;
}

/*
private IndexingObject processSemantic(IndexingObject objToIndex, ProductOffering product) {
// Reactivate for Semantic services
Expand Down
Loading
Loading