summaryrefslogtreecommitdiffstats
path: root/appc-sequence-generator
diff options
context:
space:
mode:
authorezhil <ezhrajam@in.ibm.com>2019-01-02 17:30:40 +0530
committerTakamune Cho <takamune.cho@att.com>2019-01-02 19:01:21 +0000
commit34aecca733edd7842139a33f57ea050dffb2f2ab (patch)
treed2916e896d4c6101a4bc086c88126143d766a4d3 /appc-sequence-generator
parent47d1766ddf889c9109f4421d8c52f9135dcc31b0 (diff)
Fixed sonar in SequenceGeneratorDBservices.java
Change-Id: I9931d24771399dedb8c7884d1009d6c3cb84ba16 Issue-ID: APPC-1297 Signed-off-by: ezhil <ezhrajam@in.ibm.com>
Diffstat (limited to 'appc-sequence-generator')
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/onap/appc/seqgen/dbservices/SequenceGeneratorDBServices.java28
1 files changed, 20 insertions, 8 deletions
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/onap/appc/seqgen/dbservices/SequenceGeneratorDBServices.java b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/onap/appc/seqgen/dbservices/SequenceGeneratorDBServices.java
index 8411c2b81..bbf188319 100644
--- a/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/onap/appc/seqgen/dbservices/SequenceGeneratorDBServices.java
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/onap/appc/seqgen/dbservices/SequenceGeneratorDBServices.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
* =============================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -26,7 +28,6 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicException;
import org.onap.ccsdk.sli.core.sli.SvcLogicResource;
import org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource;
import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus;
-import org.onap.ccsdk.sli.core.dblib.DBResourceManager;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
@@ -37,6 +38,10 @@ public class SequenceGeneratorDBServices {
private static SequenceGeneratorDBServices dgGeneralDBService = null;
private final SvcLogicResource serviceLogic;
+ public SequenceGeneratorDBServices() {
+ serviceLogic = new SqlResource();
+ }
+
public static SequenceGeneratorDBServices initialise() {
if (dgGeneralDBService == null) {
dgGeneralDBService = new SequenceGeneratorDBServices();
@@ -44,18 +49,20 @@ public class SequenceGeneratorDBServices {
return dgGeneralDBService;
}
- public SequenceGeneratorDBServices() {
- serviceLogic = new SqlResource();
- }
+
public String getOutputPayloadTemplate(SvcLogicContext localContext) throws SvcLogicException {
String fn = "DBService.getPayloadOutput";
+ String outputPayloadTemplate = "null";
+ String ASDC_ARTIFACTS = "asdc_artifacts";
log.info("Entering getOutputPayloadTemplate()");
QueryStatus status = null;
- if (localContext == null) return null;
+ if (localContext == null) {
+ return null;
+ }
localContext.setAttribute("file_category", "output_payload");
String queryString = "select max(internal_version) as maxInternalVersion, artifact_name as artifactName from "
- + "asdc_artifacts" + " where artifact_name in (select artifact_name from " + "asdc_artifacts"
+ + ASDC_ARTIFACTS + " where artifact_name in (select artifact_name from " + ASDC_ARTIFACTS
+ " where file_category = '" + "payload" + "' )";
log.info(fn + "Query String : " + queryString);
@@ -64,7 +71,7 @@ public class SequenceGeneratorDBServices {
if (status == QueryStatus.FAILURE)
throw new SvcLogicException("Error - while getting output payload template");
- String queryString1 = "select artifact_content from " + "asdc_artifacts"
+ String queryString1 = "select artifact_content from " + ASDC_ARTIFACTS
+ " where artifact_name = $artifactName and internal_version = $maxInternalVersion ";
log.debug(fn + "Query String : " + queryString1);
@@ -72,6 +79,11 @@ public class SequenceGeneratorDBServices {
if (status == QueryStatus.FAILURE)
throw new SvcLogicException("Error - while getting output payload template");
log.debug("Template for the payload data:" + localContext.getAttribute("artifact-content"));
- return localContext != null ? localContext.getAttribute("artifact-content") : null;
+
+ if(localContext != null ){
+ outputPayloadTemplate = localContext.getAttribute("artifact-content");
+
+ }
+ return outputPayloadTemplate;
}
}