summaryrefslogtreecommitdiffstats
path: root/mso-catalog-db/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'mso-catalog-db/src/main/java/org')
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java21
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java51
2 files changed, 69 insertions, 3 deletions
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java
index 9cce212c36..a56abff927 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java
@@ -21,14 +21,19 @@
package org.onap.so.db.catalog.beans;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.openpojo.business.annotation.BusinessKey;
+import com.openpojo.reflection.java.packageloader.impl.URLToFileSystemAdapter;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
+import uk.co.blackpepper.bowman.annotation.RemoteResource;
+import uk.co.blackpepper.bowman.annotation.ResourceId;
import javax.persistence.CascadeType;
import javax.persistence.Column;
@@ -40,6 +45,7 @@ import javax.persistence.OneToOne;
import javax.persistence.PrePersist;
import javax.persistence.Table;
import javax.persistence.Temporal;
+import javax.persistence.Transient;
import javax.persistence.TemporalType;
/**
@@ -48,6 +54,7 @@ import javax.persistence.TemporalType;
* object, of which it is a component
*
*/
+@RemoteResource("/cloudSite")
@Entity
@Table(name = "cloud_sites")
public class CloudSite {
@@ -115,6 +122,9 @@ public class CloudSite {
@Temporal(TemporalType.TIMESTAMP)
private Date updated;
+ @Transient
+ private URI uri;
+
public CloudSite() {
}
@@ -135,8 +145,8 @@ public class CloudSite {
this.regionId = site.getRegionId();
this.identityServiceId = site.getIdentityServiceId();
}
-
-
+
+
public String getId() {
return this.id;
}
@@ -145,6 +155,13 @@ public class CloudSite {
this.id = id;
}
+ @ResourceId
+ public URI getUri() {return this.uri;}
+
+ public void setUri(URI uri) {
+ this.uri = uri;
+ }
+
public String getRegionId() {
return regionId;
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
index 9a03f8fb07..9742a0c85b 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
@@ -27,7 +27,6 @@ import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
import org.onap.so.db.catalog.beans.ControllerSelectionReference;
import org.onap.so.db.catalog.beans.CvnfcCustomization;
-import org.onap.so.db.catalog.beans.ExternalServiceToInternalService;
import org.onap.so.db.catalog.beans.InstanceGroup;
import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
import org.onap.so.db.catalog.beans.NetworkRecipe;
@@ -291,6 +290,47 @@ public class CatalogDbClient {
controllerSelectionReferenceClient = clientFactory.create(ControllerSelectionReference.class);
}
+ public CatalogDbClient(String baseUri, String auth) {
+ ClientHttpRequestFactory factory = new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory());
+
+ ClientFactory clientFactory = Configuration.builder().setBaseUri(baseUri).setClientHttpRequestFactory(factory).setRestTemplateConfigurer(restTemplate -> {
+ restTemplate.getInterceptors().add((new SpringClientFilter()));
+
+ restTemplate.getInterceptors().add((request, body, execution) -> {
+
+ request.getHeaders().add(HttpHeaders.AUTHORIZATION, auth);
+ request.getHeaders().add(LogConstants.TARGET_ENTITY_HEADER,TARGET_ENTITY);
+ return execution.execute(request, body);
+ });
+ }).build().buildClientFactory();
+ serviceClient = clientFactory.create(Service.class);
+ networkRecipeClient = clientFactory.create(NetworkRecipe.class);
+ networkResourceCustomizationClient = clientFactory.create(NetworkResourceCustomization.class);
+ vnfResourceClient = clientFactory.create(VnfResource.class);
+ vnfResourceCustomizationClient = clientFactory.create(VnfResourceCustomization.class);
+ vnfRecipeClient = clientFactory.create(VnfRecipe.class);
+ orchestrationClient = clientFactory.create(OrchestrationFlow.class);
+ vfModuleCustomizationClient = clientFactory.create(VfModuleCustomization.class);
+ vfModuleClient = clientFactory.create(VfModule.class);
+ vnfComponentsRecipeClient = clientFactory.create(VnfComponentsRecipe.class);
+ northBoundRequestClient = clientFactory.create(NorthBoundRequest.class);
+ rainyDayHandlerStatusClient = clientFactory.create(RainyDayHandlerStatus.class);
+ buildingBlockDetailClient = clientFactory.create(BuildingBlockDetail.class);
+ orchestrationStatusStateTransitionDirectiveClient = clientFactory
+ .create(OrchestrationStatusStateTransitionDirective.class);
+ vnfcInstanceGroupCustomizationClient = clientFactory.create(VnfcInstanceGroupCustomization.class);
+ collectionResourceInstanceGroupCustomizationClient = clientFactory
+ .create(CollectionResourceInstanceGroupCustomization.class);
+ instanceGroupClient = clientFactory.create(InstanceGroup.class);
+ networkCollectionResourceCustomizationClient = clientFactory.create(NetworkCollectionResourceCustomization.class);
+ collectionNetworkResourceCustomizationClient = clientFactory.create(CollectionNetworkResourceCustomization.class);
+ cloudSiteClient = clientFactory.create(CloudSite.class);
+ cloudifyManagerClient = clientFactory.create(CloudifyManager.class);
+ serviceRecipeClient = clientFactory.create(ServiceRecipe.class);
+ cvnfcCustomizationClient = clientFactory.create(CvnfcCustomization.class);
+ controllerSelectionReferenceClient = clientFactory.create(ControllerSelectionReference.class);
+ }
+
public NetworkCollectionResourceCustomization getNetworkCollectionResourceCustomizationByID(String modelCustomizationUUID) {
NetworkCollectionResourceCustomization networkCollectionResourceCustomization =
this.getSingleResource(networkCollectionResourceCustomizationClient, getUri(networkCollectionResourceCustomizationURI + modelCustomizationUUID));
@@ -504,6 +544,11 @@ public class CatalogDbClient {
return this.getSingleResource(cloudSiteClient, getUri(cloudSiteURI + id));
}
+ public void postCloudSite(CloudSite cloudSite){
+ this.postSingleResource(cloudSiteClient, cloudSite);
+ }
+
+
public CloudSite getCloudSiteByClliAndAicVersion (String clli, String cloudVersion){
return this.getSingleResource(cloudSiteClient, getUri(UriBuilder
.fromUri(findByClliAndCloudVersion)
@@ -547,6 +592,10 @@ public class CatalogDbClient {
it.forEachRemaining(list::add);
return list;
}
+
+ private <T> URI postSingleResource(Client<T> client, T type){
+ return client.post(type);
+ }
public List<CvnfcCustomization> getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID(String vnfCustomizationUUID, String vfModuleCustomizationUUID){
return this.getMultipleVnfcCustomizations(