diff options
20 files changed, 318 insertions, 364 deletions
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleRequest.java index 854cda9cea..43ac1f1f3c 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleRequest.java @@ -72,7 +72,7 @@ public class CreateVfModuleRequest extends VfRequestCommon { private Boolean failIfExists; private Boolean backout; - private Map<String,String> vfModuleParams = new HashMap<String, String>(); + private Map<String,String> vfModuleParams = new HashMap<>(); private MsoRequest msoRequest = new MsoRequest(); public String getCloudSiteId() { diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleResponse.java index 7fd72ee20e..84b8caa096 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleResponse.java @@ -36,7 +36,7 @@ public class CreateVfModuleResponse extends VfResponseCommon { private String vfModuleId; private String vfModuleStackId; private Boolean vfModuleCreated; - private Map<String,String> vfModuleOutputs = new HashMap<String, String>(); + private Map<String,String> vfModuleOutputs = new HashMap<>(); private VfModuleRollback rollback = new VfModuleRollback(); public CreateVfModuleResponse() { diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVolumeGroupRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVolumeGroupRequest.java index 5d7451148e..e66271c24a 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVolumeGroupRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVolumeGroupRequest.java @@ -43,7 +43,7 @@ public class CreateVolumeGroupRequest extends VfRequestCommon { private String vnfVersion; private String vfModuleType; private String modelCustomizationUuid; - private Map<String,String> volumeGroupParams = new HashMap<String, String>(); + private Map<String,String> volumeGroupParams = new HashMap<>(); private Boolean failIfExists; private Boolean suppressBackout; private MsoRequest msoRequest = new MsoRequest(); diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVolumeGroupResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVolumeGroupResponse.java index 5201bcef81..cc2f6da29e 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVolumeGroupResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVolumeGroupResponse.java @@ -36,7 +36,7 @@ public class CreateVolumeGroupResponse extends VfResponseCommon { private String volumeGroupId; private String volumeGroupStackId; private Boolean volumeGroupCreated; - private Map<String,String> volumeGroupOutputs = new HashMap<String, String>(); + private Map<String,String> volumeGroupOutputs = new HashMap<>(); private VolumeGroupRollback volumeGroupRollback = new VolumeGroupRollback(); public CreateVolumeGroupResponse() { diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVfModuleRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVfModuleRequest.java index 0f16fdf538..ba576e36b2 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVfModuleRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVfModuleRequest.java @@ -58,7 +58,7 @@ public class UpdateVfModuleRequest extends VfRequestCommon { private Boolean failIfExists; private Boolean backout; - private Map<String,String> vfModuleParams = new HashMap<String, String>(); + private Map<String,String> vfModuleParams = new HashMap<>(); private MsoRequest msoRequest = new MsoRequest(); public String getCloudSiteId() { diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVfModuleResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVfModuleResponse.java index 6e84185704..bf50008bc7 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVfModuleResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVfModuleResponse.java @@ -34,7 +34,7 @@ public class UpdateVfModuleResponse extends VfResponseCommon { private String vnfId; private String vfModuleId; private String vfModuleStackId; - private Map<String,String> vfModuleOutputs = new HashMap<String, String>(); + private Map<String,String> vfModuleOutputs = new HashMap<>(); public UpdateVfModuleResponse() { super(); diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVolumeGroupRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVolumeGroupRequest.java index 61fd9ccf87..2cd2cd49fb 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVolumeGroupRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVolumeGroupRequest.java @@ -43,7 +43,7 @@ public class UpdateVolumeGroupRequest extends VfRequestCommon { private String vnfVersion; private String vfModuleType; private String modelCustomizationUuid; - private Map<String,String> volumeGroupParams = new HashMap<String, String>(); + private Map<String,String> volumeGroupParams = new HashMap<>(); private MsoRequest msoRequest = new MsoRequest(); public UpdateVolumeGroupRequest() { diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVolumeGroupResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVolumeGroupResponse.java index babf5476e6..7f1c70314f 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVolumeGroupResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVolumeGroupResponse.java @@ -39,7 +39,7 @@ public class UpdateVolumeGroupResponse extends VfResponseCommon { public UpdateVolumeGroupResponse() { super(); - this.volumeGroupOutputs = new HashMap<String, String>(); + this.volumeGroupOutputs = new HashMap<>(); } public UpdateVolumeGroupResponse( diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java index 44922a7a8a..c8c036d58a 100644 --- a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java +++ b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java @@ -643,6 +643,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { return stringMap; } + @Override public void createVfModule(String cloudSiteId, String tenantId, String vnfType, @@ -1415,6 +1416,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { return; } + @Override public void deleteVfModule (String cloudSiteId, String tenantId, String vnfName, diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/VnfAdapterRest.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/VnfAdapterRest.java index 21ad1ce490..c438e7b821 100644 --- a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/VnfAdapterRest.java +++ b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/VnfAdapterRest.java @@ -174,7 +174,7 @@ public class VnfAdapterRest { public void run() { try { String cloudsite = req.getCloudSiteId(); - Holder<Map<String, String>> outputs = new Holder <Map <String, String>> (); + Holder<Map<String, String>> outputs = new Holder <> (); if (cloudsite != null && !cloudsite.equals(TESTING_KEYWORD)) { //vnfAdapter.deleteVnf (req.getCloudSiteId(), req.getTenantId(), req.getVfModuleStackId(), req.getMsoRequest()); vnfAdapter.deleteVfModule (req.getCloudSiteId(), req.getTenantId(), req.getVfModuleStackId(), req.getMsoRequest(), outputs); @@ -226,10 +226,10 @@ public class VnfAdapterRest { try { int respStatus = HttpStatus.SC_OK; QueryVfModuleResponse qryResp = new QueryVfModuleResponse(aaiVnfId, aaiVfModuleId, null, null, null); - Holder<Boolean> vnfExists = new Holder<Boolean>(); - Holder<String> vfModuleId = new Holder<String>(); - Holder<VnfStatus> status = new Holder<VnfStatus>(); - Holder<Map<String, String>> outputs = new Holder <Map <String, String>> (); + Holder<Boolean> vnfExists = new Holder<>(); + Holder<String> vfModuleId = new Holder<>(); + Holder<VnfStatus> status = new Holder<>(); + Holder<Map<String, String>> outputs = new Holder <> (); vnfAdapter.queryVnf (cloudSiteId, tenantId, vfModuleName, msoRequest, vnfExists, vfModuleId, status, outputs); if (!vnfExists.value) { LOGGER.debug ("vfModule not found"); @@ -354,9 +354,9 @@ public class VnfAdapterRest { LOGGER.debug ("CreateVfModuleTask start"); try { // Synchronous Web Service Outputs - Holder <String> vfModuleStackId = new Holder <String> (); - Holder <Map <String, String>> outputs = new Holder <Map <String, String>> (); - Holder <VnfRollback> vnfRollback = new Holder <VnfRollback> (); + Holder <String> vfModuleStackId = new Holder <> (); + Holder <Map <String, String>> outputs = new Holder <> (); + Holder <VnfRollback> vnfRollback = new Holder <> (); String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType(); LOGGER.debug("completeVnfVfModuleType=" + completeVnfVfModuleType); String cloudsite = req.getCloudSiteId(); @@ -483,9 +483,9 @@ public class VnfAdapterRest { //MsoVnfAdapter vnfAdapter = new MsoVnfAdapterImpl (msoPropertiesFactory, cloudConfigFactory); // Synchronous Web Service Outputs - Holder <String> vfModuleStackId = new Holder <String> (); - Holder <Map <String, String>> outputs = new Holder <Map <String, String>> (); - Holder <VnfRollback> vnfRollback = new Holder <VnfRollback> (); + Holder <String> vfModuleStackId = new Holder <> (); + Holder <Map <String, String>> outputs = new Holder <> (); + Holder <VnfRollback> vnfRollback = new Holder <> (); String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType(); LOGGER.debug("in updateVf - completeVnfVfModuleType=" + completeVnfVfModuleType); diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/VolumeAdapterRest.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/VolumeAdapterRest.java index d2f1c86fda..87b48fc68a 100644 --- a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/VolumeAdapterRest.java +++ b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/VolumeAdapterRest.java @@ -136,9 +136,9 @@ public class VolumeAdapterRest { LOGGER.debug ("CreateVFModule VolumesTask start"); try { // Synchronous Web Service Outputs - Holder<String> stackId = new Holder<String>(); - Holder<Map<String, String>> outputs = new Holder<Map<String, String>>(); - Holder<VnfRollback> vnfRollback = new Holder<VnfRollback>(); + Holder<String> stackId = new Holder<>(); + Holder<Map<String, String>> outputs = new Holder<>(); + Holder<VnfRollback> vnfRollback = new Holder<>(); String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType(); LOGGER.debug("in createVfModuleVolumes - completeVnfVfModuleType=" + completeVnfVfModuleType); @@ -462,9 +462,9 @@ public class VolumeAdapterRest { LOGGER.debug("UpdateVNFVolumesTask start"); try { @SuppressWarnings("unused") - Holder<String> stackId = new Holder<String> (); - Holder<Map<String, String>> outputs = new Holder<Map <String, String>> (); - Holder<VnfRollback> vnfRollback = new Holder<VnfRollback> (); + Holder<String> stackId = new Holder<> (); + Holder<Map<String, String>> outputs = new Holder<> (); + Holder<VnfRollback> vnfRollback = new Holder<> (); String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType(); LOGGER.debug("in updateVfModuleVolume - completeVnfVfModuleType=" + completeVnfVfModuleType); @@ -535,10 +535,10 @@ public class VolumeAdapterRest { try { int respStatus = HttpStatus.SC_OK; QueryVolumeGroupResponse qryResp = new QueryVolumeGroupResponse(aaiVolumeGroupId, volumeGroupStackId, null, null); - Holder<Boolean> vnfExists = new Holder<Boolean>(); - Holder<String> vfModuleId = new Holder<String>(); - Holder<VnfStatus> status = new Holder<VnfStatus>(); - Holder<Map<String, String>> outputs = new Holder<Map<String, String>>(); + Holder<Boolean> vnfExists = new Holder<>(); + Holder<String> vfModuleId = new Holder<>(); + Holder<VnfStatus> status = new Holder<>(); + Holder<Map<String, String>> outputs = new Holder<>(); if (cloudSiteId != null && cloudSiteId.equals(TESTING_KEYWORD)) { if (tenantId != null && tenantId.equals(TESTING_KEYWORD)) { throw new VnfException("testing."); @@ -575,7 +575,7 @@ public class VolumeAdapterRest { } } public static Map<String, String> testMap() { - Map<String, String> m = new HashMap<String, String>(); + Map<String, String> m = new HashMap<>(); m.put("mickey", "7"); m.put("clyde", "10"); m.put("wayne", "99"); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerSupport.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerSupport.java index 3b7089153f..bfd0d7dee4 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerSupport.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerSupport.java @@ -108,7 +108,7 @@ public class ApplicationControllerSupport { try { return (Status) statusReader.invoke(response); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - throw new RuntimeException(String.format("Unable to obtain status from LCM Kit response"), e); + throw new RuntimeException("Unable to obtain status from LCM Kit response", e); } } return new Status(); diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ReadConfigTask.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ReadConfigTask.java index 6249040342..b27a2fa64e 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ReadConfigTask.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ReadConfigTask.java @@ -67,29 +67,12 @@ public class ReadConfigTask extends BaseTask { synchronized (ReadConfigTask.class) { if (properties == null) { properties = new Properties(); - - InputStream stream = null; - - try { - stream = getClass().getResourceAsStream(thePropertiesFile); - - if (stream == null) { - throw new IOException("Resource not found: " + thePropertiesFile); - } + try (InputStream stream = getClass().getResourceAsStream(thePropertiesFile)) { properties.load(stream); - stream.close(); - stream = null; - - } finally { - if (stream != null) { - try { - stream.close(); - } catch (Exception e) { - msoLogger.debug("Exception:", e); - } - } + } catch (Exception e) { + msoLogger.debug("Exception at readResourceFile stream: " + e); } } } diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ReadFileTask.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ReadFileTask.java index 6b3cb5a1db..af38053fac 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ReadFileTask.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/ReadFileTask.java @@ -76,36 +76,18 @@ public class ReadFileTask extends BaseTask { Object value = execution.getVariable(theInputVariable); if (value == null) { - InputStream xmlStream = null; - - try { - xmlStream = getClass().getResourceAsStream(theFile); - - if (xmlStream == null) { - throw new IOException("Resource not found: " + theFile); - } - - BufferedReader reader = new BufferedReader(new InputStreamReader(xmlStream)); + try (InputStream xmlStream = getClass().getResourceAsStream(theFile); + BufferedReader reader = new BufferedReader(new InputStreamReader(xmlStream))) { StringBuilder output = new StringBuilder(); String line; while ((line = reader.readLine()) != null) { output.append(line); } - - xmlStream.close(); - xmlStream = null; - value = output.toString(); - } finally { - if (xmlStream != null) { - try { - xmlStream.close(); - } catch (Exception e) { - msoLogger.debug("Exception ", e); - } - } + } catch (Exception e) { + msoLogger.debug("Exception at readResourceFile stream: " + e); } } execution.setVariable(theInputVariable, value); diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/XQueryScriptTask.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/XQueryScriptTask.java index 4b34ddf0f0..6080768cee 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/XQueryScriptTask.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/XQueryScriptTask.java @@ -1,244 +1,233 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.core;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.math.BigDecimal;
-import java.net.URI;
-import java.util.Iterator;
-
-import javax.xml.transform.stream.StreamSource;
-
-import org.camunda.bpm.engine.ProcessEngineException;
-import org.camunda.bpm.engine.delegate.DelegateExecution;
-//import java.util.logging.Logger;
-import org.camunda.bpm.engine.delegate.Expression;
-
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-
-import net.sf.saxon.Configuration;
-import net.sf.saxon.s9api.DocumentBuilder;
-import net.sf.saxon.s9api.Processor;
-import net.sf.saxon.s9api.QName;
-import net.sf.saxon.s9api.XQueryCompiler;
-import net.sf.saxon.s9api.XQueryEvaluator;
-import net.sf.saxon.s9api.XQueryExecutable;
-import net.sf.saxon.s9api.XdmAtomicValue;
-import net.sf.saxon.s9api.XdmItem;
-import net.sf.saxon.s9api.XdmNode;
-
-/**
- * Executes an XQuery script.
- * <p>
- * Required fields:<br/><br/>
- * scriptFile: the XQuery script file path<br/>
- * outputVariable: the output variable name<br/>
- * <p>
- * Optional fields:<br/><br/>
- * xmlInputVariables: CSV list of variables containing
- * XML data to be injected into the script<br/>
- * atomicInputVariables: CSV list of variables containing
- * atomic data to be injected into the script<br/>
- */
-public class XQueryScriptTask extends BaseTask {
-
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
-
- private Expression scriptFile;
- private Expression xmlInputVariables;
- private Expression atomicInputVariables;
- private Expression outputVariable;
-
- public void execute(DelegateExecution execution) throws Exception {
- if (msoLogger.isDebugEnabled()) {
- msoLogger.debug("Started Executing " + getTaskName());
- }
-
- String theScriptFile =
- getStringField(scriptFile, execution, "scriptFile");
- String theXmlInputVariables =
- getOptionalStringField(xmlInputVariables, execution, "xmlInputVariables");
- String theAtomicInputVariables =
- getOptionalStringField(atomicInputVariables, execution, "atomicInputVariables");
- String theOutputVariable =
- getStringField(outputVariable, execution, "outputVariable");
-
- if (msoLogger.isDebugEnabled()) {
- msoLogger.debug ("scriptFile = " + theScriptFile
- + " xmlInputVariables = " + theXmlInputVariables
- + " atomicInputVariables = " + theAtomicInputVariables
- + "outputVariable = " + theOutputVariable);
- }
-
- String[] xmlInputVariableArray = (theXmlInputVariables == null)
- ? new String[0] : theXmlInputVariables.split(",[ ]*");
-
- String[] atomicInputVariableArray = (theAtomicInputVariables == null)
- ? new String[0] : theAtomicInputVariables.split(",[ ]*");
-
- Boolean shouldFail = (Boolean) execution.getVariable("shouldFail");
-
- if (shouldFail != null && shouldFail) {
- throw new ProcessEngineException(getClass().getSimpleName() + " Failed");
- }
-
- // The script could be compiled once and reused, but we are reading it
- // and compiling it every time.
- Configuration configuration = new Configuration();
- Processor processor = new Processor(configuration);
- XQueryCompiler compiler = processor.newXQueryCompiler();
- XQueryExecutable executable = compile(compiler, theScriptFile);
-
- // The evaluator must not be shared by multiple threads. Here is where
- // the initial context may be set, as well as values of external variables.
- XQueryEvaluator evaluator = executable.load();
-
- // Convert XML string variable content to document-node objects and inject
- // these into the evaluator. Note: the script must accept the document-node
- // type. Most MSO scripts today expect element() input, not document-node
- // input. TODO: figure out how to pass the variable data as element() types.
-
- for (String xmlInputVariable : xmlInputVariableArray) {
- if (msoLogger.isDebugEnabled()) {
- msoLogger.debug("Injecting XML variable '" + xmlInputVariable + "'");
- msoLogger.debug("printing the variable content>>'" + execution.getVariable(xmlInputVariable) +"'");
- }
-
- String xml = (String) execution.getVariable(xmlInputVariable);
- DocumentBuilder documentBuilder = processor.newDocumentBuilder();
- StreamSource source = new StreamSource(new ByteArrayInputStream(xml.getBytes("UTF-8")));
- XdmNode xdmNode = documentBuilder.build(source);
-
- // Inject the document-node object into the XQueryEvaluator.
- // TODO: transform it to an element()
- QName variable = new QName(xmlInputVariable);
- evaluator.setExternalVariable(variable, xdmNode);
- }
-
- // Inject atomic variables into the evaluator.
-
- for (String atomicInputVariable : atomicInputVariableArray) {
-
- if (msoLogger.isDebugEnabled()) {
- msoLogger.debug ("Injecting object variable '"
- + atomicInputVariable + "'");
- }
-
- QName variable = new QName(atomicInputVariable);
- Object value = execution.getVariable(atomicInputVariable);
-
- if (value == null) {
- // The variable value is null, so we have no way to know what
- // type it is. I don't know how to deal with this, so for
- // now, just skip it.
-
- msoLogger.warn (MessageEnum.BPMN_VARIABLE_NULL, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.DataError, atomicInputVariable);
-
- continue;
- }
-
- // There might be a better way to do this...
- if (value instanceof BigDecimal) {
- evaluator.setExternalVariable(variable,
- new XdmAtomicValue((BigDecimal) value));
- } else if (value instanceof Boolean) {
- evaluator.setExternalVariable(variable,
- new XdmAtomicValue((Boolean) value));
- } else if (value instanceof Double) {
- evaluator.setExternalVariable(variable,
- new XdmAtomicValue((Double) value));
- } else if (value instanceof Float) {
- evaluator.setExternalVariable(variable,
- new XdmAtomicValue((Float) value));
- } else if (value instanceof Long) {
- evaluator.setExternalVariable(variable,
- new XdmAtomicValue((Long) value));
- } else if (value instanceof String) {
- evaluator.setExternalVariable(variable,
- new XdmAtomicValue((String) value));
- } else if (value instanceof URI) {
- evaluator.setExternalVariable(variable,
- new XdmAtomicValue((URI) value));
- } else {
- throw new BadInjectedFieldException(
- "atomicInputVariables", getTaskName(),
- "'" + atomicInputVariable + "' type is not supported: "
- + value.getClass());
- }
- }
-
- // Evaluate the query and collect the output.
- StringBuilder output = new StringBuilder();
- Iterator<XdmItem> xdmItems = evaluator.iterator();
- while (xdmItems.hasNext()) {
- XdmItem item = xdmItems.next();
-
- if (msoLogger.isDebugEnabled()) {
- msoLogger.debug("XQuery result item = " + item);
- }
-
- output.append(item.toString());
- }
-
- // Set the output variable.
- execution.setVariable(theOutputVariable, output.toString());
-
- if (msoLogger.isDebugEnabled()) {
- msoLogger.debug("Done Executing " + getTaskName());
- }
- }
-
- /**
- * Compiles an XQuery script contained in a resource (file).
- * @param compiler the XQueryCompiler
- * @param resource the resource path
- * @return an XQueryExecutable
- * @throws Exception on error
- */
- private XQueryExecutable compile(XQueryCompiler compiler, String resource)
- throws Exception {
- InputStream xqStream = null;
- try {
- xqStream = getClass().getResourceAsStream(resource);
-
- if (xqStream == null) {
- throw new IOException("Resource not found: " + resource);
- }
-
- XQueryExecutable executable = compiler.compile(xqStream);
- xqStream.close();
- xqStream = null;
- return executable;
- } finally {
- if (xqStream != null) {
- try {
- xqStream.close();
- } catch (Exception e) {
- msoLogger.debug ("Exception:", e);
- }
- }
- }
- }
+/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.core; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.math.BigDecimal; +import java.net.URI; +import java.util.Iterator; + +import javax.xml.transform.stream.StreamSource; + +import org.camunda.bpm.engine.ProcessEngineException; +import org.camunda.bpm.engine.delegate.DelegateExecution; +//import java.util.logging.Logger; +import org.camunda.bpm.engine.delegate.Expression; + +import org.openecomp.mso.logger.MessageEnum; +import org.openecomp.mso.logger.MsoLogger; + +import net.sf.saxon.Configuration; +import net.sf.saxon.s9api.DocumentBuilder; +import net.sf.saxon.s9api.Processor; +import net.sf.saxon.s9api.QName; +import net.sf.saxon.s9api.XQueryCompiler; +import net.sf.saxon.s9api.XQueryEvaluator; +import net.sf.saxon.s9api.XQueryExecutable; +import net.sf.saxon.s9api.XdmAtomicValue; +import net.sf.saxon.s9api.XdmItem; +import net.sf.saxon.s9api.XdmNode; + +/** + * Executes an XQuery script. + * <p> + * Required fields:<br/><br/> + * scriptFile: the XQuery script file path<br/> + * outputVariable: the output variable name<br/> + * <p> + * Optional fields:<br/><br/> + * xmlInputVariables: CSV list of variables containing + * XML data to be injected into the script<br/> + * atomicInputVariables: CSV list of variables containing + * atomic data to be injected into the script<br/> + */ +public class XQueryScriptTask extends BaseTask { + + private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); + + private Expression scriptFile; + private Expression xmlInputVariables; + private Expression atomicInputVariables; + private Expression outputVariable; + + public void execute(DelegateExecution execution) throws Exception { + if (msoLogger.isDebugEnabled()) { + msoLogger.debug("Started Executing " + getTaskName()); + } + + String theScriptFile = + getStringField(scriptFile, execution, "scriptFile"); + String theXmlInputVariables = + getOptionalStringField(xmlInputVariables, execution, "xmlInputVariables"); + String theAtomicInputVariables = + getOptionalStringField(atomicInputVariables, execution, "atomicInputVariables"); + String theOutputVariable = + getStringField(outputVariable, execution, "outputVariable"); + + if (msoLogger.isDebugEnabled()) { + msoLogger.debug ("scriptFile = " + theScriptFile + + " xmlInputVariables = " + theXmlInputVariables + + " atomicInputVariables = " + theAtomicInputVariables + + "outputVariable = " + theOutputVariable); + } + + String[] xmlInputVariableArray = (theXmlInputVariables == null) + ? new String[0] : theXmlInputVariables.split(",[ ]*"); + + String[] atomicInputVariableArray = (theAtomicInputVariables == null) + ? new String[0] : theAtomicInputVariables.split(",[ ]*"); + + Boolean shouldFail = (Boolean) execution.getVariable("shouldFail"); + + if (shouldFail != null && shouldFail) { + throw new ProcessEngineException(getClass().getSimpleName() + " Failed"); + } + + // The script could be compiled once and reused, but we are reading it + // and compiling it every time. + Configuration configuration = new Configuration(); + Processor processor = new Processor(configuration); + XQueryCompiler compiler = processor.newXQueryCompiler(); + XQueryExecutable executable = compile(compiler, theScriptFile); + if (executable == null) { + throw new ProcessEngineException(getClass().getSimpleName() + " Failed"); + } + + // The evaluator must not be shared by multiple threads. Here is where + // the initial context may be set, as well as values of external variables. + XQueryEvaluator evaluator = executable.load(); + + // Convert XML string variable content to document-node objects and inject + // these into the evaluator. Note: the script must accept the document-node + // type. Most MSO scripts today expect element() input, not document-node + // input. TODO: figure out how to pass the variable data as element() types. + + for (String xmlInputVariable : xmlInputVariableArray) { + if (msoLogger.isDebugEnabled()) { + msoLogger.debug("Injecting XML variable '" + xmlInputVariable + "'"); + msoLogger.debug("printing the variable content>>'" + execution.getVariable(xmlInputVariable) +"'"); + } + + String xml = (String) execution.getVariable(xmlInputVariable); + DocumentBuilder documentBuilder = processor.newDocumentBuilder(); + StreamSource source = new StreamSource(new ByteArrayInputStream(xml.getBytes("UTF-8"))); + XdmNode xdmNode = documentBuilder.build(source); + + // Inject the document-node object into the XQueryEvaluator. + // TODO: transform it to an element() + QName variable = new QName(xmlInputVariable); + evaluator.setExternalVariable(variable, xdmNode); + } + + // Inject atomic variables into the evaluator. + + for (String atomicInputVariable : atomicInputVariableArray) { + + if (msoLogger.isDebugEnabled()) { + msoLogger.debug ("Injecting object variable '" + + atomicInputVariable + "'"); + } + + QName variable = new QName(atomicInputVariable); + Object value = execution.getVariable(atomicInputVariable); + + if (value == null) { + // The variable value is null, so we have no way to know what + // type it is. I don't know how to deal with this, so for + // now, just skip it. + + msoLogger.warn (MessageEnum.BPMN_VARIABLE_NULL, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.DataError, atomicInputVariable); + + continue; + } + + // There might be a better way to do this... + if (value instanceof BigDecimal) { + evaluator.setExternalVariable(variable, + new XdmAtomicValue((BigDecimal) value)); + } else if (value instanceof Boolean) { + evaluator.setExternalVariable(variable, + new XdmAtomicValue((Boolean) value)); + } else if (value instanceof Double) { + evaluator.setExternalVariable(variable, + new XdmAtomicValue((Double) value)); + } else if (value instanceof Float) { + evaluator.setExternalVariable(variable, + new XdmAtomicValue((Float) value)); + } else if (value instanceof Long) { + evaluator.setExternalVariable(variable, + new XdmAtomicValue((Long) value)); + } else if (value instanceof String) { + evaluator.setExternalVariable(variable, + new XdmAtomicValue((String) value)); + } else if (value instanceof URI) { + evaluator.setExternalVariable(variable, + new XdmAtomicValue((URI) value)); + } else { + throw new BadInjectedFieldException( + "atomicInputVariables", getTaskName(), + "'" + atomicInputVariable + "' type is not supported: " + + value.getClass()); + } + } + + // Evaluate the query and collect the output. + StringBuilder output = new StringBuilder(); + Iterator<XdmItem> xdmItems = evaluator.iterator(); + while (xdmItems.hasNext()) { + XdmItem item = xdmItems.next(); + + if (msoLogger.isDebugEnabled()) { + msoLogger.debug("XQuery result item = " + item); + } + + output.append(item.toString()); + } + + // Set the output variable. + execution.setVariable(theOutputVariable, output.toString()); + + if (msoLogger.isDebugEnabled()) { + msoLogger.debug("Done Executing " + getTaskName()); + } + } + + /** + * Compiles an XQuery script contained in a resource (file). + * @param compiler the XQueryCompiler + * @param resource the resource path + * @return an XQueryExecutable + * @throws Exception on error + */ + private XQueryExecutable compile(XQueryCompiler compiler, String resource) + throws Exception { + try (InputStream xqStream = getClass().getResourceAsStream(resource)) { + XQueryExecutable executable = compiler.compile(xqStream); + return executable; + } catch (Exception e) { + msoLogger.debug ("Exception at resourceFile stream:", e); + return null; + } + } }
\ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java index d5170af22d..d0de819e03 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java @@ -156,7 +156,7 @@ public class JsonUtils { str = null;
}
// append the content to the XML output
- if (key.equals("content")) {
+ if ("content".equals(key)) {
if (curObj instanceof JSONArray) {
jsonArr = (JSONArray) curObj;
len = jsonArr.length();
@@ -952,11 +952,9 @@ public class JsonUtils { try {
Object rawValue = getJsonRawValue(jsonStr, keys);
- if (rawValue == null) {
- return false;
- } else {
- return true;
- }
+
+ return !(rawValue == null);
+
} catch (Exception e) {
msoLogger.debug("jsonElementExist(): unable to determine if json element exist. Exception is: " + e.toString(),e);
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java index cf8e94a733..b4e7b7e068 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java @@ -51,7 +51,7 @@ public class CamundaTaskClient extends RequestClient{ StringEntity input = new StringEntity(jsonReq);
input.setContentType(CommonConstants.CONTENT_TYPE_JSON);
- String encryptedCredentials = null;
+ String encryptedCredentials;
if(props!=null){
encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH,null);
if(encryptedCredentials != null){
@@ -92,7 +92,7 @@ public class CamundaTaskClient extends RequestClient{ throws ClientProtocolException, IOException{
HttpGet get = new HttpGet(url);
msoLogger.debug("Camunda Task url is: "+ url);
- String encryptedCredentials = null;
+ String encryptedCredentials;
if(props!=null){
encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH,null);
if(encryptedCredentials != null){
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ResponseHandler.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ResponseHandler.java index e90989deb8..6722a930ae 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ResponseHandler.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ResponseHandler.java @@ -131,36 +131,36 @@ public class ResponseHandler { } private int setStatus(int statusCode){ - int status = 0; + int httpStatus; switch(statusCode) { case HttpStatus.SC_ACCEPTED: case HttpStatus.SC_OK: - status = HttpStatus.SC_ACCEPTED; + httpStatus = HttpStatus.SC_ACCEPTED; break; case HttpStatus.SC_BAD_REQUEST: - status = HttpStatus.SC_BAD_REQUEST; + httpStatus = HttpStatus.SC_BAD_REQUEST; break; case HttpStatus.SC_UNAUTHORIZED: case HttpStatus.SC_FORBIDDEN: - status = HttpStatus.SC_INTERNAL_SERVER_ERROR; + httpStatus = HttpStatus.SC_INTERNAL_SERVER_ERROR; break; case HttpStatus.SC_NOT_FOUND: - status = HttpStatus.SC_NOT_IMPLEMENTED; + httpStatus = HttpStatus.SC_NOT_IMPLEMENTED; break; case HttpStatus.SC_INTERNAL_SERVER_ERROR: - status = HttpStatus.SC_BAD_GATEWAY; + httpStatus = HttpStatus.SC_BAD_GATEWAY; break; case HttpStatus.SC_SERVICE_UNAVAILABLE: - status = HttpStatus.SC_SERVICE_UNAVAILABLE; + httpStatus = HttpStatus.SC_SERVICE_UNAVAILABLE; break; case HttpStatus.SC_NO_CONTENT: - status = HttpStatus.SC_NO_CONTENT; + httpStatus = HttpStatus.SC_NO_CONTENT; break; default: - status = HttpStatus.SC_INTERNAL_SERVER_ERROR; + httpStatus = HttpStatus.SC_INTERNAL_SERVER_ERROR; break; } - return status; + return httpStatus; } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java index 8ee106efc1..9b975facc6 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java @@ -586,20 +586,20 @@ public class MsoRequest { public Map<String, List<String>> getOrchestrationFilters (MultivaluedMap<String, String> queryParams) throws ValidationException { String queryParam = null; - Map<String, List<String>> orchestrationFilterParams = new HashMap<String, List<String>>(); + Map<String, List<String>> orchestrationFilterParams = new HashMap<>(); for (Entry<String,List<String>> entry : queryParams.entrySet()) { queryParam = entry.getKey(); try{ - if(queryParam.equalsIgnoreCase("filter")){ + if("filter".equalsIgnoreCase(queryParam)){ for(String value : entry.getValue()) { StringTokenizer st = new StringTokenizer(value, ":"); int counter=0; String mapKey=null; - List<String> orchestrationList = new ArrayList<String>(); + List<String> orchestrationList = new ArrayList<>(); while (st.hasMoreElements()) { if(counter == 0){ mapKey = st.nextElement() + ""; diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java index 254ae3bf39..b426c39176 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java @@ -226,37 +226,37 @@ public class RequestsDatabase { if(instanceName != null && !instanceName.equals("")) { - if(requestScope.equals("service")){ + if("service".equals(requestScope)){ criteria.add (Restrictions.eq (SERVICE_INSTANCE_NAME, instanceName)); - } else if(requestScope.equals("vnf")){ + } else if("vnf".equals(requestScope)){ criteria.add (Restrictions.eq (VNF_INSTANCE_NAME, instanceName)); - } else if(requestScope.equals("volumeGroup")){ + } else if("volumeGroup".equals(requestScope)){ criteria.add (Restrictions.eq (VOLUME_GROUP_INSTANCE_NAME, instanceName)); - } else if(requestScope.equals("vfModule")){ + } else if("vfModule".equals(requestScope)){ criteria.add (Restrictions.eq (VFMODULE_INSTANCE_NAME, instanceName)); - } else if(requestScope.equals("network")){ + } else if("network".equals(requestScope)){ criteria.add (Restrictions.eq (NETWORK_INSTANCE_NAME, instanceName)); } } else { if(instanceIdMap != null){ - if(requestScope.equals("service") && instanceIdMap.get("serviceInstanceId") != null){ + if("service".equals(requestScope) && instanceIdMap.get("serviceInstanceId") != null){ criteria.add (Restrictions.eq (SERVICE_INSTANCE_ID, instanceIdMap.get("serviceInstanceId"))); } - if(requestScope.equals("vnf") && instanceIdMap.get("vnfInstanceId") != null){ + if("vnf".equals(requestScope) && instanceIdMap.get("vnfInstanceId") != null){ criteria.add (Restrictions.eq (VNF_INSTANCE_ID, instanceIdMap.get("vnfInstanceId"))); } - if(requestScope.equals("vfModule") && instanceIdMap.get("vfModuleInstanceId") != null){ + if("vfModule".equals(requestScope) && instanceIdMap.get("vfModuleInstanceId") != null){ criteria.add (Restrictions.eq (VFMODULE_INSTANCE_ID, instanceIdMap.get("vfModuleInstanceId"))); } - if(requestScope.equals("volumeGroup") && instanceIdMap.get("volumeGroupInstanceId") != null){ + if("volumeGroup".equals(requestScope) && instanceIdMap.get("volumeGroupInstanceId") != null){ criteria.add (Restrictions.eq (VOLUME_GROUP_INSTANCE_ID, instanceIdMap.get("volumeGroupInstanceId"))); } - if(requestScope.equals("network") && instanceIdMap.get("networkInstanceId") != null){ + if("network".equals(requestScope) && instanceIdMap.get("networkInstanceId") != null){ criteria.add (Restrictions.eq (NETWORK_INSTANCE_ID, instanceIdMap.get("networkInstanceId"))); } } @@ -270,7 +270,7 @@ public class RequestsDatabase { InfraActiveRequests infraActiveRequests = null; - if(dupList != null && dupList.size() > 0){ + if(dupList != null && !dupList.isEmpty()){ infraActiveRequests = dupList.get(0); } @@ -284,40 +284,40 @@ public class RequestsDatabase { for (Map.Entry<String, List<String>> entry : orchestrationMap.entrySet()) { String mapKey = entry.getKey(); - if(mapKey.equalsIgnoreCase("serviceInstanceId")) { + if("serviceInstanceId".equalsIgnoreCase(mapKey)) { mapKey = "serviceInstanceId"; - } else if(mapKey.equalsIgnoreCase("serviceInstanceName")) { + } else if("serviceInstanceName".equalsIgnoreCase(mapKey)) { mapKey = "serviceInstanceName"; - } else if(mapKey.equalsIgnoreCase("vnfInstanceId")){ + } else if("vnfInstanceId".equalsIgnoreCase(mapKey)){ mapKey = "vnfId"; - } else if(mapKey.equalsIgnoreCase("vnfInstanceName")) { + } else if("vnfInstanceName".equalsIgnoreCase(mapKey)) { mapKey = "vnfName"; - } else if(mapKey.equalsIgnoreCase("vfModuleInstanceId")) { + } else if("vfModuleInstanceId".equalsIgnoreCase(mapKey)) { mapKey = "vfModuleId"; - } else if(mapKey.equalsIgnoreCase("vfModuleInstanceName")) { + } else if("vfModuleInstanceName".equalsIgnoreCase(mapKey)) { mapKey = "vfModuleName"; - } else if(mapKey.equalsIgnoreCase("volumeGroupInstanceId")) { + } else if("volumeGroupInstanceId".equalsIgnoreCase(mapKey)) { mapKey = "volumeGroupId"; - } else if(mapKey.equalsIgnoreCase("volumeGroupInstanceName")) { + } else if("volumeGroupInstanceName".equalsIgnoreCase(mapKey)) { mapKey = "volumeGroupName"; - } else if(mapKey.equalsIgnoreCase("networkInstanceId")) { + } else if("networkInstanceId".equalsIgnoreCase(mapKey)) { mapKey = "networkId"; - } else if(mapKey.equalsIgnoreCase("networkInstanceName")) { + } else if("networkInstanceName".equalsIgnoreCase(mapKey)) { mapKey = "networkName"; - } else if(mapKey.equalsIgnoreCase("lcpCloudRegionId")) { + } else if("lcpCloudRegionId".equalsIgnoreCase(mapKey)) { mapKey = "aicCloudRegion"; - } else if(mapKey.equalsIgnoreCase("tenantId")) { + } else if("tenantId".equalsIgnoreCase(mapKey)) { mapKey = "tenantId"; - } else if(mapKey.equalsIgnoreCase("modelType")) { + } else if("modelType".equalsIgnoreCase(mapKey)) { mapKey = "requestScope"; - } else if(mapKey.equalsIgnoreCase("requestorId")) { + } else if("requestorId".equalsIgnoreCase(mapKey)) { mapKey = "requestorId"; - } else if(mapKey.equalsIgnoreCase("requestExecutionDate")) { + } else if("requestExecutionDate".equalsIgnoreCase(mapKey)) { mapKey = "startTime"; } String propertyValue = entry.getValue().get(1); - if (mapKey.equals("startTime")) { + if ("startTime".equals(mapKey)) { SimpleDateFormat format = new SimpleDateFormat("MM-dd-yyyy"); try { Date thisDate = format.parse(propertyValue); |