summaryrefslogtreecommitdiffstats
path: root/appc-inbound
diff options
context:
space:
mode:
Diffstat (limited to 'appc-inbound')
-rw-r--r--appc-inbound/appc-design-services/provider/src/main/java/org/onap/appc/design/dbervices/DbResponseProcessor.java10
-rw-r--r--appc-inbound/appc-design-services/provider/src/main/java/org/onap/appc/design/dbervices/DesignDBService.java17
-rw-r--r--appc-inbound/appc-design-services/provider/src/main/java/org/onap/appc/design/dbervices/RequestValidator.java11
-rw-r--r--appc-inbound/appc-design-services/provider/src/main/java/org/onap/appc/design/services/util/DesignServiceConstants.java1
4 files changed, 35 insertions, 4 deletions
diff --git a/appc-inbound/appc-design-services/provider/src/main/java/org/onap/appc/design/dbervices/DbResponseProcessor.java b/appc-inbound/appc-design-services/provider/src/main/java/org/onap/appc/design/dbervices/DbResponseProcessor.java
index a2a9226d1..229e61cb3 100644
--- a/appc-inbound/appc-design-services/provider/src/main/java/org/onap/appc/design/dbervices/DbResponseProcessor.java
+++ b/appc-inbound/appc-design-services/provider/src/main/java/org/onap/appc/design/dbervices/DbResponseProcessor.java
@@ -33,12 +33,15 @@ public class DbResponseProcessor {
private static final EELFLogger log = EELFManager.getInstance().getLogger(DbResponseProcessor.class);
public String parseResponse(String dbresposne, String action) throws Exception {
- log.info("Starting Parsing the response for action : " + action + "\n data " + dbresposne );
+ log.info("Starting Parsing the response for action :[" + action + "]\n data:[" + dbresposne +"]" );
String response ;
switch (action) {
case DesignServiceConstants.GETDESIGNS:
response = getDesignsResponse(dbresposne);
break;
+ case DesignServiceConstants.GETAPPCTIMESTAMPUTC:
+ response = getAppcTimestampResponse(dbresposne);
+ break;
case DesignServiceConstants.ADDINCART:
response = getAddInCartResponse(dbresposne);
break ;
@@ -106,4 +109,9 @@ public class DbResponseProcessor {
return dbresposne;
}
+
+ private String getAppcTimestampResponse(String dbresposne) {
+ log.info("getAppcTimestampResponse:[" + dbresposne +"]" );
+ return dbresposne;
+ }
}
diff --git a/appc-inbound/appc-design-services/provider/src/main/java/org/onap/appc/design/dbervices/DesignDBService.java b/appc-inbound/appc-design-services/provider/src/main/java/org/onap/appc/design/dbervices/DesignDBService.java
index 83ef0f914..f8971255e 100644
--- a/appc-inbound/appc-design-services/provider/src/main/java/org/onap/appc/design/dbervices/DesignDBService.java
+++ b/appc-inbound/appc-design-services/provider/src/main/java/org/onap/appc/design/dbervices/DesignDBService.java
@@ -79,6 +79,9 @@ public class DesignDBService {
case DesignServiceConstants.GETDESIGNS:
response = getDesigns(payload, requestID);
break;
+ case DesignServiceConstants.GETAPPCTIMESTAMPUTC:
+ response = getAppcTimestampUTC( requestID );
+ break;
case DesignServiceConstants.ADDINCART:
response = setInCart(payload, requestID);
break;
@@ -110,6 +113,20 @@ public class DesignDBService {
return response;
}
+ private String getAppcTimestampUTC( String requestID) throws Exception
+ {
+ log.info("Starting getAppcTimestampUTC: requestID:"+ requestID );
+ java.util.TimeZone gmtTZ= java.util.TimeZone.getTimeZone("GMT");
+ java.text.SimpleDateFormat formatter =
+ new java.text.SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" );
+ formatter.setTimeZone( gmtTZ );
+ java.util.Date dateVal= new java.util.Date();
+ log.info("getAppcTimestampUTC: current local Date:["+ dateVal+"]");
+ String timeStr= formatter.format( dateVal );
+ log.info("getAppcTimestampUTC: returning:["+timeStr+"]");
+ return timeStr;
+ }
+
private String setInCart(String payload, String requestID) throws Exception {
ObjectMapper objectMapper = new ObjectMapper();
diff --git a/appc-inbound/appc-design-services/provider/src/main/java/org/onap/appc/design/dbervices/RequestValidator.java b/appc-inbound/appc-design-services/provider/src/main/java/org/onap/appc/design/dbervices/RequestValidator.java
index 8bf063dd8..5278cc7b3 100644
--- a/appc-inbound/appc-design-services/provider/src/main/java/org/onap/appc/design/dbervices/RequestValidator.java
+++ b/appc-inbound/appc-design-services/provider/src/main/java/org/onap/appc/design/dbervices/RequestValidator.java
@@ -30,6 +30,7 @@ import static org.onap.appc.design.services.util.DesignServiceConstants.ARTIFACT
import static org.onap.appc.design.services.util.DesignServiceConstants.ARTIFACT_TYPE;
import static org.onap.appc.design.services.util.DesignServiceConstants.ARTIFACT_VERSOIN;
import static org.onap.appc.design.services.util.DesignServiceConstants.GETARTIFACT;
+import static org.onap.appc.design.services.util.DesignServiceConstants.GETAPPCTIMESTAMPUTC;
import static org.onap.appc.design.services.util.DesignServiceConstants.GETDESIGNS;
import static org.onap.appc.design.services.util.DesignServiceConstants.GETSTATUS;
import static org.onap.appc.design.services.util.DesignServiceConstants.PROTOCOL;
@@ -55,16 +56,20 @@ public class RequestValidator {
}
public static void validate(String action, String payload) throws RequestValidationException, IOException {
- log.info("payload" + payload);
+ log.info("validate: action:" + action );
+ log.info("validate: payload:" + payload);
ObjectMapper objectMapper = new ObjectMapper();
JsonNode payloadObject = objectMapper.readTree(payload);
- log.info("payloadObject" + payloadObject.get(ARTIFACT_CONTENTS));
+ log.info("payloadObject:" + payloadObject.get(ARTIFACT_CONTENTS));
- String errorString;
+ String errorString= null;
switch (action) {
case GETDESIGNS:
errorString = resolveGetDesignsErrorString(payloadObject);
break;
+ case GETAPPCTIMESTAMPUTC:
+ log.info("validate: No payload validation needed for Timestamp.");
+ break;
case GETARTIFACT:
errorString = resolveGetArtifactErrorString(payloadObject);
break;
diff --git a/appc-inbound/appc-design-services/provider/src/main/java/org/onap/appc/design/services/util/DesignServiceConstants.java b/appc-inbound/appc-design-services/provider/src/main/java/org/onap/appc/design/services/util/DesignServiceConstants.java
index 9f311d934..f7208bf03 100644
--- a/appc-inbound/appc-design-services/provider/src/main/java/org/onap/appc/design/services/util/DesignServiceConstants.java
+++ b/appc-inbound/appc-design-services/provider/src/main/java/org/onap/appc/design/services/util/DesignServiceConstants.java
@@ -36,6 +36,7 @@ public class DesignServiceConstants {
public static final String DATA_TYPE_SQL = "SQL";
public static final String GETDESIGNS = "getDesigns";
+ public static final String GETAPPCTIMESTAMPUTC = "getAppcTimestampUTC";
public static final String UPLOADARTIFACTS = "uploadArtifacts";
public static final String VALIDATETEMPLATE = "validateTemplate";
public static final String GETSTATUS = "getStatus";