aboutsummaryrefslogtreecommitdiffstats
path: root/mso-catalog-db/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'mso-catalog-db/src/main')
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/BBNameSelectionReference.java115
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java20
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/BBNameSelectionReferenceRepository.java36
3 files changed, 171 insertions, 0 deletions
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/BBNameSelectionReference.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/BBNameSelectionReference.java
new file mode 100644
index 0000000000..9b71c970a7
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/BBNameSelectionReference.java
@@ -0,0 +1,115 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Tech Mahindra
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.catalog.beans;
+
+import java.io.Serializable;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import com.openpojo.business.annotation.BusinessKey;
+
+@Entity
+@Table(name = "bbname_selection_reference")
+public class BBNameSelectionReference implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @Column(name = "ID", nullable = false, updatable = false)
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ private Integer ID;
+
+ @BusinessKey
+ @Column(name = "CONTROLLER_ACTOR")
+ private String controllerActor;
+
+ @Column(name = "SCOPE")
+ private String scope;
+
+ @Column(name = "ACTION")
+ private String action;
+
+ @BusinessKey
+ @Column(name = "BB_NAME")
+ private String bbName;
+
+ public String getControllerActor() {
+ return controllerActor;
+ }
+
+ public void setControllerActor(String controllerActor) {
+ this.controllerActor = controllerActor;
+ }
+
+ public String getScope() {
+ return scope;
+ }
+
+ public void setScope(String scope) {
+ this.scope = scope;
+ }
+
+ public String getAction() {
+ return action;
+ }
+
+ public void setAction(String action) {
+ this.action = action;
+ }
+
+ public Integer getID() {
+ return ID;
+ }
+
+ public String getBbName() {
+ return bbName;
+ }
+
+ public void setBbName(String bbName) {
+ this.bbName = bbName;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("ID", ID).append("controllerActor", controllerActor)
+ .append("scope", scope).append("action", action).append("bbName", bbName).toString();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof BBNameSelectionReference)) {
+ return false;
+ }
+ BBNameSelectionReference castOther = (BBNameSelectionReference) other;
+ return new EqualsBuilder().append(controllerActor, castOther.controllerActor).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(controllerActor).append(bbName).toHashCode();
+ }
+}
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 4090e19d34..cf066f9721 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
@@ -32,6 +32,7 @@ import javax.ws.rs.core.UriBuilder;
import org.apache.http.HttpStatus;
import org.onap.logging.filter.base.Constants;
import org.onap.logging.filter.spring.SpringClientPayloadFilter;
+import org.onap.so.db.catalog.beans.BBNameSelectionReference;
import org.onap.so.db.catalog.beans.BuildingBlockDetail;
import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.db.catalog.beans.CloudifyManager;
@@ -119,6 +120,7 @@ public class CatalogDbClient {
private static final String PNF_RESOURCE = "/pnfResource";
private static final String PNF_RESOURCE_CUSTOMIZATION = "/pnfResourceCustomization";
private static final String WORKFLOW = "/workflow";
+ private static final String BB_NAME_SELECTION_REFERENCE = "/bbNameSelectionReference";
private static final String SEARCH = "/search";
@@ -205,6 +207,8 @@ public class CatalogDbClient {
private String findWorkflowByPnfModelUUID = "/findWorkflowByPnfModelUUID";
private String findWorkflowBySource = "/findBySource";
private String findVnfResourceCustomizationByModelUuid = "/findVnfResourceCustomizationByModelUuid";
+ private String findBBNameSelectionReferenceByControllerActorAndScopeAndAction =
+ "/findBBNameSelectionReferenceByControllerActorAndScopeAndAction";
private String serviceURI;
private String vfModuleURI;
@@ -277,6 +281,8 @@ public class CatalogDbClient {
private final Client<Workflow> workflowClient;
+ private final Client<BBNameSelectionReference> bbNameSelectionReferenceClient;
+
@Value("${mso.catalog.db.spring.endpoint:#{null}}")
private String endpoint;
@@ -346,6 +352,9 @@ public class CatalogDbClient {
findVnfResourceCustomizationByModelUuid =
endpoint + VNF_RESOURCE_CUSTOMIZATION + SEARCH + findVnfResourceCustomizationByModelUuid;
+ findBBNameSelectionReferenceByControllerActorAndScopeAndAction = endpoint + BB_NAME_SELECTION_REFERENCE + SEARCH
+ + findBBNameSelectionReferenceByControllerActorAndScopeAndAction;
+
serviceURI = endpoint + SERVICE + URI_SEPARATOR;
vfModuleURI = endpoint + VFMODULE + URI_SEPARATOR;
vnfResourceURI = endpoint + VNF_RESOURCE + URI_SEPARATOR;
@@ -412,6 +421,8 @@ public class CatalogDbClient {
pnfResourceClient = clientFactory.create(PnfResource.class);
pnfResourceCustomizationClient = clientFactory.create(PnfResourceCustomization.class);
workflowClient = clientFactory.create(Workflow.class);
+ bbNameSelectionReferenceClient = clientFactory.create(BBNameSelectionReference.class);
+
}
public CatalogDbClient(String baseUri, String auth) {
@@ -462,6 +473,7 @@ public class CatalogDbClient {
pnfResourceClient = clientFactory.create(PnfResource.class);
pnfResourceCustomizationClient = clientFactory.create(PnfResourceCustomization.class);
workflowClient = clientFactory.create(Workflow.class);
+ bbNameSelectionReferenceClient = clientFactory.create(BBNameSelectionReference.class);
}
public NetworkCollectionResourceCustomization getNetworkCollectionResourceCustomizationByID(
@@ -689,6 +701,14 @@ public class CatalogDbClient {
UriBuilder.fromUri(findFirstByModelNameURI).queryParam(MODEL_NAME, modelName).build());
}
+ public BBNameSelectionReference getBBNameSelectionReference(String controllerActor, String scope, String action) {
+
+ return this.getSingleResource(bbNameSelectionReferenceClient,
+ getUri(UriBuilder.fromUri(findBBNameSelectionReferenceByControllerActorAndScopeAndAction)
+ .queryParam("CONTROLLER_ACTOR", controllerActor).queryParam("SCOPE", scope)
+ .queryParam("ACTION", action).build().toString()));
+ }
+
public ExternalServiceToInternalService findExternalToInternalServiceByServiceName(String serviceName) {
return this.getSingleResource(externalServiceToInternalServiceClient,
getUri(UriBuilder.fromUri(findExternalToInternalServiceByServiceName)
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/BBNameSelectionReferenceRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/BBNameSelectionReferenceRepository.java
new file mode 100644
index 0000000000..38f1291f37
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/BBNameSelectionReferenceRepository.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Tech Mahindra
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.catalog.data.repository;
+
+
+import org.onap.so.db.catalog.beans.BBNameSelectionReference;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.repository.query.Param;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
+
+
+@RepositoryRestResource(collectionResourceRel = "bbNameSelectionReference", path = "bbNameSelectionReference")
+public interface BBNameSelectionReferenceRepository extends JpaRepository<BBNameSelectionReference, Integer> {
+
+ public BBNameSelectionReference findBBNameSelectionReferenceByControllerActorAndScopeAndAction(
+ @Param("CONTROLLER_ACTOR") String controllerActor, @Param("SCOPE") String scope,
+ @Param("ACTION") String action);
+}