Changes to capability check processing 53/18353/2
authorRamya Balaji <rb111y@att.com>
Wed, 11 Oct 2017 19:55:05 +0000 (15:55 -0400)
committerSkip Wonnell <skip@att.com>
Thu, 12 Oct 2017 13:14:15 +0000 (13:14 +0000)
Code changes to ensure processing continues if
capability artifact is not available

Issue-ID:APPC-269
Change-Id: I27663622e56f54f721d40705d842ab30a173519d
Signed-off-by: Ramya Balaji <rb111y@att.com>
appc-config/appc-data-services/provider/src/main/java/org/openecomp/appc/data/services/db/DGGeneralDBService.java
appc-config/appc-data-services/provider/src/main/java/org/openecomp/appc/data/services/node/ConfigResourceNode.java
appc-directed-graph/appc-dgraph/provider/src/main/resources/json/APPC/APPC_DGOrchestrator.json

index 1b63d75..cfb2493 100644 (file)
@@ -34,383 +34,383 @@ import com.att.eelf.configuration.EELFManager;
 
 public class DGGeneralDBService {
 
-       private static final EELFLogger log = EELFManager.getInstance().getLogger(DGGeneralDBService.class);
-       private SvcLogicResource serviceLogic;
-       private static DGGeneralDBService dgGeneralDBService = null;
-
-       public static DGGeneralDBService initialise() {
-               if (dgGeneralDBService == null) {
-                       dgGeneralDBService = new DGGeneralDBService();
-               }
-               return dgGeneralDBService;
-       }
-
-       private DGGeneralDBService() {
-               if (serviceLogic == null) {
-                       serviceLogic = new SqlResource();
-               }
-       }
-
-       public QueryStatus getDeviceProtocolByVnfType(SvcLogicContext ctx, String prefix) throws SvcLogicException {
-               QueryStatus status = null;
-               if (serviceLogic != null && ctx != null) {
-                       String key = "SELECT * FROM DEVICE_INTERFACE_PROTOCOL WHERE vnf_type = $vnf-type ;";
-                       status = serviceLogic.query("SQL", false, null, key, prefix, null, ctx);
-               }
-               return status;
-       }
-
-       public QueryStatus getDeviceAuthenticationByVnfType(SvcLogicContext ctx, String prefix) throws SvcLogicException {
-               QueryStatus status = null;
-               if (serviceLogic != null && ctx != null) {
-                       String key = "SELECT * FROM DEVICE_AUTHENTICATION WHERE vnf_type = $vnf-type ;";
-                       status = serviceLogic.query("SQL", false, null, key, prefix, null, ctx);
-
-               }
-               return status;
-       }
-
-       public QueryStatus getConfigFileReferenceByVnfType(SvcLogicContext ctx, String prefix) throws SvcLogicException {
-               QueryStatus status = null;
-               if (serviceLogic != null && ctx != null) {
-                       String key = "SELECT * FROM CONFIG_FILE_REFERENCE WHERE vnf_type = $vnf-type ;";
-                       status = serviceLogic.query("SQL", false, null, key, prefix, null, ctx);
-               }
-               return status;
-       }
-
-       public QueryStatus getConfigFileReferenceByFileTypeNVnfType(SvcLogicContext ctx, String prefix, String fileType)
-                       throws SvcLogicException {
-               QueryStatus status = null;
-               if (serviceLogic != null && ctx != null) {
-                       String key = "SELECT * FROM CONFIG_FILE_REFERENCE  WHERE file_type = '" + fileType
-                                       + "' and vnf_type = $vnf-type ;";
-                       status = serviceLogic.query("SQL", false, null, key, prefix, null, ctx);
-               }
-               return status;
-       }
-
-       public QueryStatus getTemplate(SvcLogicContext ctx, String prefix, String fileCategory) throws SvcLogicException {
-               QueryStatus status = null;
-               if (serviceLogic != null && ctx != null) {
-                       String key = "SELECT artifact_content file_content , asdc_artifacts_id config_file_id "
-                                       + " FROM ASDC_ARTIFACTS "
-                                       + " WHERE asdc_artifacts_id = ( SELECT MAX(a.asdc_artifacts_id) configfileid  "
-                                       + " FROM ASDC_ARTIFACTS a, ASDC_REFERENCE b " + " WHERE a.artifact_name = b.artifact_name "
-                                       + " AND file_category =  '" + fileCategory + "'" + " AND action =  $request-action "
-                                       + " AND vnf_type =  $vnf-type  " + " AND vnfc_type =   $vnfc-type ) ; ";
-                       status = serviceLogic.query("SQL", false, null, key, prefix, null, ctx);
-               }
-               return status;
-       }
-
-       public QueryStatus getTemplateByVnfTypeNAction(SvcLogicContext ctx, String prefix, String fileCategory)
-                       throws SvcLogicException {
-               QueryStatus status = null;
-               if (serviceLogic != null && ctx != null) {
-                       String key = "SELECT artifact_content file_content , asdc_artifacts_id config_file_id "
-                                       + " FROM ASDC_ARTIFACTS "
-                                       + " WHERE asdc_artifacts_id = (SELECT MAX(a.asdc_artifacts_id) configfileid  "
-                                       + " FROM ASDC_ARTIFACTS a, ASDC_REFERENCE b " + " WHERE a.artifact_name = b.artifact_name "
-                                       + " AND file_category =  '" + fileCategory + "'" + " AND action =  $request-action "
-                                       + " AND vnf_type =  $vnf-type ) ; ";
-
-                       status = serviceLogic.query("SQL", false, null, key, prefix, null, ctx);
-               }
-               return status;
-       }
-
-       public QueryStatus getTemplateByVnfType(SvcLogicContext ctx, String prefix, String fileCategory)
-                       throws SvcLogicException {
-               QueryStatus status = null;
-               if (serviceLogic != null && ctx != null) {
-                       String key = "SELECT artifact_content file_content , asdc_artifacts_id config_file_id "
-                                       + " FROM ASDC_ARTIFACTS "
-                                       + " WHERE asdc_artifacts_id = (SELECT MAX(a.asdc_artifacts_id) configfileid  "
-                                       + " FROM ASDC_ARTIFACTS a, ASDC_REFERENCE b " + " WHERE a.artifact_name = b.artifact_name "
-                                       + " AND file_category =  '" + fileCategory + "'" + " AND vnf_type =  $vnf-type ) ; ";
-
-                       status = serviceLogic.query("SQL", false, null, key, prefix, null, ctx);
-               }
-               return status;
-       }
-
-       public QueryStatus getTemplateByTemplateName(SvcLogicContext ctx, String prefix, String templateName)
-                       throws SvcLogicException {
-               QueryStatus status = null;
-               if (serviceLogic != null && ctx != null) {
-                       String key = "SELECT artifact_content file_content , asdc_artifacts_id config_file_id "
-                                       + " FROM ASDC_ARTIFACTS "
-                                       + " WHERE asdc_artifacts_id = (SELECT MAX(asdc_artifacts_id) configfileid  "
-                                       + " FROM ASDC_ARTIFACTS  " + " WHERE artifact_name = '" + templateName + "' ) ; ";
-
-                       status = serviceLogic.query("SQL", false, null, key, prefix, null, ctx);
-               }
-               return status;
-       }
-
-       public QueryStatus getConfigureActionDGByVnfTypeNAction(SvcLogicContext ctx, String prefix)
-                       throws SvcLogicException {
-               QueryStatus status = null;
-               if (serviceLogic != null && ctx != null) {
-                       String key = "SELECT * " + " FROM CONFIGURE_ACTION_DG "
-                                       + " where vnf_type = $vnf-type and action = $request-action ; ";
-
-                       status = serviceLogic.query("SQL", false, null, key, prefix, null, ctx);
-               }
-               return status;
-       }
-
-       public QueryStatus getConfigureActionDGByVnfType(SvcLogicContext ctx, String prefix) throws SvcLogicException {
-               QueryStatus status = null;
-               if (serviceLogic != null && ctx != null) {
-                       String key = "SELECT * " + " FROM CONFIGURE_ACTION_DG "
-                                       + " where vnf_type = $vnf-type and action IS NULL ; ";
-
-                       status = serviceLogic.query("SQL", false, null, key, prefix, null, ctx);
-               }
-               return status;
-       }
-
-       public QueryStatus getMaxConfigFileId(SvcLogicContext ctx, String prefix, String fileCategory)
-                       throws SvcLogicException {
-               QueryStatus status = null;
-               if (serviceLogic != null && ctx != null) {
-                       String key = "SELECT MAX(config_file_id) configfileid " + " FROM CONFIGFILES " + " WHERE file_category = '"
-                                       + fileCategory + "'" + " AND vnf_id =  $vnf-id  AND vm_name = $vm-name ; ";
-
-                       status = serviceLogic.query("SQL", false, null, key, prefix, null, ctx);
-               }
-               return status;
-       }
-
-       public QueryStatus saveConfigFiles(SvcLogicContext ctx, String prefix) throws SvcLogicException {
-
-               QueryStatus status = null;
-
-               if (serviceLogic != null && ctx != null) {
-                       String key = "INSERT INTO CONFIGFILES " + " SET data_source        = $data-source , "
-                                       + " service_instance_id =  $service-instance-id ," + " action              =   $request-action ,"
-                                       + " vnf_type            =       $vnf-type ," + " vnfc_type           =  $vnfc-type ,"
-                                       + " vnf_id              =   $vnf-id , " + " vnf_name            =   $vnf-name ,"
-                                       + " vm_name            =   $vm-name ," + " file_category                =  $file-category ,"
-                                       + " file_content        =  $file-content ; ";
-
-                       status = serviceLogic.save("SQL", false, false, key, null, prefix, ctx);
-
-               }
-               return status;
-
-       }
-
-       public QueryStatus savePrepareRelationship(SvcLogicContext ctx, String prefix, String fileId, String sdcInd)
-                       throws SvcLogicException {
-
-               QueryStatus status = null;
-               String key = null;
-
-               if (serviceLogic != null && ctx != null) {
-
-                       if ("Y".equals(sdcInd))
-
-                               key = "INSERT INTO PREPARE_FILE_RELATIONSHIP " + " SET service_instance_id =  $service-instance-id , "
-                                               + "   request_id         = $request-id , " + "  asdc_artifacts_id        =  " + fileId + " ;";
-                       else
-                               key = "INSERT INTO PREPARE_FILE_RELATIONSHIP " + " SET service_instance_id =  $service-instance-id , "
-                                               + "   request_id         = $request-id , " + "  config_file_id        =  " + fileId + " ;";
-
-                       status = serviceLogic.save("SQL", false, false, key, null, prefix, ctx);
-
-                       log.info("DGGeneralDBService.savePrepareRelationship()" + ctx.getAttributeKeySet());
-               }
-               return status;
-
-       }
-
-       public void cleanContextPropertyByPrefix(SvcLogicContext ctx, String prefix) {
-               if (ctx != null && ctx.getAttributeKeySet() != null && StringUtils.isNotBlank(prefix)) {
-
-                       Set<String> keySet = ctx.getAttributeKeySet();
-                       for (String key : keySet) {
-                               if (StringUtils.isNotBlank(key) && key.startsWith(prefix = ".")) {
-                                       ctx.getAttributeKeySet().remove(key);
-                               }
-                       }
-               }
-       }
-
-       public QueryStatus saveUploadConfig(SvcLogicContext ctx, String prefix) throws SvcLogicException {
-
-               QueryStatus status = null;
-
-               if (serviceLogic != null && ctx != null) {
-                       String key = "INSERT INTO UPLOAD_CONFIG " + " SET request_id = $request-id , "
-                                       + " action = $request-action , " + " originator_id = $originator-id , " + " vnf_id =  $vnf-id , "
-                                       + " vnf_name = $vnf-name ,  " + " vm_name =  $vm-name ,  "
-                                       + " host_ip_address = $vnf-host-ip-address , " + " vnf_type            =        $vnf-type , "
-                                       + " vnfc_type           =       $vnfc-type , " + " config_indicator             =  'Current' , "
-                                       + " content        =  $tmp.escaped.devicerunningconfig ; ";
-
-                       status = serviceLogic.save("SQL", false, false, key, null, prefix, ctx);
-
-                       log.info("DGGeneralDBService.saveUploadConfig()" + ctx.getAttributeKeySet());
-
-               }
-               return status;
-
-       }
-
-       /*public QueryStatus getMaxUploadConfigFileId(SvcLogicContext ctx, String prefix) throws SvcLogicException {
-               QueryStatus status = null;
-               if (serviceLogic != null && ctx != null) {
-                       String key = "SELECT MAX(upload_config_id) uploadconfigid " + " FROM UPLOAD_CONFIG "
-                                       + " WHERE vnf_id =  $vnf-id  AND vm_name = $vm-name ; ";
-
-                       status = serviceLogic.query("SQL", false, null, key, prefix, null, ctx);
-                       log.info("DGGeneralDBService.getMaxUploadConfigFileId()" + ctx.getAttributeKeySet());
-               }
-               return status;
-       }*/
-
-       public QueryStatus updateUploadConfig(SvcLogicContext ctx, String prefix, int maxId) throws SvcLogicException {
-               QueryStatus status = null;
-               if (serviceLogic != null && ctx != null) {
-                       String key = "UPDATE UPLOAD_CONFIG " + " SET  config_indicator          =  null "
-                                       + " WHERE upload_config_id != " + maxId + " AND config_indicator                =  'Current' "
-                                       + " AND vnf_id = $vnf-id " + " AND vm_name =  $vm-name ; ";
-
-                       status = serviceLogic.save("SQL", false, false, key, null, prefix, ctx);
-
-                       log.info("DGGeneralDBService.updateUploadConfig()" + ctx.getAttributeKeySet());
-
-               }
-               return status;
-
-       }
-
-       
-       public QueryStatus getTemplateByArtifactType(SvcLogicContext ctx, String prefix, String fileCategory, String artifactType)
-                       throws SvcLogicException {
-               QueryStatus status = null;
-               if (serviceLogic != null && ctx != null) {
-                       String key = "SELECT artifact_content file_content , asdc_artifacts_id config_file_id "
-                                       + " FROM ASDC_ARTIFACTS "
-                                       + " WHERE asdc_artifacts_id = (SELECT MAX(a.asdc_artifacts_id) configfileid  "
-                                       + " FROM ASDC_ARTIFACTS a, ASDC_REFERENCE b " + " WHERE a.artifact_name = b.artifact_name "
-                                       + " AND file_category =  '" + fileCategory + "'" + " AND action =  $request-action "
-                                       + " AND artifactType =  '" + artifactType + "'" + " AND vnf_type =  $vnf-type ) ; ";
-
-                       status = serviceLogic.query("SQL", false, null, key, prefix, null, ctx);
-               }
-               return status;
-       }
-       
-       
-       public QueryStatus getConfigFilesByVnfVmNCategory(SvcLogicContext ctx, String prefix, String fileCategory, String vnfId, String vmName)
-                       throws SvcLogicException {
-               QueryStatus status = null;
-               if (serviceLogic != null && ctx != null) {
-                       
-                       String key = "SELECT  file_content ,  config_file_id "
-                                       + " FROM CONFIGFILES "
-                                       + " WHERE config_file_id = ( SELECT MAX(config_file_id) configfileid " + " FROM CONFIGFILES " 
-                                       + " WHERE file_category = '"    + fileCategory + "'" 
-                                       + " AND vnf_id =  '" + vnfId + "'" 
-                                       + " AND vm_name = '" + vmName + "' ) ; ";
-                       
-                       
-                       status = serviceLogic.query("SQL", false, null, key, prefix, null, ctx);
-               }
-               return status;
-       }
-       
-       
-       public QueryStatus getDownloadConfigTemplateByVnf(SvcLogicContext ctx, String prefix)
-                       throws SvcLogicException {
-               QueryStatus status = null;
-               if (serviceLogic != null && ctx != null) {
-                       String key = "SELECT * FROM DOWNLOAD_CONFIG_TEMPLATE  WHERE vnf_type = $vnf-type ; ";
-                       status = serviceLogic.query("SQL", false, null, key, prefix, null, ctx);
-               }
-               return status;
-       }
-       
-       
-       
-       public QueryStatus saveConfigTransactionLog(SvcLogicContext ctx, String prefix) throws SvcLogicException {
-
-               QueryStatus status = null;
-
-               if (serviceLogic != null && ctx != null) {
-                               
-               
-                               String key = "INSERT INTO CONFIG_TRANSACTION_LOG " + " SET request_id = $request-id , "
-                               + " message_type = $log-message-type , "
-                               + " message = $log-message ;";
-
-
-                               status = serviceLogic.save("SQL", false, false, key, null, prefix, ctx);
-
-               
-
-               }
-               return status;
-
-       }
-
-       
-       public QueryStatus getVnfcReferenceByVnfcTypeNAction(SvcLogicContext ctx, String prefix)
-                       throws SvcLogicException {
-               QueryStatus status = null;
-               if (serviceLogic != null && ctx != null) {
-                       
-                       String key = "SELECT  * "
-                                       + " FROM VNFC_REFERENCE "
-                                       + " WHERE vnf_type =  $vnf-type " 
-                                       + " AND vnfc_type = $vnfc-type "
-                                       + " AND action =  $request-action "
-                                       + " ORDER BY vm_instance, vnfc_instance ; ";
-                       
-                       
-                       status = serviceLogic.query("SQL", false, null, key, prefix, null, ctx);
-               }
-               return status;
-       }
-
-       
-       public QueryStatus getVnfcReferenceByVnfTypeNAction(SvcLogicContext ctx, String prefix)
-                       throws SvcLogicException {
-               QueryStatus status = null;
-               if (serviceLogic != null && ctx != null) {
-                       
-                       String key = "SELECT  * "
-                                       + " FROM VNFC_REFERENCE "
-                                       + " WHERE vnf_type =  $vnf-type " 
-                                       + " AND action =  $request-action   "
-                                       + " ORDER BY vm_instance, vnfc_instance ; ";
-                       
-                       status = serviceLogic.query("SQL", false, null, key, prefix, null, ctx);
-               }
-               return status;
-       }
-       
-       
-       public QueryStatus getUploadConfigInfo(SvcLogicContext ctx, String prefix)
-                       throws SvcLogicException {
-               QueryStatus status = null;
-               if (serviceLogic != null && ctx != null) {
-                       
-                       String key = "SELECT  * , UNIX_TIMESTAMP(UPLOAD_DATE) UPLOAD_TIMESTAMP "
-                                       + " FROM UPLOAD_CONFIG "
-                                       + " WHERE upload_config_id = " + 
-                                       "( SELECT MAX(upload_config_id) uploadconfigid " + " FROM UPLOAD_CONFIG "
-                                       + " WHERE vnf_id =  $vnf-id  AND vm_name = $vm-name ) ; ";
-                               
-                       status = serviceLogic.query("SQL", false, null, key, prefix, null, ctx);
-               }
-               return status;
-       }
-        public String getCapability(SvcLogicContext ctx, String vnf_type) throws SvcLogicException {
+    private static final EELFLogger log = EELFManager.getInstance().getLogger(DGGeneralDBService.class);
+    private SvcLogicResource serviceLogic;
+    private static DGGeneralDBService dgGeneralDBService = null;
+
+    public static DGGeneralDBService initialise() {
+        if (dgGeneralDBService == null) {
+            dgGeneralDBService = new DGGeneralDBService();
+        }
+        return dgGeneralDBService;
+    }
+
+    private DGGeneralDBService() {
+        if (serviceLogic == null) {
+            serviceLogic = new SqlResource();
+        }
+    }
+
+    public QueryStatus getDeviceProtocolByVnfType(SvcLogicContext ctx, String prefix) throws SvcLogicException {
+        QueryStatus status = null;
+        if (serviceLogic != null && ctx != null) {
+            String key = "SELECT * FROM DEVICE_INTERFACE_PROTOCOL WHERE vnf_type = $vnf-type ;";
+            status = serviceLogic.query("SQL", false, null, key, prefix, null, ctx);
+        }
+        return status;
+    }
+
+    public QueryStatus getDeviceAuthenticationByVnfType(SvcLogicContext ctx, String prefix) throws SvcLogicException {
+        QueryStatus status = null;
+        if (serviceLogic != null && ctx != null) {
+            String key = "SELECT * FROM DEVICE_AUTHENTICATION WHERE vnf_type = $vnf-type ;";
+            status = serviceLogic.query("SQL", false, null, key, prefix, null, ctx);
+
+        }
+        return status;
+    }
+
+    public QueryStatus getConfigFileReferenceByVnfType(SvcLogicContext ctx, String prefix) throws SvcLogicException {
+        QueryStatus status = null;
+        if (serviceLogic != null && ctx != null) {
+            String key = "SELECT * FROM CONFIG_FILE_REFERENCE WHERE vnf_type = $vnf-type ;";
+            status = serviceLogic.query("SQL", false, null, key, prefix, null, ctx);
+        }
+        return status;
+    }
+
+    public QueryStatus getConfigFileReferenceByFileTypeNVnfType(SvcLogicContext ctx, String prefix, String fileType)
+            throws SvcLogicException {
+        QueryStatus status = null;
+        if (serviceLogic != null && ctx != null) {
+            String key = "SELECT * FROM CONFIG_FILE_REFERENCE  WHERE file_type = '" + fileType
+                    + "' and vnf_type = $vnf-type ;";
+            status = serviceLogic.query("SQL", false, null, key, prefix, null, ctx);
+        }
+        return status;
+    }
+
+    public QueryStatus getTemplate(SvcLogicContext ctx, String prefix, String fileCategory) throws SvcLogicException {
+        QueryStatus status = null;
+        if (serviceLogic != null && ctx != null) {
+            String key = "SELECT artifact_content file_content , asdc_artifacts_id config_file_id "
+                    + " FROM ASDC_ARTIFACTS "
+                    + " WHERE asdc_artifacts_id = ( SELECT MAX(a.asdc_artifacts_id) configfileid  "
+                    + " FROM ASDC_ARTIFACTS a, ASDC_REFERENCE b " + " WHERE a.artifact_name = b.artifact_name "
+                    + " AND file_category =  '" + fileCategory + "'" + " AND action =  $request-action "
+                    + " AND vnf_type =  $vnf-type  " + " AND vnfc_type =   $vnfc-type ) ; ";
+            status = serviceLogic.query("SQL", false, null, key, prefix, null, ctx);
+        }
+        return status;
+    }
+
+    public QueryStatus getTemplateByVnfTypeNAction(SvcLogicContext ctx, String prefix, String fileCategory)
+            throws SvcLogicException {
+        QueryStatus status = null;
+        if (serviceLogic != null && ctx != null) {
+            String key = "SELECT artifact_content file_content , asdc_artifacts_id config_file_id "
+                    + " FROM ASDC_ARTIFACTS "
+                    + " WHERE asdc_artifacts_id = (SELECT MAX(a.asdc_artifacts_id) configfileid  "
+                    + " FROM ASDC_ARTIFACTS a, ASDC_REFERENCE b " + " WHERE a.artifact_name = b.artifact_name "
+                    + " AND file_category =  '" + fileCategory + "'" + " AND action =  $request-action "
+                    + " AND vnf_type =  $vnf-type ) ; ";
+
+            status = serviceLogic.query("SQL", false, null, key, prefix, null, ctx);
+        }
+        return status;
+    }
+
+    public QueryStatus getTemplateByVnfType(SvcLogicContext ctx, String prefix, String fileCategory)
+            throws SvcLogicException {
+        QueryStatus status = null;
+        if (serviceLogic != null && ctx != null) {
+            String key = "SELECT artifact_content file_content , asdc_artifacts_id config_file_id "
+                    + " FROM ASDC_ARTIFACTS "
+                    + " WHERE asdc_artifacts_id = (SELECT MAX(a.asdc_artifacts_id) configfileid  "
+                    + " FROM ASDC_ARTIFACTS a, ASDC_REFERENCE b " + " WHERE a.artifact_name = b.artifact_name "
+                    + " AND file_category =  '" + fileCategory + "'" + " AND vnf_type =  $vnf-type ) ; ";
+
+            status = serviceLogic.query("SQL", false, null, key, prefix, null, ctx);
+        }
+        return status;
+    }
+
+    public QueryStatus getTemplateByTemplateName(SvcLogicContext ctx, String prefix, String templateName)
+            throws SvcLogicException {
+        QueryStatus status = null;
+        if (serviceLogic != null && ctx != null) {
+            String key = "SELECT artifact_content file_content , asdc_artifacts_id config_file_id "
+                    + " FROM ASDC_ARTIFACTS "
+                    + " WHERE asdc_artifacts_id = (SELECT MAX(asdc_artifacts_id) configfileid  "
+                    + " FROM ASDC_ARTIFACTS  " + " WHERE artifact_name = '" + templateName + "' ) ; ";
+
+            status = serviceLogic.query("SQL", false, null, key, prefix, null, ctx);
+        }
+        return status;
+    }
+
+    public QueryStatus getConfigureActionDGByVnfTypeNAction(SvcLogicContext ctx, String prefix)
+            throws SvcLogicException {
+        QueryStatus status = null;
+        if (serviceLogic != null && ctx != null) {
+            String key = "SELECT * " + " FROM CONFIGURE_ACTION_DG "
+                    + " where vnf_type = $vnf-type and action = $request-action ; ";
+
+            status = serviceLogic.query("SQL", false, null, key, prefix, null, ctx);
+        }
+        return status;
+    }
+
+    public QueryStatus getConfigureActionDGByVnfType(SvcLogicContext ctx, String prefix) throws SvcLogicException {
+        QueryStatus status = null;
+        if (serviceLogic != null && ctx != null) {
+            String key = "SELECT * " + " FROM CONFIGURE_ACTION_DG "
+                    + " where vnf_type = $vnf-type and action IS NULL ; ";
+
+            status = serviceLogic.query("SQL", false, null, key, prefix, null, ctx);
+        }
+        return status;
+    }
+
+    public QueryStatus getMaxConfigFileId(SvcLogicContext ctx, String prefix, String fileCategory)
+            throws SvcLogicException {
+        QueryStatus status = null;
+        if (serviceLogic != null && ctx != null) {
+            String key = "SELECT MAX(config_file_id) configfileid " + " FROM CONFIGFILES " + " WHERE file_category = '"
+                    + fileCategory + "'" + " AND vnf_id =  $vnf-id  AND vm_name = $vm-name ; ";
+
+            status = serviceLogic.query("SQL", false, null, key, prefix, null, ctx);
+        }
+        return status;
+    }
+
+    public QueryStatus saveConfigFiles(SvcLogicContext ctx, String prefix) throws SvcLogicException {
+
+        QueryStatus status = null;
+
+        if (serviceLogic != null && ctx != null) {
+            String key = "INSERT INTO CONFIGFILES " + " SET data_source        = $data-source , "
+                    + " service_instance_id =  $service-instance-id ," + " action              =   $request-action ,"
+                    + " vnf_type            =     $vnf-type ," + " vnfc_type           =     $vnfc-type ,"
+                    + " vnf_id              =   $vnf-id , " + " vnf_name            =   $vnf-name ,"
+                    + " vm_name            =   $vm-name ," + " file_category         =  $file-category ,"
+                    + " file_content        =  $file-content ; ";
+
+            status = serviceLogic.save("SQL", false, false, key, null, prefix, ctx);
+
+        }
+        return status;
+
+    }
+
+    public QueryStatus savePrepareRelationship(SvcLogicContext ctx, String prefix, String fileId, String sdcInd)
+            throws SvcLogicException {
+
+        QueryStatus status = null;
+        String key = null;
+
+        if (serviceLogic != null && ctx != null) {
+
+            if ("Y".equals(sdcInd))
+
+                key = "INSERT INTO PREPARE_FILE_RELATIONSHIP " + " SET service_instance_id =  $service-instance-id , "
+                        + "   request_id         = $request-id , " + "  asdc_artifacts_id        =  " + fileId + " ;";
+            else
+                key = "INSERT INTO PREPARE_FILE_RELATIONSHIP " + " SET service_instance_id =  $service-instance-id , "
+                        + "   request_id         = $request-id , " + "  config_file_id        =  " + fileId + " ;";
+
+            status = serviceLogic.save("SQL", false, false, key, null, prefix, ctx);
+
+            log.info("DGGeneralDBService.savePrepareRelationship()" + ctx.getAttributeKeySet());
+        }
+        return status;
+
+    }
+
+    public void cleanContextPropertyByPrefix(SvcLogicContext ctx, String prefix) {
+        if (ctx != null && ctx.getAttributeKeySet() != null && StringUtils.isNotBlank(prefix)) {
+
+            Set<String> keySet = ctx.getAttributeKeySet();
+            for (String key : keySet) {
+                if (StringUtils.isNotBlank(key) && key.startsWith(prefix = ".")) {
+                    ctx.getAttributeKeySet().remove(key);
+                }
+            }
+        }
+    }
+
+    public QueryStatus saveUploadConfig(SvcLogicContext ctx, String prefix) throws SvcLogicException {
+
+        QueryStatus status = null;
+
+        if (serviceLogic != null && ctx != null) {
+            String key = "INSERT INTO UPLOAD_CONFIG " + " SET request_id = $request-id , "
+                    + " action = $request-action , " + " originator_id = $originator-id , " + " vnf_id =  $vnf-id , "
+                    + " vnf_name = $vnf-name ,  " + " vm_name =  $vm-name ,  "
+                    + " host_ip_address = $vnf-host-ip-address , " + " vnf_type            =     $vnf-type , "
+                    + " vnfc_type           =     $vnfc-type , " + " config_indicator         =  'Current' , "
+                    + " content        =  $tmp.escaped.devicerunningconfig ; ";
+
+            status = serviceLogic.save("SQL", false, false, key, null, prefix, ctx);
+
+            log.info("DGGeneralDBService.saveUploadConfig()" + ctx.getAttributeKeySet());
+
+        }
+        return status;
+
+    }
+
+    /*public QueryStatus getMaxUploadConfigFileId(SvcLogicContext ctx, String prefix) throws SvcLogicException {
+        QueryStatus status = null;
+        if (serviceLogic != null && ctx != null) {
+            String key = "SELECT MAX(upload_config_id) uploadconfigid " + " FROM UPLOAD_CONFIG "
+                    + " WHERE vnf_id =  $vnf-id  AND vm_name = $vm-name ; ";
+
+            status = serviceLogic.query("SQL", false, null, key, prefix, null, ctx);
+            log.info("DGGeneralDBService.getMaxUploadConfigFileId()" + ctx.getAttributeKeySet());
+        }
+        return status;
+    }*/
+
+    public QueryStatus updateUploadConfig(SvcLogicContext ctx, String prefix, int maxId) throws SvcLogicException {
+        QueryStatus status = null;
+        if (serviceLogic != null && ctx != null) {
+            String key = "UPDATE UPLOAD_CONFIG " + " SET  config_indicator         =  null "
+                    + " WHERE upload_config_id != " + maxId + " AND config_indicator         =  'Current' "
+                    + " AND vnf_id = $vnf-id " + " AND vm_name =  $vm-name ; ";
+
+            status = serviceLogic.save("SQL", false, false, key, null, prefix, ctx);
+
+            log.info("DGGeneralDBService.updateUploadConfig()" + ctx.getAttributeKeySet());
+
+        }
+        return status;
+
+    }
+
+    
+    public QueryStatus getTemplateByArtifactType(SvcLogicContext ctx, String prefix, String fileCategory, String artifactType)
+            throws SvcLogicException {
+        QueryStatus status = null;
+        if (serviceLogic != null && ctx != null) {
+            String key = "SELECT artifact_content file_content , asdc_artifacts_id config_file_id "
+                    + " FROM ASDC_ARTIFACTS "
+                    + " WHERE asdc_artifacts_id = (SELECT MAX(a.asdc_artifacts_id) configfileid  "
+                    + " FROM ASDC_ARTIFACTS a, ASDC_REFERENCE b " + " WHERE a.artifact_name = b.artifact_name "
+                    + " AND file_category =  '" + fileCategory + "'" + " AND action =  $request-action "
+                    + " AND artifactType =  '" + artifactType + "'"    + " AND vnf_type =  $vnf-type ) ; ";
+
+            status = serviceLogic.query("SQL", false, null, key, prefix, null, ctx);
+        }
+        return status;
+    }
+    
+    
+    public QueryStatus getConfigFilesByVnfVmNCategory(SvcLogicContext ctx, String prefix, String fileCategory, String vnfId, String vmName)
+            throws SvcLogicException {
+        QueryStatus status = null;
+        if (serviceLogic != null && ctx != null) {
+            
+            String key = "SELECT  file_content ,  config_file_id "
+                    + " FROM CONFIGFILES "
+                    + " WHERE config_file_id = ( SELECT MAX(config_file_id) configfileid " + " FROM CONFIGFILES " 
+                    + " WHERE file_category = '"    + fileCategory + "'" 
+                    + " AND vnf_id =  '" + vnfId + "'" 
+                    + " AND vm_name = '" + vmName + "' ) ; ";
+            
+            
+            status = serviceLogic.query("SQL", false, null, key, prefix, null, ctx);
+        }
+        return status;
+    }
+    
+    
+    public QueryStatus getDownloadConfigTemplateByVnf(SvcLogicContext ctx, String prefix)
+            throws SvcLogicException {
+        QueryStatus status = null;
+        if (serviceLogic != null && ctx != null) {
+            String key = "SELECT * FROM DOWNLOAD_CONFIG_TEMPLATE  WHERE vnf_type = $vnf-type ; ";
+            status = serviceLogic.query("SQL", false, null, key, prefix, null, ctx);
+        }
+        return status;
+    }
+    
+    
+    
+    public QueryStatus saveConfigTransactionLog(SvcLogicContext ctx, String prefix) throws SvcLogicException {
+
+        QueryStatus status = null;
+
+        if (serviceLogic != null && ctx != null) {
+                
+        
+                String key = "INSERT INTO CONFIG_TRANSACTION_LOG " + " SET request_id = $request-id , "
+                + " message_type = $log-message-type , "
+                + " message = $log-message ;";
+
+
+                status = serviceLogic.save("SQL", false, false, key, null, prefix, ctx);
+
+        
+
+        }
+        return status;
+
+    }
+
+    
+    public QueryStatus getVnfcReferenceByVnfcTypeNAction(SvcLogicContext ctx, String prefix)
+            throws SvcLogicException {
+        QueryStatus status = null;
+        if (serviceLogic != null && ctx != null) {
+            
+            String key = "SELECT  * "
+                    + " FROM VNFC_REFERENCE "
+                    + " WHERE vnf_type =  $vnf-type " 
+                    + " AND vnfc_type = $vnfc-type "
+                    + " AND action =  $request-action "
+                    + " ORDER BY vm_instance, vnfc_instance ; ";
+            
+            
+            status = serviceLogic.query("SQL", false, null, key, prefix, null, ctx);
+        }
+        return status;
+    }
+
+    
+    public QueryStatus getVnfcReferenceByVnfTypeNAction(SvcLogicContext ctx, String prefix)
+            throws SvcLogicException {
+        QueryStatus status = null;
+        if (serviceLogic != null && ctx != null) {
+            
+            String key = "SELECT  * "
+                    + " FROM VNFC_REFERENCE "
+                    + " WHERE vnf_type =  $vnf-type " 
+                    + " AND action =  $request-action   "
+                    + " ORDER BY vm_instance, vnfc_instance ; ";
+            
+            status = serviceLogic.query("SQL", false, null, key, prefix, null, ctx);
+        }
+        return status;
+    }
+    
+    
+    public QueryStatus getUploadConfigInfo(SvcLogicContext ctx, String prefix)
+            throws SvcLogicException {
+        QueryStatus status = null;
+        if (serviceLogic != null && ctx != null) {
+            
+            String key = "SELECT  * , UNIX_TIMESTAMP(UPLOAD_DATE) UPLOAD_TIMESTAMP "
+                    + " FROM UPLOAD_CONFIG "
+                    + " WHERE upload_config_id = " + 
+                    "( SELECT MAX(upload_config_id) uploadconfigid " + " FROM UPLOAD_CONFIG "
+                    + " WHERE vnf_id =  $vnf-id  AND vm_name = $vm-name ) ; ";
+                
+            status = serviceLogic.query("SQL", false, null, key, prefix, null, ctx);
+        }
+        return status;
+    }
+     public String getCapability(SvcLogicContext ctx, String vnf_type) throws SvcLogicException {
 
          //{"capabilities":{"vnfc":[],"vm":[],"vf-module":[],"vnf":["ConfigureTest","ConfigModify","HealthCheck"]}}
          String fn = "getCapability ";
@@ -433,8 +433,11 @@ public class DGGeneralDBService {
 
                  log.debug(fn + "Query String : " + queryString1);
                  status = serviceLogic.query("SQL", false, null, queryString1, null, null, localContext);
+                 if (status.toString().equals("NOT_FOUND"))
+                     return null;
+
                  if(status.toString().equals("FAILURE"))
-                         throw new SvcLogicException("Error - while getting capabilitiesData ");
+                     throw new SvcLogicException("Error - while getting capabilitiesData ");
          }
 
          return localContext.getAttribute("artifact-content");
index f59a887..f389ff8 100644 (file)
@@ -40,718 +40,687 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus;
 
 public class ConfigResourceNode implements SvcLogicJavaPlugin {
 
-       private static final EELFLogger log = EELFManager.getInstance().getLogger(ConfigResourceNode.class);
+    private static final EELFLogger log = EELFManager.getInstance().getLogger(ConfigResourceNode.class);
 
-       public void getConfigFileReference(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+    public void getConfigFileReference(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
 
-               log.info("Received getConfigFiles call with params : " + inParams);
+        log.info("Received getConfigFiles call with params : " + inParams);
 
-               String responsePrefix = inParams.get(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX);
+        String responsePrefix = inParams.get(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX);
 
-               try {
+        try {
 
-                       responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
-                       DGGeneralDBService db = DGGeneralDBService.initialise();
-                       QueryStatus status = db.getConfigFileReferenceByFileTypeNVnfType(ctx, "configfilereference-deviceconfig",
-                                       "device_configuration");
+            responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
+            DGGeneralDBService db = DGGeneralDBService.initialise();
+            QueryStatus status = db.getConfigFileReferenceByFileTypeNVnfType(ctx, "configfilereference-deviceconfig",
+                    "device_configuration");
 
-                       if (status == QueryStatus.NOT_FOUND || status == QueryStatus.FAILURE)
-                               throw new Exception("Unable to Read ConfigFileReference:device-configuration");
+            if (status == QueryStatus.NOT_FOUND || status == QueryStatus.FAILURE)
+                throw new Exception("Unable to Read ConfigFileReference:device-configuration");
 
-                       status = db.getConfigFileReferenceByFileTypeNVnfType(ctx, "configfilereference-success",
-                                       "configuration_success");
+            status = db.getConfigFileReferenceByFileTypeNVnfType(ctx, "configfilereference-success",
+                    "configuration_success");
 
-                       if (status == QueryStatus.NOT_FOUND || status == QueryStatus.FAILURE)
-                               throw new Exception("Unable to Read ConfigFileReference:configuration_success");
+            if (status == QueryStatus.NOT_FOUND || status == QueryStatus.FAILURE)
+                throw new Exception("Unable to Read ConfigFileReference:configuration_success");
 
-                       status = db.getConfigFileReferenceByFileTypeNVnfType(ctx, "configfilereference-failure",
-                                       "configuration_error");
+            status = db.getConfigFileReferenceByFileTypeNVnfType(ctx, "configfilereference-failure",
+                    "configuration_error");
 
-                       if (status == QueryStatus.NOT_FOUND || status == QueryStatus.FAILURE)
-                               throw new Exception("Unable to Read ConfigFileReference:configuration_error");
+            if (status == QueryStatus.NOT_FOUND || status == QueryStatus.FAILURE)
+                throw new Exception("Unable to Read ConfigFileReference:configuration_error");
 
-                       status = db.getConfigFileReferenceByFileTypeNVnfType(ctx, "configfilereference-log", "log");
+            status = db.getConfigFileReferenceByFileTypeNVnfType(ctx, "configfilereference-log", "log");
 
-                       if (status == QueryStatus.NOT_FOUND || status == QueryStatus.FAILURE)
-                               throw new Exception("Unable to Read ConfigFileReference:configuration_log");
+            if (status == QueryStatus.NOT_FOUND || status == QueryStatus.FAILURE)
+                throw new Exception("Unable to Read ConfigFileReference:configuration_log");
 
 
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
-                                       AppcDataServiceConstant.OUTPUT_STATUS_SUCCESS);
-                       log.info("GetConfigFileReference Successful ");
-               } catch (Exception e) {
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
-                                       AppcDataServiceConstant.OUTPUT_STATUS_FAILURE);
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
-                       log.error("Failed in GetConfigFileReference " + e.getMessage());
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
+                    AppcDataServiceConstant.OUTPUT_STATUS_SUCCESS);
+            log.info("GetConfigFileReference Successful ");
+        } catch (Exception e) {
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
+                    AppcDataServiceConstant.OUTPUT_STATUS_FAILURE);
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
+            log.error("Failed in GetConfigFileReference " + e.getMessage());
 
-                       throw new SvcLogicException(e.getMessage());
-               }
-       }
+            throw new SvcLogicException(e.getMessage());
+        }
+    }
 
-       public void getCommonConfigInfo(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+    public void getCommonConfigInfo(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
 
-               log.info("Received getDeviceInfo call with params : " + inParams);
+        log.info("Received getDeviceInfo call with params : " + inParams);
 
-               String responsePrefix = inParams.get(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX);
+        String responsePrefix = inParams.get(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX);
 
-               try {
+        try {
 
-                       responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
-                       DGGeneralDBService db = DGGeneralDBService.initialise();
-                       QueryStatus status = db.getDeviceAuthenticationByVnfType(ctx, "device-authentication");
+            responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
+            DGGeneralDBService db = DGGeneralDBService.initialise();
+            QueryStatus status = db.getDeviceAuthenticationByVnfType(ctx, "device-authentication");
 
-                       if (status == QueryStatus.NOT_FOUND || status == QueryStatus.FAILURE)
-                               throw new Exception("Unable to Read device_authentication");
+            if (status == QueryStatus.NOT_FOUND || status == QueryStatus.FAILURE)
+                throw new Exception("Unable to Read device_authentication");
 
-                       status = db.getDeviceProtocolByVnfType(ctx, "tmp.deviceinterfaceprotocol");
+            status = db.getDeviceProtocolByVnfType(ctx, "tmp.deviceinterfaceprotocol");
 
-                       if (status == QueryStatus.NOT_FOUND || status == QueryStatus.FAILURE)
-                               throw new Exception("Unable to Read device_interface_protocol");
+            if (status == QueryStatus.NOT_FOUND || status == QueryStatus.FAILURE)
+                throw new Exception("Unable to Read device_interface_protocol");
 
-                       status = db.getConfigureActionDGByVnfTypeNAction(ctx, "tmp.configureactiondg");
-                       if (status == QueryStatus.FAILURE)
-                               throw new Exception("Unable to Read configure_action_dg");
+            status = db.getConfigureActionDGByVnfTypeNAction(ctx, "tmp.configureactiondg");
+            if (status == QueryStatus.FAILURE)
+                throw new Exception("Unable to Read configure_action_dg");
 
-                       if (status == QueryStatus.NOT_FOUND) {
-                               status = db.getConfigureActionDGByVnfType(ctx, "tmp.configureactiondg");
+            if (status == QueryStatus.NOT_FOUND) {
+                status = db.getConfigureActionDGByVnfType(ctx, "tmp.configureactiondg");
 
-                               if (status == QueryStatus.NOT_FOUND || status == QueryStatus.FAILURE)
-                                       throw new Exception("Unable to Read configure_action_dg");
-                       }
+                if (status == QueryStatus.NOT_FOUND || status == QueryStatus.FAILURE)
+                    throw new Exception("Unable to Read configure_action_dg");
+            }
 
 
 
 
 
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
-                                       AppcDataServiceConstant.OUTPUT_STATUS_SUCCESS);
-                       log.info("getCommonConfigInfo Successful ");
-               } catch (Exception e) {
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
-                                       AppcDataServiceConstant.OUTPUT_STATUS_FAILURE);
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
-                       log.error("Failed in getCommonConfigInfo " + e.getMessage());
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
+                    AppcDataServiceConstant.OUTPUT_STATUS_SUCCESS);
+            log.info("getCommonConfigInfo Successful ");
+        } catch (Exception e) {
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
+                    AppcDataServiceConstant.OUTPUT_STATUS_FAILURE);
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
+            log.error("Failed in getCommonConfigInfo " + e.getMessage());
 
-                       throw new SvcLogicException(e.getMessage());
-               }
-       }
+            throw new SvcLogicException(e.getMessage());
+        }
+    }
 
 
-       // fileCategory Can be  config_template, parameter_definitions, parameter_yang
-       public void getTemplate(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+    // fileCategory Can be  config_template, parameter_definitions, parameter_yang
+    public void getTemplate(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
 
-               log.info("Received getTemplate call with params : " + inParams);
+        log.info("Received getTemplate call with params : " + inParams);
 
 
-               String responsePrefix = inParams.get(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX);
-               String fileCategory = inParams.get(AppcDataServiceConstant.INPUT_PARAM_FILE_CATEGORY);
-               String templateName = ctx.getAttribute("template-name");
-               QueryStatus status = null;
-               String responsePrefix1 = "";
+        String responsePrefix = inParams.get(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX);
+        String fileCategory = inParams.get(AppcDataServiceConstant.INPUT_PARAM_FILE_CATEGORY);
+        String templateName = ctx.getAttribute("template-name");
+        QueryStatus status = null;
+        String responsePrefix1 = "";
 
-               try {
+        try {
 
-                       responsePrefix1 = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
-                       log.info("RESPONSEPREFIX : " + responsePrefix);
-                       log.info("RESPONSEPREFIX1 : " + responsePrefix1);
+            responsePrefix1 = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
+            log.info("RESPONSEPREFIX : " + responsePrefix);
+            log.info("RESPONSEPREFIX1 : " + responsePrefix1);
 
-                       DGGeneralDBService db = DGGeneralDBService.initialise();
+            DGGeneralDBService db = DGGeneralDBService.initialise();
 
-                       if (StringUtils.isBlank(templateName)) {
+            if (StringUtils.isBlank(templateName)) {
 
-                               //if ( !StringUtils.isBlank(ctx.getAttribute("vnfc-type"))) {
+                //if ( !StringUtils.isBlank(ctx.getAttribute("vnfc-type"))) {
 
 
-                               status = db.getTemplate(ctx, responsePrefix, fileCategory);
-                               if (status == QueryStatus.FAILURE)
-                                       throw new Exception("Unable to Read " + fileCategory );
-                               //}
+                status = db.getTemplate(ctx, responsePrefix, fileCategory);
+                if (status == QueryStatus.FAILURE)
+                    throw new Exception("Unable to Read " + fileCategory );
+                //}
 
-                               if (status == QueryStatus.NOT_FOUND) {
+                if (status == QueryStatus.NOT_FOUND) {
 
 
-                                       status = db.getTemplateByVnfTypeNAction(ctx, responsePrefix, fileCategory);
+                    status = db.getTemplateByVnfTypeNAction(ctx, responsePrefix, fileCategory);
 
-                                       if (status == QueryStatus.FAILURE)
-                                               throw new Exception("Unable to Read " + fileCategory );
+                    if (status == QueryStatus.FAILURE)
+                        throw new Exception("Unable to Read " + fileCategory );
 
-                                       if (status == QueryStatus.NOT_FOUND) {
+                    if (status == QueryStatus.NOT_FOUND) {
 
-                                               //status = db.getTemplateByVnfType(ctx, responsePrefix, fileCategory);
+                        //status = db.getTemplateByVnfType(ctx, responsePrefix, fileCategory);
 
-                                               //if (status == QueryStatus.NOT_FOUND || status == QueryStatus.FAILURE)
-                                                       throw new Exception("Unable to Read " + fileCategory );
-                                       }
-                               }
-                       } else {
+                        //if (status == QueryStatus.NOT_FOUND || status == QueryStatus.FAILURE)
+                            throw new Exception("Unable to Read " + fileCategory );
+                    }
+                }
+            } else {
 
-                               status = db.getTemplateByTemplateName(ctx, responsePrefix, templateName);
+                status = db.getTemplateByTemplateName(ctx, responsePrefix, templateName);
 
-                               if (status == QueryStatus.NOT_FOUND || status == QueryStatus.FAILURE)
-                                       throw new Exception("Unable to Read " + fileCategory + " template");
-                       }
+                if (status == QueryStatus.NOT_FOUND || status == QueryStatus.FAILURE)
+                    throw new Exception("Unable to Read " + fileCategory + " template");
+            }
 
 
-                       ctx.setAttribute(responsePrefix1 + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
-                                       AppcDataServiceConstant.OUTPUT_STATUS_SUCCESS);
-                       log.info("GetTemplate Successful ");
-               } catch (Exception e) {
-                       ctx.setAttribute(responsePrefix1 + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
-                                       AppcDataServiceConstant.OUTPUT_STATUS_FAILURE);
-                       ctx.setAttribute(responsePrefix1 + AppcDataServiceConstant.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
-                       log.error("Failed in getTemplate " + e.getMessage());
+            ctx.setAttribute(responsePrefix1 + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
+                    AppcDataServiceConstant.OUTPUT_STATUS_SUCCESS);
+            log.info("GetTemplate Successful ");
+        } catch (Exception e) {
+            ctx.setAttribute(responsePrefix1 + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
+                    AppcDataServiceConstant.OUTPUT_STATUS_FAILURE);
+            ctx.setAttribute(responsePrefix1 + AppcDataServiceConstant.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
+            log.error("Failed in getTemplate " + e.getMessage());
 
-                       throw new SvcLogicException(e.getMessage());
-               }
-       }
+            throw new SvcLogicException(e.getMessage());
+        }
+    }
 
-       public void saveConfigFiles(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+    public void saveConfigFiles(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
 
-               log.info("Received saveConfigFiles call with params : " + inParams);
+        log.info("Received saveConfigFiles call with params : " + inParams);
 
-               String responsePrefix = inParams.get(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX);
+        String responsePrefix = inParams.get(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX);
 
-               try {
+        try {
 
-                       responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
-                       DGGeneralDBService db = DGGeneralDBService.initialise();
-                       QueryStatus status = db.saveConfigFiles(ctx, "tmp.configFiles");
+            responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
+            DGGeneralDBService db = DGGeneralDBService.initialise();
+            QueryStatus status = db.saveConfigFiles(ctx, "tmp.configFiles");
 
-                       if (status == QueryStatus.FAILURE)
-                               throw new Exception("Unable to Save " + ctx.getAttribute("file-category") + " in configfiles");
+            if (status == QueryStatus.FAILURE)
+                throw new Exception("Unable to Save " + ctx.getAttribute("file-category") + " in configfiles");
 
-                       status = db.getMaxConfigFileId(ctx, "tmp.configfilesmax", ctx.getAttribute("file-category"));
+            status = db.getMaxConfigFileId(ctx, "tmp.configfilesmax", ctx.getAttribute("file-category"));
 
-                       if (status == QueryStatus.NOT_FOUND || status == QueryStatus.FAILURE)
-                               throw new Exception("Unable to get " + ctx.getAttribute("file-category") + " from configfiles");
+            if (status == QueryStatus.NOT_FOUND || status == QueryStatus.FAILURE)
+                throw new Exception("Unable to get " + ctx.getAttribute("file-category") + " from configfiles");
 
-                       status = db.savePrepareRelationship(ctx, "tmp.preparerel",
-                                       ctx.getAttribute("tmp.configfilesmax.configfileid"), "N");
-                       if (status == QueryStatus.FAILURE)
-                               throw new Exception("Unable to save prepare_relationship");
+            status = db.savePrepareRelationship(ctx, "tmp.preparerel",
+                    ctx.getAttribute("tmp.configfilesmax.configfileid"), "N");
+            if (status == QueryStatus.FAILURE)
+                throw new Exception("Unable to save prepare_relationship");
 
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
-                                       AppcDataServiceConstant.OUTPUT_STATUS_SUCCESS);
-                       log.info("saveConfigFiles Successful ");
-               } catch (Exception e) {
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
-                                       AppcDataServiceConstant.OUTPUT_STATUS_FAILURE);
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
-                       log.error("Failed in saveConfigFiles " + e.getMessage());
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
+                    AppcDataServiceConstant.OUTPUT_STATUS_SUCCESS);
+            log.info("saveConfigFiles Successful ");
+        } catch (Exception e) {
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
+                    AppcDataServiceConstant.OUTPUT_STATUS_FAILURE);
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
+            log.error("Failed in saveConfigFiles " + e.getMessage());
 
-                       throw new SvcLogicException(e.getMessage());
-               }
-       }
+            throw new SvcLogicException(e.getMessage());
+        }
+    }
 
-       public void updateUploadConfig(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+    public void updateUploadConfig(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
 
-               log.info("Received updateUploadConfig call with params : " + inParams);
+        log.info("Received updateUploadConfig call with params : " + inParams);
 
-               String responsePrefix = inParams.get(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX);
+        String responsePrefix = inParams.get(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX);
 
-               try {
+        try {
 
-                       responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
-                       DGGeneralDBService db = DGGeneralDBService.initialise();
+            responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
+            DGGeneralDBService db = DGGeneralDBService.initialise();
 
-                       ctx.setAttribute("tmp.escaped.devicerunningconfig",
-                                       EscapeUtils.escapeSql(ctx.getAttribute("device-running-config")));
+            ctx.setAttribute("tmp.escaped.devicerunningconfig",
+                    EscapeUtils.escapeSql(ctx.getAttribute("device-running-config")));
 
-                       QueryStatus status = db.saveUploadConfig(ctx, "tmp.uploadConfig");
+            QueryStatus status = db.saveUploadConfig(ctx, "tmp.uploadConfig");
 
-                       if (status == QueryStatus.FAILURE)
-                               throw new Exception("Unable to Save configuration in upload_config");
+            if (status == QueryStatus.FAILURE)
+                throw new Exception("Unable to Save configuration in upload_config");
 
-                       /*status = db.getMaxUploadConfigFileId(ctx, "tmp.uploadconfigmax");
+            /*status = db.getMaxUploadConfigFileId(ctx, "tmp.uploadconfigmax");
 
-                       if (status == QueryStatus.NOT_FOUND || status == QueryStatus.FAILURE)
-                               throw new Exception("Unable to get record from upload_config");
+            if (status == QueryStatus.NOT_FOUND || status == QueryStatus.FAILURE)
+                throw new Exception("Unable to get record from upload_config");
 
-                       status = db.updateUploadConfig(ctx, "tmp.uploadConfig",
-                                       Integer.parseInt(ctx.getAttribute("tmp.uploadconfigmax.uploadconfigid")));
-                       if (status == QueryStatus.FAILURE)
-                               throw new Exception("Unable to upload upload_config");*/
+            status = db.updateUploadConfig(ctx, "tmp.uploadConfig",
+                    Integer.parseInt(ctx.getAttribute("tmp.uploadconfigmax.uploadconfigid")));
+            if (status == QueryStatus.FAILURE)
+                throw new Exception("Unable to upload upload_config");*/
 
-                       status = db.getUploadConfigInfo(ctx, "tmp.uploadConfigInfo");
+            status = db.getUploadConfigInfo(ctx, "tmp.uploadConfigInfo");
 
-                       if (status == QueryStatus.NOT_FOUND || status == QueryStatus.FAILURE)
-                               throw new Exception("Unable to get record from upload_config");
+            if (status == QueryStatus.NOT_FOUND || status == QueryStatus.FAILURE)
+                throw new Exception("Unable to get record from upload_config");
 
-                       status = db.updateUploadConfig(ctx, "tmp.uploadConfig",
-                                       Integer.parseInt(ctx.getAttribute("tmp.uploadConfigInfo.UPLOAD-CONFIG-ID")));
-                       if (status == QueryStatus.FAILURE)
-                               throw new Exception("Unable to upload upload_config");
+            status = db.updateUploadConfig(ctx, "tmp.uploadConfig",
+                    Integer.parseInt(ctx.getAttribute("tmp.uploadConfigInfo.UPLOAD-CONFIG-ID")));
+            if (status == QueryStatus.FAILURE)
+                throw new Exception("Unable to upload upload_config");
 
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
-                                       AppcDataServiceConstant.OUTPUT_STATUS_SUCCESS);
-                       log.info("updateUploadConfig Successful ");
-               } catch (Exception e) {
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
-                                       AppcDataServiceConstant.OUTPUT_STATUS_FAILURE);
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
-                       log.error("Failed in updateUploadConfig  " + e.getMessage());
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
+                    AppcDataServiceConstant.OUTPUT_STATUS_SUCCESS);
+            log.info("updateUploadConfig Successful ");
+        } catch (Exception e) {
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
+                    AppcDataServiceConstant.OUTPUT_STATUS_FAILURE);
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
+            log.error("Failed in updateUploadConfig  " + e.getMessage());
 
-                       throw new SvcLogicException(e.getMessage());
-               }
-       }
+            throw new SvcLogicException(e.getMessage());
+        }
+    }
 
-       public void savePrepareRelationship(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+    public void savePrepareRelationship(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
 
-               log.info("Received savePrepareRelationship call with params : " + inParams);
+        log.info("Received savePrepareRelationship call with params : " + inParams);
 
-               String responsePrefix = inParams.get(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX);
-               String sdcArtifactInd = inParams.get(AppcDataServiceConstant.INPUT_PARAM_SDC_ARTIFACT_IND);
-               String fileId = inParams.get(AppcDataServiceConstant.INPUT_PARAM_FILE_ID);
-               try {
+        String responsePrefix = inParams.get(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX);
+        String sdcArtifactInd = inParams.get(AppcDataServiceConstant.INPUT_PARAM_SDC_ARTIFACT_IND);
+        String fileId = inParams.get(AppcDataServiceConstant.INPUT_PARAM_FILE_ID);
+        try {
 
-                       responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
-                       DGGeneralDBService db = DGGeneralDBService.initialise();
+            responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
+            DGGeneralDBService db = DGGeneralDBService.initialise();
 
-                       QueryStatus status = db.savePrepareRelationship(ctx, "tmp.preparerel", fileId, sdcArtifactInd);
-                       if (status == QueryStatus.FAILURE)
-                               throw new Exception("Unable to save prepare_relationship");
+            QueryStatus status = db.savePrepareRelationship(ctx, "tmp.preparerel", fileId, sdcArtifactInd);
+            if (status == QueryStatus.FAILURE)
+                throw new Exception("Unable to save prepare_relationship");
 
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
-                                       AppcDataServiceConstant.OUTPUT_STATUS_SUCCESS);
-                       log.info("savePrepareRelationship Successful ");
-               } catch (Exception e) {
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
-                                       AppcDataServiceConstant.OUTPUT_STATUS_FAILURE);
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
-                       log.error("Failed in saveConfigFiles " + e.getMessage());
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
+                    AppcDataServiceConstant.OUTPUT_STATUS_SUCCESS);
+            log.info("savePrepareRelationship Successful ");
+        } catch (Exception e) {
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
+                    AppcDataServiceConstant.OUTPUT_STATUS_FAILURE);
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
+            log.error("Failed in saveConfigFiles " + e.getMessage());
 
-                       throw new SvcLogicException(e.getMessage());
-               }
-       }
+            throw new SvcLogicException(e.getMessage());
+        }
+    }
 
-       public void saveConfigBlock(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+    public void saveConfigBlock(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
 
-               log.info("Received saveConfigBlock call with params : " + inParams);
+        log.info("Received saveConfigBlock call with params : " + inParams);
 
-               String responsePrefix = inParams.get(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX);
+        String responsePrefix = inParams.get(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX);
 
-               try {
+        try {
 
-                       responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
-                       ctx.setAttribute("tmp.convertconfig.escapeData",
-                                       EscapeUtils.escapeSql(ctx.getAttribute("configuration")));
-                       DGGeneralDBService db = DGGeneralDBService.initialise();
+            responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
+            ctx.setAttribute("tmp.convertconfig.escapeData",
+                    EscapeUtils.escapeSql(ctx.getAttribute("configuration")));
+            DGGeneralDBService db = DGGeneralDBService.initialise();
 
-                       if (StringUtils.isBlank(ctx.getAttribute("configuration-params"))) {
-                               saveDeviceConfiguration(inParams, ctx, "Request", ctx.getAttribute("tmp.convertconfig.escapeData"),
-                                               ctx.getAttribute("configuration"));
-                       } else {
+            if (StringUtils.isBlank(ctx.getAttribute("configuration-params"))) {
+                saveDeviceConfiguration(inParams, ctx, "Request", ctx.getAttribute("tmp.convertconfig.escapeData"),
+                        ctx.getAttribute("configuration"));
+            } else {
 
-                               saveConfigurationBlock(inParams, ctx);
+                saveConfigurationBlock(inParams, ctx);
 
-                               ctx.setAttribute("tmp.convertconfig.escapeData",
-                                               EscapeUtils.escapeSql(ctx.getAttribute("tmp.merge.mergedData")));
-                               saveDeviceConfiguration(inParams, ctx, "Configurator", ctx.getAttribute("tmp.convertconfig.escapeData"),
-                                               ctx.getAttribute("tmp.merge.mergedData"));
+                ctx.setAttribute("tmp.convertconfig.escapeData",
+                        EscapeUtils.escapeSql(ctx.getAttribute("tmp.merge.mergedData")));
+                saveDeviceConfiguration(inParams, ctx, "Configurator", ctx.getAttribute("tmp.convertconfig.escapeData"),
+                        ctx.getAttribute("tmp.merge.mergedData"));
 
-                               saveConfigurationData(inParams, ctx);
-                       }
+                saveConfigurationData(inParams, ctx);
+            }
 
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
-                                       AppcDataServiceConstant.OUTPUT_STATUS_SUCCESS);
-                       log.info("saveConfigBlock Successful ");
-               } catch (Exception e) {
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
-                                       AppcDataServiceConstant.OUTPUT_STATUS_FAILURE);
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
-                       log.error("Failed in saveConfigBlock " + e.getMessage());
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
+                    AppcDataServiceConstant.OUTPUT_STATUS_SUCCESS);
+            log.info("saveConfigBlock Successful ");
+        } catch (Exception e) {
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
+                    AppcDataServiceConstant.OUTPUT_STATUS_FAILURE);
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
+            log.error("Failed in saveConfigBlock " + e.getMessage());
 
-                       throw new SvcLogicException(e.getMessage());
-               }
-       }
+            throw new SvcLogicException(e.getMessage());
+        }
+    }
 
-       public void saveTemplateConfig(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+    public void saveTemplateConfig(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
 
-               log.info("Received saveTemplateConfig call with params : " + inParams);
+        log.info("Received saveTemplateConfig call with params : " + inParams);
 
-               String responsePrefix = inParams.get(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX);
+        String responsePrefix = inParams.get(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX);
 
-               try {
+        try {
 
-                       responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
-                       DGGeneralDBService db = DGGeneralDBService.initialise();
+            responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
+            DGGeneralDBService db = DGGeneralDBService.initialise();
 
-                       if (StringUtils.isBlank(ctx.getAttribute("configuration-params"))) {
+            if (StringUtils.isBlank(ctx.getAttribute("configuration-params"))) {
 
-                               ctx.setAttribute("tmp.convertconfig.escapeData",
-                                               EscapeUtils.escapeSql(ctx.getAttribute("config-template.file-content")));
-                               saveDeviceConfiguration(inParams, ctx, "Template", ctx.getAttribute("tmp.convertconfig.escapeData"),
-                                               ctx.getAttribute("config-template.file-content"));
+                ctx.setAttribute("tmp.convertconfig.escapeData",
+                        EscapeUtils.escapeSql(ctx.getAttribute("config-template.file-content")));
+                saveDeviceConfiguration(inParams, ctx, "Template", ctx.getAttribute("tmp.convertconfig.escapeData"),
+                        ctx.getAttribute("config-template.file-content"));
 
-                       } else {
-                               saveConfigurationData(inParams, ctx);
+            } else {
+                saveConfigurationData(inParams, ctx);
 
-                               ctx.setAttribute("tmp.convertconfig.escapeData",
-                                               EscapeUtils.escapeSql(ctx.getAttribute("tmp.merge.mergedData")));
-                               saveDeviceConfiguration(inParams, ctx, "Configurator", ctx.getAttribute("tmp.convertconfig.escapeData"),
-                                               ctx.getAttribute("tmp.merge.mergedData"));
+                ctx.setAttribute("tmp.convertconfig.escapeData",
+                        EscapeUtils.escapeSql(ctx.getAttribute("tmp.merge.mergedData")));
+                saveDeviceConfiguration(inParams, ctx, "Configurator", ctx.getAttribute("tmp.convertconfig.escapeData"),
+                        ctx.getAttribute("tmp.merge.mergedData"));
 
-                       }
+            }
 
-                       QueryStatus status = db.savePrepareRelationship(ctx, "tmp.preparerel",
-                                       ctx.getAttribute("config-template.config-file-id"), "Y");
-                       if (status == QueryStatus.FAILURE)
-                               throw new Exception("Unable to save prepare_relationship");
+            QueryStatus status = db.savePrepareRelationship(ctx, "tmp.preparerel",
+                    ctx.getAttribute("config-template.config-file-id"), "Y");
+            if (status == QueryStatus.FAILURE)
+                throw new Exception("Unable to save prepare_relationship");
 
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
-                                       AppcDataServiceConstant.OUTPUT_STATUS_SUCCESS);
-                       log.info("saveTemplateConfig Successful ");
-               } catch (Exception e) {
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
-                                       AppcDataServiceConstant.OUTPUT_STATUS_FAILURE);
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
-                       log.error("Failed in saveTemplateConfig " + e.getMessage());
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
+                    AppcDataServiceConstant.OUTPUT_STATUS_SUCCESS);
+            log.info("saveTemplateConfig Successful ");
+        } catch (Exception e) {
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
+                    AppcDataServiceConstant.OUTPUT_STATUS_FAILURE);
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
+            log.error("Failed in saveTemplateConfig " + e.getMessage());
 
-                       throw new SvcLogicException(e.getMessage());
-               }
-       }
+            throw new SvcLogicException(e.getMessage());
+        }
+    }
 
 
 
 
-       public void saveStyleSheetConfig(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+    public void saveStyleSheetConfig(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
 
 
-               log.info("Received saveStyleSheet call with params : " + inParams);
+        log.info("Received saveStyleSheet call with params : " + inParams);
 
-               String responsePrefix = inParams.get(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX);
+        String responsePrefix = inParams.get(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX);
 
-               try {
+        try {
 
-                       responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
-                       ctx.setAttribute("tmp.convertconfig.escapeData",
-                                       EscapeUtils.escapeSql(ctx.getAttribute("tmp.merge.mergedData")));
-                       saveDeviceConfiguration(inParams, ctx, "StyleSheet", ctx.getAttribute("tmp.convertconfig.escapeData"),
-                                       ctx.getAttribute("tmp.merge.mergedData"));
+            responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
+            ctx.setAttribute("tmp.convertconfig.escapeData",
+                    EscapeUtils.escapeSql(ctx.getAttribute("tmp.merge.mergedData")));
+            saveDeviceConfiguration(inParams, ctx, "StyleSheet", ctx.getAttribute("tmp.convertconfig.escapeData"),
+                    ctx.getAttribute("tmp.merge.mergedData"));
 
 
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS, AppcDataServiceConstant.OUTPUT_STATUS_SUCCESS);
-                       log.info("saveStyleSheet Successful ");
-               } catch (Exception e) {
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS, AppcDataServiceConstant.OUTPUT_STATUS_FAILURE);
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_ERROR_MESSAGE,e.getMessage());
-                       log.error("Failed in saveStyleSheet " + e.getMessage());
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS, AppcDataServiceConstant.OUTPUT_STATUS_SUCCESS);
+            log.info("saveStyleSheet Successful ");
+        } catch (Exception e) {
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS, AppcDataServiceConstant.OUTPUT_STATUS_FAILURE);
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_ERROR_MESSAGE,e.getMessage());
+            log.error("Failed in saveStyleSheet " + e.getMessage());
 
-                       throw new SvcLogicException(e.getMessage());
-               }
-       }
+            throw new SvcLogicException(e.getMessage());
+        }
+    }
 
 
-       public void getSmmChainKeyFiles(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+    public void getSmmChainKeyFiles(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
 
 
-               log.info("Received saveStyleSheet call with params : " + inParams);
+        log.info("Received saveStyleSheet call with params : " + inParams);
 
-               String responsePrefix = inParams.get(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX);
-               String siteLocation = ctx.getAttribute("site-location");
+        String responsePrefix = inParams.get(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX);
+        String siteLocation = ctx.getAttribute("site-location");
 
-               QueryStatus status = null;
+        QueryStatus status = null;
 
-               try{
+        try{
 
 
-                       responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
-                       DGGeneralDBService db = DGGeneralDBService.initialise();
+            responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
+            DGGeneralDBService db = DGGeneralDBService.initialise();
 
 
 
-                       status = db.getTemplateByArtifactType(ctx,  "smm", "smm", siteLocation);
+            status = db.getTemplateByArtifactType(ctx,  "smm", "smm", siteLocation);
 
-                       if ( status == QueryStatus.FAILURE )
-                               throw new Exception("Unable to Read smm file");
+            if ( status == QueryStatus.FAILURE )
+                throw new Exception("Unable to Read smm file");
 
 
-                       status = db.getTemplateByArtifactType(ctx,  "intermediate-ca-chain", "intermediate_ca_chain", siteLocation);
+            status = db.getTemplateByArtifactType(ctx,  "intermediate-ca-chain", "intermediate_ca_chain", siteLocation);
 
-                       if ( status == QueryStatus.FAILURE )
-                               throw new Exception("Unable to Read intermediate_ca_chain file");
+            if ( status == QueryStatus.FAILURE )
+                throw new Exception("Unable to Read intermediate_ca_chain file");
 
 
 
 
-                       status = db.getTemplateByArtifactType(ctx,  "server-certificate-and-key", "server_certificate_and_key", siteLocation);
+            status = db.getTemplateByArtifactType(ctx,  "server-certificate-and-key", "server_certificate_and_key", siteLocation);
 
-                       if ( status == QueryStatus.FAILURE )
-                               throw new Exception("Unable to Read server_certificate_and_key file");
+            if ( status == QueryStatus.FAILURE )
+                throw new Exception("Unable to Read server_certificate_and_key file");
 
 
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS, AppcDataServiceConstant.OUTPUT_STATUS_SUCCESS);
-                       log.info("saveStyleSheet Successful ");
-               } catch (Exception e) {
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS, AppcDataServiceConstant.OUTPUT_STATUS_FAILURE);
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_ERROR_MESSAGE,e.getMessage());
-                       log.error("Failed in saveStyleSheet " + e.getMessage());
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS, AppcDataServiceConstant.OUTPUT_STATUS_SUCCESS);
+            log.info("saveStyleSheet Successful ");
+        } catch (Exception e) {
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS, AppcDataServiceConstant.OUTPUT_STATUS_FAILURE);
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_ERROR_MESSAGE,e.getMessage());
+            log.error("Failed in saveStyleSheet " + e.getMessage());
 
-                       throw new SvcLogicException(e.getMessage());
-               }
-       }
+            throw new SvcLogicException(e.getMessage());
+        }
+    }
 
 
-       public void saveDeviceConfiguration(Map<String, String> inParams, SvcLogicContext ctx, String dataSource,
-                       String fileContent, String deviceConfig) throws SvcLogicException {
-               ctx.setAttribute("data-source", dataSource);
-               ctx.setAttribute("file-content", fileContent);
-               ctx.setAttribute("file-category", "device_configuration");
-               ctx.setAttribute("deviceconfig-file-content", deviceConfig);
+    public void saveDeviceConfiguration(Map<String, String> inParams, SvcLogicContext ctx, String dataSource,
+            String fileContent, String deviceConfig) throws SvcLogicException {
+        ctx.setAttribute("data-source", dataSource);
+        ctx.setAttribute("file-content", fileContent);
+        ctx.setAttribute("file-category", "device_configuration");
+        ctx.setAttribute("deviceconfig-file-content", deviceConfig);
 
-               saveConfigFiles(inParams, ctx);
-       }
+        saveConfigFiles(inParams, ctx);
+    }
 
-       public void saveConfigurationBlock(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
-               ctx.setAttribute("data-source", "Request");
-               ctx.setAttribute("file-content", ctx.getAttribute("tmp.convertconfig.escapeData"));
-               ctx.setAttribute("file-category", "configuration_block");
-               saveConfigFiles(inParams, ctx);
-       }
+    public void saveConfigurationBlock(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+        ctx.setAttribute("data-source", "Request");
+        ctx.setAttribute("file-content", ctx.getAttribute("tmp.convertconfig.escapeData"));
+        ctx.setAttribute("file-category", "configuration_block");
+        saveConfigFiles(inParams, ctx);
+    }
 
-       public void saveConfigurationData(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
-               ctx.setAttribute("data-source", ctx.getAttribute("originator-id"));
-               ctx.setAttribute("file-content", ctx.getAttribute("configuration-params"));
-               ctx.setAttribute("file-category", "config_data");
-               saveConfigFiles(inParams, ctx);
-       }
+    public void saveConfigurationData(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+        ctx.setAttribute("data-source", ctx.getAttribute("originator-id"));
+        ctx.setAttribute("file-content", ctx.getAttribute("configuration-params"));
+        ctx.setAttribute("file-category", "config_data");
+        saveConfigFiles(inParams, ctx);
+    }
 
 
-       public void getConfigFilesByVnfVmNCategory(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+    public void getConfigFilesByVnfVmNCategory(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
 
-               log.info("Received getConfigFilesByVnfVmNCategory call with params : " + inParams);
+        log.info("Received getConfigFilesByVnfVmNCategory call with params : " + inParams);
 
-               String responsePrefix = inParams.get(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX);
-               String fileCategory = inParams.get(AppcDataServiceConstant.INPUT_PARAM_FILE_CATEGORY);
-               String vnfId = inParams.get(AppcDataServiceConstant.INPUT_PARAM_VNF_ID);
-               String vmName = inParams.get(AppcDataServiceConstant.INPUT_PARAM_VM_NAME);
-               try {
+        String responsePrefix = inParams.get(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX);
+        String fileCategory = inParams.get(AppcDataServiceConstant.INPUT_PARAM_FILE_CATEGORY);
+        String vnfId = inParams.get(AppcDataServiceConstant.INPUT_PARAM_VNF_ID);
+        String vmName = inParams.get(AppcDataServiceConstant.INPUT_PARAM_VM_NAME);
+        try {
 
 
-                       DGGeneralDBService db = DGGeneralDBService.initialise();
+            DGGeneralDBService db = DGGeneralDBService.initialise();
 
-                       QueryStatus status = db.getConfigFilesByVnfVmNCategory(ctx, responsePrefix, fileCategory, vnfId, vmName);
+            QueryStatus status = db.getConfigFilesByVnfVmNCategory(ctx, responsePrefix, fileCategory, vnfId, vmName);
 
-                       if (status == QueryStatus.NOT_FOUND || status == QueryStatus.FAILURE)
-                               throw new Exception("Unable to get " + ctx.getAttribute("fileCategory") + " from configfiles");
+            if (status == QueryStatus.NOT_FOUND || status == QueryStatus.FAILURE)
+                throw new Exception("Unable to get " + ctx.getAttribute("fileCategory") + " from configfiles");
 
 
-                       responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
-                                       AppcDataServiceConstant.OUTPUT_STATUS_SUCCESS);
-                       log.info("getConfigFilesByVnfVmNCategory Successful " + ctx.getAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS));
-               } catch (Exception e) {
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
-                                       AppcDataServiceConstant.OUTPUT_STATUS_FAILURE);
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
-                       log.error("Failed in getConfigFilesByVnfVmNCategory " + e.getMessage());
+            responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
+                    AppcDataServiceConstant.OUTPUT_STATUS_SUCCESS);
+            log.info("getConfigFilesByVnfVmNCategory Successful " + ctx.getAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS));
+        } catch (Exception e) {
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
+                    AppcDataServiceConstant.OUTPUT_STATUS_FAILURE);
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
+            log.error("Failed in getConfigFilesByVnfVmNCategory " + e.getMessage());
 
-                       throw new SvcLogicException(e.getMessage());
-               }
-       }
+            throw new SvcLogicException(e.getMessage());
+        }
+    }
 
 
-       public void getDownloadConfigTemplateByVnf(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+    public void getDownloadConfigTemplateByVnf(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
 
-               log.info("Received getDownloadConfigTemplateByVnfNProtocol call with params : " + inParams);
+        log.info("Received getDownloadConfigTemplateByVnfNProtocol call with params : " + inParams);
 
-               String responsePrefix = inParams.get(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX);
-               try {
-                       DGGeneralDBService db = DGGeneralDBService.initialise();
+        String responsePrefix = inParams.get(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX);
+        try {
+            DGGeneralDBService db = DGGeneralDBService.initialise();
 
-                       QueryStatus status = db.getDownloadConfigTemplateByVnf(ctx, responsePrefix);
+            QueryStatus status = db.getDownloadConfigTemplateByVnf(ctx, responsePrefix);
 
-                       if (status == QueryStatus.NOT_FOUND || status == QueryStatus.FAILURE)
-                               throw new Exception("Unable to get download config template.");
+            if (status == QueryStatus.NOT_FOUND || status == QueryStatus.FAILURE)
+                throw new Exception("Unable to get download config template.");
 
 
-                       responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,  AppcDataServiceConstant.OUTPUT_STATUS_SUCCESS);
-                       log.info("getDownloadConfigTemplateByVnf Successful " + ctx.getAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS));
-               } catch (Exception e) {
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
-                                       AppcDataServiceConstant.OUTPUT_STATUS_FAILURE);
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
-                       log.error("Failed in getDownloadConfigTemplateByVnf " + e.getMessage());
+            responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,    AppcDataServiceConstant.OUTPUT_STATUS_SUCCESS);
+            log.info("getDownloadConfigTemplateByVnf Successful " + ctx.getAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS));
+        } catch (Exception e) {
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
+                    AppcDataServiceConstant.OUTPUT_STATUS_FAILURE);
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
+            log.error("Failed in getDownloadConfigTemplateByVnf " + e.getMessage());
 
-                       throw new SvcLogicException(e.getMessage());
-               }
-       }
+            throw new SvcLogicException(e.getMessage());
+        }
+    }
 
 
-       public void saveConfigTransactionLog(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+    public void saveConfigTransactionLog(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
 
 
 
-               String responsePrefix = inParams.get(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX);
+        String responsePrefix = inParams.get(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX);
 
-               String messageType = inParams.get(AppcDataServiceConstant.INPUT_PARAM_MESSAGE_TYPE);
-               String message = inParams.get(AppcDataServiceConstant.INPUT_PARAM_MESSAGE);
+        String messageType = inParams.get(AppcDataServiceConstant.INPUT_PARAM_MESSAGE_TYPE);
+        String message = inParams.get(AppcDataServiceConstant.INPUT_PARAM_MESSAGE);
 
-               try {
+        try {
 
-                       SvcLogicContext logctx = new SvcLogicContext();
+            SvcLogicContext logctx = new SvcLogicContext();
 
-                       String escapedMessage = EscapeUtils.escapeSql(message);
+            String escapedMessage = EscapeUtils.escapeSql(message);
 
 
-                       logctx.setAttribute("request-id", ctx.getAttribute("request-id"));
-                       logctx.setAttribute("log-message-type", messageType);
-                       logctx.setAttribute("log-message", escapedMessage);
+            logctx.setAttribute("request-id", ctx.getAttribute("request-id"));
+            logctx.setAttribute("log-message-type", messageType);
+            logctx.setAttribute("log-message", escapedMessage);
 
 
-                       responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
-                       DGGeneralDBService db = DGGeneralDBService.initialise();
-                       QueryStatus status = db.saveConfigTransactionLog( logctx, responsePrefix);
+            responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
+            DGGeneralDBService db = DGGeneralDBService.initialise();
+            QueryStatus status = db.saveConfigTransactionLog( logctx, responsePrefix);
 
-                       logctx.setAttribute("log-message", null);
+            logctx.setAttribute("log-message", null);
 
-                       if (status == QueryStatus.FAILURE)
-                               throw new Exception("Unable to insert into config_transaction_log");
+            if (status == QueryStatus.FAILURE)
+                throw new Exception("Unable to insert into config_transaction_log");
 
 
-               } catch (Exception e) {
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
-                                       AppcDataServiceConstant.OUTPUT_STATUS_FAILURE);
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
+        } catch (Exception e) {
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
+                    AppcDataServiceConstant.OUTPUT_STATUS_FAILURE);
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
 
 
-                       throw new SvcLogicException(e.getMessage());
-               }
-       }
+            throw new SvcLogicException(e.getMessage());
+        }
+    }
 
 
 
-       public void getVnfcReference(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+    public void getVnfcReference(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
 
-               log.info("Received getVnfcReference call with params : " + inParams);
+        log.info("Received getVnfcReference call with params : " + inParams);
 
-               String responsePrefix = inParams.get(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX);
+        String responsePrefix = inParams.get(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX);
 
 
-               QueryStatus status = null;
+        QueryStatus status = null;
 
-               try {
+        try {
 
 
-                       DGGeneralDBService db = DGGeneralDBService.initialise();
+            DGGeneralDBService db = DGGeneralDBService.initialise();
 
-                       if ( !StringUtils.isBlank(ctx.getAttribute("vnfc-type"))) {
-                               status = db.getVnfcReferenceByVnfcTypeNAction(ctx, responsePrefix);
+            if ( !StringUtils.isBlank(ctx.getAttribute("vnfc-type"))) {
+                status = db.getVnfcReferenceByVnfcTypeNAction(ctx, responsePrefix);
 
-                               if ( status == QueryStatus.FAILURE)
-                                       throw new Exception("Unable to Read vnfc-reference");
-                       }
-                       //else if (status == QueryStatus.NOT_FOUND ) {
-                       status = db.getVnfcReferenceByVnfTypeNAction(ctx, responsePrefix);
+                if ( status == QueryStatus.FAILURE)
+                    throw new Exception("Unable to Read vnfc-reference");
+            }
+            //else if (status == QueryStatus.NOT_FOUND ) {
+            status = db.getVnfcReferenceByVnfTypeNAction(ctx, responsePrefix);
 
-                       if (status == QueryStatus.NOT_FOUND || status == QueryStatus.FAILURE)
-                               throw new Exception("Unable to Read vnfc reference");
+            if (status == QueryStatus.NOT_FOUND || status == QueryStatus.FAILURE)
+                throw new Exception("Unable to Read vnfc reference");
 
-                       //}
+            //}
 
-                       responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
-                                       AppcDataServiceConstant.OUTPUT_STATUS_SUCCESS);
-                       log.info("getVnfcReference Successful ");
-               } catch (Exception e) {
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
-                                       AppcDataServiceConstant.OUTPUT_STATUS_FAILURE);
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
-                       log.error("Failed in getVnfcReference " + e.getMessage());
+            responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
+                    AppcDataServiceConstant.OUTPUT_STATUS_SUCCESS);
+            log.info("getVnfcReference Successful ");
+        } catch (Exception e) {
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
+                    AppcDataServiceConstant.OUTPUT_STATUS_FAILURE);
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
+            log.error("Failed in getVnfcReference " + e.getMessage());
 
-                       throw new SvcLogicException(e.getMessage());
-               }
-       }
+            throw new SvcLogicException(e.getMessage());
+        }
+    }
 
-       public void getCapability(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
-               log.info("Received getCapability call with params : " + inParams);
-               String responsePrefix = inParams.get(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX);
-               responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
-               String caplevel = inParams.get("caplevel");
-               String findCapability = inParams.get("checkCapability");
+    public void getCapability(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+        log.info("Received getCapability call with params : " + inParams);
+        String responsePrefix = inParams.get(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX);
+        responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
+        String caplevel = inParams.get("caplevel");
+        String findCapability = inParams.get("checkCapability");
 
-               try {                   
-                       DGGeneralDBService db = DGGeneralDBService.initialise();                        
-                       String cap = db.getCapability(ctx, inParams.get("vnf-type"));
-                       ObjectMapper mapper = new ObjectMapper();
-                       JsonNode caps = mapper.readTree(cap);
-                       log.info("From DB =   " + caps);
-                       JsonNode capabilities = caps.get("capabilities");
-                       log.info("capabilities =   " + capabilities);
-                       if(caplevel !=null && !caplevel.isEmpty()){
-                               JsonNode subCapabilities = capabilities.get(caplevel);
-                               log.info("subCapabilities =  " +  caplevel + " : " + subCapabilities);
-                               if(findCapability !=null && !findCapability.isEmpty()){
-                                       if(subCapabilities != null && subCapabilities.toString().contains(findCapability))
-                                               ctx.setAttribute(responsePrefix + "capabilities." + caplevel + "." +  findCapability,
-                                                               "Supported");
-                                       else
-                                               ctx.setAttribute(responsePrefix + "capabilities." + caplevel + "." +  findCapability,
-                                                               "Not-Supported");
-                               }
-                               else
-                               {
-                                       ctx.setAttribute(responsePrefix + "capabilities." + caplevel,
-                                                       subCapabilities.toString());
-                               }
-                       
-                       }
-                       else
-                               ctx.setAttribute(responsePrefix + "capabilities",
-                                               capabilities.toString());
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
-                                       AppcDataServiceConstant.OUTPUT_STATUS_SUCCESS);
-                       log.info("getCapability Successful ");
-               } catch (Exception e) {
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
-                                       AppcDataServiceConstant.OUTPUT_STATUS_FAILURE);
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
-                       log.error("Failed in getCapability " + e.getMessage());
+        try {            
+            DGGeneralDBService db = DGGeneralDBService.initialise();            
+            String cap = db.getCapability(ctx, inParams.get("vnf-type"));
+            log.info("getCapability::returned from DB::+cap");
+            if (StringUtils.isBlank(cap)) {
+                ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
+                AppcDataServiceConstant.OUTPUT_STATUS_SUCCESS);
+                log.info("getCapability Successful - No capability blocks found");
+                return;
+            }
 
-                       throw new SvcLogicException(e.getMessage());
-               }
-       }
+            ObjectMapper mapper = new ObjectMapper();
+            JsonNode caps = mapper.readTree(cap);
+            log.info("From DB =   " + caps);
+            JsonNode capabilities = caps.get("capabilities");
+            log.info("capabilities =   " + capabilities);
+            if(caplevel !=null && !caplevel.isEmpty()){
+                JsonNode subCapabilities = capabilities.get(caplevel);
+                log.info("subCapabilities =  " +  caplevel + " : " + subCapabilities);
+                if(findCapability !=null && !findCapability.isEmpty()){
+                    if(subCapabilities != null && subCapabilities.toString().contains(findCapability))
+                        ctx.setAttribute(responsePrefix + "capabilities." + caplevel + "." +  findCapability,
+                                "Supported");
+                    else
+                        ctx.setAttribute(responsePrefix + "capabilities." + caplevel + "." +  findCapability,
+                                "Not-Supported");
+                }
+                else
+                {
+                    ctx.setAttribute(responsePrefix + "capabilities." + caplevel,
+                            subCapabilities.toString());
+                }
+            
+            }
+            else
+                ctx.setAttribute(responsePrefix + "capabilities",
+                        capabilities.toString());
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
+                    AppcDataServiceConstant.OUTPUT_STATUS_SUCCESS);
+            log.info("getCapability Successful ");
+        } catch (Exception e) {
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
+                    AppcDataServiceConstant.OUTPUT_STATUS_FAILURE);
+            ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
+            log.error("Failed in getCapability " + e.getMessage());
+
+            throw new SvcLogicException(e.getMessage());
+        }
+    }
 
 
-       /*public void getUploadConfigInfo(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
-
-               log.info("Received getUploadConfigInfo call with params : " + inParams);
-
-               String responsePrefix = inParams.get(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX);
-
-               String uploadConfigId = inParams.get(AppcDataServiceConstant.INPUT_PARAM_UPLOAD_CONFIG_ID);
-               QueryStatus status = null;
-
-               int id = 0;
-               try {
-
-
-                       DGGeneralDBService db = DGGeneralDBService.initialise();
-
-                       if ( uploadConfigId != null )
-                               id = Integer.parseInt(uploadConfigId);
-
-                       status = db.getUploadConfigInfo(ctx, responsePrefix,id);
-
-                       if ( status == QueryStatus.FAILURE || status == QueryStatus.NOT_FOUND)
-                               throw new Exception("Unable to Read upload-config");
-
-
-                       responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
-                                       AppcDataServiceConstant.OUTPUT_STATUS_SUCCESS);
-                       log.info("getUploadConfigInfo Successful ");
-               } catch (Exception e) {
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS,
-                                       AppcDataServiceConstant.OUTPUT_STATUS_FAILURE);
-                       ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
-                       log.error("Failed in getUploadConfigInfo " + e.getMessage());
-
-                       throw new SvcLogicException(e.getMessage());
-               }
-       }
-        */
-
 }
index 82db2b9..b573be2 100644 (file)
@@ -17,5 +17,4 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
-[{"id":"cc7613cc.95794","type":"dgstart","name":"DGSTART","outputs":1,"x":120,"y":35,"z":"b5c78a68.c719b8","wires":[["2d4b90af.faf41"]]},{"id":"2d4b90af.faf41","type":"service-logic","name":"APPC 4.0.0","module":"APPC","version":"4.0.0","comments":"","xml":"<service-logic xmlns='http://www.openecomp.org/sdnc/svclogic' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.openecomp.org/sdnc/svclogic ./svclogic.xsd' module='APPC' version='4.0.0'>","outputs":1,"x":277.34282302856445,"y":34.98572540283203,"z":"b5c78a68.c719b8","wires":[["8304fc44.9ebbb"]]},{"id":"8304fc44.9ebbb","type":"method","name":"method DGOrchestrator","xml":"<method rpc='DGOrchestrator' mode='sync'>\n","comments":"","outputs":1,"x":481.89046478271484,"y":24.48572540283203,"z":"b5c78a68.c719b8","wires":[["acf3ff69.b8c6d"]]},{"id":"acf3ff69.b8c6d","type":"block","name":"block : atomic","xml":"<block atomic=\"true\">","atomic":"true","comments":"","outputs":1,"x":88.15634155273438,"y":158.18809700012207,"z":"b5c78a68.c719b8","wires":[["45701fe7.e3742","5723a974.ebf848","a5458042.bca07","f8f31869.052208"]]},{"id":"f8f31869.052208","type":"call","name":"call: setInputParams","xml":"<call module=\"APPC\" rpc=\"setInputParams\" mode=\"sync\">","comments":"","outputs":1,"x":622.9142913818359,"y":74.48572635650635,"z":"b5c78a68.c719b8","wires":[["622ca56a.3fad0c","659a6371.afedbc","62b5aa24.e512d4"]]},{"id":"cd3540fd.5c901","type":"failure","name":"failure","xml":"<outcome value='failure'>\n","comments":"","outputs":1,"x":2115.6643924713135,"y":185.90237140655518,"z":"b5c78a68.c719b8","wires":[["c93880dc.83f6b"]]},{"id":"2cfe388d.c4a318","type":"execute","name":"execute get and executeFlowSequence","xml":"<execute plugin=\"org.openecomp.appc.flow.controller.node.FlowControlNode\" method=\"processFlow\">\n<parameter name=\"messageType\" value=\"response\" />\n<parameter name=\"message\" value=\"`$tmp.message`\" />\n<parameter name=\"responsePrefix\" value=\"tmp.flowControl\" />\n","comments":"","outputs":1,"x":1823.7911643981934,"y":198.21586418151855,"z":"b5c78a68.c719b8","wires":[["cd3540fd.5c901","a73b7dad.5f10d"]]},{"id":"c93880dc.83f6b","type":"block","name":"block : atomic","xml":"<block atomic=\"true\">","atomic":"true","comments":"","outputs":1,"x":2326.711868286133,"y":183.4261817932129,"z":"b5c78a68.c719b8","wires":[["90e79699.33c448"]]},{"id":"ce8b3cd9.aa5d5","type":"set","name":"set error-code 400 and message","xml":"<set>\n<parameter name='error-code' value='400' />\n<parameter name='error-message' value=\"SUCCESS - request has been processed successfully\" />\n<parameter name='output-payload' value=\"`'state : ' + $output.payload.state` \" />\n","comments":"","x":2572.1879119873047,"y":264.985652923584,"z":"b5c78a68.c719b8","wires":[]},{"id":"a73b7dad.5f10d","type":"success","name":"success","xml":"<outcome value='success'>\n","comments":"","outputs":1,"x":2121.5452003479004,"y":265.56900215148926,"z":"b5c78a68.c719b8","wires":[["7c4a5d10.2ce964"]]},{"id":"7c4a5d10.2ce964","type":"block","name":"block : atomic","xml":"<block atomic=\"true\">","atomic":"true","comments":"","outputs":1,"x":2309.425952911377,"y":265.2237958908081,"z":"b5c78a68.c719b8","wires":[["ce8b3cd9.aa5d5"]]},{"id":"90e79699.33c448","type":"set","name":"set error-code 401 and message","xml":"<set>\n<parameter name='error-code' value='401' />\n<parameter name='error-message' value=\"`$tmp.flowControl.status-message`\" />\n<parameter name='output-payload' value=\"\" />\n","comments":"","x":2576.9976806640625,"y":183.36661529541016,"z":"b5c78a68.c719b8","wires":[]},{"id":"5723a974.ebf848","type":"execute","name":"execute saveTxLog","xml":"<execute plugin=\"org.openecomp.appc.data.services.node.ConfigResourceNode\" method=\"saveConfigTransactionLog\">\n<parameter name=\"messageType\" value=\"response\" />\n<parameter name=\"message\" value=\"`$tmp.message`\" />\n<parameter name=\"responsePrefix\" value=\"tmp.saveTxLog\" />\n","comments":"","outputs":1,"x":287.4975776672363,"y":876.0412883758545,"z":"b5c78a68.c719b8","wires":[["5a16feb3.2142b"]]},{"id":"5a16feb3.2142b","type":"failure","name":"failure","xml":"<outcome value='failure'>\n","comments":"","outputs":1,"x":488.9419479370117,"y":876.957914352417,"z":"b5c78a68.c719b8","wires":[["9973dad4.c4f6c8"]]},{"id":"9973dad4.c4f6c8","type":"block","name":"block : atomic","xml":"<block atomic=\"true\">","atomic":"true","comments":"","outputs":1,"x":664.4143218994141,"y":878.5412473678589,"z":"b5c78a68.c719b8","wires":[[]]},{"id":"45701fe7.e3742","type":"set","name":"set tmp.message","xml":"<set>\n<parameter name=\"tmp.message\" value=\"`$error-code + ':' + $error-message`\"/>\n","comments":"","x":306.2753677368164,"y":788.2357015609741,"z":"b5c78a68.c719b8","wires":[]},{"id":"622ca56a.3fad0c","type":"not-found","name":"not-found","xml":"<outcome value='not-found'>\n","comments":"","outputs":1,"x":838.414306640625,"y":33.652387619018555,"z":"b5c78a68.c719b8","wires":[["6a0a4cab.d6ed74"]]},{"id":"659a6371.afedbc","type":"failure","name":"failure","xml":"<outcome value='failure'>\n","comments":"","outputs":1,"x":832.914306640625,"y":72.65238952636719,"z":"b5c78a68.c719b8","wires":[["6a0a4cab.d6ed74"]]},{"id":"6a0a4cab.d6ed74","type":"block","name":"block : atomic","xml":"<block atomic=\"true\">\n\n","atomic":"true","comments":"","outputs":1,"x":1005.664306640625,"y":54.15241241455078,"z":"b5c78a68.c719b8","wires":[[]]},{"id":"a5458042.bca07","type":"switchNode","name":"switch error-code","xml":"<switch test='`$error-code`'>\n","comments":"","outputs":1,"x":311.0809631347656,"y":729.9024333953857,"z":"b5c78a68.c719b8","wires":[["3369bc31.864784","db62a292.a4939"]]},{"id":"3369bc31.864784","type":"success","name":"outcome: 400","xml":"<outcome value=\"400\">","comments":"","outputs":1,"x":575.7475891113281,"y":682.2357139587402,"z":"b5c78a68.c719b8","wires":[["84d8c9bc.503a98"]]},{"id":"db62a292.a4939","type":"success","name":"outcome: Other","xml":"<outcome value=\"Other\">","comments":"","outputs":1,"x":575.664249420166,"y":782.235746383667,"z":"b5c78a68.c719b8","wires":[["149ad4e8.284b8b"]]},{"id":"84d8c9bc.503a98","type":"block","name":"block : atomic","xml":"<block atomic=\"true\">","atomic":"true","outputs":1,"x":786.9976348876953,"y":684.9024209976196,"z":"b5c78a68.c719b8","wires":[["373e530e.18cd9c"]]},{"id":"149ad4e8.284b8b","type":"block","name":"block : atomic","xml":"<block atomic=\"true\">","atomic":"true","outputs":1,"x":768.9974899291992,"y":783.485746383667,"z":"b5c78a68.c719b8","wires":[["2e5fbdd7.64def2"]]},{"id":"373e530e.18cd9c","type":"set","name":"set Status for dispatcher","xml":"<set>\n<parameter name='SvcLogic.status' value='success' />\n<parameter name='output.status.code' value='`$error-code`' />\n<parameter name='output.status.message' value='`$error-message`' />","comments":"","x":1036.6643371582031,"y":683.0690479278564,"z":"b5c78a68.c719b8","wires":[]},{"id":"2e5fbdd7.64def2","type":"set","name":"set Status for dispatcher","xml":"<set>\n<parameter name='SvcLogic.status' value='failure' />\n<parameter name='output.status.code' value='`$error-code`' />\n<parameter name='output.status.message' value='`$error-message`' />\n","comments":"","x":1006.1642837524414,"y":782.4023923873901,"z":"b5c78a68.c719b8","wires":[]},{"id":"5ffe82f1.ced74c","type":"block","name":"block : atomic","xml":"<block atomic=\"true\">","atomic":"true","comments":"","outputs":1,"x":499.16426849365234,"y":185.81904411315918,"z":"b5c78a68.c719b8","wires":[["f2a3b57e.020398"]]},{"id":"62b5aa24.e512d4","type":"success","name":"success","xml":"<outcome value='success'>\n","comments":"","outputs":1,"x":828.747615814209,"y":112.48571968078613,"z":"b5c78a68.c719b8","wires":[["5ffe82f1.ced74c"]]},{"id":"b1cea122.15118","type":"execute","name":"execute getCapability","xml":"<execute plugin=\"org.openecomp.appc.data.services.node.ConfigResourceNode\" method=\"getCapability\">\n<parameter name=\"caplevel\" value=\"`$action-level`\" />\n<parameter name=\"checkCapability\" value=\"`$request-action`\" />\n<parameter name=\"vnf-type\" value=\"`$vnf-type`\" />\n\n","comments":"","outputs":1,"x":804.9144706726074,"y":333.9023542404175,"z":"b5c78a68.c719b8","wires":[["d22ba9c1.a51338","eb81f91.6a55e08"]]},{"id":"1fadfea8.b95051","type":"switchNode","name":"switch capability-result","xml":"<switch test=\"`$capabilities`\">\n","comments":"","outputs":1,"x":1134.704574584961,"y":419.6452317237854,"z":"b5c78a68.c719b8","wires":[["e9a40f9e.0d95c","9e5a076a.69f2e8","439b34b1.4501ac"]]},{"id":"e9a40f9e.0d95c","type":"success","name":"outcome: Not-Supported","xml":"<outcome value=\"Not-Supported\">","comments":"","outputs":1,"x":1373.9144439697266,"y":546.2356586456299,"z":"b5c78a68.c719b8","wires":[["a8ce8939.428ce8"]]},{"id":"9e5a076a.69f2e8","type":"success","name":"outcome: Supported","xml":"<outcome value=\"Supported\">","comments":"","outputs":1,"x":1364.8310241699219,"y":478.56904220581055,"z":"b5c78a68.c719b8","wires":[["c0c9441c.47acf8"]]},{"id":"d22ba9c1.a51338","type":"failure","name":"Other","xml":"<outcome value='Other'>\n","comments":"","outputs":1,"x":1106.0094909667969,"y":280.0928611755371,"z":"b5c78a68.c719b8","wires":[["bf213715.b3a6c8"]]},{"id":"eb81f91.6a55e08","type":"success","name":"success","xml":"<outcome value='success'>\n","comments":"","outputs":1,"x":1090.4619979858398,"y":336.90238761901855,"z":"b5c78a68.c719b8","wires":[["a3035540.336198"]]},{"id":"a8ce8939.428ce8","type":"set","name":"set error-code 450 and message","xml":"<set>\n<parameter name='error-code' value='450' />\n<parameter name='error-message' value=\"Request not supported\" />\n<parameter name='output-payload' value=\"\" />","comments":"","x":1664.247543334961,"y":547.9023866653442,"z":"b5c78a68.c719b8","wires":[]},{"id":"c0c9441c.47acf8","type":"block","name":"block : atomic","xml":"<block atomic=\"true\">","atomic":"true","comments":"","outputs":1,"x":1586.2476196289062,"y":482.56903076171875,"z":"b5c78a68.c719b8","wires":[["2cfe388d.c4a318"]]},{"id":"439b34b1.4501ac","type":"other","name":"Other","xml":"<outcome value='Other'>\n","comments":"","outputs":1,"x":1311.5810661315918,"y":408.23571491241455,"z":"b5c78a68.c719b8","wires":[["bf213715.b3a6c8"]]},{"id":"7bfc9412.60aa0c","type":"set","name":"set error code 401","xml":"<set>\n<parameter name='error-code' value='401' />\n<parameter name='error-message' value=\"Cannot Determine Capabilities\" />\n<parameter name='output-payload' value=\"\" />\n","comments":"","x":1544.9141693115234,"y":277.48572874069214,"z":"b5c78a68.c719b8","wires":[]},{"id":"a3035540.336198","type":"block","name":"block : atomic","xml":"<block atomic=\"true\">\n\n","atomic":"true","comments":"","outputs":1,"x":935.2992706298828,"y":420.0594539642334,"z":"b5c78a68.c719b8","wires":[["1fadfea8.b95051"]]},{"id":"b32ad07d.3b548","type":"record","name":"record","xml":"<record plugin=\"org.openecomp.sdnc.sli.recording.Slf4jRecorder\">\n<parameter name=\"level\" value=\"info\"/>\n<parameter name=\"logger\" value=\"message-log\"/>\n<parameter name=\"field1\" value=\"__TIMESTAMP__\"/>\n<parameter name=\"field2\" value=\"` 'Capabilities results will be - '+$capabilities`\" />","comments":"","outputs":1,"x":1511.3230590820312,"y":337.7023859024048,"z":"b5c78a68.c719b8","wires":[[]]},{"id":"f2a3b57e.020398","type":"switchNode","name":"switch action-level","xml":"<switch test='`$action-level`'>\n","comments":"","outputs":1,"x":690.4444808959961,"y":186.66671562194824,"z":"b5c78a68.c719b8","wires":[["33069169.beb0fe","640470bf.d9539"]]},{"id":"33069169.beb0fe","type":"success","name":"outcome: Other","xml":"<outcome value='Other'>","comments":"","outputs":1,"x":587.8610458374023,"y":331.4166831970215,"z":"b5c78a68.c719b8","wires":[["b1cea122.15118"]]},{"id":"640470bf.d9539","type":"success","name":"outcome: vm","xml":"<outcome value='vm'>","comments":"","outputs":1,"x":886.1943511962891,"y":184.08336639404297,"z":"b5c78a68.c719b8","wires":[["b9c857ee.f64a08"]]},{"id":"bf213715.b3a6c8","type":"block","name":"block : atomic","xml":"<block atomic=\"true\">\n\n","atomic":"true","comments":"","outputs":1,"x":1339.2476119995117,"y":282.15234565734863,"z":"b5c78a68.c719b8","wires":[["7bfc9412.60aa0c","b32ad07d.3b548"]]},{"id":"b9c857ee.f64a08","type":"block","name":"block : atomic","xml":"<block atomic=\"true\">\n\n","atomic":"true","comments":"","outputs":1,"x":1101.6666717529297,"y":184.99999809265137,"z":"b5c78a68.c719b8","wires":[["2cfe388d.c4a318"]]}]
+[{"id":"af863c5e.90e748","type":"dgstart","name":"DGSTART","outputs":1,"x":146.75,"y":164.75,"z":"7aa4b695.11473","wires":[["d9df0190.a42ba"]]},{"id":"d9df0190.a42ba","type":"service-logic","name":"APPC 4.0.0","module":"APPC","version":"4.0.0","comments":"","xml":"<service-logic xmlns='http://www.openecomp.org/sdnc/svclogic' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.openecomp.org/sdnc/svclogic ./svclogic.xsd' module='APPC' version='4.0.0'>","outputs":1,"x":304.09282302856445,"y":164.73572540283203,"z":"7aa4b695.11473","wires":[["7c89aa4e.932024"]]},{"id":"7c89aa4e.932024","type":"method","name":"method DGOrchestrator","xml":"<method rpc='DGOrchestrator' mode='sync'>\n","comments":"","outputs":1,"x":508.64046478271484,"y":154.23572540283203,"z":"7aa4b695.11473","wires":[["c70f8f3b.05d388"]]},{"id":"c70f8f3b.05d388","type":"block","name":"block : atomic","xml":"<block atomic=\"true\">","atomic":"true","comments":"","outputs":1,"x":114.90634155273438,"y":287.93809700012207,"z":"7aa4b695.11473","wires":[["381e0ace.b3f33e","5f6fb0ca.2c254","c488bd07.108a38","75917e4e.17476"]]},{"id":"75917e4e.17476","type":"call","name":"call: setInputParams","xml":"<call module=\"APPC\" rpc=\"setInputParams\" mode=\"sync\">","comments":"","outputs":1,"x":649.6642913818359,"y":204.23572635650635,"z":"7aa4b695.11473","wires":[["36ff1ffa.c778a","26081ec1.29b53a","c2f54a3a.ddf05"]]},{"id":"1210a216.c8af96","type":"failure","name":"failure","xml":"<outcome value='failure'>\n","comments":"","outputs":1,"x":2142.4143924713135,"y":315.6523714065552,"z":"7aa4b695.11473","wires":[["9c3d67a5.92d02"]]},{"id":"b0e87141.6fe4f8","type":"execute","name":"execute get and executeFlowSequence","xml":"<execute plugin=\"org.openecomp.appc.flow.controller.node.FlowControlNode\" method=\"processFlow\">\n<parameter name=\"messageType\" value=\"response\" />\n<parameter name=\"message\" value=\"`$tmp.message`\" />\n<parameter name=\"responsePrefix\" value=\"tmp.flowControl\" />\n","comments":"","outputs":1,"x":1850.5411643981934,"y":327.96586418151855,"z":"7aa4b695.11473","wires":[["1210a216.c8af96","85baeb80.e02e8"]]},{"id":"9c3d67a5.92d02","type":"block","name":"block : atomic","xml":"<block atomic=\"true\">","atomic":"true","comments":"","outputs":1,"x":2353.461868286133,"y":313.1761817932129,"z":"7aa4b695.11473","wires":[["4c31beff.349f7"]]},{"id":"88a7413.62118c","type":"set","name":"set error-code 400 and message","xml":"<set>\n<parameter name='error-code' value='400' />\n<parameter name='error-message' value=\"SUCCESS - request has been processed successfully\" />\n<parameter name='output-payload' value=\"`'state : ' + $output.payload.state` \" />\n","comments":"","x":2598.9379119873047,"y":394.735652923584,"z":"7aa4b695.11473","wires":[]},{"id":"85baeb80.e02e8","type":"success","name":"success","xml":"<outcome value='success'>\n","comments":"","outputs":1,"x":2148.2952003479004,"y":395.31900215148926,"z":"7aa4b695.11473","wires":[["91b3c0c8.bd7338"]]},{"id":"91b3c0c8.bd7338","type":"block","name":"block : atomic","xml":"<block atomic=\"true\">","atomic":"true","comments":"","outputs":1,"x":2336.175952911377,"y":394.9737958908081,"z":"7aa4b695.11473","wires":[["88a7413.62118c"]]},{"id":"4c31beff.349f7","type":"set","name":"set error-code 401 and message","xml":"<set>\n<parameter name='error-code' value='401' />\n<parameter name='error-message' value=\"`$tmp.flowControl.status-message`\" />\n<parameter name='output-payload' value=\"\" />\n","comments":"","x":2603.7476806640625,"y":313.11661529541016,"z":"7aa4b695.11473","wires":[]},{"id":"5f6fb0ca.2c254","type":"execute","name":"execute saveTxLog","xml":"<execute plugin=\"org.openecomp.appc.data.services.node.ConfigResourceNode\" method=\"saveConfigTransactionLog\">\n<parameter name=\"messageType\" value=\"response\" />\n<parameter name=\"message\" value=\"`$tmp.message`\" />\n<parameter name=\"responsePrefix\" value=\"tmp.saveTxLog\" />\n","comments":"","outputs":1,"x":314.2475776672363,"y":1005.7912883758545,"z":"7aa4b695.11473","wires":[["9340c18b.3084e8"]]},{"id":"9340c18b.3084e8","type":"failure","name":"failure","xml":"<outcome value='failure'>\n","comments":"","outputs":1,"x":515.6919479370117,"y":1006.707914352417,"z":"7aa4b695.11473","wires":[["af758d58.5b9778"]]},{"id":"af758d58.5b9778","type":"block","name":"block : atomic","xml":"<block atomic=\"true\">","atomic":"true","comments":"","outputs":1,"x":691.1643218994141,"y":1008.2912473678589,"z":"7aa4b695.11473","wires":[[]]},{"id":"381e0ace.b3f33e","type":"set","name":"set tmp.message","xml":"<set>\n<parameter name=\"tmp.message\" value=\"`$error-code + ':' + $error-message`\"/>\n","comments":"","x":333.0253677368164,"y":917.9857015609741,"z":"7aa4b695.11473","wires":[]},{"id":"36ff1ffa.c778a","type":"not-found","name":"not-found","xml":"<outcome value='not-found'>\n","comments":"","outputs":1,"x":865.164306640625,"y":163.40238761901855,"z":"7aa4b695.11473","wires":[["ca660a6a.37209"]]},{"id":"26081ec1.29b53a","type":"failure","name":"failure","xml":"<outcome value='failure'>\n","comments":"","outputs":1,"x":859.664306640625,"y":202.4023895263672,"z":"7aa4b695.11473","wires":[["ca660a6a.37209"]]},{"id":"ca660a6a.37209","type":"block","name":"block : atomic","xml":"<block atomic=\"true\">\n\n","atomic":"true","comments":"","outputs":1,"x":1032.414306640625,"y":183.90241241455078,"z":"7aa4b695.11473","wires":[[]]},{"id":"c488bd07.108a38","type":"switchNode","name":"switch error-code","xml":"<switch test='`$error-code`'>\n","comments":"","outputs":1,"x":337.8309631347656,"y":859.6524333953857,"z":"7aa4b695.11473","wires":[["3d595d5f.577762","faa2fd8b.a0c5c"]]},{"id":"3d595d5f.577762","type":"success","name":"outcome: 400","xml":"<outcome value=\"400\">","comments":"","outputs":1,"x":602.4975891113281,"y":811.9857139587402,"z":"7aa4b695.11473","wires":[["185cf26e.a85396"]]},{"id":"faa2fd8b.a0c5c","type":"success","name":"outcome: Other","xml":"<outcome value=\"Other\">","comments":"","outputs":1,"x":602.414249420166,"y":911.985746383667,"z":"7aa4b695.11473","wires":[["d829d71e.06cbb8"]]},{"id":"185cf26e.a85396","type":"block","name":"block : atomic","xml":"<block atomic=\"true\">","atomic":"true","outputs":1,"x":813.7476348876953,"y":814.6524209976196,"z":"7aa4b695.11473","wires":[["766d8c6f.46c504"]]},{"id":"d829d71e.06cbb8","type":"block","name":"block : atomic","xml":"<block atomic=\"true\">","atomic":"true","outputs":1,"x":795.7474899291992,"y":913.235746383667,"z":"7aa4b695.11473","wires":[["cb724d6.bb5e03"]]},{"id":"766d8c6f.46c504","type":"set","name":"set Status for dispatcher","xml":"<set>\n<parameter name='SvcLogic.status' value='success' />\n<parameter name='output.status.code' value='`$error-code`' />\n<parameter name='output.status.message' value='`$error-message`' />","comments":"","x":1063.4143371582031,"y":812.8190479278564,"z":"7aa4b695.11473","wires":[]},{"id":"cb724d6.bb5e03","type":"set","name":"set Status for dispatcher","xml":"<set>\n<parameter name='SvcLogic.status' value='failure' />\n<parameter name='output.status.code' value='`$error-code`' />\n<parameter name='output.status.message' value='`$error-message`' />\n","comments":"","x":1032.9142837524414,"y":912.1523923873901,"z":"7aa4b695.11473","wires":[]},{"id":"3df8ebcb.3db3a4","type":"block","name":"block : atomic","xml":"<block atomic=\"true\">","atomic":"true","comments":"","outputs":1,"x":525.9142684936523,"y":315.5690441131592,"z":"7aa4b695.11473","wires":[["db8589d5.f5783"]]},{"id":"c2f54a3a.ddf05","type":"success","name":"success","xml":"<outcome value='success'>\n","comments":"","outputs":1,"x":855.497615814209,"y":242.23571968078613,"z":"7aa4b695.11473","wires":[["3df8ebcb.3db3a4"]]},{"id":"98b12577.b4145","type":"execute","name":"execute getCapability","xml":"<execute plugin=\"org.openecomp.appc.data.services.node.ConfigResourceNode\" method=\"getCapability\">\n<parameter name=\"caplevel\" value=\"`$action-level`\" />\n<parameter name=\"checkCapability\" value=\"`$request-action`\" />\n<parameter name=\"vnf-type\" value=\"`$vnf-type`\" />\n\n","comments":"","outputs":1,"x":831.6644706726074,"y":463.6523542404175,"z":"7aa4b695.11473","wires":[["e327dfa0.71d49","a7e121d5.e56c78"]]},{"id":"79a2cd7a.1539c4","type":"switchNode","name":"switch capability-result","xml":"<switch test=\"`$capabilities`\">\n","comments":"","outputs":1,"x":1161.454574584961,"y":549.3952317237854,"z":"7aa4b695.11473","wires":[["2529f428.b003fc","69db5125.fc4bf","4ed07506.b71b1c"]]},{"id":"2529f428.b003fc","type":"success","name":"outcome: Not-Supported","xml":"<outcome value=\"Not-Supported\">","comments":"","outputs":1,"x":1400.6644439697266,"y":675.9856586456299,"z":"7aa4b695.11473","wires":[["b6a06ded.095718"]]},{"id":"69db5125.fc4bf","type":"success","name":"outcome: Supported","xml":"<outcome value=\"Supported\">","comments":"","outputs":1,"x":1391.5810241699219,"y":608.3190422058105,"z":"7aa4b695.11473","wires":[["b748bba.a3058c8"]]},{"id":"e327dfa0.71d49","type":"failure","name":"Other","xml":"<outcome value='Other'>\n","comments":"","outputs":1,"x":1132.7594909667969,"y":409.8428611755371,"z":"7aa4b695.11473","wires":[["54a3be90.486a98"]]},{"id":"a7e121d5.e56c78","type":"success","name":"success","xml":"<outcome value='success'>\n","comments":"","outputs":1,"x":1117.2119979858398,"y":466.65238761901855,"z":"7aa4b695.11473","wires":[["670943f4.e09734"]]},{"id":"b6a06ded.095718","type":"set","name":"set error-code 450 and message","xml":"<set>\n<parameter name='error-code' value='450' />\n<parameter name='error-message' value=\"Request not supported\" />\n<parameter name='output-payload' value=\"\" />","comments":"","x":1690.997543334961,"y":677.6523866653442,"z":"7aa4b695.11473","wires":[]},{"id":"b748bba.a3058c8","type":"block","name":"block : atomic","xml":"<block atomic=\"true\">","atomic":"true","comments":"","outputs":1,"x":1612.9976196289062,"y":612.3190307617188,"z":"7aa4b695.11473","wires":[["b0e87141.6fe4f8"]]},{"id":"4ed07506.b71b1c","type":"other","name":"Other","xml":"<outcome value='Other'>\n","comments":"","outputs":1,"x":1338.3310661315918,"y":537.9857149124146,"z":"7aa4b695.11473","wires":[["b0e87141.6fe4f8"]]},{"id":"2930004b.59f6a","type":"set","name":"set error code 401","xml":"<set>\n<parameter name='error-code' value='401' />\n<parameter name='error-message' value=\"Cannot Determine Capabilities\" />\n<parameter name='output-payload' value=\"\" />\n","comments":"","x":1482.6641845703125,"y":398.2357177734375,"z":"7aa4b695.11473","wires":[]},{"id":"670943f4.e09734","type":"block","name":"block : atomic","xml":"<block atomic=\"true\">\n\n","atomic":"true","comments":"","outputs":1,"x":962.0492706298828,"y":549.8094539642334,"z":"7aa4b695.11473","wires":[["79a2cd7a.1539c4"]]},{"id":"55f47d04.5f65bc","type":"record","name":"record","xml":"<record plugin=\"org.openecomp.sdnc.sli.recording.Slf4jRecorder\">\n<parameter name=\"level\" value=\"info\"/>\n<parameter name=\"logger\" value=\"message-log\"/>\n<parameter name=\"field1\" value=\"__TIMESTAMP__\"/>\n<parameter name=\"field2\" value=\"` 'Capabilities results will be - '+$capabilities`\" />","comments":"","outputs":1,"x":1447.072998046875,"y":446.452392578125,"z":"7aa4b695.11473","wires":[[]]},{"id":"db8589d5.f5783","type":"switchNode","name":"switch action-level","xml":"<switch test='`$action-level`'>\n","comments":"","outputs":1,"x":717.1944808959961,"y":316.41671562194824,"z":"7aa4b695.11473","wires":[["c0e2c8b.089e238","9e5abf68.ff6c1"]]},{"id":"c0e2c8b.089e238","type":"success","name":"outcome: Other","xml":"<outcome value='Other'>","comments":"","outputs":1,"x":614.6110458374023,"y":461.1666831970215,"z":"7aa4b695.11473","wires":[["98b12577.b4145"]]},{"id":"9e5abf68.ff6c1","type":"success","name":"outcome: vm","xml":"<outcome value='vm'>","comments":"","outputs":1,"x":912.9443511962891,"y":313.83336639404297,"z":"7aa4b695.11473","wires":[["6c0f9755.4e6f38"]]},{"id":"54a3be90.486a98","type":"block","name":"block : atomic","xml":"<block atomic=\"true\">\n\n","atomic":"true","comments":"","outputs":1,"x":1285.99755859375,"y":408.90234375,"z":"7aa4b695.11473","wires":[["2930004b.59f6a","55f47d04.5f65bc"]]},{"id":"6c0f9755.4e6f38","type":"block","name":"block : atomic","xml":"<block atomic=\"true\">\n\n","atomic":"true","comments":"","outputs":1,"x":1128.4166717529297,"y":314.74999809265137,"z":"7aa4b695.11473","wires":[["b0e87141.6fe4f8"]]}]