* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
+ * ================================================================================
+ * Modifications Copyright (C) 2019 Ericsson
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
JSONObject requestInfo = (JSONObject) postDataJson.get(REQUEST_INFORMATION);
JSONObject documentInfo = (JSONObject) postDataJson.get(DOCUMENT_PARAMETERS);
String artifactName = documentInfo.getString(ARTIFACT_NAME);
-
if (artifactName != null) {
updateStoreArtifacts(requestInfo, documentInfo);
if (artifactName.toLowerCase().startsWith(REFERENCE)) {
String fn = "ArtifactHandlerNode.createReferenceDataForPD";
String artifactName = documentInfo.getString(ARTIFACT_NAME);
- log.info(fn + "Received PD File Name: " + artifactName + " and suffix lenght "
+ log.info(fn + "Received PD File Name: " + artifactName + " and suffix length "
+ PD.length());
try {
// Tosca generation
OutputStream toscaStream = new ByteArrayOutputStream();
String toscaContents;
- ArtifactProcessorImpl toscaGenerator = new ArtifactProcessorImpl();
+ ArtifactProcessorImpl toscaGenerator = getArtifactProcessorImpl();
toscaGenerator.generateArtifact(pdFileContents, toscaStream);
toscaContents = toscaStream.toString();
log.info("Generated Tosca File : " + toscaContents);
protected boolean updateStoreArtifacts(JSONObject requestInfo, JSONObject documentInfo)
throws SvcLogicException {
log.info("UpdateStoreArtifactsStarted storing of SDC Artifacs ");
-
SvcLogicContext context = new SvcLogicContext();
DBService dbservice = DBService.initialise();
ArtifactHandlerProviderUtil ahpUtil = new ArtifactHandlerProviderUtil();
public boolean storeReferenceData(JSONObject requestInfo, JSONObject documentInfo)
throws ArtifactHandlerInternalException {
+
log.info("Started storing of SDC Artifacs into Handler");
try {
DBService dbservice = DBService.initialise();
JSONObject contentObject = new JSONObject(contentString);
JSONArray contentArray = contentObject.getJSONArray("reference_data");
boolean storeCapabilityArtifact = true;
-
for (int a = 0; a < contentArray.length(); a++) {
JSONObject content = (JSONObject) contentArray.get(a);
log.info("contentString =" + content.toString());
log.info("artifact is " + artifact);
//Get Model details
- if (null != templateIdList && i>0 && i%2==0) {//Should this be changed to 3 to account for 3 artifacts
+ if (null != templateIdList && i>0 && i%2 == 0) {//Should this be changed to 3 to account for 3 artifacts
modelInd++;
}
- if (null != vnfcTypeList && i>0 && i%3==0) {
+ if (null != vnfcTypeList && i>0 && i%3 == 0) {
//TDP 517180 - CD tool has made changes to send 3 artifacts instead of 2
vnfcRefInd++;
}
if (null != templateIdList && modelInd < templateIdList.length()) {
model = templateIdList.getString(modelInd);
- log.info("Model is ::: "+model+" ,modelInd = "+modelInd);
+ log.info("Model is ::: "+model+" ,modelInd = " + modelInd);
}
if (null != vnfcTypeList && vnfcRefInd < vnfcTypeList.length() ) {
String vnfcType = vnfcTypeList.getString(vnfcRefInd);
if (StringUtils.isNotBlank(vnfcType)) {
context.setAttribute(VNFC_TYPE, vnfcType);
}
- log.info("Setting vnfc type from vnfc-type-list ::"+vnfcType);
+ log.info("Setting vnfc type from vnfc-type-list ::" + vnfcType);
}
if (StringUtils.isNotBlank(model)) {
dbservice.processSdcReferences(context, dbservice.isArtifactUpdateRequired(context,
- DB_SDC_REFERENCE, model),model);
+ DB_SDC_REFERENCE, model), model);
}
else {
dbservice.processSdcReferences(context, dbservice.isArtifactUpdateRequired(context,
if (pdFile) {
log.info("Sending information related to pdfile Artifact");
tryUpdateContext(dbservice, context, pdFile, suffix, model);
- pdFile=false;//set to false afterprocessing yang and Tosca
+ pdFile = false;//set to false afterprocessing yang and Tosca
}
}
}
return null;
}
+
+ protected ArtifactProcessorImpl getArtifactProcessorImpl() {
+ return new ArtifactProcessorImpl();
+ }
}