2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.be.servlets;
23 import com.fasterxml.jackson.databind.DeserializationFeature;
24 import com.fasterxml.jackson.databind.ObjectMapper;
25 import com.fasterxml.jackson.databind.module.SimpleModule;
26 import com.google.common.annotations.VisibleForTesting;
27 import com.google.gson.Gson;
28 import com.google.gson.GsonBuilder;
29 import com.google.gson.reflect.TypeToken;
30 import fj.data.Either;
31 import io.swagger.v3.oas.annotations.OpenAPIDefinition;
32 import io.swagger.v3.oas.annotations.info.Info;
33 import io.swagger.v3.oas.annotations.servers.Server;
34 import org.json.simple.JSONArray;
35 import org.json.simple.JSONObject;
36 import org.json.simple.parser.JSONParser;
37 import org.json.simple.parser.ParseException;
38 import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic;
39 import org.openecomp.sdc.be.components.impl.BaseBusinessLogic;
40 import org.openecomp.sdc.be.components.impl.CapabilitiesBusinessLogic;
41 import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic;
42 import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
43 import org.openecomp.sdc.be.components.impl.ElementBusinessLogic;
44 import org.openecomp.sdc.be.components.impl.GenericArtifactBrowserBusinessLogic;
45 import org.openecomp.sdc.be.components.impl.InputsBusinessLogic;
46 import org.openecomp.sdc.be.components.impl.InterfaceOperationBusinessLogic;
47 import org.openecomp.sdc.be.components.impl.OutputsBusinessLogic;
48 import org.openecomp.sdc.be.components.impl.PolicyBusinessLogic;
49 import org.openecomp.sdc.be.components.impl.ProductBusinessLogic;
50 import org.openecomp.sdc.be.components.impl.RelationshipTypeBusinessLogic;
51 import org.openecomp.sdc.be.components.impl.RequirementBusinessLogic;
52 import org.openecomp.sdc.be.components.impl.ResourceBusinessLogic;
53 import org.openecomp.sdc.be.components.impl.ServiceBusinessLogic;
54 import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentException;
55 import org.openecomp.sdc.be.components.impl.exceptions.ComponentException;
56 import org.openecomp.sdc.be.components.lifecycle.LifecycleBusinessLogic;
57 import org.openecomp.sdc.be.components.scheduledtasks.ComponentsCleanBusinessLogic;
58 import org.openecomp.sdc.be.components.upgrade.UpgradeBusinessLogic;
59 import org.openecomp.sdc.be.config.BeEcompErrorManager;
60 import org.openecomp.sdc.be.dao.api.ActionStatus;
61 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
62 import org.openecomp.sdc.be.datatypes.enums.DeclarationTypeEnum;
63 import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
64 import org.openecomp.sdc.be.ecomp.converters.AssetMetadataConverter;
65 import org.openecomp.sdc.be.impl.ComponentsUtils;
66 import org.openecomp.sdc.be.impl.WebAppContextWrapper;
67 import org.openecomp.sdc.be.model.ComponentInstInputsMap;
68 import org.openecomp.sdc.be.model.PropertyConstraint;
69 import org.openecomp.sdc.be.model.PropertyDefinition;
70 import org.openecomp.sdc.be.model.InputDefinition;
71 import org.openecomp.sdc.be.model.User;
72 import org.openecomp.sdc.be.model.operations.impl.PropertyOperation;
73 import org.openecomp.sdc.be.model.operations.impl.PropertyOperation.PropertyConstraintJacksonDeserializer;
74 import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder;
75 import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum;
76 import org.openecomp.sdc.be.user.UserBusinessLogic;
77 import org.openecomp.sdc.common.api.Constants;
78 import org.openecomp.sdc.common.log.wrappers.Logger;
79 import org.openecomp.sdc.common.servlets.BasicServlet;
80 import org.openecomp.sdc.exception.ResponseFormat;
81 import org.springframework.web.context.WebApplicationContext;
83 import javax.servlet.ServletContext;
84 import javax.servlet.http.HttpServletRequest;
85 import javax.ws.rs.core.Context;
86 import javax.ws.rs.core.Response;
87 import javax.ws.rs.core.Response.ResponseBuilder;
88 import java.io.IOException;
89 import java.lang.reflect.Type;
90 import java.util.HashMap;
91 import java.util.Iterator;
92 import java.util.List;
94 import java.util.Map.Entry;
95 import java.util.Objects;
97 import java.util.function.Supplier;
99 @OpenAPIDefinition(info = @Info(title = "SDC API", description = "SDC External, Distribution and Internal APIs"),
100 servers = {@Server(url = "/sdc", description = "SDC External and Distribution APIs"),
101 @Server(url = "/sdc2/rest", description = "SDC Internal APIs")})
102 public class BeGenericServlet extends BasicServlet {
104 public BeGenericServlet(UserBusinessLogic userAdminManager,
105 ComponentsUtils componentsUtils) {
106 this.userAdminManager = userAdminManager;
107 this.componentsUtils = componentsUtils;
111 protected HttpServletRequest servletRequest;
113 private static final Logger log = Logger.getLogger(BeGenericServlet.class);
115 private static final String PROPERTY_NAME_REGEX = "[\\w,\\d,_]+";
117 private UserBusinessLogic userAdminManager;
118 protected ComponentsUtils componentsUtils;
120 /******************** New error response mechanism
121 * @param requestErrorWrapper **************/
123 protected Response buildErrorResponse(ResponseFormat requestErrorWrapper) {
124 return Response.status(requestErrorWrapper.getStatus()).entity(gson.toJson(requestErrorWrapper.getRequestError())).build();
127 protected Response buildGeneralErrorResponse() {
128 return buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.GENERAL_ERROR));
131 protected Response buildOkResponse(Object entity) {
132 return buildOkResponseStatic(entity);
135 private static Response buildOkResponseStatic(Object entity) {
136 return Response.status(Response.Status.OK)
141 public HttpServletRequest getServletRequest() {
142 return servletRequest;
146 public void setRequestServlet(HttpServletRequest request) {this.servletRequest = request;}
148 protected Response buildOkResponse(ResponseFormat errorResponseWrapper, Object entity) {
149 return buildOkResponse(errorResponseWrapper, entity, null);
152 protected Response buildOkResponse(ResponseFormat errorResponseWrapper, Object entity, Map<String, String> additionalHeaders) {
153 int status = errorResponseWrapper.getStatus();
154 ResponseBuilder responseBuilder = Response.status(status);
155 if (entity != null) {
156 if (log.isTraceEnabled())
157 log.trace("returned entity is {}", entity.toString());
158 responseBuilder = responseBuilder.entity(entity);
160 if (additionalHeaders != null) {
161 for (Entry<String, String> additionalHeader : additionalHeaders.entrySet()) {
162 String headerName = additionalHeader.getKey();
163 String headerValue = additionalHeader.getValue();
164 if (log.isTraceEnabled())
165 log.trace("Adding header {} with value {} to the response", headerName, headerValue);
166 responseBuilder.header(headerName, headerValue);
169 return responseBuilder.build();
172 /*******************************************************************************************************/
173 protected Either<User, ResponseFormat> getUser(final HttpServletRequest request, String userId) {
176 user = getUserAdminManager(request.getSession().getServletContext()).getUser(userId, false);
177 return Either.left(user);
178 } catch (ComponentException ce) {
179 log.info("createResource method - user is not listed. userId= {}", userId);
180 ResponseFormat errorResponse = getComponentsUtils().getResponseFormat(ce);
181 user = new User("", "", userId, "", null, null);
182 getComponentsUtils().auditResource(errorResponse, user, "", AuditingActionEnum.CHECKOUT_RESOURCE);
183 return Either.right(errorResponse);
187 UserBusinessLogic getUserAdminManager(ServletContext context) {
188 return getClassFromWebAppContext(context, () -> UserBusinessLogic.class);
191 protected GenericArtifactBrowserBusinessLogic getGenericArtifactBrowserBL(ServletContext context) {
192 return getClassFromWebAppContext(context, () -> GenericArtifactBrowserBusinessLogic.class);
195 protected ResourceBusinessLogic getResourceBL(ServletContext context) {
196 return getClassFromWebAppContext(context, () -> ResourceBusinessLogic.class);
199 InterfaceOperationBusinessLogic getInterfaceOperationBL(ServletContext context) {
200 return getClassFromWebAppContext(context, () -> InterfaceOperationBusinessLogic.class);
203 protected CapabilitiesBusinessLogic getCapabilitiesBL(ServletContext context) {
204 return getClassFromWebAppContext(context, () -> CapabilitiesBusinessLogic.class);
207 protected RelationshipTypeBusinessLogic getRelationshipTypeBL(ServletContext context) {
208 return getClassFromWebAppContext(context, () -> RelationshipTypeBusinessLogic.class);
210 protected RequirementBusinessLogic getRequirementBL(ServletContext context) {
211 return getClassFromWebAppContext(context, () -> RequirementBusinessLogic.class);
213 ComponentsCleanBusinessLogic getComponentCleanerBL(ServletContext context) {
214 return getClassFromWebAppContext(context, () -> ComponentsCleanBusinessLogic.class);
217 protected ServiceBusinessLogic getServiceBL(ServletContext context) {
218 return getClassFromWebAppContext(context, () -> ServiceBusinessLogic.class);
221 ProductBusinessLogic getProductBL(ServletContext context) {
222 return getClassFromWebAppContext(context, () -> ProductBusinessLogic.class);
225 protected ArtifactsBusinessLogic getArtifactBL(ServletContext context) {
226 return getClassFromWebAppContext(context, () -> ArtifactsBusinessLogic.class);
228 protected UpgradeBusinessLogic getUpgradeBL(ServletContext context) {
229 return getClassFromWebAppContext(context, () -> UpgradeBusinessLogic.class);
232 protected ElementBusinessLogic getElementBL(ServletContext context) {
233 return getClassFromWebAppContext(context, () -> ElementBusinessLogic.class);
236 protected AssetMetadataConverter getAssetUtils(ServletContext context) {
237 return getClassFromWebAppContext(context, () -> AssetMetadataConverter.class);
240 protected LifecycleBusinessLogic getLifecycleBL(ServletContext context) {
241 return getClassFromWebAppContext(context, () -> LifecycleBusinessLogic.class);
244 <T> T getClassFromWebAppContext(final ServletContext context, final Supplier<Class<T>> businessLogicClassGen) {
245 return getWebAppContext(context).getBean(businessLogicClassGen.get());
248 protected ComponentInstanceBusinessLogic getComponentInstanceBL(final ServletContext context) {
249 return getClassFromWebAppContext(context, () -> ComponentInstanceBusinessLogic.class);
252 protected ComponentsUtils getComponentsUtils() {
253 final ServletContext context = this.servletRequest.getSession().getServletContext();
254 return getClassFromWebAppContext(context, () -> ComponentsUtils.class);
258 * Used to support Unit Test.<br>
259 * Header Params are not supported in Unit Tests
263 String initHeaderParam(String headerValue, HttpServletRequest request, String headerName) {
265 if (headerValue != null) {
266 retValue = headerValue;
268 retValue = request.getHeader(headerName);
273 protected String getContentDispositionValue(String artifactFileName) {
274 return new StringBuilder().append("attachment; filename=\"").append(artifactFileName).append("\"").toString();
277 protected ComponentBusinessLogic getComponentBL(ComponentTypeEnum componentTypeEnum, ServletContext context) {
278 ComponentBusinessLogic businessLogic;
279 switch (componentTypeEnum) {
281 businessLogic = getResourceBL(context);
284 businessLogic = getServiceBL(context);
287 businessLogic = getProductBL(context);
289 case RESOURCE_INSTANCE:
290 businessLogic = getResourceBL(context);
293 BeEcompErrorManager.getInstance().logBeSystemError("getComponentBL");
294 throw new IllegalArgumentException("Illegal component type:" + componentTypeEnum.getValue());
296 return businessLogic;
299 <T> T convertJsonToObjectOfClass(String json, Class<T> clazz) {
301 ObjectMapper mapper = new ObjectMapper()
302 .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
303 .configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
305 log.trace("Starting to convert json to object. Json=\n{}", json);
307 SimpleModule module = new SimpleModule("customDeserializationModule");
308 module.addDeserializer(PropertyConstraint.class, new PropertyConstraintJacksonDeserializer());
309 mapper.registerModule(module);
311 object = mapper.readValue(json, clazz);
312 if (object != null) {
315 BeEcompErrorManager.getInstance().logBeInvalidJsonInput("convertJsonToObject");
316 log.debug("The object of class {} is null after converting from json. ", clazz);
317 throw new ByActionStatusComponentException(ActionStatus.INVALID_CONTENT);
319 } catch (IOException e) {
320 BeEcompErrorManager.getInstance().logBeInvalidJsonInput("convertJsonToObject");
321 log.debug("The exception {} occurred upon json to object convertation. Json=\n{}", e, json);
322 throw new ByActionStatusComponentException(ActionStatus.INVALID_CONTENT);
326 protected Either<Map<String, PropertyDefinition>, ActionStatus> getPropertyModel(String componentId, String data) {
327 JSONParser parser = new JSONParser();
330 Map<String, PropertyDefinition> properties = new HashMap<>();
331 root = (JSONObject) parser.parse(data);
333 Set entrySet = root.entrySet();
334 Iterator iterator = entrySet.iterator();
335 while (iterator.hasNext()) {
336 Entry next = (Entry) iterator.next();
337 String propertyName = (String) next.getKey();
339 if(!isPropertyNameValid(propertyName)) {
340 return Either.right(ActionStatus.INVALID_PROPERTY_NAME);
343 JSONObject value = (JSONObject) next.getValue();
344 Either<PropertyDefinition, ActionStatus> propertyDefinitionEither =
345 getPropertyDefinitionFromJson(componentId, propertyName, value);
347 if(propertyDefinitionEither.isRight()) {
348 return Either.right(propertyDefinitionEither.right().value());
351 properties.put(propertyName, propertyDefinitionEither.left().value());
354 return Either.left(properties);
355 } catch (ParseException e) {
356 log.info("Property conetnt is invalid - {}", data);
357 return Either.right(ActionStatus.INVALID_CONTENT);
361 protected boolean isPropertyNameValid(String propertyName) {
362 return Objects.nonNull(propertyName)
363 && propertyName.matches(PROPERTY_NAME_REGEX);
367 private Either<PropertyDefinition, ActionStatus> getPropertyDefinitionFromJson(String componentId, String propertyName, JSONObject value) {
368 String jsonString = value.toJSONString();
369 Either<PropertyDefinition, ActionStatus> convertJsonToObject = convertJsonToObject(jsonString, PropertyDefinition.class);
370 if (convertJsonToObject.isRight()) {
371 return Either.right(convertJsonToObject.right().value());
373 PropertyDefinition propertyDefinition = convertJsonToObject.left().value();
374 String uniqueId = UniqueIdBuilder.buildPropertyUniqueId(componentId, propertyName);
375 propertyDefinition.setUniqueId(uniqueId);
377 return Either.left(propertyDefinition);
380 private Either<InputDefinition, ActionStatus> getInputDefinitionFromJson(String componentId, String inputName, JSONObject value) {
381 String jsonString = value.toJSONString();
382 Either<InputDefinition, ActionStatus> convertJsonToObject = convertJsonToObject(jsonString, InputDefinition.class);
383 if (convertJsonToObject.isRight()) {
384 return Either.right(convertJsonToObject.right().value());
386 InputDefinition inputDefinition = convertJsonToObject.left().value();
387 String uniqueId = UniqueIdBuilder.buildPropertyUniqueId(componentId, inputName);
388 inputDefinition.setUniqueId(uniqueId);
390 return Either.left(inputDefinition);
393 protected Either<Map<String, PropertyDefinition>, ActionStatus> getPropertiesListForUpdate(String data) {
395 Map<String, PropertyDefinition> properties = new HashMap<>();
396 JSONParser parser = new JSONParser();
400 jsonArray = (JSONArray) parser.parse(data);
401 for (Object jsonElement : jsonArray) {
402 String propertyAsString = jsonElement.toString();
403 Either<PropertyDefinition, ActionStatus> convertJsonToObject = convertJsonToObject(propertyAsString, PropertyDefinition.class);
405 if (convertJsonToObject.isRight()) {
406 return Either.right(convertJsonToObject.right().value());
409 PropertyDefinition propertyDefinition = convertJsonToObject.left().value();
410 properties.put(propertyDefinition.getName(), propertyDefinition);
413 return Either.left(properties);
414 } catch (Exception e) {
415 log.info("Property content is invalid - {}", data);
416 return Either.right(ActionStatus.INVALID_CONTENT);
421 protected String propertyToJson(Map.Entry<String, PropertyDefinition> property) {
422 JSONObject root = new JSONObject();
423 String propertyName = property.getKey();
424 PropertyDefinition propertyDefinition = property.getValue();
425 JSONObject propertyDefinitionO = getPropertyDefinitionJSONObject(propertyDefinition);
426 root.put(propertyName, propertyDefinitionO);
427 propertyDefinition.getType();
428 return root.toString();
431 private JSONObject getPropertyDefinitionJSONObject(PropertyDefinition propertyDefinition) {
433 Either<String, ActionStatus> either = convertObjectToJson(propertyDefinition);
434 if (either.isRight()) {
435 return new JSONObject();
438 return (JSONObject) new JSONParser().parse(either.left().value());
439 } catch (ParseException e) {
440 log.info("failed to convert input to json");
441 log.error("failed to convert to json", e);
442 return new JSONObject();
447 protected <T> Either<T, ActionStatus> convertJsonToObject(String data, Class<T> clazz) {
449 Type constraintType = new TypeToken<PropertyConstraint>() {
452 gson = new GsonBuilder().registerTypeAdapter(constraintType, new PropertyOperation.PropertyConstraintDeserialiser()).create();
454 log.trace("convert json to object. json=\n {}", data);
455 t = gson.fromJson(data, clazz);
457 log.info("object is null after converting from json");
458 return Either.right(ActionStatus.INVALID_CONTENT);
460 } catch (Exception e) {
462 log.info("failed to convert from json");
463 log.error("failed to convert from json", e);
464 return Either.right(ActionStatus.INVALID_CONTENT);
466 return Either.left(t);
469 private Either<String, ActionStatus> convertObjectToJson(PropertyDefinition propertyDefinition) {
470 Type constraintType = new TypeToken<PropertyConstraint>() {
472 Gson gson = new GsonBuilder().registerTypeAdapter(constraintType, new PropertyOperation.PropertyConstraintSerialiser()).create();
474 log.trace("convert object to json. propertyDefinition= {}", propertyDefinition);
475 String json = gson.toJson(propertyDefinition);
477 log.info("object is null after converting to json");
478 return Either.right(ActionStatus.INVALID_CONTENT);
480 return Either.left(json);
481 } catch (Exception e) {
483 log.info("failed to convert to json");
484 log.debug("failed to convert fto json", e);
485 return Either.right(ActionStatus.INVALID_CONTENT);
490 private OutputsBusinessLogic getOutputBL(final ServletContext context) {
491 return getClassFromWebAppContext(context, () -> OutputsBusinessLogic.class);
494 private InputsBusinessLogic getInputBL(final ServletContext context) {
495 return getClassFromWebAppContext(context, () -> InputsBusinessLogic.class);
498 private PolicyBusinessLogic getPolicyBL(final ServletContext context) {
499 return getClassFromWebAppContext(context, () -> PolicyBusinessLogic.class);
502 private WebApplicationContext getWebAppContext(final ServletContext context) {
503 return ((WebAppContextWrapper) context.getAttribute(Constants.WEB_APPLICATION_CONTEXT_WRAPPER_ATTR)).getWebAppContext(context);
506 protected <T> Either<T, ResponseFormat> parseToComponentInstanceMap(final String componentJson,
508 final ComponentTypeEnum componentType,
509 final Class<T> clazz) {
510 return getComponentsUtils()
511 .convertJsonToObjectUsingObjectMapper(componentJson, user, clazz, AuditingActionEnum.CREATE_RESOURCE, componentType);
514 protected Response declareProperties(String userId, String componentId, String componentType,
515 String componentInstInputsMapObj, DeclarationTypeEnum typeEnum, HttpServletRequest request) {
516 ServletContext context = request.getSession().getServletContext();
517 String url = request.getMethod() + " " + request.getRequestURI();
518 log.debug("(get) Start handle request of {}", url);
521 BaseBusinessLogic businessLogic = getBlForDeclaration(typeEnum, context);
524 User modifier = new User();
525 modifier.setUserId(userId);
526 log.debug("modifier id is {}", userId);
527 ComponentTypeEnum componentTypeEnum = ComponentTypeEnum.findByParamName(componentType);
528 Either<ComponentInstInputsMap, ResponseFormat> componentInstInputsMapRes = parseToComponentInstanceMap(
529 componentInstInputsMapObj, modifier, componentTypeEnum, ComponentInstInputsMap.class);
530 if (componentInstInputsMapRes.isRight()) {
531 log.debug("failed to parse componentInstInputsMap");
532 return buildErrorResponse(componentInstInputsMapRes.right().value());
535 Either<List<ToscaDataDefinition>, ResponseFormat> propertiesAfterDeclaration = businessLogic
536 .declareProperties(userId, componentId,
538 componentInstInputsMapRes.left().value());
539 if (propertiesAfterDeclaration.isRight()) {
540 log.debug("failed to create inputs for service: {}", componentId);
541 return buildErrorResponse(propertiesAfterDeclaration.right().value());
543 Object properties = RepresentationUtils.toRepresentation(propertiesAfterDeclaration.left().value());
544 return buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), properties);
546 } catch (Exception e) {
547 BeEcompErrorManager.getInstance().logBeRestApiGeneralError("Create inputs for service with id: " + componentId);
548 log.debug("Properties declaration failed with exception", e);
549 return buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.GENERAL_ERROR));
553 public BaseBusinessLogic getBlForDeclaration(final DeclarationTypeEnum typeEnum,
554 final ServletContext context) {
557 return getOutputBL(context);
559 return getPolicyBL(context);
561 return getInputBL(context);
563 throw new IllegalArgumentException("Invalid DeclarationTypeEnum");
567 protected Either<Map<String, InputDefinition>, ActionStatus> getInputModel(String componentId, String data) {
568 JSONParser parser = new JSONParser();
571 Map<String, InputDefinition> inputs = new HashMap<>();
572 root = (JSONObject) parser.parse(data);
574 Set entrySet = root.entrySet();
575 Iterator iterator = entrySet.iterator();
576 while (iterator.hasNext()) {
577 Entry next = (Entry) iterator.next();
578 String inputName = (String) next.getKey();
580 if(!isInputNameValid(inputName)) {
581 return Either.right(ActionStatus.INVALID_INPUT_NAME);
584 JSONObject value = (JSONObject) next.getValue();
585 Either<InputDefinition, ActionStatus> inputDefinitionEither =
586 getInputDefinitionFromJson(componentId, inputName, value);
588 if(inputDefinitionEither.isRight()) {
589 return Either.right(inputDefinitionEither.right().value());
592 inputs.put(inputName, inputDefinitionEither.left().value());
595 return Either.left(inputs);
596 } catch (ParseException e) {
597 log.warn("Input content is invalid - {}", data, e);
598 return Either.right(ActionStatus.INVALID_CONTENT);
602 protected boolean isInputNameValid(String inputName) {
603 return Objects.nonNull(inputName)
604 && inputName.matches(PROPERTY_NAME_REGEX);