diff options
author | Stone, Avi (as206k) <as206k@att.com> | 2018-04-12 15:12:44 +0300 |
---|---|---|
committer | Stone, Avi (as206k) <as206k@att.com> | 2018-04-12 15:16:30 +0300 |
commit | 438bdef0d2473a4db83aac3d71d4596b223879d7 (patch) | |
tree | c6cd021d4b64d83c435ae07143ee4aa1ae0cfd6b /src/main | |
parent | a5e73f1e0597834ba46754aaae4683f7acf06e47 (diff) |
DCAE-D property initial commit
DCAE-D property initial commit
Change-Id: I5ba79eddaa1732524e30652b679e4dd5dfed56b5
Issue-ID: SDC-1218
Signed-off-by: Stone, Avi (as206k) <as206k@att.com>
Diffstat (limited to 'src/main')
88 files changed, 4965 insertions, 0 deletions
diff --git a/src/main/java/org/onap/sdc/common/onaplog/Enums/LogLevel.java b/src/main/java/org/onap/sdc/common/onaplog/Enums/LogLevel.java new file mode 100644 index 0000000..3e6df9d --- /dev/null +++ b/src/main/java/org/onap/sdc/common/onaplog/Enums/LogLevel.java @@ -0,0 +1,10 @@ +package org.onap.sdc.common.onaplog.Enums; + +public enum LogLevel { + INFO, + WARN, + DEBUG, + ERROR, + FATAL +} + diff --git a/src/main/java/org/onap/sdc/common/onaplog/Enums/LogMarkers.java b/src/main/java/org/onap/sdc/common/onaplog/Enums/LogMarkers.java new file mode 100644 index 0000000..f9f2f84 --- /dev/null +++ b/src/main/java/org/onap/sdc/common/onaplog/Enums/LogMarkers.java @@ -0,0 +1,19 @@ +package org.onap.sdc.common.onaplog.Enums; + +public enum LogMarkers { + DEBUG_MARKER("DEBUG_MARKER"), + ERROR_MARKER("ERROR_MARKER"), + AUDIT_MARKER("AUDIT_MARKER"), + METRIC_MARKER("METRICS"); + + private String text; + + LogMarkers (String text){ + this.text = text; + } + + public String text(){ + return text; + } + +} diff --git a/src/main/java/org/onap/sdc/common/onaplog/Enums/OnapLoggerErrorCode.java b/src/main/java/org/onap/sdc/common/onaplog/Enums/OnapLoggerErrorCode.java new file mode 100644 index 0000000..b1984c4 --- /dev/null +++ b/src/main/java/org/onap/sdc/common/onaplog/Enums/OnapLoggerErrorCode.java @@ -0,0 +1,21 @@ +package org.onap.sdc.common.onaplog.Enums; + +public enum OnapLoggerErrorCode { + SUCCESS(0), + PERMISSION_ERROR(100), + AVAILABILITY_TIMEOUTS_ERROR(200), + DATA_ERROR(300), + SCHEMA_ERROR(400), + BUSINESS_PROCESS_ERROR(500), + UNKNOWN_ERROR(900); + + int errorCode; + + OnapLoggerErrorCode(int errorCode) { + this.errorCode = errorCode; + } + + public int getErrorCode() { + return errorCode; + } +} diff --git a/src/main/java/org/onap/sdc/common/onaplog/Enums/Severity.java b/src/main/java/org/onap/sdc/common/onaplog/Enums/Severity.java new file mode 100644 index 0000000..219cddc --- /dev/null +++ b/src/main/java/org/onap/sdc/common/onaplog/Enums/Severity.java @@ -0,0 +1,20 @@ +package org.onap.sdc.common.onaplog.Enums; + +public enum Severity { + OK(0), + WARNING(1), + CRITICAL(2), + DOWN(3), + UNREACHABLE(4); + + int severityType; + + Severity(int serveryType) { + this.severityType = serveryType; + } + + public int getSeverityType() { + return severityType; + } +} + diff --git a/src/main/java/org/onap/sdc/common/onaplog/Enums/StatusCode.java b/src/main/java/org/onap/sdc/common/onaplog/Enums/StatusCode.java new file mode 100644 index 0000000..da645a9 --- /dev/null +++ b/src/main/java/org/onap/sdc/common/onaplog/Enums/StatusCode.java @@ -0,0 +1,14 @@ +package org.onap.sdc.common.onaplog.Enums; + +public enum StatusCode { + ERROR("ERROR"), + COMPLETE("COMPLETE"); + + String statusCode; + + StatusCode(String statusCode){this.statusCode = statusCode;} + + public String getStatusCodeEnum(){ + return statusCode; + } +} diff --git a/src/main/java/org/onap/sdc/common/onaplog/OnapLoggerAudit.java b/src/main/java/org/onap/sdc/common/onaplog/OnapLoggerAudit.java new file mode 100644 index 0000000..f6e2c98 --- /dev/null +++ b/src/main/java/org/onap/sdc/common/onaplog/OnapLoggerAudit.java @@ -0,0 +1,164 @@ +package org.onap.sdc.common.onaplog; + +import org.onap.sdc.common.onaplog.Enums.LogMarkers; +import org.onap.sdc.common.onaplog.Enums.OnapLoggerErrorCode; +import org.onap.sdc.common.onaplog.Enums.Severity; +import org.onap.sdc.common.onaplog.Enums.StatusCode; +import org.onap.sdc.common.onaplog.interfaces.IOnapLogConfiguration; +import org.onap.sdc.common.onaplog.interfaces.IOnapMdcWrapper; +import org.slf4j.LoggerFactory; +import org.slf4j.MDC; +import org.slf4j.MarkerFactory; + +public class OnapLoggerAudit extends OnapLoggerBase { + private static OnapLoggerAudit instanceLoggerAudit = OnapLoggerFactory.getLogger(OnapLoggerAudit.class); + + OnapLoggerAudit(IOnapMdcWrapper onapMDCWrapper) { + super (onapMDCWrapper, MarkerFactory.getMarker(LogMarkers.AUDIT_MARKER.text())); + logger = LoggerFactory.getLogger(this.getClass().getName()); + } + + public static OnapLoggerAudit getInstance() { + return instanceLoggerAudit; + } + + @Override + public OnapLoggerAudit startTimer() { + return (OnapLoggerAudit) super.startTimer(); + } + + public OnapLoggerAudit stopTimer() { + onapMDCWrapper.stopTimer(); + return this; + } + + // automatic parameter this is optional + public OnapLoggerAudit setAutoServerFQDN(String serverFQDN) { + onapMDCWrapper.setAutoServerFQDN(serverFQDN); + return this; + } + + // automatic parameter this is optional + public OnapLoggerAudit setAutoServerIPAddress(String serverIPAddress) { + onapMDCWrapper.setAutoServerIPAddress(serverIPAddress); + return this; + } + + public OnapLoggerAudit setInstanceUUID(String instanceUUID) { + onapMDCWrapper.setInstanceUUID(instanceUUID); + return this; + } + + public OnapLoggerAudit setOptClassName(String className) { + MDC.put("ClassName", className); + return this; + } + + public OnapLoggerAudit setOptProcessKey(String processKey) { + onapMDCWrapper.setProcessKey(processKey); + return this; + } + + public OnapLoggerAudit setOptAlertSeverity(Severity alertSeverity) { + onapMDCWrapper.setAlertSeverity(alertSeverity); + return this; + } + + // onap optional parameter + public OnapLoggerAudit setOptCustomField1(String customField1) { + onapMDCWrapper.setOptCustomField1(customField1); + return this; + } + + // onap optional parameter + public OnapLoggerAudit setOptCustomField2(String customField2) { + onapMDCWrapper.setOptCustomField2(customField2); + return this; + } + + // onap optional parameter + public OnapLoggerAudit setOptCustomField3(String customField3) { + onapMDCWrapper.setOptCustomField3(customField3); + return this; + } + + public OnapLoggerAudit setOptCustomField4(String customField4) { + onapMDCWrapper.setOptCustomField4(customField4); + return this; + } + + @Override + public OnapLoggerAudit setKeyRequestId(String keyRequestId) { + return (OnapLoggerAudit) super.setKeyRequestId(keyRequestId); + } + + public OnapLoggerAudit setRemoteHost(String remoteHost) { + onapMDCWrapper.setRemoteHost(remoteHost); + return this; + } + + public OnapLoggerAudit setServiceName(String serviceName) { + onapMDCWrapper.setServiceName(serviceName); + return this; + } + + public OnapLoggerAudit setStatusCode(String statusCode) { + // status code is either success (COMPLETE) or failure (ERROR) of the request. + String respStatus = Integer.parseInt(statusCode) / 100 == 2 ? StatusCode.COMPLETE.getStatusCodeEnum() : StatusCode.ERROR.getStatusCodeEnum(); + onapMDCWrapper.setStatusCode(respStatus); + return this; + } + + public OnapLoggerAudit setPartnerName(String partnerName) { + onapMDCWrapper.setPartnerName(partnerName); + return this; + } + + public OnapLoggerAudit setResponseCode(OnapLoggerErrorCode responseCode) { + onapMDCWrapper.setResponseCode(responseCode.getErrorCode()); + return this; + } + + public OnapLoggerAudit setResponseDesc(String responseDesc) { + onapMDCWrapper.setResponseDesc(responseDesc); + return this; + } + + public OnapLoggerAudit setOptServiceInstanceId(String serviceInstanceId) { + onapMDCWrapper.setServiceInstanceId(serviceInstanceId); + return this; + } + + @Override + public OnapLoggerAudit clear() { + return (OnapLoggerAudit) super.clear(); + } + + @Override + public void initializeMandatoryFields() { + + onapMDCWrapper.setMandatoryField(IOnapLogConfiguration.MDC_BEGIN_TIMESTAMP); + onapMDCWrapper.setMandatoryField(IOnapLogConfiguration.MDC_END_TIMESTAMP); + onapMDCWrapper.setMandatoryField(IOnapLogConfiguration.MDC_KEY_REQUEST_ID); + onapMDCWrapper.setMandatoryField(IOnapLogConfiguration.MDC_SERVICE_NAME); + onapMDCWrapper.setMandatoryField(IOnapLogConfiguration.MDC_PARTNER_NAME); + onapMDCWrapper.setMandatoryField(IOnapLogConfiguration.MDC_STATUS_CODE); + onapMDCWrapper.setMandatoryField(IOnapLogConfiguration.MDC_RESPONSE_CODE); + onapMDCWrapper.setMandatoryField(IOnapLogConfiguration.MDC_RESPONSE_DESC); + onapMDCWrapper.setMandatoryField(IOnapLogConfiguration.MDC_ELAPSED_TIME); + + //Theoretically Optional, but practically Mandatory + onapMDCWrapper.setMandatoryField(IOnapLogConfiguration.MDC_SERVER_IP_ADDRESS); + onapMDCWrapper.setMandatoryField(IOnapLogConfiguration.MDC_SERVER_FQDN); + + onapMDCWrapper.setOptionalField(IOnapLogConfiguration.MDC_INSTANCE_UUID); + onapMDCWrapper.setOptionalField(IOnapLogConfiguration.MDC_ALERT_SEVERITY); + onapMDCWrapper.setOptionalField(IOnapLogConfiguration.MDC_REMOTE_HOST); + onapMDCWrapper.setOptionalField(IOnapLogConfiguration.MDC_CLASS_NAME); + onapMDCWrapper.setOptionalField(IOnapLogConfiguration.MDC_PROCESS_KEY); + onapMDCWrapper.setOptionalField(IOnapLogConfiguration.MDC_OPT_FIELD1); + onapMDCWrapper.setOptionalField(IOnapLogConfiguration.MDC_OPT_FIELD2); + onapMDCWrapper.setOptionalField(IOnapLogConfiguration.MDC_OPT_FIELD3); + onapMDCWrapper.setOptionalField(IOnapLogConfiguration.MDC_OPT_FIELD4); + } +} diff --git a/src/main/java/org/onap/sdc/common/onaplog/OnapLoggerBase.java b/src/main/java/org/onap/sdc/common/onaplog/OnapLoggerBase.java new file mode 100644 index 0000000..70d5973 --- /dev/null +++ b/src/main/java/org/onap/sdc/common/onaplog/OnapLoggerBase.java @@ -0,0 +1,78 @@ +package org.onap.sdc.common.onaplog; + +import org.onap.sdc.common.onaplog.Enums.LogLevel; +import org.onap.sdc.common.onaplog.interfaces.IOnapLogConfiguration; +import org.onap.sdc.common.onaplog.interfaces.IOnapLogger; +import org.onap.sdc.common.onaplog.interfaces.IOnapMdcWrapper; +import org.slf4j.Logger; +import org.slf4j.MDC; +import org.slf4j.Marker; + + +/** + * Created by mm288v on 12/27/2017. + * This class holds the common behavior of all Loger-Typed classes. + * The Concrete loggers should derive from this one. + */ + +public abstract class OnapLoggerBase implements IOnapLogger { + + protected static Logger logger = null; + private Marker myMarker; + protected IOnapMdcWrapper onapMDCWrapper; + + OnapLoggerBase(IOnapMdcWrapper onapMDCWrapper, Marker marker) { + this.onapMDCWrapper = onapMDCWrapper; + initializeMandatoryFields(); + this.myMarker = marker; + } + + @Override + public void log(LogLevel errorLevel, String className, String message, Object... args) { + MDC.put("ClassName", className); + if (this instanceof OnapLoggerAudit || this instanceof OnapLoggerMetric) { + MDC.put(IOnapLogConfiguration.MDC_SERVER_IP_ADDRESS, OnapMDCWrapper.getInstance().getHostAddress()); + MDC.put(IOnapLogConfiguration.MDC_SERVER_FQDN, OnapMDCWrapper.getInstance().getFqdn()); + } + + onapMDCWrapper.validateMandatoryFields(); + + if (errorLevel.equals(LogLevel.ERROR)) { + logger.error(myMarker, message, args); + return; + } + + if (errorLevel.equals(LogLevel.WARN)) { + logger.warn(myMarker, message, args); + return; + } + + if (errorLevel.equals(LogLevel.INFO)) { + logger.info(myMarker, message, args); + return; + } + + if (errorLevel.equals(LogLevel.DEBUG)) { + logger.info(myMarker, message, args); + } + } + + @Override + public IOnapLogger clear() { + onapMDCWrapper.clear(); + return this; + } + + @Override + public IOnapLogger startTimer() { + onapMDCWrapper.startTimer(); + return this; + } + + @Override + public IOnapLogger setKeyRequestId(String keyRequestId) { + onapMDCWrapper.setKeyRequestId(keyRequestId); + return this; + } + +} diff --git a/src/main/java/org/onap/sdc/common/onaplog/OnapLoggerDebug.java b/src/main/java/org/onap/sdc/common/onaplog/OnapLoggerDebug.java new file mode 100644 index 0000000..1897aca --- /dev/null +++ b/src/main/java/org/onap/sdc/common/onaplog/OnapLoggerDebug.java @@ -0,0 +1,47 @@ +package org.onap.sdc.common.onaplog; + +import org.onap.sdc.common.onaplog.Enums.LogLevel; +import org.onap.sdc.common.onaplog.Enums.LogMarkers; +import org.onap.sdc.common.onaplog.interfaces.IOnapMdcWrapper; +import org.slf4j.LoggerFactory; +import org.slf4j.MarkerFactory; + +public class OnapLoggerDebug extends OnapLoggerBase { + + private static OnapLoggerDebug instanceLoggerDebug = OnapLoggerFactory.getLogger(OnapLoggerDebug.class); + + OnapLoggerDebug(IOnapMdcWrapper onapMdcWrapper) { + super(onapMdcWrapper, MarkerFactory.getMarker(LogMarkers.DEBUG_MARKER.text())); + logger = LoggerFactory.getLogger(this.getClass().getName()); + } + + public static OnapLoggerDebug getInstance() { + return instanceLoggerDebug; + } + + @Override + public void log(LogLevel errorLevel, String className, String message, Object... args) { + String endOfRecordDelimiter = "|^\\n"; + super.log(errorLevel, className, message + endOfRecordDelimiter, args); + } + + @Override + public void initializeMandatoryFields() { + // nothing to do here + } + + @Override + public OnapLoggerDebug clear() { + return (OnapLoggerDebug) super.clear(); + } + + @Override + public OnapLoggerDebug startTimer() { + return (OnapLoggerDebug) super.startTimer(); + } + + @Override + public OnapLoggerDebug setKeyRequestId(String keyRequestId) { + return (OnapLoggerDebug) super.setKeyRequestId(keyRequestId); + } +} diff --git a/src/main/java/org/onap/sdc/common/onaplog/OnapLoggerError.java b/src/main/java/org/onap/sdc/common/onaplog/OnapLoggerError.java new file mode 100644 index 0000000..2f7ac14 --- /dev/null +++ b/src/main/java/org/onap/sdc/common/onaplog/OnapLoggerError.java @@ -0,0 +1,83 @@ +package org.onap.sdc.common.onaplog; + +import org.onap.sdc.common.onaplog.Enums.LogLevel; +import org.onap.sdc.common.onaplog.Enums.LogMarkers; +import org.onap.sdc.common.onaplog.Enums.OnapLoggerErrorCode; +import org.onap.sdc.common.onaplog.interfaces.IOnapMdcWrapper; +import org.slf4j.LoggerFactory; +import org.slf4j.MarkerFactory; + +import static org.onap.sdc.common.onaplog.interfaces.IOnapLogConfiguration.*; + +import org.apache.log4j.MDC; + +public class OnapLoggerError extends OnapLoggerBase { + private static OnapLoggerError instanceLoggerError = OnapLoggerFactory.getLogger(OnapLoggerError.class); + + OnapLoggerError(IOnapMdcWrapper onapMDCWrapper) { + super(onapMDCWrapper, MarkerFactory.getMarker(LogMarkers.ERROR_MARKER.text())); + logger = LoggerFactory.getLogger(this.getClass().getName()); + } + + public static OnapLoggerError getInstance() { + return instanceLoggerError; + } + + @Override + public void initializeMandatoryFields() { + onapMDCWrapper.setMandatoryField(MDC_BEGIN_TIMESTAMP); + onapMDCWrapper.setMandatoryField(MDC_SERVICE_NAME); + onapMDCWrapper.setMandatoryField(MDC_ERROR_CATEGORY); + onapMDCWrapper.setMandatoryField(MDC_ERROR_CODE); + onapMDCWrapper.setMandatoryField(MDC_ERROR_DESC); + onapMDCWrapper.setOptionalField(MDC_TARGET_ENTITY); + onapMDCWrapper.setOptionalField(MDC_TARGET_SERVICE_NAME); + } + + @Override + public void log(LogLevel errorLevel, String className, String message, Object... args) { + MDC.put(MDC_ERROR_CATEGORY, "ERROR"); + this + .startTimer() + .setServiceName("DCAE") + .setErrorCode(OnapLoggerErrorCode.UNKNOWN_ERROR) + .setErrorDescription(); + super.log(errorLevel, className, message, args); + } + + @Override + public OnapLoggerError startTimer() { + return (OnapLoggerError) super.startTimer(); + } + + @Override + public OnapLoggerError setKeyRequestId(String keyRequestId) { + return (OnapLoggerError) super.setKeyRequestId(keyRequestId); + } + + public OnapLoggerError setServiceName(String serviceName) { + onapMDCWrapper.setServiceName(serviceName); + return this; + } + + public OnapLoggerError setTargetEntity(String targetEntity) { + onapMDCWrapper.setTargetEntity(targetEntity); + return this; + } + + private OnapLoggerError setErrorCode(OnapLoggerErrorCode errorCode) { + onapMDCWrapper.setErrorCode(errorCode.getErrorCode()); + return this; + } + + private OnapLoggerError setErrorDescription() { + onapMDCWrapper.setErrorDescription("error"); + return this; + } + + @Override + public OnapLoggerError clear() { + return (OnapLoggerError) super.clear(); + } + +} diff --git a/src/main/java/org/onap/sdc/common/onaplog/OnapLoggerFactory.java b/src/main/java/org/onap/sdc/common/onaplog/OnapLoggerFactory.java new file mode 100644 index 0000000..6c5d879 --- /dev/null +++ b/src/main/java/org/onap/sdc/common/onaplog/OnapLoggerFactory.java @@ -0,0 +1,34 @@ +package org.onap.sdc.common.onaplog; + +/** + * Created by dd4296 on 12/26/2017. + * this factory helps decouple the classes for Stopwatch and OnapMDCWrapper from + * the EcompLogger classes + */ +public class OnapLoggerFactory { + + private OnapLoggerFactory() { + } + + @SuppressWarnings("unchecked") + public static <T, V> V getLogger(Class<T> type) { + + if (type.equals(OnapLoggerAudit.class)) { + return (V) new OnapLoggerAudit(new OnapMDCWrapper(new Stopwatch())); + } + + if (type.equals(OnapLoggerDebug.class)) { + return (V) new OnapLoggerDebug(new OnapMDCWrapper(new Stopwatch())); + } + + if (type.equals(OnapLoggerMetric.class)) { + return (V) new OnapLoggerMetric(new OnapMDCWrapper(new Stopwatch())); + } + + if (type.equals(OnapLoggerError.class)) { + return (V) new OnapLoggerError(new OnapMDCWrapper(new Stopwatch())); + } + + return null; + } +} diff --git a/src/main/java/org/onap/sdc/common/onaplog/OnapLoggerMetric.java b/src/main/java/org/onap/sdc/common/onaplog/OnapLoggerMetric.java new file mode 100644 index 0000000..9c77bf3 --- /dev/null +++ b/src/main/java/org/onap/sdc/common/onaplog/OnapLoggerMetric.java @@ -0,0 +1,185 @@ +package org.onap.sdc.common.onaplog; + +import org.onap.sdc.common.onaplog.Enums.LogMarkers; +import org.onap.sdc.common.onaplog.Enums.Severity; +import org.onap.sdc.common.onaplog.interfaces.IOnapLogConfiguration; +import org.onap.sdc.common.onaplog.interfaces.IOnapMdcWrapper; +import org.slf4j.LoggerFactory; +import org.slf4j.MarkerFactory; + + +public class OnapLoggerMetric extends OnapLoggerBase { + private static OnapLoggerMetric instanceLoggerMetric = OnapLoggerFactory.getLogger(OnapLoggerMetric.class); + + OnapLoggerMetric(IOnapMdcWrapper onapMDCWrapper) { + super(onapMDCWrapper, MarkerFactory.getMarker(LogMarkers.METRIC_MARKER.text())); + logger = LoggerFactory.getLogger(this.getClass().getName()); + } + + public static OnapLoggerMetric getInstance() { + return instanceLoggerMetric; + } + + @Override + public OnapLoggerMetric startTimer() { + return (OnapLoggerMetric) super.startTimer(); + } + + @Override + public OnapLoggerMetric setKeyRequestId(String keyRequestId) { + return (OnapLoggerMetric) super.setKeyRequestId(keyRequestId); + } + + public OnapLoggerMetric stopTimer() { + onapMDCWrapper.stopTimer(); + return this; + } + + // automatic parameter this is optional + public OnapLoggerMetric setAutoServerFQDN(String serverFQDN) { + onapMDCWrapper.setAutoServerFQDN(serverFQDN); + return this; + } + + // automatic parameter this is optional + public OnapLoggerMetric setAutoServerIPAddress(String serverIPAddress) { + onapMDCWrapper.setAutoServerIPAddress(serverIPAddress); + return this; + } + + public OnapLoggerMetric setInstanceUUID(String instanceUUID) { + onapMDCWrapper.setInstanceUUID(instanceUUID); + return this; + } + + // onap optional parameter + public OnapLoggerMetric setOptProcessKey(String processKey) { + onapMDCWrapper.setProcessKey(processKey); + return this; + } + + // onap optional parameter + public OnapLoggerMetric setOptAlertSeverity(Severity alertSeverity) { + onapMDCWrapper.setAlertSeverity(alertSeverity); + return this; + } + + // onap optional parameter + public OnapLoggerMetric setOptCustomField1(String customField1) { + onapMDCWrapper.setOptCustomField1(customField1); + return this; + } + + // onap optional parameter + public OnapLoggerMetric setOptCustomField2(String customField2) { + onapMDCWrapper.setOptCustomField2(customField2); + return this; + } + + // onap optional parameter + public OnapLoggerMetric setOptCustomField3(String customField3) { + onapMDCWrapper.setOptCustomField3(customField3); + return this; + } + + // onap optional parameter + public OnapLoggerMetric setOptCustomField4(String customField4) { + onapMDCWrapper.setOptCustomField4(customField4); + return this; + } + + public OnapLoggerMetric setRemoteHost(String remoteHost) { + onapMDCWrapper.setRemoteHost(remoteHost); + return this; + } + + public OnapLoggerMetric setServiceName(String serviceName) { + onapMDCWrapper.setServiceName(serviceName); + return this; + } + + public OnapLoggerMetric setStatusCode(String statusCode) { + onapMDCWrapper.setStatusCode(statusCode); + return this; + } + + public OnapLoggerMetric setPartnerName(String partnerName) { + onapMDCWrapper.setPartnerName(partnerName); + return this; + } + + public OnapLoggerMetric setResponseCode(int responseCode) { + onapMDCWrapper.setResponseCode(responseCode); + return this; + } + + public OnapLoggerMetric setResponseDesc(String responseDesc) { + onapMDCWrapper.setResponseDesc(responseDesc); + return this; + } + + public OnapLoggerMetric setOptServiceInstanceId(String serviceInstanceId) { + onapMDCWrapper.setServiceInstanceId(serviceInstanceId); + return this; + } + + public OnapLoggerMetric setOptClassName(String className) { + onapMDCWrapper.setClassName(className); + return this; + } + + public OnapLoggerMetric setTargetEntity(String targetEntity) { + onapMDCWrapper.setTargetEntity(targetEntity); + return this; + } + + public OnapLoggerMetric setTargetServiceName(String targetServiceName) { + onapMDCWrapper.setTargetServiceName(targetServiceName); + return this; + } + + public OnapLoggerMetric setTargetVirtualEntity(String targetVirtualEntity) { + onapMDCWrapper.setTargetVirtualEntity(targetVirtualEntity); + return this; + } + + @Override + public OnapLoggerMetric clear () { + return (OnapLoggerMetric) super.clear(); + } + + + @Override + public void initializeMandatoryFields() { + + onapMDCWrapper.setMandatoryField(IOnapLogConfiguration.MDC_BEGIN_TIMESTAMP); + onapMDCWrapper.setMandatoryField(IOnapLogConfiguration.MDC_END_TIMESTAMP); + onapMDCWrapper.setMandatoryField(IOnapLogConfiguration.MDC_KEY_REQUEST_ID); + onapMDCWrapper.setMandatoryField(IOnapLogConfiguration.MDC_SERVICE_NAME); + onapMDCWrapper.setMandatoryField(IOnapLogConfiguration.MDC_PARTNER_NAME); + onapMDCWrapper.setMandatoryField(IOnapLogConfiguration.MDC_STATUS_CODE); + onapMDCWrapper.setMandatoryField(IOnapLogConfiguration.MDC_RESPONSE_CODE); + onapMDCWrapper.setMandatoryField(IOnapLogConfiguration.MDC_SERVICE_INSTANCE_ID); + onapMDCWrapper.setMandatoryField(IOnapLogConfiguration.MDC_RESPONSE_DESC); + onapMDCWrapper.setMandatoryField(IOnapLogConfiguration.MDC_ELAPSED_TIME); + onapMDCWrapper.setMandatoryField(IOnapLogConfiguration.MDC_TARGET_ENTITY); + onapMDCWrapper.setMandatoryField(IOnapLogConfiguration.MDC_TARGET_SERVICE_NAME); + onapMDCWrapper.setMandatoryField(IOnapLogConfiguration.MDC_TARGET_VIRTUAL_ENTITY); + + //Theoretically Optional, but practically Mandatory + onapMDCWrapper.setMandatoryField(IOnapLogConfiguration.MDC_SERVER_IP_ADDRESS); + onapMDCWrapper.setMandatoryField(IOnapLogConfiguration.MDC_SERVER_FQDN); + + onapMDCWrapper.setOptionalField(IOnapLogConfiguration.MDC_INSTANCE_UUID); + onapMDCWrapper.setOptionalField(IOnapLogConfiguration.MDC_ALERT_SEVERITY); + onapMDCWrapper.setOptionalField(IOnapLogConfiguration.MDC_REMOTE_HOST); + onapMDCWrapper.setOptionalField(IOnapLogConfiguration.MDC_CLASS_NAME); + onapMDCWrapper.setOptionalField(IOnapLogConfiguration.MDC_PROCESS_KEY); + onapMDCWrapper.setOptionalField(IOnapLogConfiguration.MDC_OPT_FIELD1); + onapMDCWrapper.setOptionalField(IOnapLogConfiguration.MDC_OPT_FIELD2); + onapMDCWrapper.setOptionalField(IOnapLogConfiguration.MDC_OPT_FIELD3); + onapMDCWrapper.setOptionalField(IOnapLogConfiguration.MDC_OPT_FIELD4); + + + } +} diff --git a/src/main/java/org/onap/sdc/common/onaplog/OnapMDCWrapper.java b/src/main/java/org/onap/sdc/common/onaplog/OnapMDCWrapper.java new file mode 100644 index 0000000..d992a8b --- /dev/null +++ b/src/main/java/org/onap/sdc/common/onaplog/OnapMDCWrapper.java @@ -0,0 +1,267 @@ +package org.onap.sdc.common.onaplog; + +import org.onap.sdc.common.onaplog.Enums.Severity; +import org.onap.sdc.common.onaplog.interfaces.IOnapLogConfiguration; +import org.onap.sdc.common.onaplog.interfaces.IOnapMdcWrapper; +import org.onap.sdc.common.onaplog.interfaces.IStopWatch; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.MDC; + +import java.net.InetAddress; +import java.util.ArrayList; + +public class OnapMDCWrapper implements IOnapMdcWrapper { + private IStopWatch stopWatch; + private ArrayList<String> mandatoryFields = new ArrayList<>(); + private ArrayList<String> optionalFields = new ArrayList<>(); + private static String hostAddress; + private static String fqdn; + + private static OnapMDCWrapper instanceMdcWrapper = new OnapMDCWrapper(new Stopwatch()); + private static final Logger log = LoggerFactory.getLogger(OnapMDCWrapper.class.getName()); + + + // in package classes can instantiate this class + // to use directly from outside the package usr the getInstance() Method + OnapMDCWrapper(IStopWatch stopwatch) { + this.stopWatch = stopwatch; + } + + + public static OnapMDCWrapper getInstance() { + return instanceMdcWrapper; + } + + static { + try { + hostAddress = InetAddress.getLocalHost().getHostAddress(); + fqdn = InetAddress.getByName(hostAddress).getCanonicalHostName(); + } catch (Exception ex) { + log.error("failed to get machine parameters", ex); + } + } + + @Override + public OnapMDCWrapper startTimer() { + stopWatch.start(); + return this; + } + + @Override + public OnapMDCWrapper stopTimer() { + try { + stopWatch.stop(); + } catch (Exception ex) { + log.error("StopWatch failed; probably start was not called before Stopwatch", ex); + } + return this; + } + + @Override + public OnapMDCWrapper setClassName(String className) { + MDC.put(IOnapLogConfiguration.MDC_CLASS_NAME, className); + return this; + } + + // automatic parameter this is optional + @Override + public OnapMDCWrapper setAutoServerFQDN(String serverFQDN) { + MDC.put(IOnapLogConfiguration.MDC_SERVER_FQDN, serverFQDN); + return this; + } + + // automatic parameter this is optional + @Override + public OnapMDCWrapper setAutoServerIPAddress(String serverIPAddress) { + MDC.put(IOnapLogConfiguration.MDC_SERVER_IP_ADDRESS, serverIPAddress); + return this; + } + + @Override + public OnapMDCWrapper setInstanceUUID(String instanceUUID) { + MDC.put(IOnapLogConfiguration.MDC_INSTANCE_UUID, instanceUUID); + return this; + } + + @Override + public OnapMDCWrapper setProcessKey(String processKey) { + MDC.put(IOnapLogConfiguration.MDC_PROCESS_KEY, processKey); + return this; + } + + @Override + public OnapMDCWrapper setAlertSeverity(Severity alertSeverity) { + MDC.put(IOnapLogConfiguration.MDC_ALERT_SEVERITY, String.valueOf(alertSeverity.getSeverityType())); + return this; + } + + @Override + public OnapMDCWrapper setOptCustomField1(String customField1) { + MDC.put(IOnapLogConfiguration.MDC_OPT_FIELD1, customField1); + return this; + } + + @Override + public OnapMDCWrapper setOptCustomField2(String customField2) { + MDC.put(IOnapLogConfiguration.MDC_OPT_FIELD2, customField2); + return this; + } + + @Override + public OnapMDCWrapper setOptCustomField3(String customField3) { + MDC.put(IOnapLogConfiguration.MDC_OPT_FIELD3, customField3); + return this; + } + + @Override + public OnapMDCWrapper setOptCustomField4(String customField4) { + MDC.put(IOnapLogConfiguration.MDC_OPT_FIELD4, customField4); + return this; + } + + @Override + public OnapMDCWrapper setKeyRequestId(String keyRequestId) { + MDC.put(IOnapLogConfiguration.MDC_KEY_REQUEST_ID, keyRequestId); // eg. servletRequest.getSession().getId() + return this; + } + + @Override + public OnapMDCWrapper setRemoteHost(String remoteHost) { + MDC.put(IOnapLogConfiguration.MDC_REMOTE_HOST, remoteHost); + return this; + } + + @Override + public OnapMDCWrapper setServiceName(String serviceName) { + MDC.put(IOnapLogConfiguration.MDC_SERVICE_NAME, serviceName); + return this; + } + + @Override + public OnapMDCWrapper setStatusCode(String statusCode) { + MDC.put(IOnapLogConfiguration.MDC_STATUS_CODE, statusCode); + return this; + } + + @Override + public OnapMDCWrapper setPartnerName(String partnerName) { + MDC.put(IOnapLogConfiguration.MDC_PARTNER_NAME, partnerName); + return this; + } + + @Override + public OnapMDCWrapper setResponseCode(int responseCode) { + MDC.put(IOnapLogConfiguration.MDC_RESPONSE_CODE, Integer.toString(responseCode)); + return this; + } + + @Override + public OnapMDCWrapper setResponseDesc(String responseDesc) { + MDC.put(IOnapLogConfiguration.MDC_RESPONSE_DESC, responseDesc); + return this; + } + + @Override + public OnapMDCWrapper setServiceInstanceId(String serviceInstanceId) { + MDC.put(IOnapLogConfiguration.MDC_SERVICE_INSTANCE_ID, serviceInstanceId); + return this; + } + + @Override + public OnapMDCWrapper setTargetEntity(String targetEntity) { + MDC.put(IOnapLogConfiguration.MDC_TARGET_ENTITY, targetEntity); + return this; + } + + @Override + public OnapMDCWrapper setTargetServiceName(String targetServiceName) { + MDC.put(IOnapLogConfiguration.MDC_TARGET_SERVICE_NAME, targetServiceName); + return this; + } + + @Override + public OnapMDCWrapper setTargetVirtualEntity(String targetVirtualEntity) { + MDC.put(IOnapLogConfiguration.MDC_TARGET_VIRTUAL_ENTITY, targetVirtualEntity); + return this; + } + + @Override + public OnapMDCWrapper setErrorCode(int errorCode) { + MDC.put(IOnapLogConfiguration.MDC_ERROR_CODE, Integer.toString(errorCode)); + return this; + } + + @Override + public OnapMDCWrapper setErrorDescription(String errorDescription) { + MDC.put(IOnapLogConfiguration.MDC_ERROR_DESC, errorDescription); + return this; + } + + @Override + public void validateMandatoryFields() { + // this method only checks if the mandatory fields have been initialized + String missingFieldNames = checkMandatoryFieldsExistInMDC(); + + if (MDC.getCopyOfContextMap() == null || MDC.getCopyOfContextMap().isEmpty()) { + writeLogMDCEmptyError(); + return; + } + + if (!"".equalsIgnoreCase(missingFieldNames)) { + writeLogMissingFieldsError(missingFieldNames); + } + } + + private void writeLogMissingFieldsError(String filedNameThatHasNotBeenInitialized) { + log.warn("mandatory parameters for EELF logging, missing fields: {}", filedNameThatHasNotBeenInitialized); + } + + private void writeLogMDCEmptyError() { + log.error("write to log when MDC is empty error"); + } + + @Override + public OnapMDCWrapper clear() { + mandatoryFields.forEach(MDC::remove); + optionalFields.forEach(MDC::remove); + return this; + } + + private String checkMandatoryFieldsExistInMDC() { + // this method returns a String of uninitialised fields + StringBuilder missingFields = new StringBuilder(); + mandatoryFields.forEach(field -> { + if (isMDCParamEmpty(field)) { + missingFields.append(field).append(" "); + } + }); + return missingFields.toString(); + } + + @Override + public void setMandatoryField(String parameterName) { + mandatoryFields.add(parameterName); + } + + @Override + public void setOptionalField(String parameterName) { + optionalFields.add(parameterName); + } + + @Override + public boolean isMDCParamEmpty(String mdcKeyName) { + String val = MDC.get(mdcKeyName); + return val == null || val.trim().length() == 0; + } + + @Override + public String getFqdn() { + return fqdn; + } + + @Override + public String getHostAddress() { + return hostAddress; + } +}
\ No newline at end of file diff --git a/src/main/java/org/onap/sdc/common/onaplog/Stopwatch.java b/src/main/java/org/onap/sdc/common/onaplog/Stopwatch.java new file mode 100644 index 0000000..de56853 --- /dev/null +++ b/src/main/java/org/onap/sdc/common/onaplog/Stopwatch.java @@ -0,0 +1,59 @@ +package org.onap.sdc.common.onaplog; + +import org.onap.sdc.common.onaplog.interfaces.IOnapLogConfiguration; +import org.onap.sdc.common.onaplog.interfaces.IStopWatch; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.MDC; + +import java.time.Clock; +import java.time.Duration; +import java.time.LocalDateTime; + +/** + * Created by dd4296 on 12/13/2017. + * this is local implementation of the stopwatch class from EELF standard with the same interface + * can be replaced if needed with EELF lib + */ +public class Stopwatch implements IStopWatch { + + private static final Logger log = LoggerFactory.getLogger(Stopwatch.class.getName()); + + Stopwatch() { + } + + public void start() { + if (MDC.get(IOnapLogConfiguration.MDC_BEGIN_TIMESTAMP) == null || MDC.get(IOnapLogConfiguration.MDC_BEGIN_TIMESTAMP).trim().length() == 0) { + MDC.put(IOnapLogConfiguration.MDC_BEGIN_TIMESTAMP, generatedTimeNow()); + } + } + + public void stop() { + if (MDC.get(IOnapLogConfiguration.MDC_BEGIN_TIMESTAMP) == null) { + log.error("call to stop without calling start first, this is not compliant with EELF format"); + } + MDC.put(IOnapLogConfiguration.MDC_END_TIMESTAMP, generatedTimeNow()); + setElapsedTime(); + } + + private void setElapsedTime() { + + try { + + final LocalDateTime startTime = LocalDateTime.parse(MDC.get(IOnapLogConfiguration.MDC_BEGIN_TIMESTAMP)); + final LocalDateTime endTime = LocalDateTime.parse(MDC.get(IOnapLogConfiguration.MDC_END_TIMESTAMP)); + + final Duration timeDifference = Duration.between(startTime, endTime); + + MDC.put(IOnapLogConfiguration.MDC_ELAPSED_TIME, String.valueOf(timeDifference.toMillis())); + + } catch(Exception ex) { + log.error("failed to calculate elapsed time",ex); + } + } + + private String generatedTimeNow() { + return String.valueOf(LocalDateTime.now(Clock.systemUTC())); + } + +}
\ No newline at end of file diff --git a/src/main/java/org/onap/sdc/common/onaplog/interfaces/IOnapLogConfiguration.java b/src/main/java/org/onap/sdc/common/onaplog/interfaces/IOnapLogConfiguration.java new file mode 100644 index 0000000..55c4b00 --- /dev/null +++ b/src/main/java/org/onap/sdc/common/onaplog/interfaces/IOnapLogConfiguration.java @@ -0,0 +1,31 @@ +package org.onap.sdc.common.onaplog.interfaces; + +public interface IOnapLogConfiguration { + String MDC_KEY_REQUEST_ID = "RequestId"; + String MDC_SERVICE_INSTANCE_ID = "ServiceInstanceId"; + String MDC_SERVICE_NAME = "ServiceName"; + String MDC_INSTANCE_UUID = "InstanceUUID"; + String MDC_SERVER_IP_ADDRESS = "ServerIPAddress"; + String MDC_SERVER_FQDN = "ServerFQDN"; + String MDC_REMOTE_HOST = "RemoteHost"; + String MDC_ALERT_SEVERITY = "AlertSeverity"; + String MDC_BEGIN_TIMESTAMP = "BeginTimestamp"; + String MDC_END_TIMESTAMP = "EndTimestamp"; + String MDC_PARTNER_NAME = "PartnerName"; + String MDC_STATUS_CODE = "StatusCode"; + String MDC_RESPONSE_CODE = "ResponseCode"; + String MDC_RESPONSE_DESC = "ResponseDescription"; + String MDC_ELAPSED_TIME = "ElapsedTime"; + String MDC_PROCESS_KEY = "ProcessKey"; + String MDC_TARGET_ENTITY = "TargetEntity"; + String MDC_TARGET_SERVICE_NAME = "TargetServiceName"; + String MDC_TARGET_VIRTUAL_ENTITY = "TargetVirtualEntity"; + String MDC_ERROR_CATEGORY = "ErrorCategory"; + String MDC_ERROR_CODE = "ErrorCode"; + String MDC_ERROR_DESC = "ErrorDescription"; + String MDC_CLASS_NAME = "ClassName"; + String MDC_OPT_FIELD1 = "CustomField1"; + String MDC_OPT_FIELD2 = "CustomField2"; + String MDC_OPT_FIELD3 = "CustomField3"; + String MDC_OPT_FIELD4 = "CustomField4"; +}
\ No newline at end of file diff --git a/src/main/java/org/onap/sdc/common/onaplog/interfaces/IOnapLogger.java b/src/main/java/org/onap/sdc/common/onaplog/interfaces/IOnapLogger.java new file mode 100644 index 0000000..61e94a4 --- /dev/null +++ b/src/main/java/org/onap/sdc/common/onaplog/interfaces/IOnapLogger.java @@ -0,0 +1,14 @@ +package org.onap.sdc.common.onaplog.interfaces; + +import org.onap.sdc.common.onaplog.Enums.LogLevel; + +/** + * Created by dd4296 on 12/24/2017. + */ +public interface IOnapLogger { + public void log(LogLevel errorLevel, String className, String message, Object... args); + void initializeMandatoryFields(); + IOnapLogger clear(); + IOnapLogger startTimer(); + IOnapLogger setKeyRequestId(String keyRequestId); +} diff --git a/src/main/java/org/onap/sdc/common/onaplog/interfaces/IOnapMdcWrapper.java b/src/main/java/org/onap/sdc/common/onaplog/interfaces/IOnapMdcWrapper.java new file mode 100644 index 0000000..ae94655 --- /dev/null +++ b/src/main/java/org/onap/sdc/common/onaplog/interfaces/IOnapMdcWrapper.java @@ -0,0 +1,75 @@ +package org.onap.sdc.common.onaplog.interfaces; + +import org.onap.sdc.common.onaplog.OnapMDCWrapper; +import org.onap.sdc.common.onaplog.Enums.Severity; + +/** + * Created by dd4296 on 12/25/2017. + */ +public interface IOnapMdcWrapper { + OnapMDCWrapper startTimer(); + + OnapMDCWrapper stopTimer(); + + OnapMDCWrapper setClassName(String className); + + // automatic parameter this is optional + OnapMDCWrapper setAutoServerFQDN(String serverFQDN); + + // automatic parameter this is optional + OnapMDCWrapper setAutoServerIPAddress(String serverIPAddress); + + OnapMDCWrapper setInstanceUUID(String instanceUUID); + + OnapMDCWrapper setProcessKey(String processKey); + + OnapMDCWrapper setAlertSeverity(Severity alertSeverity); + + OnapMDCWrapper setOptCustomField1(String customField1); + + OnapMDCWrapper setOptCustomField2(String customField2); + + OnapMDCWrapper setOptCustomField3(String customField3); + + OnapMDCWrapper setOptCustomField4(String customField4); + + OnapMDCWrapper setKeyRequestId(String keyRequestId); + + OnapMDCWrapper setRemoteHost(String remoteHost); + + OnapMDCWrapper setServiceName(String serviceName); + + OnapMDCWrapper setStatusCode(String statusCode); + + OnapMDCWrapper setPartnerName(String partnerName); + + OnapMDCWrapper setResponseCode(int responseCode); + + OnapMDCWrapper setResponseDesc(String responseDesc); + + OnapMDCWrapper setServiceInstanceId(String serviceInstanceId); + + OnapMDCWrapper setTargetEntity(String targetEntity); + + OnapMDCWrapper setTargetServiceName(String targetServiceName); + + OnapMDCWrapper setTargetVirtualEntity(String targetVirtualEntity); + + OnapMDCWrapper setErrorCode(int errorCode); + + OnapMDCWrapper setErrorDescription(String errorDescription); + + OnapMDCWrapper clear(); + + void validateMandatoryFields(); + + void setMandatoryField(String mdcKeyRequestId); + + void setOptionalField(String mdcKeyRequestId); + + boolean isMDCParamEmpty(String mdcKeyName); + + String getFqdn(); + + String getHostAddress(); +} diff --git a/src/main/java/org/onap/sdc/common/onaplog/interfaces/IStopWatch.java b/src/main/java/org/onap/sdc/common/onaplog/interfaces/IStopWatch.java new file mode 100644 index 0000000..dc1cb81 --- /dev/null +++ b/src/main/java/org/onap/sdc/common/onaplog/interfaces/IStopWatch.java @@ -0,0 +1,6 @@ +package org.onap.sdc.common.onaplog.interfaces; + +public interface IStopWatch { + void start(); + void stop(); +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/model/Assignment.java b/src/main/java/org/onap/sdc/dcae/composition/model/Assignment.java new file mode 100644 index 0000000..de1da01 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/model/Assignment.java @@ -0,0 +1,21 @@ + +package org.onap.sdc.dcae.composition.model; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class Assignment { + + @SerializedName("value") + @Expose + private Value value; + + public Value getValue() { + return value; + } + + public void setValue(Value value) { + this.value = value; + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/model/Capability.java b/src/main/java/org/onap/sdc/dcae/composition/model/Capability.java new file mode 100644 index 0000000..36e147f --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/model/Capability.java @@ -0,0 +1,32 @@ + +package org.onap.sdc.dcae.composition.model; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class Capability { + + @SerializedName("name") + @Expose + private String name; + @SerializedName("id") + @Expose + private String id; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/model/Capability_.java b/src/main/java/org/onap/sdc/dcae/composition/model/Capability_.java new file mode 100644 index 0000000..fcb1136 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/model/Capability_.java @@ -0,0 +1,21 @@ + +package org.onap.sdc.dcae.composition.model; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class Capability_ { + + @SerializedName("dcae.capabilities.stream.subscribe") + @Expose + private DcaeCapabilitiesStreamSubscribe dcaeCapabilitiesStreamSubscribe; + + public DcaeCapabilitiesStreamSubscribe getDcaeCapabilitiesStreamSubscribe() { + return dcaeCapabilitiesStreamSubscribe; + } + + public void setDcaeCapabilitiesStreamSubscribe(DcaeCapabilitiesStreamSubscribe dcaeCapabilitiesStreamSubscribe) { + this.dcaeCapabilitiesStreamSubscribe = dcaeCapabilitiesStreamSubscribe; + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/model/Capability__.java b/src/main/java/org/onap/sdc/dcae/composition/model/Capability__.java new file mode 100644 index 0000000..8ef044a --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/model/Capability__.java @@ -0,0 +1,32 @@ + +package org.onap.sdc.dcae.composition.model; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class Capability__ { + + @SerializedName("name") + @Expose + private String name; + @SerializedName("type") + @Expose + private Type type; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Type getType() { + return type; + } + + public void setType(Type type) { + this.type = type; + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/model/Data.java b/src/main/java/org/onap/sdc/dcae/composition/model/Data.java new file mode 100644 index 0000000..6852b08 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/model/Data.java @@ -0,0 +1,21 @@ + +package org.onap.sdc.dcae.composition.model; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class Data { + + @SerializedName("model") + @Expose + private Model model; + + public Model getModel() { + return model; + } + + public void setModel(Model model) { + this.model = model; + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/model/DcaeCapabilitiesStreamSubscribe.java b/src/main/java/org/onap/sdc/dcae/composition/model/DcaeCapabilitiesStreamSubscribe.java new file mode 100644 index 0000000..233fb1c --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/model/DcaeCapabilitiesStreamSubscribe.java @@ -0,0 +1,22 @@ + +package org.onap.sdc.dcae.composition.model; + +import java.util.List; +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class DcaeCapabilitiesStreamSubscribe { + + @SerializedName("properties") + @Expose + private List<Property> properties = null; + + public List<Property> getProperties() { + return properties; + } + + public void setProperties(List<Property> properties) { + this.properties = properties; + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/model/Error.java b/src/main/java/org/onap/sdc/dcae/composition/model/Error.java new file mode 100644 index 0000000..6802593 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/model/Error.java @@ -0,0 +1,8 @@ + +package org.onap.sdc.dcae.composition.model; + + +public class Error { + + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/model/Format.java b/src/main/java/org/onap/sdc/dcae/composition/model/Format.java new file mode 100644 index 0000000..1a07275 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/model/Format.java @@ -0,0 +1,21 @@ + +package org.onap.sdc.dcae.composition.model; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class Format { + + @SerializedName("equal") + @Expose + private String equal; + + public String getEqual() { + return equal; + } + + public void setEqual(String equal) { + this.equal = equal; + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/model/Model.java b/src/main/java/org/onap/sdc/dcae/composition/model/Model.java new file mode 100644 index 0000000..9c24602 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/model/Model.java @@ -0,0 +1,77 @@ + +package org.onap.sdc.dcae.composition.model; + +import java.util.List; +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class Model { + + @SerializedName("itemId") + @Expose + private String itemId; + @SerializedName("nodes") + @Expose + private List<Node> nodes = null; + @SerializedName("catalogId") + @Expose + private Integer catalogId; + @SerializedName("catalog") + @Expose + private String catalog; + @SerializedName("name") + @Expose + private String name; + @SerializedName("id") + @Expose + private Integer id; + + public String getItemId() { + return itemId; + } + + public void setItemId(String itemId) { + this.itemId = itemId; + } + + public List<Node> getNodes() { + return nodes; + } + + public void setNodes(List<Node> nodes) { + this.nodes = nodes; + } + + public Integer getCatalogId() { + return catalogId; + } + + public void setCatalogId(Integer catalogId) { + this.catalogId = catalogId; + } + + public String getCatalog() { + return catalog; + } + + public void setCatalog(String catalog) { + this.catalog = catalog; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/model/ModelDcae.java b/src/main/java/org/onap/sdc/dcae/composition/model/ModelDcae.java new file mode 100644 index 0000000..8b3cd5b --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/model/ModelDcae.java @@ -0,0 +1,56 @@ + +package org.onap.sdc.dcae.composition.model; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +import java.lang.Error; + +public class ModelDcae { + + @SerializedName("id") + @Expose + private Object id; + @SerializedName("timestamp") + @Expose + private Integer timestamp; + @SerializedName("data") + @Expose + private Data data; + @SerializedName("error") + @Expose + private java.lang.Error error; + + public Object getId() { + return id; + } + + public void setId(Object id) { + this.id = id; + } + + public Integer getTimestamp() { + return timestamp; + } + + public void setTimestamp(Integer timestamp) { + this.timestamp = timestamp; + } + + public Data getData() { + return data; + } + + public void setData(Data data) { + this.data = data; + } + + public java.lang.Error getError() { + return error; + } + + public void setError(Error error) { + this.error = error; + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/model/Node.java b/src/main/java/org/onap/sdc/dcae/composition/model/Node.java new file mode 100644 index 0000000..12cbfeb --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/model/Node.java @@ -0,0 +1,77 @@ + +package org.onap.sdc.dcae.composition.model; + +import java.util.List; +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class Node { + + @SerializedName("requirements") + @Expose + private List<Requirement> requirements = null; + @SerializedName("capabilities") + @Expose + private List<Capability__> capabilities = null; + @SerializedName("name") + @Expose + private String name; + @SerializedName("description") + @Expose + private String description; + @SerializedName("type") + @Expose + private String type; + @SerializedName("properties") + @Expose + private List<Property_> properties = null; + + public List<Requirement> getRequirements() { + return requirements; + } + + public void setRequirements(List<Requirement> requirements) { + this.requirements = requirements; + } + + public List<Capability__> getCapabilities() { + return capabilities; + } + + public void setCapabilities(List<Capability__> capabilities) { + this.capabilities = capabilities; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public List<Property_> getProperties() { + return properties; + } + + public void setProperties(List<Property_> properties) { + this.properties = properties; + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/model/NodeFilter.java b/src/main/java/org/onap/sdc/dcae/composition/model/NodeFilter.java new file mode 100644 index 0000000..9a79148 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/model/NodeFilter.java @@ -0,0 +1,22 @@ + +package org.onap.sdc.dcae.composition.model; + +import java.util.List; +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class NodeFilter { + + @SerializedName("capabilities") + @Expose + private List<Capability_> capabilities = null; + + public List<Capability_> getCapabilities() { + return capabilities; + } + + public void setCapabilities(List<Capability_> capabilities) { + this.capabilities = capabilities; + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/model/Property.java b/src/main/java/org/onap/sdc/dcae/composition/model/Property.java new file mode 100644 index 0000000..eb871cd --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/model/Property.java @@ -0,0 +1,33 @@ + +package org.onap.sdc.dcae.composition.model; + +import java.util.List; +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class Property { + + @SerializedName("format") + @Expose + private List<Format> format = null; + @SerializedName("version") + @Expose + private List<Version> version = null; + + public List<Format> getFormat() { + return format; + } + + public void setFormat(List<Format> format) { + this.format = format; + } + + public List<Version> getVersion() { + return version; + } + + public void setVersion(List<Version> version) { + this.version = version; + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/model/Property_.java b/src/main/java/org/onap/sdc/dcae/composition/model/Property_.java new file mode 100644 index 0000000..15a3145 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/model/Property_.java @@ -0,0 +1,54 @@ + +package org.onap.sdc.dcae.composition.model; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class Property_ { + + @SerializedName("assignment") + @Expose + private Assignment assignment; + @SerializedName("name") + @Expose + private String name; + @SerializedName("type") + @Expose + private String type; + @SerializedName("required") + @Expose + private Boolean required; + + public Assignment getAssignment() { + return assignment; + } + + public void setAssignment(Assignment assignment) { + this.assignment = assignment; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public Boolean getRequired() { + return required; + } + + public void setRequired(Boolean required) { + this.required = required; + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/model/Relationship.java b/src/main/java/org/onap/sdc/dcae/composition/model/Relationship.java new file mode 100644 index 0000000..b7b0e24 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/model/Relationship.java @@ -0,0 +1,21 @@ + +package org.onap.sdc.dcae.composition.model; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class Relationship { + + @SerializedName("type") + @Expose + private String type; + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/model/Requirement.java b/src/main/java/org/onap/sdc/dcae/composition/model/Requirement.java new file mode 100644 index 0000000..905de99 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/model/Requirement.java @@ -0,0 +1,77 @@ + +package org.onap.sdc.dcae.composition.model; + +import java.util.List; +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class Requirement { + + @SerializedName("capability") + @Expose + private Capability capability; + @SerializedName("node_filter") + @Expose + private NodeFilter nodeFilter; + @SerializedName("name") + @Expose + private String name; + @SerializedName("relationship") + @Expose + private Relationship relationship; + @SerializedName("occurrences") + @Expose + private List<String> occurrences = null; + @SerializedName("node") + @Expose + private String node; + + public Capability getCapability() { + return capability; + } + + public void setCapability(Capability capability) { + this.capability = capability; + } + + public NodeFilter getNodeFilter() { + return nodeFilter; + } + + public void setNodeFilter(NodeFilter nodeFilter) { + this.nodeFilter = nodeFilter; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Relationship getRelationship() { + return relationship; + } + + public void setRelationship(Relationship relationship) { + this.relationship = relationship; + } + + public List<String> getOccurrences() { + return occurrences; + } + + public void setOccurrences(List<String> occurrences) { + this.occurrences = occurrences; + } + + public String getNode() { + return node; + } + + public void setNode(String node) { + this.node = node; + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/model/Type.java b/src/main/java/org/onap/sdc/dcae/composition/model/Type.java new file mode 100644 index 0000000..2549af6 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/model/Type.java @@ -0,0 +1,32 @@ + +package org.onap.sdc.dcae.composition.model; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class Type { + + @SerializedName("name") + @Expose + private String name; + @SerializedName("id") + @Expose + private String id; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/model/Value.java b/src/main/java/org/onap/sdc/dcae/composition/model/Value.java new file mode 100644 index 0000000..7b8da57 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/model/Value.java @@ -0,0 +1,22 @@ + +package org.onap.sdc.dcae.composition.model; + +import java.util.List; +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class Value { + + @SerializedName("get_property") + @Expose + private List<String> getProperty = null; + + public List<String> getGetProperty() { + return getProperty; + } + + public void setGetProperty(List<String> getProperty) { + this.getProperty = getProperty; + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/model/Version.java b/src/main/java/org/onap/sdc/dcae/composition/model/Version.java new file mode 100644 index 0000000..753f82c --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/model/Version.java @@ -0,0 +1,21 @@ + +package org.onap.sdc.dcae.composition.model; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class Version { + + @SerializedName("equal") + @Expose + private String equal; + + public String getEqual() { + return equal; + } + + public void setEqual(String equal) { + this.equal = equal; + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/model/deserializer/RequirementDeserializer.java b/src/main/java/org/onap/sdc/dcae/composition/model/deserializer/RequirementDeserializer.java new file mode 100644 index 0000000..ca2deef --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/model/deserializer/RequirementDeserializer.java @@ -0,0 +1,49 @@ +package org.onap.sdc.dcae.composition.model.deserializer; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.onap.sdc.dcae.composition.model.Capability; +import org.onap.sdc.dcae.composition.model.NodeFilter; +import org.onap.sdc.dcae.composition.model.Relationship; +import org.onap.sdc.dcae.composition.model.Requirement; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; + +public class RequirementDeserializer implements JsonDeserializer<Requirement>{ + + public Requirement deserialize(JsonElement je, Type type, JsonDeserializationContext jdc)throws JsonParseException{ + Gson gson = new Gson(); + + JsonObject jo = je.getAsJsonObject(); + + Requirement requirement = new Requirement(); + + requirement.setCapability(jo.get("capability")!=null ? gson.fromJson(jo.get("capability"), Capability.class) : null); + requirement.setName(jo.get("name")!=null ? jo.get("name").getAsString() : null); + requirement.setRelationship(jo.get("relationship")!=null ? gson.fromJson(jo.get("relationship"), Relationship.class) : null); + requirement.setNodeFilter(jo.get("node_filter")!=null ? gson.fromJson(jo.get("node_filter"), NodeFilter.class) : null); + requirement.setNode(jo.get("node")!=null ? jo.get("node").getAsString() : null); + + JsonArray occurrences = jo.getAsJsonArray("occurrences"); + if(occurrences!=null){ + Iterator<JsonElement> it = occurrences.iterator(); + List<String> occurrencesList = new ArrayList<String>(); + while(it.hasNext()){ + JsonElement curr = it.next(); + String occurance = curr.getAsString(); + occurrencesList.add(occurance); + } + requirement.setOccurrences(occurrencesList); + } + + return requirement; + } +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/model/deserializer/ValueDeserializer.java b/src/main/java/org/onap/sdc/dcae/composition/model/deserializer/ValueDeserializer.java new file mode 100644 index 0000000..4b2951a --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/model/deserializer/ValueDeserializer.java @@ -0,0 +1,45 @@ +package org.onap.sdc.dcae.composition.model.deserializer; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.onap.sdc.dcae.composition.model.Value; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; + +public class ValueDeserializer implements JsonDeserializer<Value>{ + + public Value deserialize(JsonElement je, Type type, JsonDeserializationContext jdc)throws JsonParseException{ + + List<String> getPropertyList = new ArrayList<String>(); + + Value value = new Value(); + + if(je instanceof JsonObject){ + JsonObject jo = je.getAsJsonObject(); + if(jo.get("get_input")!=null){ + getPropertyList.add(jo.get("get_input").getAsString()); + } + else if(jo.get("get_property")!=null){ + if(jo.get("get_property") instanceof JsonObject){ + JsonArray jsonArray = jo.getAsJsonArray("get_property"); + Iterator<JsonElement> it = jsonArray.iterator(); + while(it.hasNext()){ + JsonElement item = it.next(); + getPropertyList.add(item.getAsString()); + } + } + } + + } + value.setGetProperty(getPropertyList); + + return value; + } +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/AttachVFCMTServiceRequest.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/AttachVFCMTServiceRequest.java new file mode 100644 index 0000000..bb25713 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/AttachVFCMTServiceRequest.java @@ -0,0 +1,25 @@ +package org.onap.sdc.dcae.composition.restmodels; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonInclude(Include.NON_NULL) +public class AttachVFCMTServiceRequest { + @JsonProperty("serviceUuid") + private String serviceUuid; + @JsonProperty("instanceName") + private String instanceName; + public String getServiceUuid() { + return serviceUuid; + } + public void setServiceUuid(String serviceUuid) { + this.serviceUuid = serviceUuid; + } + public String getInstanceName() { + return instanceName; + } + public void setInstanceName(String instanceName) { + this.instanceName = instanceName; + } +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/Composition.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/Composition.java new file mode 100644 index 0000000..9997f52 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/Composition.java @@ -0,0 +1,31 @@ +package org.onap.sdc.dcae.composition.restmodels; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Composition { + + @JsonProperty("id") + private String id; + + @JsonProperty("composition") + private Composition composition; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public Composition getComposition() { + return composition; + } + + public void setComposition(Composition composition) { + this.composition = composition; + } + + + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/CompositionRequest.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/CompositionRequest.java new file mode 100644 index 0000000..edb6a2a --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/CompositionRequest.java @@ -0,0 +1,22 @@ +package org.onap.sdc.dcae.composition.restmodels; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class CompositionRequest implements Serializable{ + + private static final long serialVersionUID = 1L; + + @JsonProperty("cid") + private String cid; + + public String getCid() { + return cid; + } + + public void setCid(String cid) { + this.cid = cid; + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/CreateMcResponse.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/CreateMcResponse.java new file mode 100644 index 0000000..49248f9 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/CreateMcResponse.java @@ -0,0 +1,33 @@ +package org.onap.sdc.dcae.composition.restmodels; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; + + +@JsonInclude(Include.NON_NULL) +public class CreateMcResponse { + + private VfcmtData vfcmt; + private Object cdump; + + public VfcmtData getVfcmt() { + return vfcmt; + } + + public void setVfcmt(VfcmtData vfcmt) { + this.vfcmt = vfcmt; + } + + public Object getCdump() { + return cdump; + } + + public void setCdump(Object cdump) { + this.cdump = cdump; + } + + public CreateMcResponse(VfcmtData vfcmt, Object cdump){ + this.vfcmt = vfcmt; + this.cdump = cdump; + } +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/CreateVFCMTRequest.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/CreateVFCMTRequest.java new file mode 100644 index 0000000..d6f2403 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/CreateVFCMTRequest.java @@ -0,0 +1,170 @@ +package org.onap.sdc.dcae.composition.restmodels; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonInclude.Include; + +@JsonInclude(Include.NON_NULL) +public class CreateVFCMTRequest { + + @JsonProperty("name") + private String name; + + @JsonProperty("description") + private String description; + + @JsonProperty("vendorName") + private String vendorName; + + @JsonProperty("vendorRelease") + private String vendorRelease; + + @JsonProperty("contactId") + private String contactId; + + @JsonProperty("resourceType") + private String resourceType; + + @JsonProperty("category") + private String category; + + @JsonProperty("subcategory") + private String subcategory; + + @JsonProperty("icon") + private String icon; + + @JsonProperty("tags") + private String[] tags; + + //1806 374280 new flow - create, clone and attach to Vfi in one API request + private String serviceUuid; + + private String templateUuid; + + private String vfiName; + + private String contextType; + + private String flowType; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getVendorName() { + return vendorName; + } + + public void setVendorName(String vendorName) { + this.vendorName = vendorName; + } + + public String getVendorRelease() { + return vendorRelease; + } + + public void setVendorRelease(String vendorRelease) { + this.vendorRelease = vendorRelease; + } + + public String getContactId() { + return contactId; + } + + public void setContactId(String contactId) { + this.contactId = contactId; + } + + public String getResourceType() { + return resourceType; + } + + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + public String getSubcategory() { + return subcategory; + } + + public void setSubcategory(String subcategory) { + this.subcategory = subcategory; + } + + public String getIcon() { + return icon; + } + + public void setIcon(String icon) { + this.icon = icon; + } + + public String[] getTags() { + return tags; + } + + public void setTags(String[] tags) { + this.tags = tags; + } + + public String getServiceUuid() { + return serviceUuid; + } + + public void setServiceUuid(String serviceUuid) { + this.serviceUuid = serviceUuid; + } + + public String getTemplateUuid() { + return templateUuid; + } + + public void setTemplateUuid(String templateUuid) { + this.templateUuid = templateUuid; + } + + public String getVfiName() { + return vfiName; + } + + public void setVfiName(String vfiName) { + this.vfiName = vfiName; + } + + public String getContextType() { + return contextType; + } + + public void setContextType(String contextType) { + this.contextType = contextType; + } + + public String getFlowType() { + return flowType; + } + + public void setFlowType(String flowType) { + this.flowType = flowType; + } +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/DcaeMinimizedService.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/DcaeMinimizedService.java new file mode 100644 index 0000000..7e53a38 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/DcaeMinimizedService.java @@ -0,0 +1,59 @@ +package org.onap.sdc.dcae.composition.restmodels; + +public class DcaeMinimizedService { + String uuid; + String name; + String lastUpdaterUserId; + String lifeCycleState; + String version; + String invariantUUID; + + public String getInvariantUUID() { + return invariantUUID; + } + public void setInvariantUUID(String invariantUUID) { + this.invariantUUID = invariantUUID; + } + public DcaeMinimizedService(String uuid, String name, String lastUpdaterUserId, String lifeCycleState, String version, String invariantUUID) { + super(); + this.uuid = uuid; + this.name = name; + this.lastUpdaterUserId = lastUpdaterUserId; + this.lifeCycleState = lifeCycleState; + this.version = version; + this.invariantUUID = invariantUUID; + } + public String getVersion() { + return version; + } + public Float getVersionAsFloat() { + return Float.parseFloat(version); + } + public void setVersion(String version) { + this.version = version; + } + public String getUuid() { + return uuid; + } + public void setUuid(String uuid) { + this.uuid = uuid; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public String getLastUpdaterUserId() { + return lastUpdaterUserId; + } + public void setLastUpdaterUserId(String lastUpdaterUserId) { + this.lastUpdaterUserId = lastUpdaterUserId; + } + public String getLifeCycleState() { + return lifeCycleState; + } + public void setLifeCycleState(String lifeCycleState) { + this.lifeCycleState = lifeCycleState; + } +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ImportVFCMTRequest.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ImportVFCMTRequest.java new file mode 100644 index 0000000..cb3dd8e --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ImportVFCMTRequest.java @@ -0,0 +1,24 @@ +package org.onap.sdc.dcae.composition.restmodels; + +public class ImportVFCMTRequest extends CreateVFCMTRequest { + + private boolean cloneVFCMT; + + private boolean updateFlowType; + + public boolean isCloneVFCMT() { + return cloneVFCMT; + } + + public void setCloneVFCMT(boolean cloneVFCMT) { + this.cloneVFCMT = cloneVFCMT; + } + + public boolean isUpdateFlowType() { + return updateFlowType; + } + + public void setUpdateFlowType(boolean updateFlowType) { + this.updateFlowType = updateFlowType; + } +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/MessageResponse.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/MessageResponse.java new file mode 100644 index 0000000..e498097 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/MessageResponse.java @@ -0,0 +1,30 @@ +package org.onap.sdc.dcae.composition.restmodels; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class MessageResponse{ + + @JsonProperty("errorResponse") + private String errorResponse; + + @JsonProperty("successResponse") + private String successResponse; + + public String getErrorResponse() { + return errorResponse; + } + + public void setErrorResponse(String errorResponse) { + this.errorResponse = errorResponse; + } + + public String getSuccessResponse() { + return successResponse; + } + + public void setSuccessResponse(String successResponse) { + this.successResponse = successResponse; + } + + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/MonitoringComponent.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/MonitoringComponent.java new file mode 100644 index 0000000..09777a5 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/MonitoringComponent.java @@ -0,0 +1,96 @@ +package org.onap.sdc.dcae.composition.restmodels; + +import com.fasterxml.jackson.annotation.JsonInclude; +import org.onap.sdc.dcae.composition.restmodels.sdc.ResourceDetailed; +import org.onap.sdc.dcae.composition.util.DcaeBeConstants; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class MonitoringComponent { + + // VFCMT metadata + private String uuid; + private String name; + private String version; + private String lastUpdaterUserId; + private String description; + private String lifecycleState; + + // Blueprint submission status + // 1806 US381853 according to lifecycleState + private String status; + + // The name of the vfi monitored by the VFCMT + private String vfiName; + + public MonitoringComponent(ResourceDetailed mc, String vfiName) { + this.uuid = mc.getUuid(); + this.name = mc.getName(); + this.version = mc.getVersion(); + this.lastUpdaterUserId = mc.getLastUpdaterUserId(); + this.description = mc.getDescription(); + this.lifecycleState = mc.getLifecycleState(); + this.status = DcaeBeConstants.LifecycleStateEnum.CERTIFIED == DcaeBeConstants.LifecycleStateEnum.findState(lifecycleState) ? "Submitted" : "Not Submitted"; + this.vfiName = vfiName; + } + + public MonitoringComponent(String uuid, String vfiName, String status) { + this.uuid = uuid; + this.vfiName = vfiName; + this.status = status; + } + + MonitoringComponent(){} + + public String getUuid() { + return uuid; + } + + public String getName() { + return name; + } + + public String getVersion() { + return version; + } + + public String getLastUpdaterUserId() { + return lastUpdaterUserId; + } + + public String getDescription() { + return description; + } + + public String getStatus() { + return status; + } + + public String getVfiName() { + return vfiName; + } + + public String getLifecycleState() { + return lifecycleState; + } + + public void setVfiName(String vfiName) { + this.vfiName = vfiName; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public void setName(String name) { + this.name = name; + } + + public void setDescription(String description) { + this.description = description; + } + + public void setLifecycleState(String lifecycleState) { + this.lifecycleState = lifecycleState; + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ReferenceUUID.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ReferenceUUID.java new file mode 100644 index 0000000..19bf0b7 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ReferenceUUID.java @@ -0,0 +1,21 @@ +package org.onap.sdc.dcae.composition.restmodels; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ReferenceUUID { + + @JsonProperty("referenceUUID") + private String referenceUUID; + + public ReferenceUUID(String referenceUUID) { + this.referenceUUID = referenceUUID; + } + + public String getReferenceUUID() { + return referenceUUID; + } + + public void setReferenceUUID(String referenceUUID) { + this.referenceUUID = referenceUUID; + } +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/VfcmtData.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/VfcmtData.java new file mode 100644 index 0000000..6c7a65e --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/VfcmtData.java @@ -0,0 +1,56 @@ +package org.onap.sdc.dcae.composition.restmodels; + +import org.onap.sdc.dcae.composition.restmodels.sdc.ResourceDetailed; + +public class VfcmtData extends MonitoringComponent { + + private String flowType; + private String serviceUuid; + + private String invariantUUID; + + public VfcmtData(ResourceDetailed vfcmt) { + setUuid(vfcmt.getUuid()); + setName(vfcmt.getName()); + setDescription(vfcmt.getDescription()); + } + + public VfcmtData(ResourceDetailed vfcmt, String vfiName, String flowType) { + this(vfcmt); + setVfiName(vfiName); + setFlowType(flowType); + } + + public VfcmtData(ResourceDetailed vfcmt, String vfiName, String flowType, String serviceUuid) { + this(vfcmt, vfiName, flowType); + setInvariantUUID(vfcmt.getInvariantUUID()); + setLifecycleState(vfcmt.getLifecycleState()); + setServiceUuid(serviceUuid); + } + + public String getFlowType() { + return flowType; + } + + public void setFlowType(String flowType) { + this.flowType = flowType; + } + + public String getServiceUuid() { + return serviceUuid; + } + + public void setServiceUuid(String serviceUuid) { + this.serviceUuid = serviceUuid; + } + + public String getInvariantUUID() { + return invariantUUID; + } + + public void setInvariantUUID(String invariantUUID) { + this.invariantUUID = invariantUUID; + } + + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/health/ComponentsInfo.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/health/ComponentsInfo.java new file mode 100644 index 0000000..2c9a16a --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/health/ComponentsInfo.java @@ -0,0 +1,59 @@ +package org.onap.sdc.dcae.composition.restmodels.health; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class ComponentsInfo { + + @SerializedName("healthCheckComponent") + @Expose + private String healthCheckComponent; + @SerializedName("healthCheckStatus") + @Expose + private String healthCheckStatus; + @SerializedName("version") + @Expose + private String version; + @SerializedName("description") + @Expose + private String description; + + public String getHealthCheckComponent() { + return healthCheckComponent; + } + + public void setHealthCheckComponent(String healthCheckComponent) { + this.healthCheckComponent = healthCheckComponent; + } + + public String getHealthCheckStatus() { + return healthCheckStatus; + } + + public void setHealthCheckStatus(String healthCheckStatus) { + this.healthCheckStatus = healthCheckStatus; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + @Override + public String toString() { + return "ComponentsInfo [healthCheckComponent=" + healthCheckComponent + ", healthCheckStatus=" + + healthCheckStatus + ", version=" + version + ", description=" + description + "]"; + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/health/HealthResponse.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/health/HealthResponse.java new file mode 100644 index 0000000..56d6cf0 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/health/HealthResponse.java @@ -0,0 +1,65 @@ +package org.onap.sdc.dcae.composition.restmodels.health; + +import java.util.List; +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class HealthResponse { + + @SerializedName("healthCheckComponent") + @Expose + private String healthCheckComponent; + @SerializedName("healthCheckStatus") + @Expose + private String healthCheckStatus; + @SerializedName("sdcVersion") + @Expose + private String sdcVersion; + @SerializedName("description") + @Expose + private String description; + @SerializedName("componentsInfo") + @Expose + private List<ComponentsInfo> componentsInfo = null; + + public String getHealthCheckComponent() { + return healthCheckComponent; + } + + public void setHealthCheckComponent(String healthCheckComponent) { + this.healthCheckComponent = healthCheckComponent; + } + + public String getHealthCheckStatus() { + return healthCheckStatus; + } + + public void setHealthCheckStatus(String healthCheckStatus) { + this.healthCheckStatus = healthCheckStatus; + } + + public String getSdcVersion() { + return sdcVersion; + } + + public void setSdcVersion(String sdcVersion) { + this.sdcVersion = sdcVersion; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public List<ComponentsInfo> getComponentsInfo() { + return componentsInfo; + } + + public void setComponentsInfo(List<ComponentsInfo> componentsInfo) { + this.componentsInfo = componentsInfo; + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ActionDeserializer.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ActionDeserializer.java new file mode 100644 index 0000000..84884ee --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ActionDeserializer.java @@ -0,0 +1,34 @@ +package org.onap.sdc.dcae.composition.restmodels.ruleeditor; + +import com.google.gson.*; +import java.lang.reflect.Type; + +public class ActionDeserializer implements JsonDeserializer<BaseAction> { + + @Override + public BaseAction deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { + String action; + try { + action = json.getAsJsonObject().get("actionType").getAsString(); + } catch (RuntimeException e) { + throw new JsonParseException("Missing information : action type"); + } + ActionTypeEnum actionTypeEnum = ActionTypeEnum.getTypeByName(action); + if (null == actionTypeEnum) + throw new JsonParseException("Undefined action type: " + action); + Type clazz = getActionClassByActionTypeEnum(actionTypeEnum); + return new Gson().fromJson(json, clazz); + } + + private Type getActionClassByActionTypeEnum(ActionTypeEnum actionTypeEnum) { + switch (actionTypeEnum) { + case MAP: + return MapAction.class; + case DATE_FORMATTER: + return DateFormatterAction.class; + default: + return BaseAction.class; + } + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ActionTypeEnum.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ActionTypeEnum.java new file mode 100644 index 0000000..4538da5 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ActionTypeEnum.java @@ -0,0 +1,21 @@ +package org.onap.sdc.dcae.composition.restmodels.ruleeditor; + +import java.util.Arrays; + +public enum ActionTypeEnum { + COPY("copy"), MAP("map"), CONCAT("concat"), DATE_FORMATTER("dateFormatter"); + + private String type; + + ActionTypeEnum(String type){ + this.type = type; + } + + public String getType(){ + return type; + } + + public static ActionTypeEnum getTypeByName(String action) { + return Arrays.stream(ActionTypeEnum.values()).filter(a -> action.replaceAll(" ", "").equalsIgnoreCase(a.type)).findAny().orElse(null); + } +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/BaseAction.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/BaseAction.java new file mode 100644 index 0000000..ce9db27 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/BaseAction.java @@ -0,0 +1,212 @@ +package org.onap.sdc.dcae.composition.restmodels.ruleeditor; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.util.CollectionUtils; + +public class BaseAction { + + private String actionType; + private From from; + private String target; + // UI generated id + private String id; + + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getActionType() { + return actionType; + } + + public void setActionType(String actionType) { + this.actionType = actionType; + } + + public String getTarget() { + return target; + } + + public void setTarget(String target) { + this.target = target; + } + + public From getFrom() { + return from; + } + + public void setFrom(From from) { + this.from = from; + } + + public void setFrom(String from) { + this.from = new From(from); + } + + public void setFrom(List<String> from) { + this.from = new From(from); + } + + public void setFrom(String from, String regex) { + this.from = new From(from, regex); + } + + protected class FromField { + private String value; + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + FromField(String value){ + setValue(value); + } + + private FromField(){} + + private boolean isReference(){ + return StringUtils.isNoneBlank(value) && value.startsWith("${") && value.endsWith("}"); + } + + private String stripedReference() { + return value.substring(2, value.length()-1); + } + + boolean referencesTarget(String target) { + return isReference() && target.equals(stripedReference()); + } + + @Override + public boolean equals(Object obj) { + return obj == this || !(null == obj || getClass() != obj.getClass()) && Objects.equals(value, ((FromField)obj).value); + } + + @Override + public int hashCode(){ + return Objects.hash(this.value); + } + } + + protected class From extends FromField { + + private String regex; + // UI state of the regex field + private String state; + private List<FromField> values; + + public String getRegex() { + return regex; + } + + public void setRegex(String regex) { + this.regex = regex; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + public List<FromField> getValues() { + return values; + } + + public void setValues(List<FromField> values) { + this.values = values; + } + + protected From(String value, String regex){ + super(value); + setRegex(regex); + } + + protected From(List<String> valuesList) { + List<FromField> allValues = valuesList.stream().map(FromField::new).collect(Collectors.toList()); + setValues(allValues); + } + + protected From(String value){ + super(value); + } + + @Override + public boolean equals(Object obj) { + if (obj == this) + return true; + if (null == obj || getClass() != obj.getClass()) + return false; + From other = (From) obj; + return Objects.equals(regex, other.regex) + && Objects.equals(state, other.state) + && Objects.equals(values, other.values); + } + + @Override + public int hashCode(){ + return Objects.hash(this.regex,this.state,this.values); + } + + } + + public boolean hasDependencies(Collection<BaseAction> allActions) { + return allActions.stream().anyMatch(this::referencesTarget); + } + + public String getFromValue() { + return null == from ? null: StringUtils.isNoneBlank(from.getValue()) ? from.getValue() : StringUtils.join(getFromValues(), ""); + } + + public List<String> getFromValues() { + return null == from || CollectionUtils.isEmpty(from.values) ? new ArrayList<>() : from.values.stream().map(FromField::getValue).collect(Collectors.toList()); + } + + public String getRegexValue() { + return from.getRegex(); + } + + public boolean referencesTarget(BaseAction other) { + return from.referencesTarget(other.strippedTarget()) || + other != this && !CollectionUtils.isEmpty(from.values) && from.values.stream().anyMatch(p -> p.referencesTarget(other.strippedTarget())); + } + + String strippedTarget() { + return target.startsWith("${") && target.endsWith("}") ? target.substring(2, target.length()-1) : target; + } + + @Override + public boolean equals(Object obj) { + if (obj == this) + return true; + if (null == obj || getClass() != obj.getClass()) + return false; + BaseAction other = (BaseAction) obj; + return Objects.equals(actionType, other.actionType) + && Objects.equals(target, other.target) + && Objects.equals(id, other.id) + && Objects.equals(from, other.from); + } + + @Override + public int hashCode(){ + return Objects.hash(this.actionType,this.from,this.id,this.target); + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/BaseCondition.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/BaseCondition.java new file mode 100644 index 0000000..60a9778 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/BaseCondition.java @@ -0,0 +1,11 @@ +package org.onap.sdc.dcae.composition.restmodels.ruleeditor; + +public abstract class BaseCondition { + + // UI evaluation fields + private String level; + private String name; + private String id; + + public abstract boolean referencesTarget(String target); +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/Condition.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/Condition.java new file mode 100644 index 0000000..5f037a6 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/Condition.java @@ -0,0 +1,54 @@ +package org.onap.sdc.dcae.composition.restmodels.ruleeditor; + +import java.util.List; +import java.util.stream.Stream; + +public class Condition extends BaseCondition { + + protected String left; + protected String operator; + protected List<String> right; + + public String getLeft() { + return left; + } + + public void setLeft(String left) { + this.left = left; + } + + public String getOperator() { + return operator; + } + + public void setOperator(String operator) { + this.operator = operator; + } + + public List<String> getRight() { + return right; + } + + public void setRight(List<String> right) { + this.right = right; + } + + + @Override + public boolean referencesTarget(String target) { + return Stream.concat(Stream.of(left), right.stream()) + .filter(this::isReference) + .map(this::strippedReference) + .anyMatch(target::equals); + } + + private String strippedReference(String value) { + return value.substring(2, value.length()-1); + } + + private boolean isReference(String value) { + return value.startsWith("${") && value.endsWith("}"); + } + +} + diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ConditionDeserializer.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ConditionDeserializer.java new file mode 100644 index 0000000..b14c3b1 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ConditionDeserializer.java @@ -0,0 +1,17 @@ +package org.onap.sdc.dcae.composition.restmodels.ruleeditor; + +import com.google.gson.*; + +import java.lang.reflect.Type; + +public class ConditionDeserializer implements JsonDeserializer<BaseCondition> { + + @Override + public BaseCondition deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { + Type clazz = Condition.class; + JsonElement type = json.getAsJsonObject().get("type"); + if(null != type && !type.isJsonNull()) + clazz = ConditionGroup.class; + return context.deserialize(json, clazz); + } +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ConditionGroup.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ConditionGroup.java new file mode 100644 index 0000000..c8ddc9d --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ConditionGroup.java @@ -0,0 +1,31 @@ +package org.onap.sdc.dcae.composition.restmodels.ruleeditor; + +import java.util.List; + +public class ConditionGroup extends BaseCondition { + + private String type; + private List<BaseCondition> children; + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public List<BaseCondition> getChildren() { + return children; + } + + public void setChildren(List<BaseCondition> children) { + this.children = children; + } + + @Override + public boolean referencesTarget(String target) { + return children.stream().anyMatch(c -> c.referencesTarget(target)); + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/DateFormatterAction.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/DateFormatterAction.java new file mode 100644 index 0000000..6a66a5a --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/DateFormatterAction.java @@ -0,0 +1,87 @@ +package org.onap.sdc.dcae.composition.restmodels.ruleeditor; + +import com.google.gson.annotations.SerializedName; + +public class DateFormatterAction extends BaseAction { + + private DateFormatter dateFormatter = new DateFormatter(); + + public DateFormatter getDateFormatter() { + return dateFormatter; + } + + public void setDateFormatter(DateFormatter dateFormatter) { + this.dateFormatter = dateFormatter; + } + + private class DateFormatter{ + private String fromFormat; + private String toFormat; + private String fromTimezone; + private String toTimezone; + + public String getFromFormat() { + return fromFormat; + } + + public void setFromFormat(String fromFormat) { + this.fromFormat = fromFormat; + } + + public String getToFormat() { + return toFormat; + } + + public void setToFormat(String toFormat) { + this.toFormat = toFormat; + } + + public String getFromTimezone() { + return fromTimezone; + } + + public void setFromTimezone(String fromTimezone) { + this.fromTimezone = fromTimezone; + } + + public String getToTimezone() { + return toTimezone; + } + + public void setToTimezone(String toTimezone) { + this.toTimezone = toTimezone; + } + } + + public String getFromFormat() { + return dateFormatter.fromFormat; + } + + public void setFromFormat(String fromFormat) { + this.dateFormatter.fromFormat = fromFormat; + } + + public String getToFormat() { + return dateFormatter.toFormat; + } + + public void setToFormat(String toFormat) { + this.dateFormatter.toFormat = toFormat; + } + + public String getFromTz() { + return dateFormatter.fromTimezone; + } + + public void setFromTz(String fromTz) { + this.dateFormatter.fromTimezone = fromTz; + } + + public String getToTz() { + return dateFormatter.toTimezone; + } + + public void setToTz(String toTz) { + this.dateFormatter.toTimezone = toTz; + } +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/EventTypeDefinitionUI.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/EventTypeDefinitionUI.java new file mode 100644 index 0000000..667eb03 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/EventTypeDefinitionUI.java @@ -0,0 +1,50 @@ +package org.onap.sdc.dcae.composition.restmodels.ruleeditor; + +import java.util.List; +import java.util.stream.Collectors; + +public class EventTypeDefinitionUI { + + private String name; + private List<EventTypeDefinitionUI> children; + private Boolean isRequired; + private List<String> requiredChildren; + private String id; + + + public EventTypeDefinitionUI(String name, List<EventTypeDefinitionUI> children, Boolean isRequired, String id) { + super(); + this.name = name; + this.children = children; + this.isRequired = isRequired; + this.id = id; + this.requiredChildren = (children == null) ? null : children.stream() + .filter(c-> c.isRequired) + .map(c-> c.name) + .collect(Collectors.toList()); + } + + public String getName() { + return name; + } + + + public List<EventTypeDefinitionUI> getChildren() { + return children; + } + + + public Boolean getIsRequired() { + return isRequired; + } + + + public List<String> getRequiredChildren() { + return requiredChildren; + } + + + public String getId() { + return id; + } +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/EventTypesByVersionUI.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/EventTypesByVersionUI.java new file mode 100644 index 0000000..ed77144 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/EventTypesByVersionUI.java @@ -0,0 +1,28 @@ +package org.onap.sdc.dcae.composition.restmodels.ruleeditor; + +import java.util.Set; + +import com.google.common.collect.ImmutableList; + +public class EventTypesByVersionUI { + + public static final ImmutableList<String> DEFAULT_EVENTS = ImmutableList.of("commonEventHeader"); + + private String version; + private Set<String> eventTypes; + + public EventTypesByVersionUI(String version, Set<String> eventTypes) { + super(); + this.version = version; + this.eventTypes = eventTypes; + } + + public String getVersion() { + return version; + } + + public Set<String> getEventTypes() { + return eventTypes; + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/MapAction.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/MapAction.java new file mode 100644 index 0000000..b7988f4 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/MapAction.java @@ -0,0 +1,92 @@ +package org.onap.sdc.dcae.composition.restmodels.ruleeditor; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import com.google.gson.annotations.SerializedName; + +public class MapAction extends BaseAction { + + private Transform map; + + public Transform getMap() { + return map; + } + + public void setMap(Transform map) { + this.map = map; + } + + public List<UIHashMap> getMapValues() { + return null == map? null : map.values; + } + + public boolean mapHasDefault() { + return null != map && map.haveDefault; + } + + public String getMapDefaultValue() { + return null == map? null : map.defaultValue; + } + + + private class Transform { + @SerializedName("default") + private String defaultValue; + private boolean haveDefault; + private List<UIHashMap> values; + + public String getDefaultValue() { + return defaultValue; + } + + public void setDefaultValue(String defaultValue) { + this.defaultValue = defaultValue; + } + + public boolean isHaveDefault() { + return haveDefault; + } + + public void setHaveDefault(boolean haveDefault) { + this.haveDefault = haveDefault; + } + + public List<UIHashMap> getValues() { + return values; + } + + public void setValues(List<UIHashMap> values) { + this.values = values; + } + + } + + private class UIHashMap { + private String key; + private String value; + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + } + + public Map<String, String> transformToMap() throws IllegalStateException { + return getMap().getValues().stream().collect(Collectors.toMap(UIHashMap::getKey, UIHashMap::getValue)); + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/MappingRules.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/MappingRules.java new file mode 100644 index 0000000..ca24d57 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/MappingRules.java @@ -0,0 +1,70 @@ +package org.onap.sdc.dcae.composition.restmodels.ruleeditor; + +import java.util.LinkedHashMap; +import java.util.Map; +import com.google.gson.Gson; + +public class MappingRules { + private String version; + private String eventType; + private Map<String, Rule> rules = new LinkedHashMap<>(); + + public Map<String, Rule> getRules() { + return rules; + } + + public void setRules(Map<String, Rule> rules) { + this.rules = rules; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getEventType() { + return eventType; + } + + public void setEventType(String eventType) { + this.eventType = eventType; + } + + + public MappingRules(Rule rule) { + version = rule.getVersion(); + eventType = rule.getEventType(); + addOrReplaceRule(rule); + } + + public void addOrReplaceRule(Rule rule) { + rule.generateUid(); + rules.put(rule.getUid(), rule); + } + + public boolean ruleExists(Rule rule) { + return rules.containsKey(rule.getUid()); + } + + + public boolean isEmpty() { + return rules.isEmpty(); + } + + + public Rule removeRule(String ruleUid) { + return rules.remove(ruleUid); + } + + public String describe() { + return "{version:"+version+",eventType:"+eventType+"}"; + } + + public byte[] convertToPayload() { + return new Gson().toJson(this).getBytes(); + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/Rule.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/Rule.java new file mode 100644 index 0000000..b65fdf0 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/Rule.java @@ -0,0 +1,138 @@ +package org.onap.sdc.dcae.composition.restmodels.ruleeditor; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import org.apache.commons.lang3.StringUtils; + +import java.util.*; +import java.util.stream.Collectors; + +public class Rule { + private String version; + private String eventType; + private String description; + private String uid; + private String phase = "phase_1"; //placeholder + private BaseCondition condition; + private List<BaseAction> actions; + + private static Gson gson = new GsonBuilder().serializeNulls().create(); + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getEventType() { + return eventType; + } + + public void setEventType(String eventType) { + this.eventType = eventType; + } + + public String getUid() { + return uid; + } + + public void setUid(String uid) { + this.uid = uid; + } + + public String getPhase() { + return phase; + } + + public void setPhase(String phase) { + this.phase = phase; + } + + public List<BaseAction> getActions() { + return actions; + } + + public void setActions(List<BaseAction> actions) { + this.actions = actions; + } + + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public BaseCondition getCondition() { + return condition; + } + + public void setCondition(BaseCondition condition) { + this.condition = condition; + } + + public void generateUid() { + if(StringUtils.isBlank(uid)) + uid = UUID.randomUUID().toString(); + } + + public String toJson() { + return gson.toJson(this); + } + + @Override + public boolean equals(Object obj) { + if (obj == this) + return true; + if (null == obj || getClass() != obj.getClass()) + return false; + Rule other = (Rule) obj; + return Objects.equals(version, other.version) && + Objects.equals(description, other.description) && + Objects.equals(eventType, other.eventType) && + Objects.equals(uid, other.uid) && + Objects.equals(phase, other.phase) && + Objects.equals(condition, other.condition) && + Objects.equals(actions, other.actions); + } + + @Override + public int hashCode(){ + return Objects.hash(this.version,this.description,this.eventType,this.uid,this.phase,this.condition,this.actions); + } + + public boolean referencesOtherRule(Rule other){ + return other != this && actions.stream().anyMatch(p -> p.hasDependencies(other.actions)) || + isConditionalRule() && other.actions.stream().map(BaseAction::strippedTarget).anyMatch(t -> condition.referencesTarget(t)); + } + + + private List<BaseAction> findDependencies(Rule other) { + return other.actions.stream() + .filter(p -> actions.stream().anyMatch(a -> a.referencesTarget(p)) || isConditionalRule() && condition.referencesTarget(p.strippedTarget())) + .collect(Collectors.toList()); + } + + public List<BaseAction> findDependencies(List<Rule> others) { + return others.stream() + .filter(r -> r != this) + .map(this::findDependencies) + .flatMap(List::stream) + .collect(Collectors.toList()); + } + + public boolean referencesOtherRules(Collection<Rule> allRules) { + return allRules.stream().anyMatch(this::referencesOtherRule); + } + + public boolean isConditionalRule() { + return null != condition; + } + +} + + diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/SchemaInfo.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/SchemaInfo.java new file mode 100644 index 0000000..a6678c8 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/SchemaInfo.java @@ -0,0 +1,23 @@ +package org.onap.sdc.dcae.composition.restmodels.ruleeditor; + + +public class SchemaInfo { + private String eventType; + private String version; + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getEventType() { + return eventType; + } + + public void setEventType(String eventType) { + this.eventType = eventType; + } +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/Artifact.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/Artifact.java new file mode 100644 index 0000000..012ed9c --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/Artifact.java @@ -0,0 +1,100 @@ +package org.onap.sdc.dcae.composition.restmodels.sdc; + +import com.fasterxml.jackson.annotation.JsonInclude; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class Artifact { + + private String artifactName; + private String artifactType; + private String artifactURL; + private String artifactDescription; + private Integer artifactTimeout; + private String artifactChecksum; + private String artifactUUID; + private String artifactVersion; + private String generatedFromUUID; + private String artifactLabel; + private String artifactGroupType; + private String payloadData; + private String description; + + public String getArtifactName() { + return artifactName; + } + public void setArtifactName(String artifactName) { + this.artifactName = artifactName; + } + public String getArtifactType() { + return artifactType; + } + public void setArtifactType(String artifactType) { + this.artifactType = artifactType; + } + public String getArtifactURL() { + return artifactURL; + } + public void setArtifactURL(String artifactURL) { + this.artifactURL = artifactURL; + } + public String getArtifactDescription() { + return artifactDescription; + } + public void setArtifactDescription(String artifactDescription) { + this.artifactDescription = artifactDescription; + } + public Integer getArtifactTimeout() { + return artifactTimeout; + } + public void setArtifactTimeout(Integer artifactTimeout) { + this.artifactTimeout = artifactTimeout; + } + public String getArtifactChecksum() { + return artifactChecksum; + } + public void setArtifactChecksum(String artifactChecksum) { + this.artifactChecksum = artifactChecksum; + } + public String getArtifactUUID() { + return artifactUUID; + } + public void setArtifactUUID(String artifactUUID) { + this.artifactUUID = artifactUUID; + } + public String getArtifactVersion() { + return artifactVersion; + } + public void setArtifactVersion(String artifactVersion) { + this.artifactVersion = artifactVersion; + } + public String getGeneratedFromUUID() { + return generatedFromUUID; + } + public void setGeneratedFromUUID(String generatedFromUUID) { + this.generatedFromUUID = generatedFromUUID; + } + public String getArtifactLabel() { + return artifactLabel; + } + public void setArtifactLabel(String artifactLabel) { + this.artifactLabel = artifactLabel; + } + public String getArtifactGroupType() { + return artifactGroupType; + } + public void setArtifactGroupType(String artifactGroupType) { + this.artifactGroupType = artifactGroupType; + } + public String getPayloadData() { + return payloadData; + } + public void setPayloadData(String payloadData) { + this.payloadData = payloadData; + } + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/Asset.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/Asset.java new file mode 100644 index 0000000..39c115b --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/Asset.java @@ -0,0 +1,71 @@ +package org.onap.sdc.dcae.composition.restmodels.sdc; + +import com.fasterxml.jackson.annotation.JsonInclude; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public abstract class Asset { + + private String uuid; + private String invariantUUID; + private String name; + private String version; + private String toscaModelURL; + private String lastUpdaterUserId; + private String category; + private String lifecycleState; + + public String getUuid() { + return uuid; + } + public void setUuid(String uuid) { + this.uuid = uuid; + } + public String getInvariantUUID() { + return invariantUUID; + } + public void setInvariantUUID(String invariantUUID) { + this.invariantUUID = invariantUUID; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public String getVersion() { + return version; + } + public void setVersion(String version) { + this.version = version; + } + public String getToscaModelURL() { + return toscaModelURL; + } + public void setToscaModelURL(String toscaModelURL) { + this.toscaModelURL = toscaModelURL; + } + public String getLastUpdaterUserId() { + return lastUpdaterUserId; + } + public void setLastUpdaterUserId(String lastUpdaterUserId) { + this.lastUpdaterUserId = lastUpdaterUserId; + } + public String getCategory() { + return category; + } + public void setCategory(String category) { + this.category = category; + } + public String getLifecycleState() { + return lifecycleState; + } + public void setLifecycleState(String lifecycleState) { + this.lifecycleState = lifecycleState; + } + + + public Float versionAsFloat() { + return Float.parseFloat(version); + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/Data.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/Data.java new file mode 100644 index 0000000..5b96ea2 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/Data.java @@ -0,0 +1,21 @@ + +package org.onap.sdc.dcae.composition.restmodels.sdc; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class Data { + + @SerializedName("element") + @Expose + private Element element; + + public Element getElement() { + return element; + } + + public void setElement(Element element) { + this.element = element; + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/DcaeComponents.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/DcaeComponents.java new file mode 100644 index 0000000..ff2c411 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/DcaeComponents.java @@ -0,0 +1,54 @@ + +package org.onap.sdc.dcae.composition.restmodels.sdc; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class DcaeComponents { + + @SerializedName("id") + @Expose + private Object id; + @SerializedName("timestamp") + @Expose + private Integer timestamp; + @SerializedName("data") + @Expose + private Data data; + @SerializedName("error") + @Expose + private Error error; + + public Object getId() { + return id; + } + + public void setId(Object id) { + this.id = id; + } + + public Integer getTimestamp() { + return timestamp; + } + + public void setTimestamp(Integer timestamp) { + this.timestamp = timestamp; + } + + public Data getData() { + return data; + } + + public void setData(Data data) { + this.data = data; + } + + public Error getError() { + return error; + } + + public void setError(Error error) { + this.error = error; + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/Element.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/Element.java new file mode 100644 index 0000000..c3aa95a --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/Element.java @@ -0,0 +1,55 @@ + +package org.onap.sdc.dcae.composition.restmodels.sdc; + +import java.util.List; +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class Element { + + @SerializedName("itemId") + @Expose + private String itemId; + @SerializedName("name") + @Expose + private String name; + @SerializedName("id") + @Expose + private String id; + @SerializedName("items") + @Expose + private List<Item> items = null; + + public String getItemId() { + return itemId; + } + + public void setItemId(String itemId) { + this.itemId = itemId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public List<Item> getItems() { + return items; + } + + public void setItems(List<Item> items) { + this.items = items; + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/Error.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/Error.java new file mode 100644 index 0000000..a935a46 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/Error.java @@ -0,0 +1,8 @@ + +package org.onap.sdc.dcae.composition.restmodels.sdc; + + +public class Error { + + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/ExternalReferencesMap.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/ExternalReferencesMap.java new file mode 100644 index 0000000..3340502 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/ExternalReferencesMap.java @@ -0,0 +1,7 @@ +package org.onap.sdc.dcae.composition.restmodels.sdc; + +import java.util.HashMap; +import java.util.List; + +public class ExternalReferencesMap extends HashMap<String, List<String>>{ +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/Item.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/Item.java new file mode 100644 index 0000000..6f52e11 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/Item.java @@ -0,0 +1,220 @@ + +package org.onap.sdc.dcae.composition.restmodels.sdc; + +import java.util.List; +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class Item { + + @SerializedName("lifecycleState") + @Expose + private String lifecycleState; + @SerializedName("models") + @Expose + private List<Model> models = null; + @SerializedName("subCategory") + @Expose + private String subCategory; + @SerializedName("catalog") + @Expose + private String catalog; + @SerializedName("lastUpdaterUserId") + @Expose + private String lastUpdaterUserId; + @SerializedName("description") + @Expose + private String description; + @SerializedName("uuid") + @Expose + private String uuid; + @SerializedName("version") + @Expose + private String version; + @SerializedName("itemId") + @Expose + private String itemId; + @SerializedName("catalogId") + @Expose + private Integer catalogId; + @SerializedName("toscaModelURL") + @Expose + private String toscaModelURL; + @SerializedName("name") + @Expose + private String name; + @SerializedName("invariantUUID") + @Expose + private String invariantUUID; + @SerializedName("id") + @Expose + private Integer id; + @SerializedName("category") + @Expose + private String category; + @SerializedName("lastUpdaterFullName") + @Expose + private String lastUpdaterFullName; + @SerializedName("toscaResourceName") + @Expose + private String toscaResourceName; + @SerializedName("resourceType") + @Expose + private String resourceType; + @SerializedName("artifacts") + @Expose + private List<Artifact> artifacts = null; + + public String getLifecycleState() { + return lifecycleState; + } + + public void setLifecycleState(String lifecycleState) { + this.lifecycleState = lifecycleState; + } + + public List<Model> getModels() { + return models; + } + + public void setModels(List<Model> models) { + this.models = models; + } + + public String getSubCategory() { + return subCategory; + } + + public void setSubCategory(String subCategory) { + this.subCategory = subCategory; + } + + public String getCatalog() { + return catalog; + } + + public void setCatalog(String catalog) { + this.catalog = catalog; + } + + public String getLastUpdaterUserId() { + return lastUpdaterUserId; + } + + public void setLastUpdaterUserId(String lastUpdaterUserId) { + this.lastUpdaterUserId = lastUpdaterUserId; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getItemId() { + return itemId; + } + + public void setItemId(String itemId) { + this.itemId = itemId; + } + + public Integer getCatalogId() { + return catalogId; + } + + public void setCatalogId(Integer catalogId) { + this.catalogId = catalogId; + } + + public String getToscaModelURL() { + return toscaModelURL; + } + + public void setToscaModelURL(String toscaModelURL) { + this.toscaModelURL = toscaModelURL; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getInvariantUUID() { + return invariantUUID; + } + + public void setInvariantUUID(String invariantUUID) { + this.invariantUUID = invariantUUID; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + public String getLastUpdaterFullName() { + return lastUpdaterFullName; + } + + public void setLastUpdaterFullName(String lastUpdaterFullName) { + this.lastUpdaterFullName = lastUpdaterFullName; + } + + public String getToscaResourceName() { + return toscaResourceName; + } + + public void setToscaResourceName(String toscaResourceName) { + this.toscaResourceName = toscaResourceName; + } + + public String getResourceType() { + return resourceType; + } + + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + + public List<Artifact> getArtifacts() { + return artifacts; + } + + public void setArtifacts(List<Artifact> artifacts) { + this.artifacts = artifacts; + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/Model.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/Model.java new file mode 100644 index 0000000..0a251f0 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/Model.java @@ -0,0 +1,65 @@ + +package org.onap.sdc.dcae.composition.restmodels.sdc; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class Model { + + @SerializedName("itemId") + @Expose + private String itemId; + @SerializedName("name") + @Expose + private String name; + @SerializedName("description") + @Expose + private String description; + @SerializedName("id") + @Expose + private String id; + @SerializedName("version") + @Expose + private String version; + + public String getItemId() { + return itemId; + } + + public void setItemId(String itemId) { + this.itemId = itemId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/Resource.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/Resource.java new file mode 100644 index 0000000..48bbb76 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/Resource.java @@ -0,0 +1,24 @@ +package org.onap.sdc.dcae.composition.restmodels.sdc; + +import com.fasterxml.jackson.annotation.JsonInclude; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class Resource extends Asset { + + private String subCategory; + private String resourceType; + + public String getSubCategory() { + return subCategory; + } + public void setSubCategory(String subCategory) { + this.subCategory = subCategory; + } + public String getResourceType() { + return resourceType; + } + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/ResourceDetailed.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/ResourceDetailed.java new file mode 100644 index 0000000..fedb3bb --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/ResourceDetailed.java @@ -0,0 +1,48 @@ +package org.onap.sdc.dcae.composition.restmodels.sdc; + + +import com.fasterxml.jackson.annotation.JsonInclude; + +import java.util.List; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class ResourceDetailed extends Resource { + + private String lastUpdaterFullName; + private String toscaResourceName; + private List<ResourceInstance> resources; + private List<Artifact> artifacts; + private String description; + + public String getLastUpdaterFullName() { + return lastUpdaterFullName; + } + public void setLastUpdaterFullName(String lastUpdaterFullName) { + this.lastUpdaterFullName = lastUpdaterFullName; + } + public String getToscaResourceName() { + return toscaResourceName; + } + public void setToscaResourceName(String toscaResourceName) { + this.toscaResourceName = toscaResourceName; + } + public List<ResourceInstance> getResources() { + return resources; + } + public void setResources(List<ResourceInstance> resources) { + this.resources = resources; + } + public List<Artifact> getArtifacts() { + return artifacts; + } + public void setArtifacts(List<Artifact> artifacts) { + this.artifacts = artifacts; + } + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/ResourceInstance.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/ResourceInstance.java new file mode 100644 index 0000000..3132665 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/ResourceInstance.java @@ -0,0 +1,58 @@ +package org.onap.sdc.dcae.composition.restmodels.sdc; + +import java.util.List; + +public class ResourceInstance { + + private String resourceInstanceName; + private String resourceName; + private String resourceInvariantUUID; + private String resourceVersion; + private String resoucreType; + private String resourceUUID; + private List<Artifact> artifacts; + + public String getResourceInstanceName() { + return resourceInstanceName; + } + public void setResourceInstanceName(String resourceInstanceName) { + this.resourceInstanceName = resourceInstanceName; + } + public String getResourceName() { + return resourceName; + } + public void setResourceName(String resourceName) { + this.resourceName = resourceName; + } + public String getResourceInvariantUUID() { + return resourceInvariantUUID; + } + public void setResourceInvariantUUID(String resourceInvariantUUID) { + this.resourceInvariantUUID = resourceInvariantUUID; + } + public String getResourceVersion() { + return resourceVersion; + } + public void setResourceVersion(String resourceVersion) { + this.resourceVersion = resourceVersion; + } + public String getResoucreType() { + return resoucreType; + } + public void setResoucreType(String resoucreType) { + this.resoucreType = resoucreType; + } + public String getResourceUUID() { + return resourceUUID; + } + public void setResourceUUID(String resourceUUID) { + this.resourceUUID = resourceUUID; + } + public List<Artifact> getArtifacts() { + return artifacts; + } + public void setArtifacts(List<Artifact> artifacts) { + this.artifacts = artifacts; + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/Service.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/Service.java new file mode 100644 index 0000000..49a7aa0 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/Service.java @@ -0,0 +1,17 @@ +package org.onap.sdc.dcae.composition.restmodels.sdc; + +import com.fasterxml.jackson.annotation.JsonInclude; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class Service extends Asset { + + private String distributionStatus; + + public String getDistributionStatus() { + return distributionStatus; + } + public void setDistributionStatus(String distributionStatus) { + this.distributionStatus = distributionStatus; + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/ServiceDetailed.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/ServiceDetailed.java new file mode 100644 index 0000000..3352756 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/sdc/ServiceDetailed.java @@ -0,0 +1,33 @@ +package org.onap.sdc.dcae.composition.restmodels.sdc; + +import com.fasterxml.jackson.annotation.JsonInclude; + +import java.util.List; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class ServiceDetailed extends Service { + + private String lastUpdaterFullName; + private List<ResourceInstance> resources; + private List<Artifact> artifacts; + + public String getLastUpdaterFullName() { + return lastUpdaterFullName; + } + public void setLastUpdaterFullName(String lastUpdaterFullName) { + this.lastUpdaterFullName = lastUpdaterFullName; + } + public List<ResourceInstance> getResources() { + return resources; + } + public void setResources(List<ResourceInstance> resources) { + this.resources = resources; + } + public List<Artifact> getArtifacts() { + return artifacts; + } + public void setArtifacts(List<Artifact> artifacts) { + this.artifacts = artifacts; + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/services/Artifact.java b/src/main/java/org/onap/sdc/dcae/composition/services/Artifact.java new file mode 100644 index 0000000..1b9c469 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/services/Artifact.java @@ -0,0 +1,131 @@ + +package org.onap.sdc.dcae.composition.services; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class Artifact { + + @SerializedName("artifactChecksum") + @Expose + private String artifactChecksum; + @SerializedName("artifactType") + @Expose + private String artifactType; + @SerializedName("artifactUUID") + @Expose + private String artifactUUID; + @SerializedName("artifactVersion") + @Expose + private String artifactVersion; + @SerializedName("artifactName") + @Expose + private String artifactName; + @SerializedName("artifactGroupType") + @Expose + private String artifactGroupType; + @SerializedName("artifactURL") + @Expose + private String artifactURL; + @SerializedName("artifactDescription") + @Expose + private String artifactDescription; + @SerializedName("artifactLabel") + @Expose + private String artifactLabel; + @SerializedName("artifactTimeout") + @Expose + private Integer artifactTimeout; + @SerializedName("generatedFromUUID") + @Expose + private String generatedFromUUID; + + public String getArtifactChecksum() { + return artifactChecksum; + } + + public void setArtifactChecksum(String artifactChecksum) { + this.artifactChecksum = artifactChecksum; + } + + public String getArtifactType() { + return artifactType; + } + + public void setArtifactType(String artifactType) { + this.artifactType = artifactType; + } + + public String getArtifactUUID() { + return artifactUUID; + } + + public void setArtifactUUID(String artifactUUID) { + this.artifactUUID = artifactUUID; + } + + public String getArtifactVersion() { + return artifactVersion; + } + + public void setArtifactVersion(String artifactVersion) { + this.artifactVersion = artifactVersion; + } + + public String getArtifactName() { + return artifactName; + } + + public void setArtifactName(String artifactName) { + this.artifactName = artifactName; + } + + public String getArtifactGroupType() { + return artifactGroupType; + } + + public void setArtifactGroupType(String artifactGroupType) { + this.artifactGroupType = artifactGroupType; + } + + public String getArtifactURL() { + return artifactURL; + } + + public void setArtifactURL(String artifactURL) { + this.artifactURL = artifactURL; + } + + public String getArtifactDescription() { + return artifactDescription; + } + + public void setArtifactDescription(String artifactDescription) { + this.artifactDescription = artifactDescription; + } + + public String getArtifactLabel() { + return artifactLabel; + } + + public void setArtifactLabel(String artifactLabel) { + this.artifactLabel = artifactLabel; + } + + public Integer getArtifactTimeout() { + return artifactTimeout; + } + + public void setArtifactTimeout(Integer artifactTimeout) { + this.artifactTimeout = artifactTimeout; + } + + public String getGeneratedFromUUID() { + return generatedFromUUID; + } + + public void setGeneratedFromUUID(String generatedFromUUID) { + this.generatedFromUUID = generatedFromUUID; + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/services/Model.java b/src/main/java/org/onap/sdc/dcae/composition/services/Model.java new file mode 100644 index 0000000..6e64f56 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/services/Model.java @@ -0,0 +1,65 @@ + +package org.onap.sdc.dcae.composition.services; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class Model { + + @SerializedName("itemId") + @Expose + private String itemId; + @SerializedName("name") + @Expose + private String name; + @SerializedName("description") + @Expose + private String description; + @SerializedName("id") + @Expose + private String id; + @SerializedName("version") + @Expose + private String version; + + public String getItemId() { + return itemId; + } + + public void setItemId(String itemId) { + this.itemId = itemId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/services/Resource.java b/src/main/java/org/onap/sdc/dcae/composition/services/Resource.java new file mode 100644 index 0000000..dd75f49 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/services/Resource.java @@ -0,0 +1,101 @@ + +package org.onap.sdc.dcae.composition.services; + +import java.util.List; +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class Resource { + + @SerializedName("resourceVersion") + @Expose + private String resourceVersion; + @SerializedName("resoucreType") + @Expose + private String resoucreType; + @SerializedName("resourceInvariantUUID") + @Expose + private String resourceInvariantUUID; + @SerializedName("resourceName") + @Expose + private String resourceName; + @SerializedName("resourceInstanceName") + @Expose + private String resourceInstanceName; + @SerializedName("resourceUUID") + @Expose + private String resourceUUID; + @SerializedName("artifacts") + @Expose + private List<Artifact> artifacts = null; + @SerializedName("description") + @Expose + private String description; + + public String getResourceVersion() { + return resourceVersion; + } + + public void setResourceVersion(String resourceVersion) { + this.resourceVersion = resourceVersion; + } + + public String getResoucreType() { + return resoucreType; + } + + public void setResoucreType(String resoucreType) { + this.resoucreType = resoucreType; + } + + public String getResourceInvariantUUID() { + return resourceInvariantUUID; + } + + public void setResourceInvariantUUID(String resourceInvariantUUID) { + this.resourceInvariantUUID = resourceInvariantUUID; + } + + public String getResourceName() { + return resourceName; + } + + public void setResourceName(String resourceName) { + this.resourceName = resourceName; + } + + public String getResourceInstanceName() { + return resourceInstanceName; + } + + public void setResourceInstanceName(String resourceInstanceName) { + this.resourceInstanceName = resourceInstanceName; + } + + public String getResourceUUID() { + return resourceUUID; + } + + public void setResourceUUID(String resourceUUID) { + this.resourceUUID = resourceUUID; + } + + public List<Artifact> getArtifacts() { + return artifacts; + } + + public void setArtifacts(List<Artifact> artifacts) { + this.artifacts = artifacts; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/services/Service.java b/src/main/java/org/onap/sdc/dcae/composition/services/Service.java new file mode 100644 index 0000000..b36856f --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/services/Service.java @@ -0,0 +1,152 @@ + +package org.onap.sdc.dcae.composition.services; + +import java.util.List; +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class Service { + + @SerializedName("lifecycleState") + @Expose + private String lifecycleState; + @SerializedName("toscaModelURL") + @Expose + private String toscaModelURL; + @SerializedName("name") + @Expose + private String name; + @SerializedName("lastUpdaterUserId") + @Expose + private String lastUpdaterUserId; + @SerializedName("distributionStatus") + @Expose + private String distributionStatus; + @SerializedName("resources") + @Expose + private List<Resource> resources = null; + @SerializedName("invariantUUID") + @Expose + private String invariantUUID; + @SerializedName("category") + @Expose + private String category; + @SerializedName("lastUpdaterFullName") + @Expose + private String lastUpdaterFullName; + @SerializedName("uuid") + @Expose + private String uuid; + @SerializedName("version") + @Expose + private String version; + @SerializedName("models") + @Expose + private List<Model> models = null; + + public List<Model> getModels() { + return models; + } + + public void setModels(List<Model> models) { + this.models = models; + } + + public String getLifecycleState() { + return lifecycleState; + } + + public void setLifecycleState(String lifecycleState) { + this.lifecycleState = lifecycleState; + } + + public String getToscaModelURL() { + return toscaModelURL; + } + + public void setToscaModelURL(String toscaModelURL) { + this.toscaModelURL = toscaModelURL; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getLastUpdaterUserId() { + return lastUpdaterUserId; + } + + public void setLastUpdaterUserId(String lastUpdaterUserId) { + this.lastUpdaterUserId = lastUpdaterUserId; + } + + public String getDistributionStatus() { + return distributionStatus; + } + + public void setDistributionStatus(String distributionStatus) { + this.distributionStatus = distributionStatus; + } + + public List<Resource> getResources() { + return resources; + } + + public void setResources(List<Resource> resources) { + this.resources = resources; + } + + public String getInvariantUUID() { + return invariantUUID; + } + + public void setInvariantUUID(String invariantUUID) { + this.invariantUUID = invariantUUID; + } + + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + public String getLastUpdaterFullName() { + return lastUpdaterFullName; + } + + public void setLastUpdaterFullName(String lastUpdaterFullName) { + this.lastUpdaterFullName = lastUpdaterFullName; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public Service(){} + + public Service(String name, String uuid, String version) { + this.name = name; + this.uuid = uuid; + this.version = version; + } + + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/services/ThinService.java b/src/main/java/org/onap/sdc/dcae/composition/services/ThinService.java new file mode 100644 index 0000000..7bfa282 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/services/ThinService.java @@ -0,0 +1,31 @@ +package org.onap.sdc.dcae.composition.services; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class ThinService { + + @SerializedName("name") + @Expose + private String name; + @SerializedName("uuid") + @Expose + private String uuid; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/util/DcaeBeConstants.java b/src/main/java/org/onap/sdc/dcae/composition/util/DcaeBeConstants.java new file mode 100644 index 0000000..8d8e437 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/util/DcaeBeConstants.java @@ -0,0 +1,45 @@ +package org.onap.sdc.dcae.composition.util; + +public class DcaeBeConstants { + public class Health { + public final static String APP_NAME = "DCAE Designer"; + public final static String UP = "UP"; + public final static String DOWN = "DOWN"; + public final static String OK = "OK"; + public final static String BE = "BE"; + public final static String TOSCA_LAB = "TOSCA_LAB"; + } + public class Composition{ + + public class fileNames{ + public final static String EVENT_PROC_BP_YAML = "event_proc_bp.yaml"; + public final static String COMPOSITION_YML = "composition.yml"; + public final static String SVC_REF = "svc_reference.yml"; + public final static String MAPPING_RULE_POSTFIX = "_MappingRules.json"; + } + } + public class Config{ + // keys used to reference values in the system properties file + public static final String ASDC_CATALOG_URL = "asdc_catalog_url"; + public static final String URI = "uri"; + public static final String BLUEPRINTER_URI = "blueprinter_uri"; + public static final String ASDC_ROOTPATH = "asdc_rootPath"; + } + public enum LifecycleStateEnum { + + READY_FOR_CERTIFICATION, + CERTIFICATION_IN_PROGRESS, + CERTIFIED, + NOT_CERTIFIED_CHECKIN, + NOT_CERTIFIED_CHECKOUT; + + public static LifecycleStateEnum findState(String state) { + for (LifecycleStateEnum lifecycleStateEnum : LifecycleStateEnum.values()) { + if (lifecycleStateEnum.name().equals(state)) { + return lifecycleStateEnum; + } + } + return null; + } + } +}
\ No newline at end of file diff --git a/src/main/java/org/onap/sdc/dcae/composition/util/DcaeFeConstants.java b/src/main/java/org/onap/sdc/dcae/composition/util/DcaeFeConstants.java new file mode 100644 index 0000000..4525429 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/util/DcaeFeConstants.java @@ -0,0 +1,11 @@ +package org.onap.sdc.dcae.composition.util; + +public class DcaeFeConstants { + public class Health{ + public final static String APP_NAME = "DCAE Designer"; + public final static String UP = "UP"; + public final static String DOWN = "DOWN"; + public final static String OK = "OK"; + public final static String FE = "FE"; + } +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/util/SystemProperties.java b/src/main/java/org/onap/sdc/dcae/composition/util/SystemProperties.java new file mode 100644 index 0000000..585fe87 --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/util/SystemProperties.java @@ -0,0 +1,68 @@ +package org.onap.sdc.dcae.composition.util; + +import java.util.Properties; + +import org.onap.sdc.common.onaplog.OnapLoggerDebug; +import org.onap.sdc.common.onaplog.OnapLoggerError; +import org.onap.sdc.common.onaplog.Enums.LogLevel; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; +import org.springframework.context.annotation.PropertySources; +import org.springframework.context.annotation.Scope; +import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; + + +/** + * SystemProperties contains a list of constants used throughout portions of the + * application. Populated by Spring from multiple configuration files. + */ +@Configuration +@Component +@PropertySources({ + @PropertySource(value="classpath:application-fe.properties", ignoreResourceNotFound=true), + @PropertySource(value="file:${jetty.base}/config/dcae-be/application.properties", ignoreResourceNotFound=true) +}) +@Scope(value = "singleton") +public class SystemProperties { + private static OnapLoggerDebug debugLogger = OnapLoggerDebug.getInstance(); + + @Autowired + private Environment env; + + private Properties applicationProperties = null; + + public SystemProperties() { + super(); + } + + @javax.annotation.PostConstruct + public void init() { + debugLogger.log(LogLevel.DEBUG, this.getClass().getName(), "****************************************************************************************************************"); + debugLogger.log(LogLevel.DEBUG, this.getClass().getName(), "Configuration: {}", env); + if(applicationProperties == null){ + applicationProperties = new Properties(); + applicationProperties.setProperty(DcaeBeConstants.Config.URI, getVal(env.getProperty(DcaeBeConstants.Config.URI))); + applicationProperties.setProperty(DcaeBeConstants.Config.ASDC_CATALOG_URL, getVal(env.getProperty(DcaeBeConstants.Config.ASDC_CATALOG_URL))+":"+getVal(env.getProperty(DcaeBeConstants.Config.URI))); + applicationProperties.setProperty(DcaeBeConstants.Config.ASDC_ROOTPATH, getVal(env.getProperty(DcaeBeConstants.Config.ASDC_ROOTPATH))); + } + debugLogger.log(LogLevel.DEBUG, this.getClass().getName(), "****************************************************************************************************************"); + } + + private String getVal(String property) { + return property != null ? property : ""; + } + + public final Properties getProperties() { + return applicationProperties; + } + + public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() { + PropertySourcesPlaceholderConfigurer p = new PropertySourcesPlaceholderConfigurer(); + p.setIgnoreResourceNotFound(true); + + return p; + } +} diff --git a/src/main/java/org/onap/sdc/dcae/composition/vfcmt/Vfcmt.java b/src/main/java/org/onap/sdc/dcae/composition/vfcmt/Vfcmt.java new file mode 100644 index 0000000..429db1d --- /dev/null +++ b/src/main/java/org/onap/sdc/dcae/composition/vfcmt/Vfcmt.java @@ -0,0 +1,130 @@ +package org.onap.sdc.dcae.composition.vfcmt; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class Vfcmt { + + @SerializedName("lifecycleState") + @Expose + private String lifecycleState; + @SerializedName("subCategory") + @Expose + private String subCategory; + @SerializedName("name") + @Expose + private String name; + @SerializedName("description") + @Expose + private String description; + @SerializedName("invariantUUID") + @Expose + private String invariantUUID; + @SerializedName("category") + @Expose + private String category; + @SerializedName("uuid") + @Expose + private String uuid; + @SerializedName("version") + @Expose + private String version; + @SerializedName("resourceType") + @Expose + private String resourceType; + @SerializedName("toscaModelURL") + @Expose + private String toscaModelURL; + @SerializedName("lastUpdaterUserId") + @Expose + private String lastUpdaterUserId; + + public String getLifecycleState() { + return lifecycleState; + } + + public void setLifecycleState(String lifecycleState) { + this.lifecycleState = lifecycleState; + } + + public String getSubCategory() { + return subCategory; + } + + public void setSubCategory(String subCategory) { + this.subCategory = subCategory; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getInvariantUUID() { + return invariantUUID; + } + + public void setInvariantUUID(String invariantUUID) { + this.invariantUUID = invariantUUID; + } + + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getResourceType() { + return resourceType; + } + + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + + public String getToscaModelURL() { + return toscaModelURL; + } + + public void setToscaModelURL(String toscaModelURL) { + this.toscaModelURL = toscaModelURL; + } + + public String getLastUpdaterUserId() { + return lastUpdaterUserId; + } + + public void setLastUpdaterUserId(String lastUpdaterUserId) { + this.lastUpdaterUserId = lastUpdaterUserId; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + +}
\ No newline at end of file |