summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authornrpandya <neenendra.pandya@att.com>2019-11-21 11:51:18 -0600
committersebdet <sebastien.determe@intl.att.com>2020-01-16 13:26:16 +0100
commit825612628f130b394f9ee1aa1ad2cca41b67bc7f (patch)
tree51b3e3311ba93e878dc2f457ba2e4937dd3053f7 /src/main
parent62a0b7ca40d7810897fce2d1f8eb47e5647a2bf2 (diff)
Add template and tosca model entities and repositories
Add Control loop template, tosca model and model policy properties hibernate entity classes and crud repositories Issue-ID: CLAMP-555 Change-Id: Ib7f07aca5ad2ddf5caff7c98ea9341bdc147e817 Signed-off-by: nrpandya <neenendra.pandya@att.com>
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/onap/clamp/clds/Application.java8
-rw-r--r--src/main/java/org/onap/clamp/clds/ClampInUserAuditorAware.java46
-rw-r--r--src/main/java/org/onap/clamp/clds/filter/ClampCadiFilter.java2
-rw-r--r--src/main/java/org/onap/clamp/clds/model/CldsDictionary.java159
-rw-r--r--src/main/java/org/onap/clamp/clds/model/CldsDictionaryItem.java214
-rw-r--r--src/main/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertor.java57
-rw-r--r--src/main/java/org/onap/clamp/loop/Loop.java25
-rw-r--r--src/main/java/org/onap/clamp/loop/LoopService.java28
-rw-r--r--src/main/java/org/onap/clamp/loop/LoopsRepository.java5
-rw-r--r--src/main/java/org/onap/clamp/loop/common/AuditEntity.java108
-rw-r--r--src/main/java/org/onap/clamp/loop/log/LoopLog.java2
-rw-r--r--src/main/java/org/onap/clamp/loop/log/LoopLogRepository.java4
-rw-r--r--src/main/java/org/onap/clamp/loop/service/Service.java18
-rw-r--r--src/main/java/org/onap/clamp/loop/service/ServicesRepository.java31
-rw-r--r--src/main/java/org/onap/clamp/loop/template/LoopTemplate.java268
-rw-r--r--src/main/java/org/onap/clamp/loop/template/LoopTemplatesRepository.java37
-rw-r--r--src/main/java/org/onap/clamp/loop/template/MicroServiceModel.java217
-rw-r--r--src/main/java/org/onap/clamp/loop/template/MicroServiceModelsRepository.java31
-rw-r--r--src/main/java/org/onap/clamp/loop/template/PolicyModel.java239
-rw-r--r--src/main/java/org/onap/clamp/loop/template/PolicyModelId.java93
-rw-r--r--src/main/java/org/onap/clamp/loop/template/PolicyModelsRepository.java38
-rw-r--r--src/main/java/org/onap/clamp/loop/template/PolicyModelsService.java59
-rw-r--r--src/main/java/org/onap/clamp/loop/template/TemplateMicroServiceModel.java194
-rw-r--r--src/main/java/org/onap/clamp/loop/template/TemplateMicroServiceModelId.java102
-rw-r--r--src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.java64
-rw-r--r--src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicyRepository.java4
-rw-r--r--src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicyService.java (renamed from src/main/java/org/onap/clamp/policy/microservice/MicroservicePolicyService.java)4
-rw-r--r--src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java35
-rw-r--r--src/main/java/org/onap/clamp/policy/operational/OperationalPolicyRepository.java4
-rw-r--r--src/main/java/org/onap/clamp/tosca/Dictionary.java174
-rw-r--r--src/main/java/org/onap/clamp/tosca/DictionaryElement.java249
-rw-r--r--src/main/java/org/onap/clamp/tosca/DictionaryElementsRepository.java32
-rw-r--r--src/main/java/org/onap/clamp/tosca/DictionaryRepository.java38
-rw-r--r--src/main/java/org/onap/clamp/util/SemanticVersioning.java76
-rw-r--r--src/main/resources/META-INF/resources/swagger.html411
35 files changed, 2559 insertions, 517 deletions
diff --git a/src/main/java/org/onap/clamp/clds/Application.java b/src/main/java/org/onap/clamp/clds/Application.java
index e41140f5c..63320d2fe 100644
--- a/src/main/java/org/onap/clamp/clds/Application.java
+++ b/src/main/java/org/onap/clamp/clds/Application.java
@@ -58,6 +58,7 @@ import org.springframework.boot.web.servlet.support.SpringBootServletInitializer
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.Environment;
+import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
@@ -65,13 +66,14 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
@ComponentScan(basePackages = { "org.onap.clamp" })
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class, SecurityAutoConfiguration.class,
- UserDetailsServiceAutoConfiguration.class })
+ UserDetailsServiceAutoConfiguration.class })
@EnableJpaRepositories(basePackages = { "org.onap.clamp" })
@EntityScan(basePackages = { "org.onap.clamp" })
@EnableTransactionManagement
@EnableConfigurationProperties
@EnableAsync
@EnableScheduling
+@EnableJpaAuditing
public class Application extends SpringBootServletInitializer {
protected static final EELFLogger eelfLogger = EELFManager.getInstance().getLogger(Application.class);
@@ -137,8 +139,6 @@ public class Application extends SpringBootServletInitializer {
return tomcat;
}
-
-
private Connector createRedirectConnector(int redirectSecuredPort) {
if (redirectSecuredPort <= 0) {
eelfLogger.warn("HTTP port redirection to HTTPS is disabled because the HTTPS port is 0 (random port) or -1"
@@ -159,7 +159,7 @@ public class Application extends SpringBootServletInitializer {
if (env.getProperty("server.ssl.key-store") != null) {
KeyStore keystore = KeyStore.getInstance(env.getProperty("server.ssl.key-store-type"));
- String password = PassDecoder.decode(env.getProperty("server.ssl.key-store-password"),
+ String password = PassDecoder.decode(env.getProperty("server.ssl.key-store-password"),
env.getProperty("clamp.config.keyFile"));
String keyStore = env.getProperty("server.ssl.key-store");
InputStream is = ResourceFileUtil.getResourceAsStream(keyStore.replaceAll("classpath:", ""));
diff --git a/src/main/java/org/onap/clamp/clds/ClampInUserAuditorAware.java b/src/main/java/org/onap/clamp/clds/ClampInUserAuditorAware.java
new file mode 100644
index 000000000..d18e7ebf3
--- /dev/null
+++ b/src/main/java/org/onap/clamp/clds/ClampInUserAuditorAware.java
@@ -0,0 +1,46 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2020 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.clamp.clds;
+
+import java.util.Optional;
+
+import org.springframework.data.domain.AuditorAware;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ClampInUserAuditorAware implements AuditorAware<String> {
+
+ @Override
+ public Optional<String> getCurrentAuditor() {
+ if (SecurityContextHolder.getContext().getAuthentication() != null
+ && SecurityContextHolder.getContext().getAuthentication().getPrincipal() != null) {
+ return Optional.of(((UserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal())
+ .getUsername());
+ }
+ return Optional.of("");
+ }
+
+}
diff --git a/src/main/java/org/onap/clamp/clds/filter/ClampCadiFilter.java b/src/main/java/org/onap/clamp/clds/filter/ClampCadiFilter.java
index 9e04bd084..3bbb8a0bc 100644
--- a/src/main/java/org/onap/clamp/clds/filter/ClampCadiFilter.java
+++ b/src/main/java/org/onap/clamp/clds/filter/ClampCadiFilter.java
@@ -153,7 +153,7 @@ public class ClampCadiFilter extends CadiFilter {
URLDecoder.decode(certHeader, StandardCharsets.UTF_8.toString()).getBytes()));
X509Certificate caCert = (X509Certificate) certificateFactory
.generateCertificate(new ByteArrayInputStream(
- ResourceFileUtil.getResourceAsString("clds/aaf/ssl/ca-certs.pem").getBytes()));
+ ResourceFileUtil.getResourceAsString("clds/aaf/ssl/ca-certs.pem").getBytes()));
X509Certificate[] certifArray = ((X509Certificate[]) request
.getAttribute("javax.servlet.request.X509Certificate"));
diff --git a/src/main/java/org/onap/clamp/clds/model/CldsDictionary.java b/src/main/java/org/onap/clamp/clds/model/CldsDictionary.java
deleted file mode 100644
index 35fbcec46..000000000
--- a/src/main/java/org/onap/clamp/clds/model/CldsDictionary.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP CLAMP
- * ================================================================================
- * Copyright (C) 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.clamp.clds.model;
-
-import com.google.gson.annotations.Expose;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Represents a CLDS Dictionary.
- */
-
-public class CldsDictionary {
-
- @Expose
- private String dictionaryId;
- @Expose
- private String dictionaryName;
-
- @Expose
- private String createdBy;
- @Expose
- private String updatedBy;
- @Expose
- private String lastUpdatedDate;
- @Expose
- private List<CldsDictionaryItem> cldsDictionaryItems = new ArrayList<>();
-
- /**
- * Get the dictionary ID.
- *
- * @return the dictionaryId
- */
- public String getDictionaryId() {
- return dictionaryId;
- }
-
- /**
- * Set the dictionary Id.
- *
- * @param dictionaryId the dictionaryId to set
- */
- public void setDictionaryId(String dictionaryId) {
- this.dictionaryId = dictionaryId;
- }
-
- /**
- * Get the dictionary name.
- *
- * @return the dictionaryName
- */
- public String getDictionaryName() {
- return dictionaryName;
- }
-
- /**
- * Set the dictionary name.
- *
- * @param dictionaryName the dictionaryName to set
- */
- public void setDictionaryName(String dictionaryName) {
- this.dictionaryName = dictionaryName;
- }
-
- /**
- * Get the createdBy info.
- *
- * @return the createdBy
- */
- public String getCreatedBy() {
- return createdBy;
- }
-
- /**
- * Set the createdBy info.
- *
- * @param createdBy the createdBy to set
- */
- public void setCreatedBy(String createdBy) {
- this.createdBy = createdBy;
- }
-
- /**
- * Get the updatedBy info.
- *
- * @return the updatedBy
- */
- public String getUpdatedBy() {
- return updatedBy;
- }
-
- /**
- * Set the updatedBy info.
- *
- * @param updatedby the updatedBy to set
- */
- public void setUpdatedBy(String updatedby) {
- updatedBy = updatedby;
- }
-
- /**
- * Get the last updated date.
- *
- * @return the lastUpdatedDate
- */
- public String getLastUpdatedDate() {
- return lastUpdatedDate;
- }
-
- /**
- * Set the last updated date.
- *
- * @param lastUpdatedDate the lastUpdatedDate to set
- */
- public void setLastUpdatedDate(String lastUpdatedDate) {
- this.lastUpdatedDate = lastUpdatedDate;
- }
-
- /**
- * Get all the dictionary items.
- *
- * @return the cldsDictionaryItems
- */
- public List<CldsDictionaryItem> getCldsDictionaryItems() {
- return cldsDictionaryItems;
- }
-
- /**
- * Set the whole dictionary items.
- *
- * @param cldsDictionaryItems the cldsDictionaryItems to set
- */
- public void setCldsDictionaryItems(List<CldsDictionaryItem> cldsDictionaryItems) {
- this.cldsDictionaryItems = cldsDictionaryItems;
- }
-
-}
diff --git a/src/main/java/org/onap/clamp/clds/model/CldsDictionaryItem.java b/src/main/java/org/onap/clamp/clds/model/CldsDictionaryItem.java
deleted file mode 100644
index 1b79bdfa9..000000000
--- a/src/main/java/org/onap/clamp/clds/model/CldsDictionaryItem.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP CLAMP
- * ================================================================================
- * Copyright (C) 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.clamp.clds.model;
-
-import com.google.gson.annotations.Expose;
-
-/**
- * Represents a CLDS Dictionary Item.
- */
-public class CldsDictionaryItem {
-
- @Expose
- private String dictElementId;
- @Expose
- private String dictionaryId;
- @Expose
- private String dictElementName;
- @Expose
- private String dictElementShortName;
- @Expose
- private String dictElementDesc;
- @Expose
- private String dictElementType;
- @Expose
- private String createdBy;
- @Expose
- private String updatedBy;
- @Expose
- private String lastUpdatedDate;
-
- /**
- * Get the dictionary element id.
- *
- * @return the dictElementId
- */
- public String getDictElementId() {
- return dictElementId;
- }
-
- /**
- * Set the dictionary element id.
- *
- * @param dictElementId the dictElementId to set
- */
- public void setDictElementId(String dictElementId) {
- this.dictElementId = dictElementId;
- }
-
- /**
- * Get the dictionary id.
- *
- * @return the dictionaryId
- */
- public String getDictionaryId() {
- return dictionaryId;
- }
-
- /**
- * Set the dictionary id.
- *
- * @param dictionaryId the dictionaryId to set
- */
- public void setDictionaryId(String dictionaryId) {
- this.dictionaryId = dictionaryId;
- }
-
- /**
- * Get the dictionary name.
- *
- * @return the dictElementName
- */
- public String getDictElementName() {
- return dictElementName;
- }
-
- /**
- * Set the dictionary name.
- *
- * @param dictElementName the dictElementName to set
- */
- public void setDictElementName(String dictElementName) {
- this.dictElementName = dictElementName;
- }
-
- /**
- * Get the dictionary element short name.
- *
- * @return the dictElementShortName
- */
- public String getDictElementShortName() {
- return dictElementShortName;
- }
-
- /**
- * Set the dictionary element short name.
- *
- * @param dictElementShortName the dictElementShortName to set
- */
- public void setDictElementShortName(String dictElementShortName) {
- this.dictElementShortName = dictElementShortName;
- }
-
- /**
- * Get the dictionary element description.
- *
- * @return the dictElementDesc
- */
- public String getDictElementDesc() {
- return dictElementDesc;
- }
-
- /**
- * Set the dictionary element description.
- *
- * @param dictElementDesc the dictElementDesc to set
- */
- public void setDictElementDesc(String dictElementDesc) {
- this.dictElementDesc = dictElementDesc;
- }
-
- /**
- * Get the dictionary element type.
- *
- * @return the dictElementType
- */
- public String getDictElementType() {
- return dictElementType;
- }
-
- /**
- * Set the dictionary element type.
- *
- * @param dictElementType the dictElementType to set
- */
- public void setDictElementType(String dictElementType) {
- this.dictElementType = dictElementType;
- }
-
- /**
- * Get the createdBy info.
- *
- * @return the createdBy
- */
- public String getCreatedBy() {
- return createdBy;
- }
-
- /**
- * Set the createdBy info.
- *
- * @param createdBy the createdBy to set
- */
- public void setCreatedBy(String createdBy) {
- this.createdBy = createdBy;
- }
-
- /**
- * Get the updatedBy info.
- *
- * @return the updatedBy
- */
- public String getUpdatedBy() {
- return updatedBy;
- }
-
- /**
- * Set the updatedBy info.
- *
- * @param updatedby the updatedBy to set
- */
- public void setUpdatedBy(String updatedby) {
- updatedBy = updatedby;
- }
-
- /**
- * Get the last updated date.
- *
- * @return the lastUpdatedDate
- */
- public String getLastUpdatedDate() {
- return lastUpdatedDate;
- }
-
- /**
- * Set the last updated date.
- *
- * @param lastUpdatedDate the lastUpdatedDate to set
- */
- public void setLastUpdatedDate(String lastUpdatedDate) {
- this.lastUpdatedDate = lastUpdatedDate;
- }
-
-}
diff --git a/src/main/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertor.java b/src/main/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertor.java
index 43dd5f451..2e025ba7d 100644
--- a/src/main/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertor.java
+++ b/src/main/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertor.java
@@ -481,63 +481,6 @@ public class ToscaYamlToJsonConvertor {
private void processDictionaryElements(JSONObject childObject, String dictionaryReference) {
- /*
- * if (dictionaryReference.contains("#")) { String[] dictionaryKeyArray =
- * dictionaryReference
- * .substring(dictionaryReference.indexOf(ToscaSchemaConstants.DICTIONARY) + 11,
- * dictionaryReference.length()) .split("#"); // We support only one # as of
- * now. List<CldsDictionaryItem> cldsDictionaryElements = null;
- * List<CldsDictionaryItem> subDictionaryElements = null; if (dictionaryKeyArray
- * != null && dictionaryKeyArray.length == 2) { cldsDictionaryElements =
- * getCldsDao().getDictionaryElements(dictionaryKeyArray[0], null, null);
- * subDictionaryElements =
- * getCldsDao().getDictionaryElements(dictionaryKeyArray[1], null, null);
- *
- * if (cldsDictionaryElements != null) { List<String> subCldsDictionaryNames =
- * subDictionaryElements.stream()
- * .map(CldsDictionaryItem::getDictElementShortName).collect(Collectors.toList()
- * ); JSONArray jsonArray = new JSONArray();
- *
- * Optional.ofNullable(cldsDictionaryElements).get().stream().forEach(c -> {
- * JSONObject jsonObject = new JSONObject();
- * jsonObject.put(JsonEditorSchemaConstants.TYPE,
- * getJsonType(c.getDictElementType())); if (c.getDictElementType() != null &&
- * c.getDictElementType().equalsIgnoreCase(ToscaSchemaConstants.TYPE_STRING)) {
- * jsonObject.put(JsonEditorSchemaConstants.MIN_LENGTH, 1); }
- * jsonObject.put(JsonEditorSchemaConstants.ID, c.getDictElementName());
- * jsonObject.put(JsonEditorSchemaConstants.LABEL, c.getDictElementShortName());
- * jsonObject.put(JsonEditorSchemaConstants.OPERATORS, subCldsDictionaryNames);
- * jsonArray.put(jsonObject); }); ; JSONObject filterObject = new JSONObject();
- * filterObject.put(JsonEditorSchemaConstants.FILTERS, jsonArray);
- *
- * childObject.put(JsonEditorSchemaConstants.TYPE,
- * JsonEditorSchemaConstants.TYPE_QBLDR); // TO invoke validation on such
- * parameters childObject.put(JsonEditorSchemaConstants.MIN_LENGTH, 1);
- * childObject.put(JsonEditorSchemaConstants.QSSCHEMA, filterObject);
- *
- * } } } else { String dictionaryKey = dictionaryReference.substring(
- * dictionaryReference.indexOf(ToscaSchemaConstants.DICTIONARY) + 11,
- * dictionaryReference.length()); if (dictionaryKey != null) {
- * List<CldsDictionaryItem> cldsDictionaryElements =
- * getCldsDao().getDictionaryElements(dictionaryKey, null, null); if
- * (cldsDictionaryElements != null) { List<String> cldsDictionaryNames = new
- * ArrayList<>(); List<String> cldsDictionaryFullNames = new ArrayList<>();
- * cldsDictionaryElements.stream().forEach(c -> { // Json type will be
- * translated before Policy creation if (c.getDictElementType() != null &&
- * !c.getDictElementType().equalsIgnoreCase("json")) {
- * cldsDictionaryFullNames.add(c.getDictElementName()); }
- * cldsDictionaryNames.add(c.getDictElementShortName()); });
- *
- * if (cldsDictionaryFullNames.size() > 0) {
- * childObject.put(JsonEditorSchemaConstants.ENUM, cldsDictionaryFullNames); //
- * Add Enum titles for generated translated values during JSON instance //
- * generation JSONObject enumTitles = new JSONObject();
- * enumTitles.put(JsonEditorSchemaConstants.ENUM_TITLES, cldsDictionaryNames);
- * childObject.put(JsonEditorSchemaConstants.OPTIONS, enumTitles); } else {
- * childObject.put(JsonEditorSchemaConstants.ENUM, cldsDictionaryNames); }
- *
- * } } }
- */
}
private String getJsonType(String toscaType) {
diff --git a/src/main/java/org/onap/clamp/loop/Loop.java b/src/main/java/org/onap/clamp/loop/Loop.java
index 531587a75..66046f02b 100644
--- a/src/main/java/org/onap/clamp/loop/Loop.java
+++ b/src/main/java/org/onap/clamp/loop/Loop.java
@@ -56,18 +56,20 @@ import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;
import org.hibernate.annotations.TypeDefs;
import org.onap.clamp.dao.model.jsontype.StringJsonUserType;
+import org.onap.clamp.loop.common.AuditEntity;
import org.onap.clamp.loop.components.external.DcaeComponent;
import org.onap.clamp.loop.components.external.ExternalComponent;
import org.onap.clamp.loop.components.external.PolicyComponent;
import org.onap.clamp.loop.log.LoopLog;
import org.onap.clamp.loop.service.Service;
+import org.onap.clamp.loop.template.LoopTemplate;
import org.onap.clamp.policy.microservice.MicroServicePolicy;
import org.onap.clamp.policy.operational.OperationalPolicy;
@Entity
@Table(name = "loops")
@TypeDefs({ @TypeDef(name = "json", typeClass = StringJsonUserType.class) })
-public class Loop implements Serializable {
+public class Loop extends AuditEntity implements Serializable {
/**
* The serial version id.
@@ -103,7 +105,7 @@ public class Loop implements Serializable {
private JsonObject globalPropertiesJson;
@Expose
- @ManyToOne(fetch = FetchType.EAGER)
+ @ManyToOne(fetch = FetchType.EAGER, cascade = { CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH })
@JoinColumn(name = "service_uuid")
private Service modelService;
@@ -120,19 +122,24 @@ public class Loop implements Serializable {
private final Map<String, ExternalComponent> components = new HashMap<>();
@Expose
- @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "loop")
+ @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "loop", orphanRemoval = true)
private Set<OperationalPolicy> operationalPolicies = new HashSet<>();
@Expose
- @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
+ @ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH }, fetch = FetchType.EAGER)
@JoinTable(name = "loops_microservicepolicies", joinColumns = @JoinColumn(name = "loop_id"), inverseJoinColumns = @JoinColumn(name = "microservicepolicy_id"))
private Set<MicroServicePolicy> microServicePolicies = new HashSet<>();
@Expose
- @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "loop")
+ @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "loop", orphanRemoval = true)
@SortNatural
private SortedSet<LoopLog> loopLogs = new TreeSet<>();
+ @Expose
+ @ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH }, fetch = FetchType.EAGER)
+ @JoinColumn(name = "loop_template_name")
+ private LoopTemplate loopTemplate;
+
private void initializeExternalComponents() {
this.addComponent(new PolicyComponent());
this.addComponent(new DcaeComponent());
@@ -280,6 +287,14 @@ public class Loop implements Serializable {
this.components.put(component.getComponentName(), component);
}
+ public LoopTemplate getLoopTemplate() {
+ return loopTemplate;
+ }
+
+ public void setLoopTemplate(LoopTemplate loopTemplate) {
+ this.loopTemplate = loopTemplate;
+ }
+
/**
* Generate the loop name.
*
diff --git a/src/main/java/org/onap/clamp/loop/LoopService.java b/src/main/java/org/onap/clamp/loop/LoopService.java
index d1ab0e396..85e24cd00 100644
--- a/src/main/java/org/onap/clamp/loop/LoopService.java
+++ b/src/main/java/org/onap/clamp/loop/LoopService.java
@@ -31,29 +31,23 @@ import java.util.Set;
import javax.persistence.EntityNotFoundException;
import org.onap.clamp.policy.microservice.MicroServicePolicy;
-import org.onap.clamp.policy.microservice.MicroservicePolicyService;
+import org.onap.clamp.policy.microservice.MicroServicePolicyService;
import org.onap.clamp.policy.operational.OperationalPolicy;
import org.onap.clamp.policy.operational.OperationalPolicyService;
-import org.springframework.stereotype.Component;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
-@Component
public class LoopService {
- private final LoopsRepository loopsRepository;
- private final MicroservicePolicyService microservicePolicyService;
- private final OperationalPolicyService operationalPolicyService;
-
- /**
- * Constructor.
- */
- public LoopService(LoopsRepository loopsRepository, MicroservicePolicyService microservicePolicyService,
- OperationalPolicyService operationalPolicyService) {
- this.loopsRepository = loopsRepository;
- this.microservicePolicyService = microservicePolicyService;
- this.operationalPolicyService = operationalPolicyService;
- }
+ @Autowired
+ private LoopsRepository loopsRepository;
+
+ @Autowired
+ private MicroServicePolicyService microservicePolicyService;
+
+ @Autowired
+ private OperationalPolicyService operationalPolicyService;
Loop saveOrUpdateLoop(Loop loop) {
return loopsRepository.save(loop);
@@ -109,6 +103,6 @@ public class LoopService {
private Loop findClosedLoopByName(String loopName) {
return loopsRepository.findById(loopName)
- .orElseThrow(() -> new EntityNotFoundException("Couldn't find closed loop named: " + loopName));
+ .orElseThrow(() -> new EntityNotFoundException("Couldn't find closed loop named: " + loopName));
}
}
diff --git a/src/main/java/org/onap/clamp/loop/LoopsRepository.java b/src/main/java/org/onap/clamp/loop/LoopsRepository.java
index 37c47622f..aaa49116f 100644
--- a/src/main/java/org/onap/clamp/loop/LoopsRepository.java
+++ b/src/main/java/org/onap/clamp/loop/LoopsRepository.java
@@ -24,12 +24,13 @@
package org.onap.clamp.loop;
import java.util.List;
+
+import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
@Repository
-public interface LoopsRepository extends CrudRepository<Loop, String> {
+public interface LoopsRepository extends JpaRepository<Loop, String> {
@Query("SELECT loop.name FROM Loop as loop")
List<String> getAllLoopNames();
diff --git a/src/main/java/org/onap/clamp/loop/common/AuditEntity.java b/src/main/java/org/onap/clamp/loop/common/AuditEntity.java
new file mode 100644
index 000000000..445f5b9e8
--- /dev/null
+++ b/src/main/java/org/onap/clamp/loop/common/AuditEntity.java
@@ -0,0 +1,108 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2020 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.clamp.loop.common;
+
+import com.google.gson.annotations.Expose;
+
+import java.time.Instant;
+import java.time.temporal.ChronoUnit;
+
+import javax.persistence.Column;
+import javax.persistence.EntityListeners;
+import javax.persistence.MappedSuperclass;
+
+import org.springframework.data.annotation.CreatedBy;
+import org.springframework.data.annotation.CreatedDate;
+import org.springframework.data.annotation.LastModifiedBy;
+import org.springframework.data.annotation.LastModifiedDate;
+import org.springframework.data.jpa.domain.support.AuditingEntityListener;
+
+@MappedSuperclass
+@EntityListeners(AuditingEntityListener.class)
+public class AuditEntity {
+
+ @Expose
+ @CreatedDate
+ @Column(name = "created_timestamp", nullable = false, updatable = false)
+ private Instant createdDate;
+
+ @Expose
+ @LastModifiedDate
+ @Column(name = "updated_timestamp", nullable = false)
+ private Instant updatedDate;
+
+ @Expose
+ @LastModifiedBy
+ @Column(name = "updated_by")
+ private String updatedBy;
+
+ @Expose
+ @CreatedBy
+ @Column(name = "created_by")
+ private String createdBy;
+
+ public Instant getCreatedDate() {
+ return createdDate;
+ }
+
+ public void setCreatedDate(Instant createdDate) {
+ if (createdDate != null) {
+ this.createdDate = createdDate.truncatedTo(ChronoUnit.SECONDS);
+ } else {
+ this.createdDate = null;
+ }
+ }
+
+ public Instant getUpdatedDate() {
+ return updatedDate;
+ }
+
+ public void setUpdatedDate(Instant updatedDate) {
+ if (updatedDate != null) {
+ this.updatedDate = updatedDate.truncatedTo(ChronoUnit.SECONDS);
+ } else {
+ this.updatedDate = null;
+ }
+ }
+
+ public String getUpdatedBy() {
+ return updatedBy;
+ }
+
+ public void setUpdatedBy(String updatedBy) {
+ this.updatedBy = updatedBy;
+ }
+
+ public String getCreatedBy() {
+ return createdBy;
+ }
+
+ public void setCreatedBy(String createdBy) {
+ this.createdBy = createdBy;
+ }
+
+ public AuditEntity() {
+ }
+
+}
diff --git a/src/main/java/org/onap/clamp/loop/log/LoopLog.java b/src/main/java/org/onap/clamp/loop/log/LoopLog.java
index 0e1153a32..e49598879 100644
--- a/src/main/java/org/onap/clamp/loop/log/LoopLog.java
+++ b/src/main/java/org/onap/clamp/loop/log/LoopLog.java
@@ -190,9 +190,7 @@ public class LoopLog implements Serializable, Comparable<LoopLog> {
if (arg0.getId() == null) {
return -1;
}
-
return arg0.getId().compareTo(this.getId());
-
}
}
diff --git a/src/main/java/org/onap/clamp/loop/log/LoopLogRepository.java b/src/main/java/org/onap/clamp/loop/log/LoopLogRepository.java
index 103341fa5..0b3c34ec0 100644
--- a/src/main/java/org/onap/clamp/loop/log/LoopLogRepository.java
+++ b/src/main/java/org/onap/clamp/loop/log/LoopLogRepository.java
@@ -23,10 +23,10 @@
package org.onap.clamp.loop.log;
-import org.springframework.data.repository.CrudRepository;
+import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
-public interface LoopLogRepository extends CrudRepository<LoopLog, Long> {
+public interface LoopLogRepository extends JpaRepository<LoopLog, Long> {
}
diff --git a/src/main/java/org/onap/clamp/loop/service/Service.java b/src/main/java/org/onap/clamp/loop/service/Service.java
index 115f9f768..b74ee0b0d 100644
--- a/src/main/java/org/onap/clamp/loop/service/Service.java
+++ b/src/main/java/org/onap/clamp/loop/service/Service.java
@@ -39,9 +39,9 @@ import javax.persistence.Transient;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;
import org.hibernate.annotations.TypeDefs;
+import org.onap.clamp.clds.util.JsonUtils;
import org.onap.clamp.dao.model.jsontype.StringJsonUserType;
-
@Entity
@Table(name = "services")
@TypeDefs({ @TypeDef(name = "json", typeClass = StringJsonUserType.class) })
@@ -76,13 +76,25 @@ public class Service implements Serializable {
private JsonObject resourceDetails;
/**
- * Public constructor.
+ * Default constructor for serialization.
*/
public Service() {
}
/**
- * Constructor.
+ * Constructor with string.
+ */
+ public Service(String serviceDetails, String resourceDetails) {
+ JsonObject serviceDetailsJson = JsonUtils.GSON.fromJson(serviceDetails, JsonObject.class);
+ JsonObject resourceDetailsJson = JsonUtils.GSON.fromJson(resourceDetails, JsonObject.class);
+ this.name = serviceDetailsJson.get("name").getAsString();
+ this.serviceUuid = serviceDetailsJson.get("UUID").getAsString();
+ this.serviceDetails = serviceDetailsJson;
+ this.resourceDetails = resourceDetailsJson;
+ }
+
+ /**
+ * Constructor with Json Object.
*/
public Service(JsonObject serviceDetails, JsonObject resourceDetails, String version) {
this.name = serviceDetails.get("name").getAsString();
diff --git a/src/main/java/org/onap/clamp/loop/service/ServicesRepository.java b/src/main/java/org/onap/clamp/loop/service/ServicesRepository.java
new file mode 100644
index 000000000..fe5ba8ed0
--- /dev/null
+++ b/src/main/java/org/onap/clamp/loop/service/ServicesRepository.java
@@ -0,0 +1,31 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2020 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.clamp.loop.service;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface ServicesRepository extends JpaRepository<Service, String> {
+}
diff --git a/src/main/java/org/onap/clamp/loop/template/LoopTemplate.java b/src/main/java/org/onap/clamp/loop/template/LoopTemplate.java
new file mode 100644
index 000000000..10367e77d
--- /dev/null
+++ b/src/main/java/org/onap/clamp/loop/template/LoopTemplate.java
@@ -0,0 +1,268 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2019 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.clamp.loop.template;
+
+import com.google.gson.annotations.Expose;
+
+import java.io.Serializable;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+
+import org.hibernate.annotations.SortNatural;
+import org.onap.clamp.loop.common.AuditEntity;
+import org.onap.clamp.loop.service.Service;
+
+@Entity
+@Table(name = "loop_templates")
+public class LoopTemplate extends AuditEntity implements Serializable {
+
+ /**
+ * The serial version id.
+ */
+ private static final long serialVersionUID = -286522707701388642L;
+
+ @Id
+ @Expose
+ @Column(nullable = false, name = "name", unique = true)
+ private String name;
+
+ /**
+ * This field is used when we have a blueprint defining all microservices. The
+ * other option would be to have independent blueprint for each microservices.
+ * In that case they are stored in each MicroServiceModel
+ */
+ @Column(columnDefinition = "MEDIUMTEXT", nullable = false, name = "blueprint_yaml")
+ private String blueprint;
+
+ @Expose
+ @Column(columnDefinition = "MEDIUMTEXT", name = "svg_representation")
+ private String svgRepresentation;
+
+ @Expose
+ @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "loopTemplate", orphanRemoval = true)
+ @SortNatural
+ private SortedSet<TemplateMicroServiceModel> microServiceModelUsed = new TreeSet<>();
+
+ @Expose
+ @ManyToOne(fetch = FetchType.EAGER, cascade = { CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH })
+ @JoinColumn(name = "service_uuid")
+ private Service modelService;
+
+ @Expose
+ @Column(name = "maximum_instances_allowed")
+ private Integer maximumInstancesAllowed;
+
+ /**
+ * name getter.
+ *
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * name setter.
+ *
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * blueprint getter.
+ *
+ * @return the blueprint
+ */
+ public String getBlueprint() {
+ return blueprint;
+ }
+
+ /**
+ * blueprint setter.
+ *
+ * @param blueprint the blueprint to set
+ */
+ public void setBlueprint(String blueprint) {
+ this.blueprint = blueprint;
+ }
+
+ /**
+ * svgRepresentation getter.
+ *
+ * @return the svgRepresentation
+ */
+ public String getSvgRepresentation() {
+ return svgRepresentation;
+ }
+
+ /**
+ * svgRepresentation setter.
+ *
+ * @param svgRepresentation the svgRepresentation to set
+ */
+ public void setSvgRepresentation(String svgRepresentation) {
+ this.svgRepresentation = svgRepresentation;
+ }
+
+ /**
+ * microServiceModelUsed getter.
+ *
+ * @return the microServiceModelUsed
+ */
+ public SortedSet<TemplateMicroServiceModel> getMicroServiceModelUsed() {
+ return microServiceModelUsed;
+ }
+
+ /**
+ * maximumInstancesAllowed getter.
+ *
+ * @return the maximumInstancesAllowed
+ */
+ public Integer getMaximumInstancesAllowed() {
+ return maximumInstancesAllowed;
+ }
+
+ /**
+ * maximumInstancesAllowed setter.
+ *
+ * @param maximumInstancesAllowed the maximumInstancesAllowed to set
+ */
+ public void setMaximumInstancesAllowed(Integer maximumInstancesAllowed) {
+ this.maximumInstancesAllowed = maximumInstancesAllowed;
+ }
+
+ /**
+ * Add a microService model to the current template, the microservice is added
+ * at the end of the list so the flowOrder is computed automatically.
+ *
+ * @param microServiceModel The microserviceModel to add
+ */
+ public void addMicroServiceModel(MicroServiceModel microServiceModel) {
+ TemplateMicroServiceModel jointEntry = new TemplateMicroServiceModel(this, microServiceModel,
+ this.microServiceModelUsed.size());
+ this.microServiceModelUsed.add(jointEntry);
+ microServiceModel.getUsedByLoopTemplates().add(jointEntry);
+ }
+
+ /**
+ * Add a microService model to the current template, the flow order must be
+ * specified manually.
+ *
+ * @param microServiceModel The microserviceModel to add
+ * @param listPosition The position in the flow
+ */
+ public void addMicroServiceModel(MicroServiceModel microServiceModel, Integer listPosition) {
+ TemplateMicroServiceModel jointEntry = new TemplateMicroServiceModel(this, microServiceModel, listPosition);
+ this.microServiceModelUsed.add(jointEntry);
+ microServiceModel.getUsedByLoopTemplates().add(jointEntry);
+ }
+
+ /**
+ * modelService getter.
+ *
+ * @return the modelService
+ */
+ public Service getModelService() {
+ return modelService;
+ }
+
+ /**
+ * modelService setter.
+ *
+ * @param modelService the modelService to set
+ */
+ public void setModelService(Service modelService) {
+ this.modelService = modelService;
+ }
+
+ /**
+ * Default constructor for serialization.
+ */
+ public LoopTemplate() {
+
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param name The loop template name id
+ * @param blueprint The blueprint containing all microservices (legacy
+ * case)
+ * @param svgRepresentation The svg representation of that loop template
+ * @param maxInstancesAllowed The maximum number of instances that can be
+ * created from that template
+ * @param service The service associated to that loop template
+ */
+ public LoopTemplate(String name, String blueprint, String svgRepresentation, Integer maxInstancesAllowed,
+ Service service) {
+ this.name = name;
+ this.blueprint = blueprint;
+ this.svgRepresentation = svgRepresentation;
+
+ this.maximumInstancesAllowed = maxInstancesAllowed;
+ this.modelService = service;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ LoopTemplate other = (LoopTemplate) obj;
+ if (name == null) {
+ if (other.name != null) {
+ return false;
+ }
+ } else if (!name.equals(other.name)) {
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/src/main/java/org/onap/clamp/loop/template/LoopTemplatesRepository.java b/src/main/java/org/onap/clamp/loop/template/LoopTemplatesRepository.java
new file mode 100644
index 000000000..07f304de7
--- /dev/null
+++ b/src/main/java/org/onap/clamp/loop/template/LoopTemplatesRepository.java
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2019 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.clamp.loop.template;
+
+import java.util.List;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface LoopTemplatesRepository extends JpaRepository<LoopTemplate, String> {
+
+ @Query("SELECT looptemplate.name FROM LoopTemplate as looptemplate")
+ List<String> getAllLoopTemplateNames();
+}
diff --git a/src/main/java/org/onap/clamp/loop/template/MicroServiceModel.java b/src/main/java/org/onap/clamp/loop/template/MicroServiceModel.java
new file mode 100644
index 000000000..1e2b140e7
--- /dev/null
+++ b/src/main/java/org/onap/clamp/loop/template/MicroServiceModel.java
@@ -0,0 +1,217 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 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.clamp.loop.template;
+
+import com.google.gson.annotations.Expose;
+
+import java.io.Serializable;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinColumns;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+
+import org.onap.clamp.loop.common.AuditEntity;
+
+/**
+ * This class represents a micro service model for a loop template.
+ */
+
+@Entity
+@Table(name = "micro_service_models")
+public class MicroServiceModel extends AuditEntity implements Serializable {
+
+ /**
+ * The serial version id.
+ */
+ private static final long serialVersionUID = -286522707701376645L;
+
+ @Id
+ @Expose
+ @Column(nullable = false, name = "name", unique = true)
+ private String name;
+
+ /**
+ * This variable is used to store the type mentioned in the micro-service
+ * blueprint.
+ */
+ @Expose
+ @Column(nullable = false, name = "policy_type")
+ private String policyType;
+
+ @Column(nullable = false, name = "blueprint_yaml")
+ private String blueprint;
+
+ @Expose
+ @ManyToOne(fetch = FetchType.EAGER, cascade = { CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH })
+ @JoinColumns({ @JoinColumn(name = "policy_model_type", referencedColumnName = "policy_model_type"),
+ @JoinColumn(name = "policy_model_version", referencedColumnName = "version") })
+ private PolicyModel policyModel;
+
+ @OneToMany(fetch = FetchType.LAZY, mappedBy = "microServiceModel", orphanRemoval = true)
+ private Set<TemplateMicroServiceModel> usedByLoopTemplates = new HashSet<>();
+
+ /**
+ * policyModel getter.
+ *
+ * @return the policyModel
+ */
+ public PolicyModel getPolicyModel() {
+ return policyModel;
+ }
+
+ /**
+ * policyModel setter.
+ *
+ * @param policyModel the policyModel to set
+ */
+ public void setPolicyModel(PolicyModel policyModel) {
+ this.policyModel = policyModel;
+ }
+
+ /**
+ * name getter.
+ *
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * name setter.
+ *
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * policyType getter.
+ *
+ * @return the policyType
+ */
+ public String getPolicyType() {
+ return policyType;
+ }
+
+ /**
+ * policyType setter.
+ *
+ * @param policyType the policyType to set
+ */
+ public void setPolicyType(String policyType) {
+ this.policyType = policyType;
+ }
+
+ /**
+ * blueprint getter.
+ *
+ * @return the blueprint
+ */
+ public String getBlueprint() {
+ return blueprint;
+ }
+
+ /**
+ * blueprint setter.
+ *
+ * @param blueprint the blueprint to set
+ */
+ public void setBlueprint(String blueprint) {
+ this.blueprint = blueprint;
+ }
+
+ /**
+ * usedByLoopTemplates getter.
+ *
+ * @return the usedByLoopTemplates
+ */
+ public Set<TemplateMicroServiceModel> getUsedByLoopTemplates() {
+ return usedByLoopTemplates;
+ }
+
+ /**
+ * Default constructor for serialization.
+ */
+ public MicroServiceModel() {
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param name The name id
+ * @param policyType The policy model type like
+ * onap.policies.controlloop.operational.common.Apex
+ * @param blueprint The blueprint defined for dcae that contains the policy
+ * type to use
+ * @param policyModel The policy model for the policy type mentioned here
+ */
+ public MicroServiceModel(String name, String policyType, String blueprint, PolicyModel policyModel) {
+ this.name = name;
+ this.policyType = policyType;
+ this.blueprint = blueprint;
+ this.policyModel = policyModel;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ MicroServiceModel other = (MicroServiceModel) obj;
+ if (name == null) {
+ if (other.name != null) {
+ return false;
+ }
+ } else if (!name.equals(other.name)) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/src/main/java/org/onap/clamp/loop/template/MicroServiceModelsRepository.java b/src/main/java/org/onap/clamp/loop/template/MicroServiceModelsRepository.java
new file mode 100644
index 000000000..2b1870485
--- /dev/null
+++ b/src/main/java/org/onap/clamp/loop/template/MicroServiceModelsRepository.java
@@ -0,0 +1,31 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2019 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.clamp.loop.template;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface MicroServiceModelsRepository extends JpaRepository<MicroServiceModel, String> {
+}
diff --git a/src/main/java/org/onap/clamp/loop/template/PolicyModel.java b/src/main/java/org/onap/clamp/loop/template/PolicyModel.java
new file mode 100644
index 000000000..e6580beed
--- /dev/null
+++ b/src/main/java/org/onap/clamp/loop/template/PolicyModel.java
@@ -0,0 +1,239 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2019 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.clamp.loop.template;
+
+import com.google.gson.annotations.Expose;
+
+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 org.onap.clamp.loop.common.AuditEntity;
+import org.onap.clamp.util.SemanticVersioning;
+
+/**
+ * This class represents the policy model tosca revision that we can have to a
+ * specific microservice.
+ */
+@Entity
+@Table(name = "policy_models")
+@IdClass(PolicyModelId.class)
+public class PolicyModel extends AuditEntity implements Serializable, Comparable<PolicyModel> {
+
+ /**
+ * The serial version id.
+ */
+ private static final long serialVersionUID = -286522705701376645L;
+
+ /**
+ * This variable is used to store the type mentioned in the micro-service
+ * blueprint.
+ */
+ @Id
+ @Expose
+ @Column(nullable = false, name = "policy_model_type")
+ private String policyModelType;
+
+ /**
+ * Semantic versioning on policy side.
+ */
+ @Id
+ @Expose
+ @Column(name = "version")
+ private String version;
+
+ @Column(columnDefinition = "MEDIUMTEXT", name = "policy_tosca")
+ private String policyModelTosca;
+
+ @Expose
+ @Column(name = "policy_acronym")
+ private String policyAcronym;
+
+ @Expose
+ @Column(name = "policy_variant")
+ private String policyVariant;
+
+ /**
+ * policyModelTosca getter.
+ *
+ * @return the policyModelTosca
+ */
+ public String getPolicyModelTosca() {
+ return policyModelTosca;
+ }
+
+ /**
+ * policyModelTosca setter.
+ *
+ * @param policyModelTosca the policyModelTosca to set
+ */
+ public void setPolicyModelTosca(String policyModelTosca) {
+ this.policyModelTosca = policyModelTosca;
+ }
+
+ /**
+ * policyModelType getter.
+ *
+ * @return the modelType
+ */
+ public String getPolicyModelType() {
+ return policyModelType;
+ }
+
+ /**
+ * policyModelType setter.
+ *
+ * @param modelType the modelType to set
+ */
+ public void setPolicyModelType(String modelType) {
+ this.policyModelType = modelType;
+ }
+
+ /**
+ * version getter.
+ *
+ * @return the version
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * version setter.
+ *
+ * @param version the version to set
+ */
+ public void setVersion(String version) {
+ // Try to convert it before
+ this.version = version;
+ }
+
+ /**
+ * policyAcronym getter.
+ *
+ * @return the policyAcronym value
+ */
+ public String getPolicyAcronym() {
+ return policyAcronym;
+ }
+
+ /**
+ * policyAcronym setter.
+ *
+ * @param policyAcronym The policyAcronym to set
+ */
+ public void setPolicyAcronym(String policyAcronym) {
+ this.policyAcronym = policyAcronym;
+ }
+
+ /**
+ * policyVariant getter.
+ *
+ * @return the policyVariant value
+ */
+ public String getPolicyVariant() {
+ return policyVariant;
+ }
+
+ /**
+ * policyVariant setter.
+ *
+ * @param policyVariant The policyVariant to set
+ */
+ public void setPolicyVariant(String policyVariant) {
+ this.policyVariant = policyVariant;
+ }
+
+ /**
+ * Default constructor for serialization.
+ */
+ public PolicyModel() {
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param policyType The policyType (referenced in the blueprint)
+ * @param policyModelTosca The policy tosca model in yaml
+ * @param version the version like 1.0.0
+ * @param policyAcronym Short policy name if it exists
+ * @param policyVariant Subtype for policy if it exists (could be used by UI)
+ */
+ public PolicyModel(String policyType, String policyModelTosca, String version, String policyAcronym,
+ String policyVariant) {
+ this.policyModelType = policyType;
+ this.policyModelTosca = policyModelTosca;
+ this.version = version;
+ this.policyAcronym = policyAcronym;
+ this.policyVariant = policyVariant;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((policyModelType == null) ? 0 : policyModelType.hashCode());
+ result = prime * result + ((version == null) ? 0 : version.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ PolicyModel other = (PolicyModel) obj;
+ if (policyModelType == null) {
+ if (other.policyModelType != null) {
+ return false;
+ }
+ } else if (!policyModelType.equals(other.policyModelType)) {
+ return false;
+ }
+ if (version == null) {
+ if (other.version != null) {
+ return false;
+ }
+ } else if (!version.equals(other.version)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public int compareTo(PolicyModel arg0) {
+ // Reverse it, so that by default we have the latest
+ return SemanticVersioning.compare(arg0.getVersion(), this.version);
+ }
+}
diff --git a/src/main/java/org/onap/clamp/loop/template/PolicyModelId.java b/src/main/java/org/onap/clamp/loop/template/PolicyModelId.java
new file mode 100644
index 000000000..c4dd1933b
--- /dev/null
+++ b/src/main/java/org/onap/clamp/loop/template/PolicyModelId.java
@@ -0,0 +1,93 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2019 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.clamp.loop.template;
+
+import com.google.gson.annotations.Expose;
+
+import java.io.Serializable;
+
+public class PolicyModelId implements Serializable {
+
+ /**
+ * Serial Id.
+ */
+ private static final long serialVersionUID = -2846526482064334745L;
+
+ @Expose
+ private String policyModelType;
+
+ @Expose
+ private String version;
+
+ /**
+ * Default constructor for serialization.
+ */
+ public PolicyModelId() {
+
+ }
+
+ /**
+ * Constructor.
+ */
+ public PolicyModelId(String policyModelType, String version) {
+ this.policyModelType = policyModelType;
+ this.version = version;
+ }
+
+ /**
+ * policyModelType getter.
+ *
+ * @return the policyModelType
+ */
+ public String getPolicyModelType() {
+ return policyModelType;
+ }
+
+ /**
+ * policyModelType setter.
+ *
+ * @param policyModelType the policyModelType to set
+ */
+ public void setPolicyModelType(String policyModelType) {
+ this.policyModelType = policyModelType;
+ }
+
+ /**
+ * version getter.
+ *
+ * @return the version
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * version setter.
+ *
+ * @param version the version to set
+ */
+ public void setVersion(String version) {
+ this.version = version;
+ }
+}
diff --git a/src/main/java/org/onap/clamp/loop/template/PolicyModelsRepository.java b/src/main/java/org/onap/clamp/loop/template/PolicyModelsRepository.java
new file mode 100644
index 000000000..a76e386b5
--- /dev/null
+++ b/src/main/java/org/onap/clamp/loop/template/PolicyModelsRepository.java
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2019 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.clamp.loop.template;
+
+import java.util.List;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface PolicyModelsRepository extends JpaRepository<PolicyModel, PolicyModelId> {
+ @Query("SELECT policymodel.policyModelType FROM PolicyModel as policymodel")
+ List<String> getAllPolicyModelType();
+
+ List<PolicyModel> findByPolicyModelType(String policyModelType);
+}
diff --git a/src/main/java/org/onap/clamp/loop/template/PolicyModelsService.java b/src/main/java/org/onap/clamp/loop/template/PolicyModelsService.java
new file mode 100644
index 000000000..8e22852a9
--- /dev/null
+++ b/src/main/java/org/onap/clamp/loop/template/PolicyModelsService.java
@@ -0,0 +1,59 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2019 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.clamp.loop.template;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class PolicyModelsService {
+ private final PolicyModelsRepository policyModelsRepository;
+
+ @Autowired
+ public PolicyModelsService(PolicyModelsRepository policyModelrepo) {
+ policyModelsRepository = policyModelrepo;
+ }
+
+ public PolicyModel saveOrUpdatePolicyModel(PolicyModel policyModel) {
+ return policyModelsRepository.save(policyModel);
+ }
+
+ public List<String> getAllPolicyModelTypes() {
+ return policyModelsRepository.getAllPolicyModelType();
+ }
+
+ public Iterable<PolicyModel> getAllPolicyModels() {
+ return policyModelsRepository.findAll();
+ }
+
+ public PolicyModel getPolicyModel(String type, String version) {
+ return policyModelsRepository.findById(new PolicyModelId(type, version)).orElse(null);
+ }
+
+ public Iterable<PolicyModel> getAllPolicyModelsByType(String type) {
+ return policyModelsRepository.findByPolicyModelType(type);
+ }
+}
diff --git a/src/main/java/org/onap/clamp/loop/template/TemplateMicroServiceModel.java b/src/main/java/org/onap/clamp/loop/template/TemplateMicroServiceModel.java
new file mode 100644
index 000000000..7547c1f70
--- /dev/null
+++ b/src/main/java/org/onap/clamp/loop/template/TemplateMicroServiceModel.java
@@ -0,0 +1,194 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2019 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.clamp.loop.template;
+
+import com.google.gson.annotations.Expose;
+
+import java.io.Serializable;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.EmbeddedId;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.MapsId;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "templates_microservicemodels")
+public class TemplateMicroServiceModel implements Serializable, Comparable<TemplateMicroServiceModel> {
+
+ /**
+ * Serial ID.
+ */
+ private static final long serialVersionUID = 5924989899078094245L;
+
+ @EmbeddedId
+ private TemplateMicroServiceModelId templateMicroServiceModelId;
+
+ @ManyToOne(fetch = FetchType.LAZY)
+ @MapsId("loopTemplateName")
+ @JoinColumn(name = "loop_template_name")
+ private LoopTemplate loopTemplate;
+
+ @Expose
+ @ManyToOne(fetch = FetchType.EAGER, cascade = { CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH })
+ @MapsId("microServiceModelName")
+ @JoinColumn(name = "micro_service_model_name")
+ private MicroServiceModel microServiceModel;
+
+ @Expose
+ @Column(nullable = false, name = "flow_order")
+ private Integer flowOrder;
+
+ /**
+ * Default constructor for serialization.
+ */
+ public TemplateMicroServiceModel() {
+
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param loopTemplate The loop template object
+ * @param microServiceModel The microServiceModel object
+ * @param flowOrder The position of the micro service in the flow
+ */
+ public TemplateMicroServiceModel(LoopTemplate loopTemplate, MicroServiceModel microServiceModel,
+ Integer flowOrder) {
+ this.loopTemplate = loopTemplate;
+ this.microServiceModel = microServiceModel;
+ this.flowOrder = flowOrder;
+ this.templateMicroServiceModelId = new TemplateMicroServiceModelId(loopTemplate.getName(),
+ microServiceModel.getName());
+ }
+
+ /**
+ * loopTemplate getter.
+ *
+ * @return the loopTemplate
+ */
+ public LoopTemplate getLoopTemplate() {
+ return loopTemplate;
+ }
+
+ /**
+ * loopTemplate setter.
+ *
+ * @param loopTemplate the loopTemplate to set
+ */
+ public void setLoopTemplate(LoopTemplate loopTemplate) {
+ this.loopTemplate = loopTemplate;
+ }
+
+ /**
+ * microServiceModel getter.
+ *
+ * @return the microServiceModel
+ */
+ public MicroServiceModel getMicroServiceModel() {
+ return microServiceModel;
+ }
+
+ /**
+ * microServiceModel setter.
+ *
+ * @param microServiceModel the microServiceModel to set
+ */
+ public void setMicroServiceModel(MicroServiceModel microServiceModel) {
+ this.microServiceModel = microServiceModel;
+ }
+
+ /**
+ * flowOrder getter.
+ *
+ * @return the flowOrder
+ */
+ public Integer getFlowOrder() {
+ return flowOrder;
+ }
+
+ /**
+ * flowOrder setter.
+ *
+ * @param flowOrder the flowOrder to set
+ */
+ public void setFlowOrder(Integer flowOrder) {
+ this.flowOrder = flowOrder;
+ }
+
+ @Override
+ public int compareTo(TemplateMicroServiceModel arg0) {
+ // Reverse it, so that by default we have the latest
+ if (getFlowOrder() == null) {
+ return 1;
+ }
+ if (arg0.getFlowOrder() == null) {
+ return -1;
+ }
+ return arg0.getFlowOrder().compareTo(this.getFlowOrder());
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((loopTemplate == null) ? 0 : loopTemplate.hashCode());
+ result = prime * result + ((microServiceModel == null) ? 0 : microServiceModel.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ TemplateMicroServiceModel other = (TemplateMicroServiceModel) obj;
+ if (loopTemplate == null) {
+ if (other.loopTemplate != null) {
+ return false;
+ }
+ } else if (!loopTemplate.equals(other.loopTemplate)) {
+ return false;
+ }
+ if (microServiceModel == null) {
+ if (other.microServiceModel != null) {
+ return false;
+ }
+ } else if (!microServiceModel.equals(other.microServiceModel)) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/src/main/java/org/onap/clamp/loop/template/TemplateMicroServiceModelId.java b/src/main/java/org/onap/clamp/loop/template/TemplateMicroServiceModelId.java
new file mode 100644
index 000000000..74c768974
--- /dev/null
+++ b/src/main/java/org/onap/clamp/loop/template/TemplateMicroServiceModelId.java
@@ -0,0 +1,102 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2019 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.clamp.loop.template;
+
+import com.google.gson.annotations.Expose;
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Embeddable;
+
+@Embeddable
+public class TemplateMicroServiceModelId implements Serializable {
+
+ /**
+ * Serial ID.
+ */
+ private static final long serialVersionUID = 4089888115504914773L;
+
+ @Expose
+ @Column(name = "loop_template_name")
+ private String loopTemplateName;
+
+ @Expose
+ @Column(name = "micro_service_model_name")
+ private String microServiceModelName;
+
+ /**
+ * Default constructor for serialization.
+ */
+ public TemplateMicroServiceModelId() {
+
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param loopTemplateName The loop template name id
+ * @param microServiceModelName THe micro Service name id
+ */
+ public TemplateMicroServiceModelId(String loopTemplateName, String microServiceModelName) {
+ this.loopTemplateName = loopTemplateName;
+ this.microServiceModelName = microServiceModelName;
+ }
+
+ /**
+ * loopTemplateName getter.
+ *
+ * @return the loopTemplateName
+ */
+ public String getLoopTemplateName() {
+ return loopTemplateName;
+ }
+
+ /**
+ * loopTemplateName setter.
+ *
+ * @param loopTemplateName the loopTemplateName to set
+ */
+ public void setLoopTemplateName(String loopTemplateName) {
+ this.loopTemplateName = loopTemplateName;
+ }
+
+ /**
+ * microServiceModelName getter.
+ *
+ * @return the microServiceModelName
+ */
+ public String getMicroServiceModelName() {
+ return microServiceModelName;
+ }
+
+ /**
+ * microServiceModelName setter.
+ *
+ * @param microServiceModelName the microServiceModelName to set
+ */
+ public void setMicroServiceModelName(String microServiceModelName) {
+ this.microServiceModelName = microServiceModelName;
+ }
+}
diff --git a/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.java b/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.java
index 2943c39a2..98742d22b 100644
--- a/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.java
+++ b/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.java
@@ -40,7 +40,9 @@ import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
+import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
+import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;
@@ -52,13 +54,15 @@ import org.onap.clamp.clds.tosca.ToscaYamlToJsonConvertor;
import org.onap.clamp.clds.util.JsonUtils;
import org.onap.clamp.dao.model.jsontype.StringJsonUserType;
import org.onap.clamp.loop.Loop;
+import org.onap.clamp.loop.common.AuditEntity;
+import org.onap.clamp.loop.template.MicroServiceModel;
import org.onap.clamp.policy.Policy;
import org.yaml.snakeyaml.Yaml;
@Entity
@Table(name = "micro_service_policies")
@TypeDefs({ @TypeDef(name = "json", typeClass = StringJsonUserType.class) })
-public class MicroServicePolicy implements Serializable, Policy {
+public class MicroServicePolicy extends AuditEntity implements Serializable, Policy {
/**
* The serial version ID.
*/
@@ -73,10 +77,18 @@ public class MicroServicePolicy implements Serializable, Policy {
private String name;
@Expose
- @Column(nullable = false, name = "model_type")
+ @Column(nullable = false, name = "policy_model_type")
private String modelType;
@Expose
+ @Column(name = "context")
+ private String context;
+
+ @Expose
+ @Column(name = "device_type_scope")
+ private String deviceTypeScope;
+
+ @Expose
@Type(type = "json")
@Column(columnDefinition = "json", name = "properties")
private JsonObject properties;
@@ -96,6 +108,11 @@ public class MicroServicePolicy implements Serializable, Policy {
@ManyToMany(mappedBy = "microServicePolicies", fetch = FetchType.EAGER)
private Set<Loop> usedByLoops = new HashSet<>();
+ @Expose
+ @ManyToOne(fetch = FetchType.EAGER)
+ @JoinColumn(name = "micro_service_model_id")
+ private MicroServiceModel microServiceModel;
+
public MicroServicePolicy() {
// serialization
}
@@ -203,6 +220,49 @@ public class MicroServicePolicy implements Serializable, Policy {
this.usedByLoops = usedBy;
}
+ public String getContext() {
+ return context;
+ }
+
+ public void setContext(String context) {
+ this.context = context;
+ }
+
+ public String getDeviceTypeScope() {
+ return deviceTypeScope;
+ }
+
+ public void setDeviceTypeScope(String deviceTypeScope) {
+ this.deviceTypeScope = deviceTypeScope;
+ }
+
+ /**
+ * microServiceModel getter.
+ *
+ * @return the microServiceModel
+ */
+ public MicroServiceModel getMicroServiceModel() {
+ return microServiceModel;
+ }
+
+ /**
+ * microServiceModel setter.
+ *
+ * @param microServiceModel the microServiceModel to set
+ */
+ public void setMicroServiceModel(MicroServiceModel microServiceModel) {
+ this.microServiceModel = microServiceModel;
+ }
+
+ /**
+ * name setter.
+ *
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
@Override
public int hashCode() {
final int prime = 31;
diff --git a/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicyRepository.java b/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicyRepository.java
index f658aacc3..38b310ce8 100644
--- a/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicyRepository.java
+++ b/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicyRepository.java
@@ -23,10 +23,10 @@
package org.onap.clamp.policy.microservice;
-import org.springframework.data.repository.CrudRepository;
+import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
-interface MicroServicePolicyRepository extends CrudRepository<MicroServicePolicy, String> {
+public interface MicroServicePolicyRepository extends JpaRepository<MicroServicePolicy, String> {
}
diff --git a/src/main/java/org/onap/clamp/policy/microservice/MicroservicePolicyService.java b/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicyService.java
index 59ddaa009..346cdf624 100644
--- a/src/main/java/org/onap/clamp/policy/microservice/MicroservicePolicyService.java
+++ b/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicyService.java
@@ -35,12 +35,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
-public class MicroservicePolicyService implements PolicyService<MicroServicePolicy> {
+public class MicroServicePolicyService implements PolicyService<MicroServicePolicy> {
private final MicroServicePolicyRepository repository;
@Autowired
- public MicroservicePolicyService(MicroServicePolicyRepository repository) {
+ public MicroServicePolicyService(MicroServicePolicyRepository repository) {
this.repository = repository;
}
diff --git a/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java b/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java
index 14112694e..e8bf4a655 100644
--- a/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java
+++ b/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java
@@ -46,6 +46,7 @@ import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
+import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;
@@ -55,6 +56,7 @@ import org.hibernate.annotations.TypeDef;
import org.hibernate.annotations.TypeDefs;
import org.onap.clamp.dao.model.jsontype.StringJsonUserType;
import org.onap.clamp.loop.Loop;
+import org.onap.clamp.loop.template.PolicyModel;
import org.onap.clamp.policy.Policy;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;
@@ -90,6 +92,12 @@ public class OperationalPolicy implements Serializable, Policy {
@JoinColumn(name = "loop_id", nullable = false)
private Loop loop;
+ @Expose
+ @ManyToOne(fetch = FetchType.EAGER)
+ @JoinColumns({ @JoinColumn(name = "policy_model_type", referencedColumnName = "policy_model_type"),
+ @JoinColumn(name = "policy_model_version", referencedColumnName = "version") })
+ private PolicyModel policyModel;
+
public OperationalPolicy() {
// Serialization
}
@@ -137,6 +145,33 @@ public class OperationalPolicy implements Serializable, Policy {
this.configurationsJson = configurationsJson;
}
+ /**
+ * policyModel getter.
+ *
+ * @return the policyModel
+ */
+ public PolicyModel getPolicyModel() {
+ return policyModel;
+ }
+
+ /**
+ * policyModel setter.
+ *
+ * @param policyModel the policyModel to set
+ */
+ public void setPolicyModel(PolicyModel policyModel) {
+ this.policyModel = policyModel;
+ }
+
+ /**
+ * name setter.
+ *
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
@Override
public JsonObject getJsonRepresentation() {
return jsonRepresentation;
diff --git a/src/main/java/org/onap/clamp/policy/operational/OperationalPolicyRepository.java b/src/main/java/org/onap/clamp/policy/operational/OperationalPolicyRepository.java
index 97b183f72..c0a6e12cd 100644
--- a/src/main/java/org/onap/clamp/policy/operational/OperationalPolicyRepository.java
+++ b/src/main/java/org/onap/clamp/policy/operational/OperationalPolicyRepository.java
@@ -23,10 +23,10 @@
package org.onap.clamp.policy.operational;
-import org.springframework.data.repository.CrudRepository;
+import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
-interface OperationalPolicyRepository extends CrudRepository<OperationalPolicy, String> {
+public interface OperationalPolicyRepository extends JpaRepository<OperationalPolicy, String> {
void deleteByName(String policyName);
}
diff --git a/src/main/java/org/onap/clamp/tosca/Dictionary.java b/src/main/java/org/onap/clamp/tosca/Dictionary.java
new file mode 100644
index 000000000..7b4e513a2
--- /dev/null
+++ b/src/main/java/org/onap/clamp/tosca/Dictionary.java
@@ -0,0 +1,174 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2019 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.clamp.tosca;
+
+import com.google.gson.annotations.Expose;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+
+import org.onap.clamp.loop.common.AuditEntity;
+
+/**
+ * Represents Dictionary.
+ */
+
+@Entity
+@Table(name = "dictionary")
+public class Dictionary extends AuditEntity implements Serializable {
+
+ /**
+ * The serial version id.
+ */
+ private static final long serialVersionUID = -286522707701388645L;
+
+ @Id
+ @Expose
+ @Column(nullable = false, name = "name", unique = true)
+ private String name;
+
+ @Expose
+ @Column(name = "dictionary_second_level")
+ private int secondLevelDictionary;
+
+ @Expose
+ @Column(name = "dictionary_type")
+ private String subDictionaryType;
+
+ @Expose
+ @OneToMany(mappedBy = "dictionary", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
+ private List<DictionaryElement> dictionaryElements = new ArrayList<>();
+
+ /**
+ * name getter.
+ *
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * name setter.
+ *
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * secondLevelDictionary getter.
+ *
+ * @return the secondLevelDictionary
+ */
+ public int getSecondLevelDictionary() {
+ return secondLevelDictionary;
+ }
+
+ /**
+ * secondLevelDictionary setter.
+ *
+ * @param secondLevelDictionary the secondLevelDictionary to set
+ */
+ public void setSecondLevelDictionary(int secondLevelDictionary) {
+ this.secondLevelDictionary = secondLevelDictionary;
+ }
+
+ /**
+ * subDictionaryType getter.
+ *
+ * @return the subDictionaryType
+ */
+ public String getSubDictionaryType() {
+ return subDictionaryType;
+ }
+
+ /**
+ * subDictionaryType setter.
+ *
+ * @param subDictionaryType the subDictionaryType to set
+ */
+ public void setSubDictionaryType(String subDictionaryType) {
+ this.subDictionaryType = subDictionaryType;
+ }
+
+ /**
+ * dictionaryElements getter.
+ *
+ * @return the dictionaryElements
+ */
+ public List<DictionaryElement> getDictionaryElements() {
+ return dictionaryElements;
+ }
+
+ /**
+ * dictionaryElements setter.
+ *
+ * @param dictionaryElements the dictionaryElements to set
+ */
+ public void setDictionaryElements(List<DictionaryElement> dictionaryElements) {
+ this.dictionaryElements = dictionaryElements;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ Dictionary other = (Dictionary) obj;
+ if (name == null) {
+ if (other.name != null) {
+ return false;
+ }
+ } else if (!name.equals(other.name)) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/src/main/java/org/onap/clamp/tosca/DictionaryElement.java b/src/main/java/org/onap/clamp/tosca/DictionaryElement.java
new file mode 100644
index 000000000..e81885f3e
--- /dev/null
+++ b/src/main/java/org/onap/clamp/tosca/DictionaryElement.java
@@ -0,0 +1,249 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2019 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.clamp.tosca;
+
+import com.google.gson.annotations.Expose;
+
+import java.io.Serializable;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+import org.onap.clamp.loop.common.AuditEntity;
+
+/**
+ * Represents a Dictionary Item.
+ */
+@Entity
+@Table(name = "dictionary_elements")
+public class DictionaryElement extends AuditEntity implements Serializable {
+
+ /**
+ * The serial version id.
+ */
+ private static final long serialVersionUID = -286522707701388644L;
+
+ @Id
+ @Expose
+ @Column(nullable = false, name = "name", unique = true)
+ private String name;
+
+ @Expose
+ @Column(nullable = false, name = "short_name", unique = true)
+ private String shortName;
+
+ @Expose
+ @Column(name = "description")
+ private String description;
+
+ @Expose
+ @Column(nullable = false, name = "type")
+ private String type;
+
+ @Column(name = "subdictionary_id", nullable = false)
+ @Expose
+ private String subDictionary;
+
+ @ManyToOne(cascade = CascadeType.ALL)
+ @JoinColumn(name = "dictionary_id")
+ private Dictionary dictionary;
+
+ /**
+ * name getter.
+ *
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * name setter.
+ *
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * shortName getter.
+ *
+ * @return the shortName
+ */
+ public String getShortName() {
+ return shortName;
+ }
+
+ /**
+ * shortName setter.
+ *
+ * @param shortName the shortName to set
+ */
+ public void setShortName(String shortName) {
+ this.shortName = shortName;
+ }
+
+ /**
+ * description getter.
+ *
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * description setter.
+ *
+ * @param description the description to set
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * type getter.
+ *
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * type setter.
+ *
+ * @param type the type to set
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * subDictionary getter.
+ *
+ * @return the subDictionary
+ */
+ public String getSubDictionary() {
+ return subDictionary;
+ }
+
+ /**
+ * subDictionary setter.
+ *
+ * @param subDictionary the subDictionary to set
+ */
+ public void setSubDictionary(String subDictionary) {
+ this.subDictionary = subDictionary;
+ }
+
+ /**
+ * dictionary getter.
+ *
+ * @return the dictionary
+ */
+ public Dictionary getDictionary() {
+ return dictionary;
+ }
+
+ /**
+ * dictionary setter.
+ *
+ * @param dictionary the dictionary to set
+ */
+ public void setDictionary(Dictionary dictionary) {
+ this.dictionary = dictionary;
+ }
+
+ /**
+ * Default Constructor.
+ */
+ public DictionaryElement() {
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param name The Dictionary element name
+ * @param shortName The short name
+ * @param description The description
+ * @param type The type of element
+ * @param subDictionary The sub type
+ * @param dictionary The parent dictionary
+ */
+ public DictionaryElement(String name, String shortName, String description, String type, String subDictionary,
+ Dictionary dictionary) {
+ this.name = name;
+ this.shortName = shortName;
+ this.description = description;
+ this.type = type;
+ this.subDictionary = subDictionary;
+ this.dictionary = dictionary;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((dictionary == null) ? 0 : dictionary.hashCode());
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ DictionaryElement other = (DictionaryElement) obj;
+ if (dictionary == null) {
+ if (other.dictionary != null) {
+ return false;
+ }
+ } else if (!dictionary.equals(other.dictionary)) {
+ return false;
+ }
+ if (name == null) {
+ if (other.name != null) {
+ return false;
+ }
+ } else if (!name.equals(other.name)) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/src/main/java/org/onap/clamp/tosca/DictionaryElementsRepository.java b/src/main/java/org/onap/clamp/tosca/DictionaryElementsRepository.java
new file mode 100644
index 000000000..96cb2e35e
--- /dev/null
+++ b/src/main/java/org/onap/clamp/tosca/DictionaryElementsRepository.java
@@ -0,0 +1,32 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2019 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.clamp.tosca;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface DictionaryElementsRepository extends JpaRepository<DictionaryElement, String> {
+
+}
diff --git a/src/main/java/org/onap/clamp/tosca/DictionaryRepository.java b/src/main/java/org/onap/clamp/tosca/DictionaryRepository.java
new file mode 100644
index 000000000..2a087b6d9
--- /dev/null
+++ b/src/main/java/org/onap/clamp/tosca/DictionaryRepository.java
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2019 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.clamp.tosca;
+
+import java.util.List;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface DictionaryRepository extends JpaRepository<Dictionary, String> {
+
+ @Query("SELECT dict.name FROM Dictionary as dict")
+ List<String> getAllDictionaryNames();
+
+}
diff --git a/src/main/java/org/onap/clamp/util/SemanticVersioning.java b/src/main/java/org/onap/clamp/util/SemanticVersioning.java
new file mode 100644
index 000000000..bf1529c2c
--- /dev/null
+++ b/src/main/java/org/onap/clamp/util/SemanticVersioning.java
@@ -0,0 +1,76 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2020 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.clamp.util;
+
+/**
+ * This class is the base class for object that requires semantic versioning.
+ * ... This class supports also a.b.c.d... etc ... as a version.
+ *
+ *
+ */
+public class SemanticVersioning {
+ public static final int BEFORE = -1;
+ public static final int EQUAL = 0;
+ public static final int AFTER = 1;
+
+ /**
+ * The compare method that compare arg0 to arg1.
+ *
+ * @param arg0 A version in string for semantice versioning (a.b.c.d...)
+ * @param arg1 A version in string for semantice versioning (a.b.c.d...)
+ * @return objects (arg0, arg1) given as parameters. It returns the value: 0: if
+ * (arg0==arg1) -1: if (arg0 < arg1) 1: if (arg0 > arg1)
+ */
+ public static int compare(String arg0, String arg1) {
+
+ if (arg0 == null && arg1 == null) {
+ return EQUAL;
+ }
+ if (arg0 == null) {
+ return BEFORE;
+ }
+ if (arg1 == null) {
+ return AFTER;
+ }
+ String[] arg0Array = arg0.split("\\.");
+ String[] arg1Array = arg1.split("\\.");
+
+ int smalestStringLength = Math.min(arg0Array.length, arg1Array.length);
+
+ for (int currentVersionIndex = 0; currentVersionIndex < smalestStringLength; ++currentVersionIndex) {
+ if (Integer.parseInt(arg0Array[currentVersionIndex]) < Integer.parseInt(arg1Array[currentVersionIndex])) {
+ return BEFORE;
+ } else if (Integer.parseInt(arg0Array[currentVersionIndex]) > Integer
+ .parseInt(arg1Array[currentVersionIndex])) {
+ return AFTER;
+ }
+ // equals, so do not return anything, continue
+ }
+ if (arg0Array.length == arg1Array.length) {
+ return EQUAL;
+ } else {
+ return Integer.compare(arg0Array.length, arg1Array.length);
+ }
+ }
+} \ No newline at end of file
diff --git a/src/main/resources/META-INF/resources/swagger.html b/src/main/resources/META-INF/resources/swagger.html
index b20d0c26c..66024470a 100644
--- a/src/main/resources/META-INF/resources/swagger.html
+++ b/src/main/resources/META-INF/resources/swagger.html
@@ -444,86 +444,86 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</li>
<li><a href="#_paths">2. Paths</a>
<ul class="sectlevel2">
-<li><a href="#_route15">2.1. GET /v1/clds/cldsInfo</a>
+<li><a href="#_route32">2.1. GET /v1/clds/cldsInfo</a>
<ul class="sectlevel3">
<li><a href="#_responses">2.1.1. Responses</a></li>
<li><a href="#_produces">2.1.2. Produces</a></li>
</ul>
</li>
-<li><a href="#_route16">2.2. GET /v1/healthcheck</a>
+<li><a href="#_route33">2.2. GET /v1/healthcheck</a>
<ul class="sectlevel3">
<li><a href="#_responses_2">2.2.1. Responses</a></li>
<li><a href="#_produces_2">2.2.2. Produces</a></li>
</ul>
</li>
-<li><a href="#_route17">2.3. GET /v1/user/getUser</a>
+<li><a href="#_route34">2.3. GET /v1/user/getUser</a>
<ul class="sectlevel3">
<li><a href="#_responses_3">2.3.1. Responses</a></li>
<li><a href="#_produces_3">2.3.2. Produces</a></li>
</ul>
</li>
-<li><a href="#_route13">2.4. PUT /v2/loop/delete/{loopName}</a>
+<li><a href="#_route30">2.4. PUT /v2/loop/delete/{loopName}</a>
<ul class="sectlevel3">
<li><a href="#_parameters">2.4.1. Parameters</a></li>
<li><a href="#_responses_4">2.4.2. Responses</a></li>
</ul>
</li>
-<li><a href="#_route8">2.5. PUT /v2/loop/deploy/{loopName}</a>
+<li><a href="#_route25">2.5. PUT /v2/loop/deploy/{loopName}</a>
<ul class="sectlevel3">
<li><a href="#_parameters_2">2.5.1. Parameters</a></li>
<li><a href="#_responses_5">2.5.2. Responses</a></li>
<li><a href="#_produces_4">2.5.3. Produces</a></li>
</ul>
</li>
-<li><a href="#_route2">2.6. GET /v2/loop/getAllNames</a>
+<li><a href="#_route19">2.6. GET /v2/loop/getAllNames</a>
<ul class="sectlevel3">
<li><a href="#_responses_6">2.6.1. Responses</a></li>
<li><a href="#_produces_5">2.6.2. Produces</a></li>
</ul>
</li>
-<li><a href="#_route14">2.7. GET /v2/loop/getstatus/{loopName}</a>
+<li><a href="#_route31">2.7. GET /v2/loop/getstatus/{loopName}</a>
<ul class="sectlevel3">
<li><a href="#_parameters_3">2.7.1. Parameters</a></li>
<li><a href="#_responses_7">2.7.2. Responses</a></li>
<li><a href="#_produces_6">2.7.3. Produces</a></li>
</ul>
</li>
-<li><a href="#_route11">2.8. PUT /v2/loop/restart/{loopName}</a>
+<li><a href="#_route28">2.8. PUT /v2/loop/restart/{loopName}</a>
<ul class="sectlevel3">
<li><a href="#_parameters_4">2.8.1. Parameters</a></li>
<li><a href="#_responses_8">2.8.2. Responses</a></li>
<li><a href="#_produces_7">2.8.3. Produces</a></li>
</ul>
</li>
-<li><a href="#_route10">2.9. PUT /v2/loop/stop/{loopName}</a>
+<li><a href="#_route27">2.9. PUT /v2/loop/stop/{loopName}</a>
<ul class="sectlevel3">
<li><a href="#_parameters_5">2.9.1. Parameters</a></li>
<li><a href="#_responses_9">2.9.2. Responses</a></li>
<li><a href="#_produces_8">2.9.3. Produces</a></li>
</ul>
</li>
-<li><a href="#_route12">2.10. PUT /v2/loop/submit/{loopName}</a>
+<li><a href="#_route29">2.10. PUT /v2/loop/submit/{loopName}</a>
<ul class="sectlevel3">
<li><a href="#_parameters_6">2.10.1. Parameters</a></li>
<li><a href="#_responses_10">2.10.2. Responses</a></li>
<li><a href="#_produces_9">2.10.3. Produces</a></li>
</ul>
</li>
-<li><a href="#_route4">2.11. GET /v2/loop/svgRepresentation/{loopName}</a>
+<li><a href="#_route21">2.11. GET /v2/loop/svgRepresentation/{loopName}</a>
<ul class="sectlevel3">
<li><a href="#_parameters_7">2.11.1. Parameters</a></li>
<li><a href="#_responses_11">2.11.2. Responses</a></li>
<li><a href="#_produces_10">2.11.3. Produces</a></li>
</ul>
</li>
-<li><a href="#_route9">2.12. PUT /v2/loop/undeploy/{loopName}</a>
+<li><a href="#_route26">2.12. PUT /v2/loop/undeploy/{loopName}</a>
<ul class="sectlevel3">
<li><a href="#_parameters_8">2.12.1. Parameters</a></li>
<li><a href="#_responses_12">2.12.2. Responses</a></li>
<li><a href="#_produces_11">2.12.3. Produces</a></li>
</ul>
</li>
-<li><a href="#_route5">2.13. POST /v2/loop/updateGlobalProperties/{loopName}</a>
+<li><a href="#_route22">2.13. POST /v2/loop/updateGlobalProperties/{loopName}</a>
<ul class="sectlevel3">
<li><a href="#_parameters_9">2.13.1. Parameters</a></li>
<li><a href="#_responses_13">2.13.2. Responses</a></li>
@@ -531,7 +531,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
<li><a href="#_produces_12">2.13.4. Produces</a></li>
</ul>
</li>
-<li><a href="#_route7">2.14. POST /v2/loop/updateMicroservicePolicy/{loopName}</a>
+<li><a href="#_route24">2.14. POST /v2/loop/updateMicroservicePolicy/{loopName}</a>
<ul class="sectlevel3">
<li><a href="#_parameters_10">2.14.1. Parameters</a></li>
<li><a href="#_responses_14">2.14.2. Responses</a></li>
@@ -539,7 +539,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
<li><a href="#_produces_13">2.14.4. Produces</a></li>
</ul>
</li>
-<li><a href="#_route6">2.15. POST /v2/loop/updateOperationalPolicies/{loopName}</a>
+<li><a href="#_route23">2.15. POST /v2/loop/updateOperationalPolicies/{loopName}</a>
<ul class="sectlevel3">
<li><a href="#_parameters_11">2.15.1. Parameters</a></li>
<li><a href="#_responses_15">2.15.2. Responses</a></li>
@@ -547,7 +547,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
<li><a href="#_produces_14">2.15.4. Produces</a></li>
</ul>
</li>
-<li><a href="#_route3">2.16. GET /v2/loop/{loopName}</a>
+<li><a href="#_route20">2.16. GET /v2/loop/{loopName}</a>
<ul class="sectlevel3">
<li><a href="#_parameters_12">2.16.1. Parameters</a></li>
<li><a href="#_responses_16">2.16.2. Responses</a></li>
@@ -568,9 +568,14 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
<li><a href="#_jsonprimitive">3.8. JsonPrimitive</a></li>
<li><a href="#_loop">3.9. Loop</a></li>
<li><a href="#_looplog">3.10. LoopLog</a></li>
-<li><a href="#_microservicepolicy">3.11. MicroServicePolicy</a></li>
-<li><a href="#_number">3.12. Number</a></li>
-<li><a href="#_operationalpolicy">3.13. OperationalPolicy</a></li>
+<li><a href="#_looptemplate">3.11. LoopTemplate</a></li>
+<li><a href="#_microservicemodel">3.12. MicroServiceModel</a></li>
+<li><a href="#_microservicepolicy">3.13. MicroServicePolicy</a></li>
+<li><a href="#_number">3.14. Number</a></li>
+<li><a href="#_operationalpolicy">3.15. OperationalPolicy</a></li>
+<li><a href="#_policymodel">3.16. PolicyModel</a></li>
+<li><a href="#_service">3.17. Service</a></li>
+<li><a href="#_templatemicroservicemodel">3.18. TemplateMicroServiceModel</a></li>
</ul>
</li>
</ul>
@@ -583,13 +588,13 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
<div class="sect2">
<h3 id="_version_information"><a class="anchor" href="#_version_information"></a><a class="link" href="#_version_information">1.1. Version information</a></h3>
<div class="paragraph">
-<p><em>Version</em> : 4.1.2-SNAPSHOT</p>
+<p><em>Version</em> : 4.2.0-SNAPSHOT</p>
</div>
</div>
<div class="sect2">
<h3 id="_uri_scheme"><a class="anchor" href="#_uri_scheme"></a><a class="link" href="#_uri_scheme">1.2. URI scheme</a></h3>
<div class="paragraph">
-<p><em>Host</em> : localhost:34219<br>
+<p><em>Host</em> : localhost:33953<br>
<em>BasePath</em> : /restservices/clds/<br>
<em>Schemes</em> : HTTP</p>
</div>
@@ -600,7 +605,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
<h2 id="_paths"><a class="anchor" href="#_paths"></a><a class="link" href="#_paths">2. Paths</a></h2>
<div class="sectionbody">
<div class="sect2">
-<h3 id="_route15"><a class="anchor" href="#_route15"></a><a class="link" href="#_route15">2.1. GET /v1/clds/cldsInfo</a></h3>
+<h3 id="_route32"><a class="anchor" href="#_route32"></a><a class="link" href="#_route32">2.1. GET /v1/clds/cldsInfo</a></h3>
<div class="sect3">
<h4 id="_responses"><a class="anchor" href="#_responses"></a><a class="link" href="#_responses">2.1.1. Responses</a></h4>
<table class="tableblock frame-all grid-all stretch">
@@ -637,7 +642,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</div>
</div>
<div class="sect2">
-<h3 id="_route16"><a class="anchor" href="#_route16"></a><a class="link" href="#_route16">2.2. GET /v1/healthcheck</a></h3>
+<h3 id="_route33"><a class="anchor" href="#_route33"></a><a class="link" href="#_route33">2.2. GET /v1/healthcheck</a></h3>
<div class="sect3">
<h4 id="_responses_2"><a class="anchor" href="#_responses_2"></a><a class="link" href="#_responses_2">2.2.1. Responses</a></h4>
<table class="tableblock frame-all grid-all stretch">
@@ -674,7 +679,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</div>
</div>
<div class="sect2">
-<h3 id="_route17"><a class="anchor" href="#_route17"></a><a class="link" href="#_route17">2.3. GET /v1/user/getUser</a></h3>
+<h3 id="_route34"><a class="anchor" href="#_route34"></a><a class="link" href="#_route34">2.3. GET /v1/user/getUser</a></h3>
<div class="sect3">
<h4 id="_responses_3"><a class="anchor" href="#_responses_3"></a><a class="link" href="#_responses_3">2.3.1. Responses</a></h4>
<table class="tableblock frame-all grid-all stretch">
@@ -708,7 +713,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</div>
</div>
<div class="sect2">
-<h3 id="_route13"><a class="anchor" href="#_route13"></a><a class="link" href="#_route13">2.4. PUT /v2/loop/delete/{loopName}</a></h3>
+<h3 id="_route30"><a class="anchor" href="#_route30"></a><a class="link" href="#_route30">2.4. PUT /v2/loop/delete/{loopName}</a></h3>
<div class="sect3">
<h4 id="_parameters"><a class="anchor" href="#_parameters"></a><a class="link" href="#_parameters">2.4.1. Parameters</a></h4>
<table class="tableblock frame-all grid-all stretch">
@@ -757,7 +762,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</div>
</div>
<div class="sect2">
-<h3 id="_route8"><a class="anchor" href="#_route8"></a><a class="link" href="#_route8">2.5. PUT /v2/loop/deploy/{loopName}</a></h3>
+<h3 id="_route25"><a class="anchor" href="#_route25"></a><a class="link" href="#_route25">2.5. PUT /v2/loop/deploy/{loopName}</a></h3>
<div class="sect3">
<h4 id="_parameters_2"><a class="anchor" href="#_parameters_2"></a><a class="link" href="#_parameters_2">2.5.1. Parameters</a></h4>
<table class="tableblock frame-all grid-all stretch">
@@ -819,7 +824,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</div>
</div>
<div class="sect2">
-<h3 id="_route2"><a class="anchor" href="#_route2"></a><a class="link" href="#_route2">2.6. GET /v2/loop/getAllNames</a></h3>
+<h3 id="_route19"><a class="anchor" href="#_route19"></a><a class="link" href="#_route19">2.6. GET /v2/loop/getAllNames</a></h3>
<div class="sect3">
<h4 id="_responses_6"><a class="anchor" href="#_responses_6"></a><a class="link" href="#_responses_6">2.6.1. Responses</a></h4>
<table class="tableblock frame-all grid-all stretch">
@@ -856,7 +861,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</div>
</div>
<div class="sect2">
-<h3 id="_route14"><a class="anchor" href="#_route14"></a><a class="link" href="#_route14">2.7. GET /v2/loop/getstatus/{loopName}</a></h3>
+<h3 id="_route31"><a class="anchor" href="#_route31"></a><a class="link" href="#_route31">2.7. GET /v2/loop/getstatus/{loopName}</a></h3>
<div class="sect3">
<h4 id="_parameters_3"><a class="anchor" href="#_parameters_3"></a><a class="link" href="#_parameters_3">2.7.1. Parameters</a></h4>
<table class="tableblock frame-all grid-all stretch">
@@ -918,7 +923,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</div>
</div>
<div class="sect2">
-<h3 id="_route11"><a class="anchor" href="#_route11"></a><a class="link" href="#_route11">2.8. PUT /v2/loop/restart/{loopName}</a></h3>
+<h3 id="_route28"><a class="anchor" href="#_route28"></a><a class="link" href="#_route28">2.8. PUT /v2/loop/restart/{loopName}</a></h3>
<div class="sect3">
<h4 id="_parameters_4"><a class="anchor" href="#_parameters_4"></a><a class="link" href="#_parameters_4">2.8.1. Parameters</a></h4>
<table class="tableblock frame-all grid-all stretch">
@@ -980,7 +985,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</div>
</div>
<div class="sect2">
-<h3 id="_route10"><a class="anchor" href="#_route10"></a><a class="link" href="#_route10">2.9. PUT /v2/loop/stop/{loopName}</a></h3>
+<h3 id="_route27"><a class="anchor" href="#_route27"></a><a class="link" href="#_route27">2.9. PUT /v2/loop/stop/{loopName}</a></h3>
<div class="sect3">
<h4 id="_parameters_5"><a class="anchor" href="#_parameters_5"></a><a class="link" href="#_parameters_5">2.9.1. Parameters</a></h4>
<table class="tableblock frame-all grid-all stretch">
@@ -1042,7 +1047,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</div>
</div>
<div class="sect2">
-<h3 id="_route12"><a class="anchor" href="#_route12"></a><a class="link" href="#_route12">2.10. PUT /v2/loop/submit/{loopName}</a></h3>
+<h3 id="_route29"><a class="anchor" href="#_route29"></a><a class="link" href="#_route29">2.10. PUT /v2/loop/submit/{loopName}</a></h3>
<div class="sect3">
<h4 id="_parameters_6"><a class="anchor" href="#_parameters_6"></a><a class="link" href="#_parameters_6">2.10.1. Parameters</a></h4>
<table class="tableblock frame-all grid-all stretch">
@@ -1104,7 +1109,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</div>
</div>
<div class="sect2">
-<h3 id="_route4"><a class="anchor" href="#_route4"></a><a class="link" href="#_route4">2.11. GET /v2/loop/svgRepresentation/{loopName}</a></h3>
+<h3 id="_route21"><a class="anchor" href="#_route21"></a><a class="link" href="#_route21">2.11. GET /v2/loop/svgRepresentation/{loopName}</a></h3>
<div class="sect3">
<h4 id="_parameters_7"><a class="anchor" href="#_parameters_7"></a><a class="link" href="#_parameters_7">2.11.1. Parameters</a></h4>
<table class="tableblock frame-all grid-all stretch">
@@ -1166,7 +1171,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</div>
</div>
<div class="sect2">
-<h3 id="_route9"><a class="anchor" href="#_route9"></a><a class="link" href="#_route9">2.12. PUT /v2/loop/undeploy/{loopName}</a></h3>
+<h3 id="_route26"><a class="anchor" href="#_route26"></a><a class="link" href="#_route26">2.12. PUT /v2/loop/undeploy/{loopName}</a></h3>
<div class="sect3">
<h4 id="_parameters_8"><a class="anchor" href="#_parameters_8"></a><a class="link" href="#_parameters_8">2.12.1. Parameters</a></h4>
<table class="tableblock frame-all grid-all stretch">
@@ -1228,7 +1233,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</div>
</div>
<div class="sect2">
-<h3 id="_route5"><a class="anchor" href="#_route5"></a><a class="link" href="#_route5">2.13. POST /v2/loop/updateGlobalProperties/{loopName}</a></h3>
+<h3 id="_route22"><a class="anchor" href="#_route22"></a><a class="link" href="#_route22">2.13. POST /v2/loop/updateGlobalProperties/{loopName}</a></h3>
<div class="sect3">
<h4 id="_parameters_9"><a class="anchor" href="#_parameters_9"></a><a class="link" href="#_parameters_9">2.13.1. Parameters</a></h4>
<table class="tableblock frame-all grid-all stretch">
@@ -1306,7 +1311,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</div>
</div>
<div class="sect2">
-<h3 id="_route7"><a class="anchor" href="#_route7"></a><a class="link" href="#_route7">2.14. POST /v2/loop/updateMicroservicePolicy/{loopName}</a></h3>
+<h3 id="_route24"><a class="anchor" href="#_route24"></a><a class="link" href="#_route24">2.14. POST /v2/loop/updateMicroservicePolicy/{loopName}</a></h3>
<div class="sect3">
<h4 id="_parameters_10"><a class="anchor" href="#_parameters_10"></a><a class="link" href="#_parameters_10">2.14.1. Parameters</a></h4>
<table class="tableblock frame-all grid-all stretch">
@@ -1384,7 +1389,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</div>
</div>
<div class="sect2">
-<h3 id="_route6"><a class="anchor" href="#_route6"></a><a class="link" href="#_route6">2.15. POST /v2/loop/updateOperationalPolicies/{loopName}</a></h3>
+<h3 id="_route23"><a class="anchor" href="#_route23"></a><a class="link" href="#_route23">2.15. POST /v2/loop/updateOperationalPolicies/{loopName}</a></h3>
<div class="sect3">
<h4 id="_parameters_11"><a class="anchor" href="#_parameters_11"></a><a class="link" href="#_parameters_11">2.15.1. Parameters</a></h4>
<table class="tableblock frame-all grid-all stretch">
@@ -1462,7 +1467,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</div>
</div>
<div class="sect2">
-<h3 id="_route3"><a class="anchor" href="#_route3"></a><a class="link" href="#_route3">2.16. GET /v2/loop/{loopName}</a></h3>
+<h3 id="_route20"><a class="anchor" href="#_route20"></a><a class="link" href="#_route20">2.16. GET /v2/loop/{loopName}</a></h3>
<div class="sect3">
<h4 id="_parameters_12"><a class="anchor" href="#_parameters_12"></a><a class="link" href="#_parameters_12">2.16.1. Parameters</a></h4>
<table class="tableblock frame-all grid-all stretch">
@@ -2184,6 +2189,16 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
<td class="tableblock halign-left valign-middle"><p class="tableblock">&lt; string, <a href="#_externalcomponent">ExternalComponent</a> &gt; map</p></td>
</tr>
<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>createdBy</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>createdDate</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock">integer (int64)</p></td>
+</tr>
+<tr>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>dcaeBlueprintId</strong><br>
<em>optional</em></p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
@@ -2214,14 +2229,19 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
<td class="tableblock halign-left valign-middle"><p class="tableblock">&lt; <a href="#_looplog">LoopLog</a> &gt; array</p></td>
</tr>
<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>loopTemplate</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><a href="#_looptemplate">LoopTemplate</a></p></td>
+</tr>
+<tr>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>microServicePolicies</strong><br>
<em>optional</em></p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">&lt; <a href="#_microservicepolicy">MicroServicePolicy</a> &gt; array</p></td>
</tr>
<tr>
-<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>modelPropertiesJson</strong><br>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>modelService</strong><br>
<em>optional</em></p></td>
-<td class="tableblock halign-left valign-middle"><p class="tableblock"><a href="#_jsonobject">JsonObject</a></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><a href="#_service">Service</a></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>name</strong><br>
@@ -2238,6 +2258,16 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
<em>optional</em></p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
</tr>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>updatedBy</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>updatedDate</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock">integer (int64)</p></td>
+</tr>
</tbody>
</table>
</div>
@@ -2289,7 +2319,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</table>
</div>
<div class="sect2">
-<h3 id="_microservicepolicy"><a class="anchor" href="#_microservicepolicy"></a><a class="link" href="#_microservicepolicy">3.11. MicroServicePolicy</a></h3>
+<h3 id="_looptemplate"><a class="anchor" href="#_looptemplate"></a><a class="link" href="#_looptemplate">3.11. LoopTemplate</a></h3>
<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 42.8571%;">
@@ -2303,11 +2333,165 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</thead>
<tbody>
<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>blueprint</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>createdBy</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>createdDate</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock">integer (int64)</p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>maximumInstancesAllowed</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock">integer (int32)</p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>microServiceModelUsed</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock">&lt; <a href="#_templatemicroservicemodel">TemplateMicroServiceModel</a> &gt; array</p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>modelService</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><a href="#_service">Service</a></p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>name</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>svgRepresentation</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>updatedBy</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>updatedDate</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock">integer (int64)</p></td>
+</tr>
+</tbody>
+</table>
+</div>
+<div class="sect2">
+<h3 id="_microservicemodel"><a class="anchor" href="#_microservicemodel"></a><a class="link" href="#_microservicemodel">3.12. MicroServiceModel</a></h3>
+<table class="tableblock frame-all grid-all stretch">
+<colgroup>
+<col style="width: 42.8571%;">
+<col style="width: 57.1429%;">
+</colgroup>
+<thead>
+<tr>
+<th class="tableblock halign-left valign-middle">Name</th>
+<th class="tableblock halign-left valign-middle">Schema</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>blueprint</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>createdBy</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>createdDate</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock">integer (int64)</p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>name</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>policyModel</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><a href="#_policymodel">PolicyModel</a></p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>policyType</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>updatedBy</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>updatedDate</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock">integer (int64)</p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>usedByLoopTemplates</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock">&lt; <a href="#_templatemicroservicemodel">TemplateMicroServiceModel</a> &gt; array</p></td>
+</tr>
+</tbody>
+</table>
+</div>
+<div class="sect2">
+<h3 id="_microservicepolicy"><a class="anchor" href="#_microservicepolicy"></a><a class="link" href="#_microservicepolicy">3.13. MicroServicePolicy</a></h3>
+<table class="tableblock frame-all grid-all stretch">
+<colgroup>
+<col style="width: 42.8571%;">
+<col style="width: 57.1429%;">
+</colgroup>
+<thead>
+<tr>
+<th class="tableblock halign-left valign-middle">Name</th>
+<th class="tableblock halign-left valign-middle">Schema</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>context</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>createdBy</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>createdDate</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock">integer (int64)</p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>deviceTypeScope</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
+</tr>
+<tr>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>jsonRepresentation</strong><br>
<em>optional</em></p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><a href="#_jsonobject">JsonObject</a></p></td>
</tr>
<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>microServiceModel</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><a href="#_microservicemodel">MicroServiceModel</a></p></td>
+</tr>
+<tr>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>modelType</strong><br>
<em>optional</em></p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
@@ -2333,6 +2517,16 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
<td class="tableblock halign-left valign-middle"><p class="tableblock">boolean</p></td>
</tr>
<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>updatedBy</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>updatedDate</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock">integer (int64)</p></td>
+</tr>
+<tr>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>usedByLoops</strong><br>
<em>optional</em></p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">&lt; <a href="#_loop">Loop</a> &gt; array</p></td>
@@ -2341,13 +2535,13 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</table>
</div>
<div class="sect2">
-<h3 id="_number"><a class="anchor" href="#_number"></a><a class="link" href="#_number">3.12. Number</a></h3>
+<h3 id="_number"><a class="anchor" href="#_number"></a><a class="link" href="#_number">3.14. Number</a></h3>
<div class="paragraph">
<p><em>Type</em> : object</p>
</div>
</div>
<div class="sect2">
-<h3 id="_operationalpolicy"><a class="anchor" href="#_operationalpolicy"></a><a class="link" href="#_operationalpolicy">3.13. OperationalPolicy</a></h3>
+<h3 id="_operationalpolicy"><a class="anchor" href="#_operationalpolicy"></a><a class="link" href="#_operationalpolicy">3.15. OperationalPolicy</a></h3>
<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 42.8571%;">
@@ -2380,6 +2574,137 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
<em>optional</em></p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
</tr>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>policyModel</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><a href="#_policymodel">PolicyModel</a></p></td>
+</tr>
+</tbody>
+</table>
+</div>
+<div class="sect2">
+<h3 id="_policymodel"><a class="anchor" href="#_policymodel"></a><a class="link" href="#_policymodel">3.16. PolicyModel</a></h3>
+<table class="tableblock frame-all grid-all stretch">
+<colgroup>
+<col style="width: 42.8571%;">
+<col style="width: 57.1429%;">
+</colgroup>
+<thead>
+<tr>
+<th class="tableblock halign-left valign-middle">Name</th>
+<th class="tableblock halign-left valign-middle">Schema</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>createdBy</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>createdDate</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock">integer (int64)</p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>policyAcronym</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>policyModelTosca</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>policyModelType</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>policyVariant</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>updatedBy</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>updatedDate</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock">integer (int64)</p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>version</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
+</tr>
+</tbody>
+</table>
+</div>
+<div class="sect2">
+<h3 id="_service"><a class="anchor" href="#_service"></a><a class="link" href="#_service">3.17. Service</a></h3>
+<table class="tableblock frame-all grid-all stretch">
+<colgroup>
+<col style="width: 42.8571%;">
+<col style="width: 57.1429%;">
+</colgroup>
+<thead>
+<tr>
+<th class="tableblock halign-left valign-middle">Name</th>
+<th class="tableblock halign-left valign-middle">Schema</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>resourceDetails</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><a href="#_jsonobject">JsonObject</a></p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>serviceDetails</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><a href="#_jsonobject">JsonObject</a></p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>serviceUuid</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
+</tr>
+</tbody>
+</table>
+</div>
+<div class="sect2">
+<h3 id="_templatemicroservicemodel"><a class="anchor" href="#_templatemicroservicemodel"></a><a class="link" href="#_templatemicroservicemodel">3.18. TemplateMicroServiceModel</a></h3>
+<table class="tableblock frame-all grid-all stretch">
+<colgroup>
+<col style="width: 42.8571%;">
+<col style="width: 57.1429%;">
+</colgroup>
+<thead>
+<tr>
+<th class="tableblock halign-left valign-middle">Name</th>
+<th class="tableblock halign-left valign-middle">Schema</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>flowOrder</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock">integer (int32)</p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>loopTemplate</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><a href="#_looptemplate">LoopTemplate</a></p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>microServiceModel</strong><br>
+<em>optional</em></p></td>
+<td class="tableblock halign-left valign-middle"><p class="tableblock"><a href="#_microservicemodel">MicroServiceModel</a></p></td>
+</tr>
</tbody>
</table>
</div>
@@ -2388,7 +2713,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</div>
<div id="footer">
<div id="footer-text">
-Last updated 2019-05-27 14:30:20 CEST
+Last updated 2019-10-29 10:41:43 CET
</div>
</div>
</body>