summaryrefslogtreecommitdiffstats
path: root/mso-catalog-db/src/main/java
diff options
context:
space:
mode:
authorPrema Bhatt <pb6115@us.att.com>2018-08-10 15:54:13 -0700
committerRob Daugherty <rd472p@att.com>2018-08-23 20:13:03 +0000
commit474b1758321deae0e9730de6d2b7d10434c46d69 (patch)
tree718cdf6a8df18c6ad149fa3f7784805bf742dafe /mso-catalog-db/src/main/java
parent2fd0666635757ee894a785a0070b6f94a548c00e (diff)
Created Ref Data tbl for controllerSelection
RD: I rebased this and fixed the unit tests. Issue-ID: SO-763 Change-Id: Ie5f6a708cffbc70a9481afd35db3047fe44cb088 Signed-off-by: Prema Bhatt <pb6115@att.com> Signed-off-by: Rob Daugherty <rd472p@att.com>
Diffstat (limited to 'mso-catalog-db/src/main/java')
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ControllerSelectionReference.java106
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ControllerSelectionReferenceId.java83
-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/ControllerSelectionReferenceRepository.java37
4 files changed, 246 insertions, 0 deletions
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ControllerSelectionReference.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ControllerSelectionReference.java
new file mode 100644
index 0000000000..de0dd39edc
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ControllerSelectionReference.java
@@ -0,0 +1,106 @@
+package org.onap.so.db.catalog.beans;
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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=========================================================
+ */
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.Table;
+
+import com.openpojo.business.annotation.BusinessKey;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+
+@IdClass(ControllerSelectionReferenceId.class)
+@Entity
+@Table(name = "CONTROLLER_SELECTION_REFERENCE")
+public class ControllerSelectionReference implements Serializable {
+
+ private static final long serialVersionUID = -608098800737567188L;
+
+ @BusinessKey
+ @Id
+ @Column(name = "VNF_TYPE")
+ private String vnfType;
+
+ @BusinessKey
+ @Id
+ @Column(name = "CONTROLLER_NAME")
+ private String controllerName;
+
+ @BusinessKey
+ @Id
+ @Column(name = "ACTION_CATEGORY")
+ private String actionCategory;
+
+
+ public String getVnfType() {
+ return vnfType;
+ }
+ public void setVnfType(String vnfType) {
+ this.vnfType = vnfType;
+ }
+ public String getControllerName() {
+ return controllerName;
+ }
+ public void setControllerName(String controllerName) {
+ this.controllerName = controllerName;
+ }
+ public String getActionCategory() {
+ return actionCategory;
+ }
+ public void setActionCategory(String actionCategory) {
+ this.actionCategory = actionCategory;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("vnfType", vnfType).append("controllerName", controllerName)
+ .append("actionCategory", actionCategory).toString();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof ControllerSelectionReference)) {
+ return false;
+ }
+ ControllerSelectionReference castOther = (ControllerSelectionReference) other;
+ return new EqualsBuilder().append(vnfType, castOther.vnfType).append(controllerName, castOther.controllerName)
+ .append(actionCategory, castOther.actionCategory).isEquals();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(vnfType).append(controllerName).append(actionCategory).toHashCode();
+ }
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ControllerSelectionReferenceId.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ControllerSelectionReferenceId.java
new file mode 100644
index 0000000000..e6ee349be6
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ControllerSelectionReferenceId.java
@@ -0,0 +1,83 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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 com.openpojo.business.annotation.BusinessKey;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+
+
+public class ControllerSelectionReferenceId implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+ @BusinessKey
+ private String vnfType;
+ @BusinessKey
+ private String controllerName;
+ @BusinessKey
+ private String actionCategory;
+
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof ControllerSelectionReferenceId)) {
+ return false;
+ }
+ ControllerSelectionReferenceId castOther = (ControllerSelectionReferenceId) other;
+ return new EqualsBuilder().append(vnfType, castOther.vnfType).append(controllerName, castOther.controllerName)
+ .append(actionCategory, castOther.actionCategory).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(vnfType).append(controllerName).append(actionCategory).toHashCode();
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("vnfType", vnfType).append("controllerName", controllerName)
+ .append("actionCategory", actionCategory).toString();
+ }
+
+ public String getVnfType() {
+ return vnfType;
+ }
+ public void setVnfType(String vnfType) {
+ this.vnfType = vnfType;
+ }
+ public String getControllerName() {
+ return controllerName;
+ }
+ public void setControllerName(String controllerName) {
+ this.controllerName = controllerName;
+ }
+ public String getActionCategory() {
+ return actionCategory;
+ }
+ public void setActionCategory(String actionCategory) {
+ this.actionCategory = actionCategory;
+ }
+
+
+}
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 3b1535d66e..e43fc1796d 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
@@ -23,6 +23,7 @@ package org.onap.so.db.catalog.client;
import org.onap.so.db.catalog.beans.BuildingBlockDetail;
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.InstanceGroup;
import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
import org.onap.so.db.catalog.beans.OrchestrationAction;
@@ -102,6 +103,8 @@ public class CatalogDbClient {
private Client<CloudifyManager> cloudifyManagerClient;
+ protected Client<ControllerSelectionReference> controllerSelectionReferenceClient;
+
@Value("${mso.catalog.db.spring.endpoint}")
private String endpoint;
@@ -145,6 +148,7 @@ public class CatalogDbClient {
cloudIdentityClient = clientFactory.create(CloudIdentity.class);
cloudifyManagerClient = clientFactory.create(CloudifyManager.class);
serviceRecipeClient = clientFactory.create(ServiceRecipe.class);
+ controllerSelectionReferenceClient = clientFactory.create(ControllerSelectionReference.class);
}
public NetworkCollectionResourceCustomization getNetworkCollectionResourceCustomizationByID(String modelCustomizationUUID) {
@@ -296,6 +300,18 @@ public class CatalogDbClient {
.build());
}
+ public ControllerSelectionReference getControllerSelectionReferenceByVnfType(String vnfType) {
+ return this.getSingleControllerSelectionReference(UriBuilder
+ .fromUri(endpoint + "/controllerSelectionReference/search/findControllerSelectionReferenceByVnfType")
+ .queryParam("VNF_TYPE", vnfType).build());
+
+ }
+
+ public ControllerSelectionReference getControllerSelectionReferenceByVnfTypeAndActionCategory(String vnfType, String actionCategory) {
+ return this.getSingleControllerSelectionReference(UriBuilder
+ .fromUri(endpoint + "/controllerSelectionReference/search/findControllerSelectionReferenceByVnfTypeAndActionCategory")
+ .queryParam("VNF_TYPE", vnfType).queryParam("ACTION_CATEGORY", actionCategory).build());
+ }
private CollectionNetworkResourceCustomization getSingleCollectionNetworkResourceCustomization(URI uri) {
return collectionNetworkResourceCustomizationClient.get(uri);
@@ -355,6 +371,10 @@ public class CatalogDbClient {
return cloudifyManagerClient.get(uri);
}
+ private ControllerSelectionReference getSingleControllerSelectionReference(URI uri) {
+ return controllerSelectionReferenceClient.get(uri);
+ }
+
public Service getServiceByModelVersionAndModelInvariantUUID(String modelVersion, String modelInvariantUUID) {
return this.getSingleService(
UriBuilder.fromUri(findByModelVersionAndModelInvariantUUIDURI)
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ControllerSelectionReferenceRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ControllerSelectionReferenceRepository.java
new file mode 100644
index 0000000000..ad1bbc3f68
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ControllerSelectionReferenceRepository.java
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.ControllerSelectionReference;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.repository.query.Param;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
+
+ @RepositoryRestResource(collectionResourceRel = "controllerSelectionReference", path = "controllerSelectionReference")
+ public interface ControllerSelectionReferenceRepository extends JpaRepository<ControllerSelectionReference, String> {
+
+ public ControllerSelectionReference findControllerSelectionReferenceByVnfType(@Param("VNF_TYPE") String vnfType);
+
+ public ControllerSelectionReference findControllerSelectionReferenceByVnfTypeAndActionCategory(@Param("VNF_TYPE") String vnfType,
+ @Param("ACTION_CATEGORY") String actionCategory);
+
+ } \ No newline at end of file