@Autowired
private Environment env;
- private ObjectMapper objMapper = new ObjectMapper();
+ private static final ObjectMapper objMapper = new ObjectMapper();
public SDNCService() {
super(RetrySequenceLevel.SHORT);
private static final Logger logger = LoggerFactory.getLogger(CNFAdapterAsync.class)
ExceptionUtil exceptionUtil = new ExceptionUtil()
- ObjectMapper mapper = new ObjectMapper();
+ private static final ObjectMapper mapper = new ObjectMapper();
@Override
public void preProcessRequest(DelegateExecution execution) {
class AnNssmfUtils {
private static final Logger logger = LoggerFactory.getLogger(AnNssmfUtils.class)
- private static final ObjectMapper objectMapper = new ObjectMapper();
+ private static final ObjectMapper objectMapper = new ObjectMapper()
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
public String buildSelectRANNSSIRequest(String requestId, String messageType, String UUID,String invariantUUID,
public class ServicePluginFactory {
+ private static final Logger logger = LoggerFactory.getLogger(ServicePluginFactory.class);
+ private static final ObjectMapper wrapMapper;
+ private static final ObjectMapper nonWrapMapper;
private static String OOF_DEFAULT_ENDPOINT;
private static String THIRD_SP_DEFAULT_ENDPOINT;
private static String INVENTORY_OSS_DEFAULT_ENDPOINT;
static JsonUtils jsonUtil = new JsonUtils();
- private static Logger logger = LoggerFactory.getLogger(ServicePluginFactory.class);
+ static {
+ wrapMapper = new ObjectMapper();
+ wrapMapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
+ nonWrapMapper = new ObjectMapper();
+ nonWrapMapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false);
+ }
+
private static ServicePluginFactory instance;
}
private static <T> T getJsonObject(String jsonstr, Class<T> type) {
- ObjectMapper mapper = new ObjectMapper();
- mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
+
try {
- return mapper.readValue(jsonstr, type);
+ return wrapMapper.readValue(jsonstr, type);
} catch (IOException e) {
logger.error("{} {} fail to unMarshal json", MessageEnum.RA_NS_EXC.toString(),
ErrorCode.BusinessProcessError.getValue(), e);
}
public static String getJsonString(Object srcObj) {
- ObjectMapper mapper = new ObjectMapper();
- mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false);
String jsonStr = null;
try {
- jsonStr = mapper.writeValueAsString(srcObj);
+ jsonStr = nonWrapMapper.writeValueAsString(srcObj);
} catch (JsonProcessingException e) {
logger.debug("SdcToscaParserException", e);
}
public abstract class AbstractSdncOperationTask implements JavaDelegate {
private static final Logger logger = LoggerFactory.getLogger(AbstractSdncOperationTask.class);
+ private static final ObjectMapper objectMapper;
+
+ static {
+ objectMapper = new ObjectMapper();
+ objectMapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
+ }
@Autowired
private Environment env;
}
protected String getPostbody(Object inputEntity) {
- ObjectMapper objectMapper = new ObjectMapper();
String postBody = null;
try {
- objectMapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
postBody = objectMapper.writeValueAsString(inputEntity);
} catch (JsonProcessingException e) {
logger.error("JsonProcessingException in getPostbody", e);
@Autowired
private InjectionHelper injectionHelper;
- private ObjectMapper mapper = new ObjectMapper();
+ private static final ObjectMapper mapper = new ObjectMapper();
private AAIRestClientImpl aaiRestClient = new AAIRestClientImpl();
private static final String ACTIVITY_PREFIX = "activity:";
private static final String EXECUTE_ACTIVITY_ERROR_MESSAGE = "ExecuteActivityErrorMessage";
- private ObjectMapper mapper = new ObjectMapper();
+ private static final ObjectMapper mapper = new ObjectMapper();
@Autowired
private RuntimeService runtimeService;
@Autowired
private VnfAdapterVfModuleObjectMapper vfModuleMapper;
- private ObjectMapper mapper = new ObjectMapper();
+ private static final ObjectMapper mapper = new ObjectMapper();
/**
* This method is used for creating the request for an Instance in Multicloud K8s Plugin.
@Autowired
private VnfAdapterVfModuleObjectMapper vfModuleMapper;
- private ObjectMapper mapper = new ObjectMapper();
+ private static final ObjectMapper mapper = new ObjectMapper();
/**
* This method is used for updating the request for an Instance in Multicloud K8s Plugin.
@Autowired
private ExceptionBuilder exceptionUtil;
- private ObjectMapper mapper = new ObjectMapper();
+ private static final ObjectMapper mapper = new ObjectMapper();
public void prepareCnfAdaperRequest(BuildingBlockExecution execution) {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
* 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.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
public abstract class AbstractInputParametersProvider<T> implements InputParametersProvider<T> {
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractInputParametersProvider.class);
+ private static final ObjectMapper mapper = new ObjectMapper();
protected Map<String, String> parseAdditionalParameters(final String additionalParamsString) {
try {
- final ObjectMapper mapper = new ObjectMapper();
final TypeReference<Map<String, String>> typeRef = new TypeReference<Map<String, String>>() {};
return mapper.readValue(additionalParamsString, typeRef);
} catch (final Exception exception) {
protected List<ExternalVirtualLink> parseExternalVirtualLinks(final String extVirtualLinksString) {
try {
- final ObjectMapper mapper = new ObjectMapper();
final TypeReference<List<ExternalVirtualLink>> extVirtualLinksStringTypeRef =
new TypeReference<List<ExternalVirtualLink>>() {};
return mapper.readValue(extVirtualLinksString, extVirtualLinksStringTypeRef);
public class AppcOrchestratorPreProcessor {
private static final Logger logger = LoggerFactory.getLogger(AppcOrchestratorPreProcessor.class);
public static final String CONTROLLER_TYPE_DEFAULT = "APPC";
+ private static final ObjectMapper objectMapper = new ObjectMapper();
@Autowired
private ExceptionBuilder exceptionUtil;
appcTaskRequest.setOperationsTimeout(operationsTimeout);
Map<String, String> configMap = new HashMap<>();
- ObjectMapper objectMapper = new ObjectMapper();
String configParamsStr = JsonUtils.getJsonValue(payload, "configuration_parameters");
if (configParamsStr != null) {
configMap =
* 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.
public class SDNCLcmPayloadBuilder {
private static Logger logger = LoggerFactory.getLogger(SDNCLcmPayloadBuilder.class);
+ private static final ObjectMapper mapper = new ObjectMapper();
public static ActivateNESwPayload buildActivateNESwPayload(DelegateExecution execution) {
String requestPayload = String.valueOf(execution.getVariable(REQUEST_PAYLOAD));
String swToBeDownloadedString = JsonUtils.getJsonValue(requestPayload, "swToBeDownloaded");
SwToBeDownloadedElement[] swToBeDownloadedArray;
- ObjectMapper mapper = new ObjectMapper();
try {
swToBeDownloadedArray = mapper.readValue(swToBeDownloadedString, SwToBeDownloadedElement[].class);
downloadNESwPayload.setSwToBeDownloaded(Arrays.asList(swToBeDownloadedArray));
}
public static String convertToSting(Object msgObject) throws JsonProcessingException {
- ObjectMapper mapper = new ObjectMapper();
return mapper.writeValueAsString(msgObject);
}
}
public class SdncControllerDE extends LcmControllerDE {
private static final int SDNC_DELEGATE_EXECUTION_ERROR_CODE = 1103;
+ private static final ObjectMapper mapper = new ObjectMapper();
@Override
public Boolean understand(ControllerContext<DelegateExecution> context) {
LcmInput lcmInput =
SDNCLcmMessageBuilder.buildLcmInputForPnf(requestId, subRequestId, pnfName, lcmAction, lcmPayload);
- ObjectMapper mapper = new ObjectMapper();
try {
String lcmInputMsg = mapper.writeValueAsString(lcmInput);
logger.debug("SDNC input message for {}: {}", lcmAction, lcmInputMsg);
private static final String ORIGINATOR_ID = "SO";
private static final String ACTION_NAME = "config-assign";
private static final String MODE = "sync";
+ private static final ObjectMapper objectMapper = new ObjectMapper();
private final ExtractPojosForBB extractPojosForBB;
private final ExceptionBuilder exceptionBuilder;
}
private Service getServiceObjectFromServiceMap(Map<String, Object> serviceMap) throws IOException {
- ObjectMapper objectMapper = new ObjectMapper();
String serviceFromJson = objectMapper.writeValueAsString(serviceMap.get("service"));
try {
return objectMapper.readValue(serviceFromJson, Service.class);
* 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.
private static final String VFMODULE_ID = "vfModuleId";
private static final String CONTROLLER_TYPE = "controllerType";
private static final String PAYLOAD = "payload";
+ private static final ObjectMapper mapper = new ObjectMapper();
public void setParamsForConfigurationScaleOut(BuildingBlockExecution execution) {
List<Map<String, String>> jsonPathForCfgParams = gBBInput.getRequestContext().getConfigurationParameters();
String key = null;
String paramValue = null;
- ObjectMapper mapper = new ObjectMapper();
String configScaleOutPayloadString = null;
ControllerSelectionReference controllerSelectionReference;
ConfigScaleOutPayload configPayload = new ConfigScaleOutPayload();
public class GeneralTopologyObjectMapper {
private static final Logger logger = LoggerFactory.getLogger(GeneralTopologyObjectMapper.class);
- private ObjectMapper mapper = new ObjectMapper();
+ private static final ObjectMapper mapper = new ObjectMapper();
/*
* Build GenericResourceApiRequestinformationRequestInformation
/**
* Build ConfigurationInformation
- *
+ *
* @param configuration
* @param includeModelInformation
* @return
/**
* Build GcRequestInformation
- *
+ *
* @param vnf
* @param genericResourceApiParam
* @return
* 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.
@Component
public class VfModuleTopologyOperationRequestMapper {
private static final Logger logger = LoggerFactory.getLogger(VfModuleTopologyOperationRequestMapper.class);
+ private static final ObjectMapper mapper = new ObjectMapper();
@Autowired
private GeneralTopologyObjectMapper generalTopologyObjectMapper;
public String buildObjectPath(String sdncAssignResponse) {
String objectPath = null;
if (sdncAssignResponse != null) {
- ObjectMapper mapper = new ObjectMapper();
try {
GenericResourceApiVfModuleResponseInformation assignResponseInfo =
mapper.readValue(sdncAssignResponse, GenericResourceApiVfModuleResponseInformation.class);
import java.util.Map;
public class ChildServiceRequestBuilder {
+ private static final ObjectMapper mapper = new ObjectMapper();
private final BuildingBlockExecution buildingBlockExecution;
private Service parent;
private Service child;
for (Map<String, Object> params : buildingBlockExecution.getGeneralBuildingBlock().getRequestContext()
.getRequestParameters().getUserParams()) {
if (params.containsKey(USERPARAMSERVICE)) {
- ObjectMapper obj = new ObjectMapper();
- String input = obj.writeValueAsString(params.get(USERPARAMSERVICE));
- parent = obj.readValue(input, Service.class);
+ String input = mapper.writeValueAsString(params.get(USERPARAMSERVICE));
+ parent = mapper.readValue(input, Service.class);
if (parent.getResources().getServices() != null) {
for (Service service : parent.getResources().getServices()) {
if (service.getInstanceName().equals(childSvcInstanceName)) {
public class WorkflowAction {
private static final Logger logger = LoggerFactory.getLogger(WorkflowAction.class);
+ private static final ObjectMapper mapper = new ObjectMapper();
private static final String SERVICE_INSTANCES = "serviceInstances";
private static final String VF_MODULES = "vfModules";
try {
fillExecutionDefault(execution);
final String bpmnRequest = (String) execution.getVariable(BBConstants.G_BPMN_REQUEST);
- ServiceInstancesRequest sIRequest =
- new ObjectMapper().readValue(bpmnRequest, ServiceInstancesRequest.class);
+ ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class);
final String requestId = (String) execution.getVariable(BBConstants.G_REQUEST_ID);
@Component
public class WorkflowActionBBTasks {
+ private static final Logger logger = LoggerFactory.getLogger(WorkflowActionBBTasks.class);
+ private static final ObjectMapper mapper = new ObjectMapper();
private static final String RETRY_COUNT = "retryCount";
private static final String FABRIC_CONFIGURATION = "FabricConfiguration";
private static final String ADD_FABRIC_CONFIGURATION_BB = "AddFabricConfigurationBB";
private static final String ROLLBACK_TO_ASSIGNED = "RollbackToAssigned";
private static final String UNASSIGN = "Unassign";
private static final String DELETE = "Delete";
- private static final Logger logger = LoggerFactory.getLogger(WorkflowActionBBTasks.class);
@Autowired
private RequestsDbClient requestDbclient;
requestRef.setInstanceId(resourceId);
requestRef.setRequestId(requestId);
serviceInstancesResponse.setRequestReferences(requestRef);
- ObjectMapper mapper = new ObjectMapper();
+
String jsonRequest = "";
try {
jsonRequest = mapper.writeValueAsString(serviceInstancesResponse);
public class UserParamsServiceTraversal {
private static final Logger logger = LoggerFactory.getLogger(UserParamsServiceTraversal.class);
+ private static final ObjectMapper mapper = new ObjectMapper();
private final CatalogDbClient catalogDbClient;
private final ExceptionBuilder exceptionBuilder;
if (userParams != null) {
for (Map<String, Object> params : userParams) {
if (params.containsKey(USER_PARAM_SERVICE)) {
- ObjectMapper obj = new ObjectMapper();
- String input = obj.writeValueAsString(params.get(USER_PARAM_SERVICE));
- Service validate = obj.readValue(input, Service.class);
+ String input = mapper.writeValueAsString(params.get(USER_PARAM_SERVICE));
+ Service validate = mapper.readValue(input, Service.class);
return getResourceList(execution, serviceModelVersionId, requestAction, validate);
}
}
"Existing vnfs in AAI are not supported by service model. Unsupported vnfCustomizationIds: %s";
private final CatalogDbClient catalogDbClient;
+ private static final ObjectMapper mapper = new ObjectMapper();
private static final Function<WorkflowType, Predicate<Resource>> resourceType =
workflowType -> resource -> resource.getResourceType() == workflowType;
private Optional<ServiceInstancesRequest> parseBpmnRequest(String bpmnRequest) {
try {
- return Optional.of(new ObjectMapper().readValue(bpmnRequest, ServiceInstancesRequest.class));
+ return Optional.of(mapper.readValue(bpmnRequest, ServiceInstancesRequest.class));
} catch (IOException e) {
return Optional.empty();
}
* 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.
@Component
public class VnfAdapterObjectMapper {
- private ObjectMapper mapper = new ObjectMapper();
+ private static final ObjectMapper mapper = new ObjectMapper();
private static final String ENABLE_BRIDGE = "mso.bridgeEnabled";
@PostConstruct
* 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.
private static final String NULL_RESPONSE_FROM_NAMING_SERVICE =
"Error received a null response from Naming Service.";
private static final String NAMING_SERVICE_ERROR = "Error from Naming Service: %s";
+ private static final ObjectMapper mapper = new ObjectMapper();
public String validateNameGenResponse(ResponseEntity<NameGenResponse> response) throws BadResponseException {
if (response == null) {
}
protected String formatError(HttpStatusCodeException e) throws IOException {
- ObjectMapper mapper = new ObjectMapper();
NameGenResponse errorResponse = mapper.readValue(e.getResponseBodyAsString(), NameGenResponse.class);
NameGenResponseError error = errorResponse.getError();
public class SliceTaskParams implements Serializable {
private static final long serialVersionUID = -4389946152970978423L;
+ private static final ObjectMapper mapper = new ObjectMapper();
private String serviceId;
}
public void convertFromJson(String jsonString) throws IOException {
- ObjectMapper mapper = new ObjectMapper();
Map<String, String> paramMap = (Map<String, String>) mapper.readValue(jsonString, Map.class);
this.setServiceId(paramMap.get("ServiceId"));
this.setServiceName(paramMap.get("ServiceName"));
this.setAnStatusDescription(paramMap.get("AN.statusDescription"));
}
}
-
* 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.
@Provider
public class CommonObjectMapperProvider implements ContextResolver<ObjectMapper> {
- protected ObjectMapper mapper;
+ protected static ObjectMapper mapper;
public CommonObjectMapperProvider() {
* 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.
private static Logger logger = LoggerFactory.getLogger(PolicyClientImpl.class);
private PolicyRestProperties props;
- private ObjectMapper mapper = new ObjectMapper();
+ private static final ObjectMapper mapper = new ObjectMapper();
public PolicyClientImpl() {
props = RestPropertiesLoader.getInstance().getNewImpl(PolicyRestProperties.class);
* 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.
@Priority(Integer.MIN_VALUE)
public class AAIClientResponseExceptionMapper extends ResponseExceptionMapper {
+ private static final ObjectMapper mapper = new ObjectMapper();
private final String requestId;
public AAIClientResponseExceptionMapper() {
String errorString = "Error calling A&AI. Request-Id=" + this.getRequestId() + " ";
try {
- AAIError error = new ObjectMapper().readValue(entity, AAIError.class);
+ AAIError error = mapper.readValue(entity, AAIError.class);
AAIErrorFormatter formatter = new AAIErrorFormatter(error);
return Optional.of(errorString + formatter.getMessage());
} catch (IOException e) {
* 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.
public class AAISingleTransactionClient extends
GraphInventoryTransactionClient<AAISingleTransactionClient, AAIBaseResourceUri<?, ?>, AAIResourceUri, AAIEdgeLabel> {
+ private static final ObjectMapper mapper = new ObjectMapper();
private final SingleTransactionRequest request;
private AAIResourcesClient resourcesClient;
private AAIClient aaiClient;
/*
* (non-Javadoc)
- *
+ *
* @see org.onap.aaiclient.client.aai.GraphInventoryTransactionClient#execute()
*/
@Override
@Override
public void execute(boolean dryRun) throws BulkProcessFailed {
- final ObjectMapper mapper = new ObjectMapper();
if (dryRun) {
try {
if (logger.isDebugEnabled()) {
protected Optional<String> locateErrorMessages(SingleTransactionResponse response) {
final List<String> errorMessages = new ArrayList<>();
- final ObjectMapper mapper = new ObjectMapper();
for (OperationBodyResponse body : response.getOperationResponses()) {
if (Optional.ofNullable(body.getResponseStatusCode()).orElse(400) > 300) {
* 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.
public class AAITransactionalClient extends
GraphInventoryTransactionClient<AAITransactionalClient, AAIBaseResourceUri<?, ?>, AAIResourceUri, AAIEdgeLabel> {
+ private static final ObjectMapper mapper = new ObjectMapper();
private final Transactions transactions;
private Transaction currentTransaction;
/*
* (non-Javadoc)
- *
+ *
* @see org.onap.aaiclient.client.aai.GraphInventoryTransactionalClient#beginNewTransaction()
*/
public AAITransactionalClient beginNewTransaction() {
/*
* (non-Javadoc)
- *
+ *
* @see org.onap.aaiclient.client.aai.GraphInventoryTransactionalClient#execute()
*/
@Override
@Override
public void execute(boolean dryRun) throws BulkProcessFailed {
- final ObjectMapper mapper = new ObjectMapper();
if (dryRun) {
try {
if (logger.isDebugEnabled()) {
protected Optional<String> locateErrorMessages(String response) {
final List<String> errorMessages = new ArrayList<>();
final List<String> results = JsonPathUtil.getInstance().locateResultList(response, "$..body");
- final ObjectMapper mapper = new ObjectMapper();
if (!results.isEmpty()) {
List<Map<String, Object>> parsed = new ArrayList<>();
try {
* 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.
public abstract class HttpLookupUri extends AAISimpleUri implements HttpAwareUri {
+ private static final ObjectMapper mapper = new ObjectMapper();
private transient Optional<String> cachedValue = Optional.empty();
protected final AAIObjectType aaiType;
protected Optional<String> extractRelatedLink(String jsonString) throws IOException {
Optional<String> result;
- ObjectMapper mapper = new ObjectMapper();
Results<Pathed> results = mapper.readValue(jsonString, new TypeReference<Results<Pathed>>() {});
if (results.getResult().size() == 1) {
public class SwaggerConverter {
private final Log log;
+ private static final ObjectMapper mapper = new ObjectMapper();
public SwaggerConverter(Log log) {
this.log = log;
}
}
- ObjectMapper mapper = new ObjectMapper();
for (ObjectType item : output.values()) {
for (String path : item.getPaths()) {
* 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.
*/
public class CamundaMacroRequestSerializer {
+ private static final ObjectMapper mapper;
+
+ static {
+ mapper = new ObjectMapper();
+ mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
+ }
+
private CamundaMacroRequestSerializer() {}
public static String getJsonRequest(String requestId, String action, String serviceInstanceId)
macroRequest.setAction(getCamundaInput(action));
macroRequest.setRequestId(getCamundaInput(requestId));
macroRequest.setServiceInstanceId(getCamundaInput(serviceInstanceId));
- ObjectMapper mapper = new ObjectMapper();
- mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
return mapper.writeValueAsString(macroRequest);
}
* 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.
public class CamundaClient {
private static Logger logger = LoggerFactory.getLogger(CamundaClient.class);
private static final String BASIC = "Basic ";
+ private static final ObjectMapper mapper = new ObjectMapper();
+ private static final ObjectMapper wrapMapper;
+
+ static {
+ wrapMapper = new ObjectMapper();
+ wrapMapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
+ }
@Autowired
private RestTemplate restTemplate;
camundaRequest.setSvcid(svcid);
camundaRequest.setSchema(schema);
camundaRequest.setTimeout(timeout);
- ObjectMapper mapper = new ObjectMapper();
- mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
-
- jsonReq = mapper.writeValueAsString(camundaRequest);
+ jsonReq = wrapMapper.writeValueAsString(camundaRequest);
logger.trace("request body is {}", jsonReq);
} catch (Exception e) {
logger.error("Error in APIH Wrap request", e);
camundaRequest.setInstanceGroupId(instanceGroupIdInput);
camundaRequest.setGenerateIds(generateIds);
- ObjectMapper mapper = new ObjectMapper();
- mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
-
- jsonReq = mapper.writeValueAsString(camundaRequest);
+ jsonReq = wrapMapper.writeValueAsString(camundaRequest);
logger.trace("request body is {}", jsonReq);
} catch (Exception e) {
logger.error("Error in wrapVIDRequest", e);
}
protected BPMNFailureException createBPMNFailureException(HttpStatusCodeException e) {
- ObjectMapper mapper = new ObjectMapper();
String responseText = null;
String message = null;
try {
* 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.
@Component
public class ResponseHandler {
private static Logger logger = LoggerFactory.getLogger(ResponseHandler.class);
+ private static final ObjectMapper mapper;
+
+ static {
+ mapper = new ObjectMapper();
+ mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
+ }
public CamundaResponse getCamundaResponse(ResponseEntity<String> camundaResponse) throws ValidateException {
String responseBody = camundaResponse.getBody();
CamundaResponse response = null;
- ObjectMapper mapper = new ObjectMapper();
- mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
+
try {
response = mapper.readValue(responseBody, CamundaResponse.class);
} catch (IOException | NullPointerException e) {
* 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.
public class RequestIdFilter implements ContainerRequestFilter {
private static Logger logger = LoggerFactory.getLogger(RequestIdFilter.class);
+ private static final ObjectMapper mapper = new ObjectMapper();
@Autowired
private RequestsDbClient infraActiveRequestsClient;
}
protected String createRequestError(String requestId, String requestTable) {
- ObjectMapper mapper = new ObjectMapper();
RequestError error = new RequestError();
ServiceException serviceException = new ServiceException();
serviceException.setMessageId(ErrorNumbers.SVC_BAD_PARAMETER);
* 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.
public class ApiExceptionMapper implements ExceptionMapper<ApiException> {
private static Logger logger = LoggerFactory.getLogger(ApiExceptionMapper.class);
-
+ private static final ObjectMapper mapper = new ObjectMapper();
private final JAXBContext context;
private final Marshaller marshaller;
}
public ObjectMapper createObjectMapper() {
- return new ObjectMapper();
+ return mapper;
}
public Marshaller getMarshaller() {
* 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.
private HashMap<String, String> instanceIdMap = new HashMap<>();
private static final Logger logger = LoggerFactory.getLogger(E2EServiceInstances.class);
+ private static final ObjectMapper mapper = new ObjectMapper();
private static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
/**
* POST Requests for E2E Service create Instance on a version provided
- *
+ *
* @throws ApiException
*/
/**
* PUT Requests for E2E Service update Instance on a version provided
- *
+ *
* @throws ApiException
*/
/**
* DELETE Requests for E2E Service delete Instance on a specified version and serviceId
- *
+ *
* @throws ApiException
*/
/**
* Scale Requests for E2E Service scale Instance on a specified version
- *
+ *
* @throws ApiException
*/
/**
* GET Requests for Comparing model of service instance with target version
- *
+ *
* @throws ApiException
*/
CompareModelsRequest e2eCompareModelReq;
- ObjectMapper mapper = new ObjectMapper();
try {
e2eCompareModelReq = mapper.readValue(requestJSON, CompareModelsRequest.class);
// TODO should be a new one or the same service instance Id
E2ESliceServiceActivateRequest e2eActReq;
- ObjectMapper mapper = new ObjectMapper();
try {
e2eActReq = mapper.readValue(requestJSON, E2ESliceServiceActivateRequest.class);
// TODO should be a new one or the same service instance Id
E2EServiceInstanceDeleteRequest e2eDelReq;
- ObjectMapper mapper = new ObjectMapper();
try {
e2eDelReq = mapper.readValue(requestJSON, E2EServiceInstanceDeleteRequest.class);
E2EServiceInstanceRequest e2eSir;
String serviceId = instanceIdMap.get(SERVICE_ID);
- ObjectMapper mapper = new ObjectMapper();
try {
e2eSir = mapper.readValue(requestJSON, E2EServiceInstanceRequest.class);
E2EServiceInstanceRequest e2eSir;
MsoRequest msoRequest = new MsoRequest();
- ObjectMapper mapper = new ObjectMapper();
+
try {
e2eSir = mapper.readValue(requestJSON, E2EServiceInstanceRequest.class);
String requestId = UUID.randomUUID().toString();
E2EServiceInstanceScaleRequest e2eScaleReq;
- ObjectMapper mapper = new ObjectMapper();
try {
e2eScaleReq = mapper.readValue(requestJSON, E2EServiceInstanceScaleRequest.class);
/**
* Getting recipes from catalogDb
- *
+ *
* @param serviceModelUUID the service model version uuid
* @param action the action for the service
* @return the service recipe result
/**
* Getting recipes from catalogDb If Service recipe is not set, use default recipe, if set , use special recipe.
- *
+ *
* @param serviceModelUUID the service version uuid
* @param action the action of the service.
* @return the service recipe result.
/**
* Converting E2EServiceInstanceRequest to ServiceInstanceRequest and passing it to camunda engine.
- *
+ *
* @param e2eSir
* @return
*/
private String convertToString(ServiceInstancesRequest sir) {
String returnString = null;
// converting to string
- ObjectMapper mapper = new ObjectMapper();
try {
returnString = mapper.writeValueAsString(sir);
} catch (IOException e) {
private static final String SAVE_TO_DB = "save instance to db";
private static final String URI_PREFIX = "/moi/api/rest/";
+ private static final ObjectMapper mapper = new ObjectMapper();
@Autowired
private MsoRequest msoRequest;
attributes.setSliceProfileList(sliceProfileList);
mOIResponse.setAttributes(attributes);
- ObjectMapper mapper = new ObjectMapper();
try {
response = mapper.writeValueAsString(mOIResponse);
} catch (Exception exception) {
ServiceInstancesRequest sir = createServiceInstanceRequest(request, requestId);
String requestDetails = null;
try {
- requestDetails = new ObjectMapper().writeValueAsString(sir);
+ requestDetails = mapper.writeValueAsString(sir);
LOGGER.debug(">>> sir: {}", sir);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
Function<Object, String> toString = serviceRequest -> {
- ObjectMapper mapper = new ObjectMapper();
String requestAsString = null;
try {
requestAsString = mapper.writeValueAsString(serviceRequest);
* 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.
@Component
public class ManualTasks {
private static Logger logger = LoggerFactory.getLogger(ManualTasks.class);
+ private static final ObjectMapper mapper = new ObjectMapper();
+ private static final ObjectMapper wrapMapper;
+
+ static {
+ wrapMapper = new ObjectMapper();
+ wrapMapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
+ }
@org.springframework.beans.factory.annotation.Value("${mso.camunda.rest.task.uri}")
String apiVersion = version.substring(1);
try {
- ObjectMapper mapper = new ObjectMapper();
taskRequest = mapper.readValue(request, TasksRequest.class);
if (taskRequest.getRequestDetails() == null) {
String camundaJsonReq;
try {
- ObjectMapper mapper = new ObjectMapper();
- mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
- camundaJsonReq = mapper.writeValueAsString(variablesForComplete);
+ camundaJsonReq = wrapMapper.writeValueAsString(variablesForComplete);
} catch (JsonProcessingException e) {
logger.error("Mapping of JSON object to Camunda request failed");
ValidateException validateException =
trr.setTaskId(taskId);
String completeResp = null;
try {
- ObjectMapper mapper = new ObjectMapper();
- mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
- completeResp = mapper.writeValueAsString(trr);
+ completeResp = wrapMapper.writeValueAsString(trr);
} catch (JsonProcessingException e) {
logger.error("Unable to map response from Camunda");
ValidateException validateException =
@Component
public class MsoRequest {
+ private static Logger logger = LoggerFactory.getLogger(MsoRequest.class);
+ private static final ObjectMapper mapper = new ObjectMapper();
+ private static final ObjectMapper nonNullMapper;
+
+ static {
+ nonNullMapper = new ObjectMapper();
+ nonNullMapper.setSerializationInclusion(Include.NON_NULL);
+
+ }
@Autowired
private RequestsDbClient requestsDbClient;
@Value("${mso.enforceDLP:false}")
private boolean enforceDLP;
- private static Logger logger = LoggerFactory.getLogger(MsoRequest.class);
public Response buildServiceErrorResponse(int httpResponseCode, MsoException exceptionType, String errorText,
String messageId, List<String> variables, String version) {
if (reqVersion >= 7 && requestParameters != null && requestParameters.getUserParams() != null) {
for (Map<String, Object> params : requestParameters.getUserParams()) {
if (params.containsKey("service")) {
- ObjectMapper obj = new ObjectMapper();
- String input = obj.writeValueAsString(params.get("service"));
- Service validate = obj.readValue(input, Service.class);
+ String input = mapper.writeValueAsString(params.get("service"));
+ Service validate = mapper.readValue(input, Service.class);
info.setUserParams(validate);
rules.add(new UserParamsValidation());
break;
public String getRequestJSON(ServiceInstancesRequest sir)
throws JsonGenerationException, JsonMappingException, IOException {
- ObjectMapper mapper = new ObjectMapper();
- mapper.setSerializationInclusion(Include.NON_NULL);
logger.debug("building sir from object {}", sir);
- String requestJSON = mapper.writeValueAsString(sir);
+ String requestJSON = nonNullMapper.writeValueAsString(sir);
// Perform mapping from VID-style modelInfo fields to ASDC-style modelInfo fields
public class Onap3gppServiceInstances {
private static final Logger logger = LoggerFactory.getLogger(Onap3gppServiceInstances.class);
-
+ private static final ObjectMapper mapper = new ObjectMapper();
private static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
private static final String END_OF_THE_TRANSACTION = "End of the transaction, the final response is: ";
}
private Response getSubnetCapabilities(List<SubnetTypes> subnetTypes, String version) throws ApiException {
- ObjectMapper oMapper = new ObjectMapper();
String inputFileString = "";
Map<String, Object> subnetCapability = new HashMap<>();
BufferedReader br = null;
line = br.readLine();
}
inputFileString = sb.toString();
- subnetCapability = oMapper.readValue(inputFileString, Map.class);
+ subnetCapability = mapper.readValue(inputFileString, Map.class);
} catch (Exception e) {
logger.debug("Exception while reading subnet capability value from json", e);
}
}
String response = null;
try {
- response = oMapper.writeValueAsString(responseMap);
+ response = mapper.writeValueAsString(responseMap);
} catch (JsonProcessingException e) {
logger.debug("Exception while converting subnet capability object to String {}", e);
}
}
Function<Object, String> toString = serviceRequest -> {
- ObjectMapper mapper = new ObjectMapper();
String requestAsString = null;
try {
requestAsString = mapper.writeValueAsString(serviceRequest);
parameter.getApiVersion());
}
}
-
-
private static Logger logger = LoggerFactory.getLogger(OrchestrationRequests.class);
private static final String ERROR_MESSAGE_PREFIX = "Error Source: %s, Error Message: %s";
+ private static final ObjectMapper mapper = new ObjectMapper();
@Autowired
private RequestsDbClient requestsDbClient;
ServiceInstancesRequest sir;
try {
- ObjectMapper mapper = new ObjectMapper();
sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
} catch (IOException e) {
logger.error("Exception occurred", e);
String requestBody = iar.getRequestBody();
Request request = new Request();
- ObjectMapper mapper = new ObjectMapper();
-
request.setRequestId(iar.getRequestId());
request.setRequestScope(iar.getRequestScope());
request.setRequestType(iar.getRequestAction());
@Autowired
private ResponseBuilder builder;
- private ObjectMapper mapper = new ObjectMapper();
+ private static final ObjectMapper mapper = new ObjectMapper();
@GET
@Path("/{version:[vV][4-7]}/")
public class RequestHandlerUtils extends AbstractRestHandler {
private static Logger logger = LoggerFactory.getLogger(RequestHandlerUtils.class);
+ private static final ObjectMapper mapper = new ObjectMapper();
+ private static final ObjectMapper nonNullMapper;
+
+ static {
+ nonNullMapper = new ObjectMapper();
+ nonNullMapper.setSerializationInclusion(Include.NON_NULL);
+ }
protected static final String SAVE_TO_DB = "save instance to db";
private static final String NAME = "name";
public Response postBPELRequest(InfraActiveRequests currentActiveReq, RequestClientParameter requestClientParameter,
String orchestrationUri, String requestScope) throws ApiException {
- ObjectMapper mapper = new ObjectMapper();
ResponseEntity<String> response = postRequest(currentActiveReq, requestClientParameter, orchestrationUri);
ServiceInstancesResponse jsonResponse = null;
int bpelStatus = responseHandler.setStatus(response.getStatusCodeValue());
public ServiceInstancesRequest convertJsonToServiceInstanceRequest(String requestJSON, Actions action,
String requestId, String requestUri) throws ApiException {
try {
- ObjectMapper mapper = new ObjectMapper();
return mapper.readValue(requestJSON, ServiceInstancesRequest.class);
} catch (IOException e) {
public String mapJSONtoMSOStyle(String msoRawRequest, ServiceInstancesRequest serviceInstRequest,
boolean isAlaCarte, Actions action) throws IOException {
- ObjectMapper mapper = new ObjectMapper();
- mapper.setSerializationInclusion(Include.NON_NULL);
if (serviceInstRequest != null) {
- return mapper.writeValueAsString(serviceInstRequest);
+ return nonNullMapper.writeValueAsString(serviceInstRequest);
} else {
return msoRawRequest;
}
}
private Service serviceMapper(Map<String, Object> params) throws IOException {
- ObjectMapper obj = new ObjectMapper();
- String input = obj.writeValueAsString(params.get("service"));
- return obj.readValue(input, Service.class);
+ String input = mapper.writeValueAsString(params.get("service"));
+ return mapper.readValue(input, Service.class);
}
private void addUserParams(Map<String, Object> targetUserParams, List<Map<String, String>> sourceUserParams) {
public class ServiceIntentApiHandler {
private static final Logger logger = LoggerFactory.getLogger(ServiceIntentApiHandler.class);
+ private static final ObjectMapper mapper = new ObjectMapper();
private static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
}
Function<Object, String> toString = serviceRequest -> {
- ObjectMapper mapper = new ObjectMapper();
String requestAsString = null;
try {
requestAsString = mapper.writeValueAsString(serviceRequest);
* 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.
private static Logger logger = LoggerFactory.getLogger(TasksHandler.class);
+ private static final ObjectMapper mapper = new ObjectMapper();
@Value("${mso.camunda.rest.task.uri}")
private String requestUrl;
String camundaJsonReq = null;
try {
- ObjectMapper mapper = new ObjectMapper();
camundaJsonReq = mapper.writeValueAsString(tv);
} catch (JsonProcessingException e) {
ErrorLoggerInfo errorLoggerInfo =
String jsonResponse = null;
try {
- ObjectMapper mapper = new ObjectMapper();
jsonResponse = mapper.writeValueAsString(trr);
} catch (JsonProcessingException e) {
ErrorLoggerInfo errorLoggerInfo =
@Component
public class WorkflowSpecificationsHandler {
+ private static final ObjectMapper mapper = new ObjectMapper();
+
@Autowired
private ResponseBuilder builder;
final String pnf_resource = "pnf";
String apiVersion = version.substring(1);
- ObjectMapper mapper = new ObjectMapper();
- mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
-
List<Workflow> workflows = queryWorkflowsForResourceTarget(pnf_resource);
Optional<String> optional = getResponseByWorkflowSpec(workflows);
WorkflowSpecifications workflowSpecifications = mapWorkflowsToWorkflowSpecifications(workflows);
try {
- ObjectMapper mapper = new ObjectMapper();
return Optional.of(mapper.writeValueAsString(workflowSpecifications));
} catch (JsonProcessingException e) {
catchAndThrowValidationEx(e);
* 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.
@Autowired
private AAIDataRetrieval aaiDataRet;
- private ObjectMapper mapper = new ObjectMapper();
+ private static final ObjectMapper mapper = new ObjectMapper();
public ServiceInstancesRequest buildVFModuleDeleteRequest(String vnfId, String vfModuleId, ModelType modelType)
* 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.
public class NetworkRestHandler extends AbstractRestHandler {
private static final Logger logger = LoggerFactory.getLogger(NetworkRestHandler.class);
+ private static final ObjectMapper mapper = new ObjectMapper();
public InfraActiveRequests mapInfraActiveRequestForDelete(String requestId, String serviceInstanceId,
String networkId, String requestorId, String source, String requestURL) {
public RequestClientParameter buildRequestParams(ServiceInstancesRequest request, String requestURI,
String requestId, String serviceInstanceId, String networkId) throws JsonProcessingException {
- ObjectMapper mapper = new ObjectMapper();
return new RequestClientParameter.Builder().setRequestId(requestId).setServiceInstanceId(serviceInstanceId)
.setNetworkId(networkId).setALaCarte(true).setRequestDetails(mapper.writeValueAsString(request))
.setRequestAction(Action.deleteInstance.toString()).setRequestUri(requestURI).setApiVersion("v8")
* 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.
@Component
public class ServiceInstanceRestHandler extends AbstractRestHandler {
+ private static final Logger logger = LoggerFactory.getLogger(ServiceInstanceRestHandler.class);
+ private static final ObjectMapper mapper = new ObjectMapper();
private static final String DEFAULT_VF_MODULE_UUID = "d88da85c-d9e8-4f73-b837-3a72a431622b";
- private static final Logger logger = LoggerFactory.getLogger(ServiceInstanceRestHandler.class);
public InfraActiveRequests mapInfraActiveRequestForDelete(String requestId, String serviceInstanceId,
String requestorId, String source, String requestURL) {
public RequestClientParameter buildRequestParams(ServiceInstancesRequest request, String requestURI,
String requestId, String serviceInstanceId) throws JsonProcessingException {
- ObjectMapper mapper = new ObjectMapper();
return new RequestClientParameter.Builder().setRequestId(requestId).setServiceInstanceId(serviceInstanceId)
.setALaCarte(true).setRequestDetails(mapper.writeValueAsString(request))
.setRequestAction(Action.deleteInstance.toString()).setRequestUri(requestURI).setApiVersion("v8")
* 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.
public class VFModuleRestHandler extends AbstractRestHandler {
private static final Logger logger = LoggerFactory.getLogger(VFModuleRestHandler.class);
+ private static final ObjectMapper mapper = new ObjectMapper();
public InfraActiveRequests mapInfraActiveRequestForDelete(String requestId, String vfModuleId,
String serviceInstanceId, String vnfId, String requestorId, String source, String requestURL) {
public RequestClientParameter buildRequestParams(ServiceInstancesRequest request, String requestURI,
String requestId, String serviceInstanceId, String vnfId, String vfModuleId)
throws JsonProcessingException {
- ObjectMapper mapper = new ObjectMapper();
return new RequestClientParameter.Builder().setRequestId(requestId).setServiceInstanceId(serviceInstanceId)
.setVnfId(vnfId).setVfModuleId(vfModuleId).setALaCarte(true)
.setRequestDetails(mapper.writeValueAsString(request))
* 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.
public class VnfRestHandler extends AbstractRestHandler {
private static final Logger logger = LoggerFactory.getLogger(VnfRestHandler.class);
+ private static final ObjectMapper mapper = new ObjectMapper();
public InfraActiveRequests mapInfraActiveRequestForDelete(String requestId, String serviceInstanceId, String vnfId,
String requestorId, String source, String requestURL) {
public RequestClientParameter buildRequestParams(ServiceInstancesRequest request, String requestURI,
String requestId, String serviceInstanceId, String vnfId) throws JsonProcessingException {
- ObjectMapper mapper = new ObjectMapper();
return new RequestClientParameter.Builder().setRequestId(requestId).setServiceInstanceId(serviceInstanceId)
.setVnfId(vnfId).setALaCarte(true).setRequestDetails(mapper.writeValueAsString(request))
.setRequestAction(Action.deleteInstance.toString()).setRequestUri(requestURI).setApiVersion("v8")
* 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.
public class VolumeRestHandler extends AbstractRestHandler {
private static final Logger logger = LoggerFactory.getLogger(VolumeRestHandler.class);
+ private static final ObjectMapper mapper = new ObjectMapper();
public InfraActiveRequests mapInfraActiveRequestForDelete(String requestId, String volumeGroupId,
String serviceInstanceId, String vnfId, String requestorId, String source, String requestURL) {
public RequestClientParameter buildRequestParams(ServiceInstancesRequest request, String requestURI,
String requestId, String serviceInstanceId, String vnfId, String volumeGroupId)
throws JsonProcessingException {
- ObjectMapper mapper = new ObjectMapper();
return new RequestClientParameter.Builder().setRequestId(requestId).setServiceInstanceId(serviceInstanceId)
.setVnfId(vnfId).setVolumeGroupId(volumeGroupId).setALaCarte(true)
.setRequestDetails(mapper.writeValueAsString(request))
public class CloudOrchestration {
private static Logger logger = LoggerFactory.getLogger(CloudOrchestration.class);
+ private static final ObjectMapper mapper = new ObjectMapper();
private static final String ENVIRONMENT_ID_KEY = "operationalEnvironmentId";
@Autowired
long startTime, CloudOrchestrationRequest cor) throws ApiException {
try {
logger.debug("Converting incoming JSON request to Object");
- ObjectMapper mapper = new ObjectMapper();
return mapper.readValue(requestJSON, CloudOrchestrationRequest.class);
} catch (IOException e) {
* 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.
public class CloudResourcesOrchestration {
private static Logger logger = LoggerFactory.getLogger(CloudResourcesOrchestration.class);
+ private static final ObjectMapper mapper = new ObjectMapper();
@Autowired
RequestsDbClient requestDbClient;
logger.debug("requestId is: {}", requestId);
try {
- ObjectMapper mapper = new ObjectMapper();
cor = mapper.readValue(requestJSON, CloudOrchestrationRequest.class);
} catch (IOException e) {
ErrorLoggerInfo errorLoggerInfo =
if (requestBody != null) {
try {
- ObjectMapper mapper = new ObjectMapper();
requestDetails = mapper.readValue(requestBody, RequestDetails.class);
} catch (IOException e) {
ErrorLoggerInfo errorLoggerInfo =
* 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.
public class ModelDistributionRequest {
private static Logger logger = LoggerFactory.getLogger(ModelDistributionRequest.class);
+ private static final ObjectMapper mapper = new ObjectMapper();
+
@Autowired
private Provider<TenantIsolationRunnable> tenantIsolationRunnable;
Distribution distributionRequest;
try {
- ObjectMapper mapper = new ObjectMapper();
distributionRequest = mapper.readValue(requestJSON, Distribution.class);
} catch (IOException e) {
ErrorLoggerInfo errorLoggerInfo =
* 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.
@Scope("prototype")
public class TenantIsolationRequest {
+ private static final ObjectMapper mapper = new ObjectMapper();
+
private String requestId;
private String requestJSON;
private RequestInfo requestInfo;
this.requestInfo = request.getRequestDetails().getRequestInfo();
try {
- ObjectMapper mapper = new ObjectMapper();
requestJSON = mapper.writeValueAsString(request.getRequestDetails());
-
} catch (JsonProcessingException e) {
logger.error("Exception in JSON processing", e);
throw new ValidationException("Parse ServiceInstanceRequest to JSON string", true);
this.cor = cor;
try {
- ObjectMapper mapper = new ObjectMapper();
requestJSON = mapper.writeValueAsString(cor.getRequestDetails());
} catch (JsonProcessingException e) {
* 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.
@Component
public class DmaapOperationalEnvClient {
+ private static final ObjectMapper mapper = new ObjectMapper();
+
@Autowired
private Provider<OperationalEnvironmentPublisher> dmaapPublisher;
}
protected String getJson(CreateEcompOperationEnvironmentBean obj) throws JsonProcessingException {
-
- final ObjectMapper mapper = new ObjectMapper();
return mapper.writeValueAsString(obj);
}
* 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.
public class CreateVnfOperationalEnvironment {
private static Logger logger = LoggerFactory.getLogger(CreateVnfOperationalEnvironment.class);
+ private static final ObjectMapper mapper = new ObjectMapper();
protected CloudOrchestrationRequest request;
@Autowired
public void execute(String requestId, CloudOrchestrationRequest request) throws ApiException {
try {
setRequest(request);
- ObjectMapper objectMapper = new ObjectMapper();
AAIResultWrapper aaiResultWrapper = aaiHelper.getAaiOperationalEnvironment(getEcompManagingEnvironmentId());
if (aaiResultWrapper.isEmpty()) {
throw new NotFoundException(getEcompManagingEnvironmentId() + " not found in A&AI");
String searchKey = getSearchKey(aaiEnv);
String tenantContext = getTenantContext().toUpperCase();
String jsonResponse = getGrmClient().findRunningServicesAsString(searchKey, 1, tenantContext);
- ServiceEndPointList sel = objectMapper.readValue(jsonResponse, ServiceEndPointList.class);
+ ServiceEndPointList sel = mapper.readValue(jsonResponse, ServiceEndPointList.class);
if (sel.getServiceEndPointList().size() == 0) {
throw new TenantIsolationException(
"GRM did not find any matches for " + searchKey + " in " + tenantContext);