diff options
Diffstat (limited to 'catalog-be/src/main')
27 files changed, 22 insertions, 525 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/category/AuditCategoryEventFactory.java b/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/category/AuditCategoryEventFactory.java index d4e1c37c58..da2fc0a5d5 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/category/AuditCategoryEventFactory.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/category/AuditCategoryEventFactory.java @@ -43,12 +43,6 @@ public class AuditCategoryEventFactory extends AuditBaseEventFactory { this(action, commonFields, buildUserName(modifier), categoryName, subCategoryName, groupingName, resourceType); } - public AuditCategoryEventFactory(AuditingActionEnum action, CommonAuditData commonFields, String modifier, String categoryName, - String subCategoryName, String groupingName, String resourceType, String timestamp) { - this(action, commonFields, modifier, categoryName, subCategoryName, groupingName, resourceType); - event.setTimestamp1(timestamp); - } - @Override public String getLogPattern() { return LOG_STR; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/distribution/AuditDistributionDownloadEventFactory.java b/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/distribution/AuditDistributionDownloadEventFactory.java index b18ac6aaac..a8427107da 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/distribution/AuditDistributionDownloadEventFactory.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/distribution/AuditDistributionDownloadEventFactory.java @@ -36,11 +36,6 @@ public class AuditDistributionDownloadEventFactory extends AuditBaseEventFactory this.event = new DistributionDownloadEvent(getAction().getName(), commonFields, distributionData); } - public AuditDistributionDownloadEventFactory(CommonAuditData commonFields, DistributionData distributionData, String timestamp) { - this(commonFields, distributionData); - this.event.setTimestamp1(timestamp); - } - @Override public String getLogPattern() { return LOG_STR; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/distribution/AuditDistributionNotificationEventFactory.java b/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/distribution/AuditDistributionNotificationEventFactory.java index 05664b926e..36cb5d622c 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/distribution/AuditDistributionNotificationEventFactory.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/distribution/AuditDistributionNotificationEventFactory.java @@ -42,13 +42,6 @@ public class AuditDistributionNotificationEventFactory extends AuditBaseEventFac this(commonAuditData, resourceCommonInfo, resourceVersionInfo, did, AuditBaseEventFactory.buildUserName(modifier), topicName, opEnvFields); } - public AuditDistributionNotificationEventFactory(CommonAuditData commonAuditData, ResourceCommonInfo resourceCommonInfo, - ResourceVersionInfo resourceVersionInfo, String did, String modifier, String topicName, - OperationalEnvAuditData opEnvFields, String timestamp) { - this(commonAuditData, resourceCommonInfo, resourceVersionInfo, did, modifier, topicName, opEnvFields); - this.event.setTimestamp1(timestamp); - } - private AuditDistributionNotificationEventFactory(CommonAuditData commonAuditData, ResourceCommonInfo resourceCommonInfo, ResourceVersionInfo resourceVersionInfo, String did, String modifier, String topicName, OperationalEnvAuditData opEnvFields) { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/resourceadmin/AuditResourceAdminEventMigrationFactory.java b/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/resourceadmin/AuditResourceAdminEventMigrationFactory.java deleted file mode 100644 index 579971d909..0000000000 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/resourceadmin/AuditResourceAdminEventMigrationFactory.java +++ /dev/null @@ -1,46 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. 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.sdc.be.auditing.impl.resourceadmin; - -import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; -import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; -import org.openecomp.sdc.be.resources.data.auditing.model.ResourceCommonInfo; -import org.openecomp.sdc.be.resources.data.auditing.model.ResourceVersionInfo; - -public class AuditResourceAdminEventMigrationFactory extends AuditResourceAdminEventFactory { - - public AuditResourceAdminEventMigrationFactory(AuditingActionEnum action, CommonAuditData commonFields, ResourceCommonInfo resourceCommonInfo, - ResourceVersionInfo prevParams, ResourceVersionInfo currParams, String invariantUuid, - String modifier, String artifactData, String comment, String did, String toscaNodeType, - String timestamp) { - super(action, commonFields, resourceCommonInfo, prevParams, currParams, invariantUuid, modifier, artifactData, comment, did, toscaNodeType, - timestamp); - } - - @Override - public String getLogPattern() { - return ""; - } - - @Override - public String[] getLogMessageParams() { - return new String[0]; - } -} diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/CambriaErrorResponse.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/CambriaErrorResponse.java index bebc286592..b397d26f75 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/CambriaErrorResponse.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/CambriaErrorResponse.java @@ -25,7 +25,6 @@ import org.openecomp.sdc.be.distribution.api.client.CambriaOperationStatus; public class CambriaErrorResponse { - public static final int HTTP_OK = 200; public static final int HTTP_INTERNAL_SERVER_ERROR = 500; CambriaOperationStatus operationStatus; Integer httpCode; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ActivationRequestInformation.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ActivationRequestInformation.java index 87ef16f163..26ded1f344 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ActivationRequestInformation.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ActivationRequestInformation.java @@ -19,11 +19,13 @@ */ package org.openecomp.sdc.be.components.impl; +import lombok.Data; import org.openecomp.sdc.be.model.Service; /** * Created by chaya on 10/22/2017. */ +@Data public class ActivationRequestInformation { private Service serviceToActivate; @@ -35,28 +37,4 @@ public class ActivationRequestInformation { this.workloadContext = workloadContext; this.tenant = tenant; } - - public String getTenant() { - return tenant; - } - - public void setTenant(String tenant) { - this.tenant = tenant; - } - - public Service getServiceToActivate() { - return serviceToActivate; - } - - public void setServiceToActivate(Service serviceToActivate) { - this.serviceToActivate = serviceToActivate; - } - - public String getWorkloadContext() { - return workloadContext; - } - - public void setWorkloadContext(String workloadContext) { - this.workloadContext = workloadContext; - } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactTypeBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactTypeBusinessLogic.java index 126571741f..39f6041c5d 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactTypeBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactTypeBusinessLogic.java @@ -39,8 +39,6 @@ import org.springframework.beans.factory.annotation.Autowired; @org.springframework.stereotype.Component("artifactTypeBusinessLogic") public class ArtifactTypeBusinessLogic extends BaseBusinessLogic { - private static final Logger log = Logger.getLogger(ArtifactTypeBusinessLogic.class.getName()); - private final ArtifactTypeOperation artifactTypeOperation; @Autowired diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java index 06b4a34062..71d55d362b 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java @@ -3744,7 +3744,6 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { errorWrapper.setInnerElement(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(status))); } if (errorWrapper.isEmpty()) { - NodeTypeEnum parentType = convertParentType(componentType); final List<ArtifactDefinition> existingDeploymentArtifacts = getDeploymentArtifacts(toscaComponentEither.left().value(), null); for (ArtifactDefinition artifactDefinition : existingDeploymentArtifacts) { if (artifactInfo.getArtifactName().equalsIgnoreCase(artifactDefinition.getArtifactName())) { @@ -4032,7 +4031,6 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { String componentId = component.getUniqueId(); String artifactId = artifactDefinition.getUniqueId(); Either<ArtifactDefinition, Operation> result; - Wrapper<ResponseFormat> errorWrapper = new Wrapper<>(); //artifact validation artifactDefinition = validateArtifact(componentId, componentType, operation, artifactId, artifactDefinition, auditingAction, user, component, shouldLock, inTransaction); @@ -4224,7 +4222,6 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { } private Component checkoutParentComponent(ComponentTypeEnum componentType, String parentId, String userId) { - Component component = null; User modifier = userBusinessLogic.getUser(userId, false); LifecycleChangeInfoWithAction changeInfo = new LifecycleChangeInfoWithAction("External API checkout", LifecycleChanceActionEnum.UPDATE_FROM_EXTERNAL_API); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogic.java index 0b60a3671d..b878adf639 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogic.java @@ -634,20 +634,6 @@ public abstract class ComponentBusinessLogic extends BaseBusinessLogic { return Either.left(deleteMarkedElements.left().value()); } - public Either<List<ArtifactDefinition>, StorageOperationStatus> getComponentArtifactsForDelete(String parentId, NodeTypeEnum parentType) { - List<ArtifactDefinition> artifacts = new ArrayList<>(); - Either<Map<String, ArtifactDefinition>, StorageOperationStatus> artifactsResponse = artifactToscaOperation.getArtifacts(parentId); - if (artifactsResponse.isRight()) { - if (artifactsResponse.right().value() != StorageOperationStatus.NOT_FOUND) { - log.debug("failed to retrieve artifacts for {} {}", parentType, parentId); - return Either.right(artifactsResponse.right().value()); - } - } else { - artifacts.addAll(artifactsResponse.left().value().values()); - } - return Either.left(artifacts); - } - /** * @param componentId * @param user @@ -1019,10 +1005,6 @@ public abstract class ComponentBusinessLogic extends BaseBusinessLogic { return Either.left(component); } - public CatalogOperation getCatalogOperations() { - return catalogOperations; - } - @Autowired public void setCatalogOperations(CatalogOperation catalogOperations) { this.catalogOperations = catalogOperations; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java index ddbc5dc041..7cb9858484 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java @@ -1888,43 +1888,6 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { * @param userId * @return */ - public Either<ComponentInstanceProperty, ResponseFormat> createOrUpdateAttributeValue(ComponentTypeEnum componentTypeEnum, String componentId, - String resourceInstanceId, - ComponentInstanceProperty attribute, String userId) { - Either<ComponentInstanceProperty, ResponseFormat> result = null; - Wrapper<ResponseFormat> errorWrapper = new Wrapper<>(); - validateUserExists(userId); - if (errorWrapper.isEmpty()) { - validateComponentTypeEnum(componentTypeEnum, "CreateOrUpdateAttributeValue", errorWrapper); - } - if (errorWrapper.isEmpty()) { - validateCanWorkOnComponent(componentId, componentTypeEnum, userId, errorWrapper); - } - if (errorWrapper.isEmpty()) { - validateComponentLock(componentId, componentTypeEnum, errorWrapper); - } - try { - if (errorWrapper.isEmpty()) { - final boolean isCreate = Objects.isNull(attribute.getValueUniqueUid()); - if (isCreate) { - result = createAttributeValue(attribute, resourceInstanceId); - } else { - result = updateAttributeValue(attribute, resourceInstanceId); - } - } else { - result = Either.right(errorWrapper.getInnerElement()); - } - return result; - } finally { - if (result == null || result.isRight()) { - janusGraphDao.rollback(); - } else { - janusGraphDao.commit(); - } - // unlock resource - graphLockOperation.unlockComponent(componentId, componentTypeEnum.getNodeType()); - } - } public Either<List<ComponentInstanceProperty>, ResponseFormat> createOrUpdatePropertiesValues(ComponentTypeEnum componentTypeEnum, String componentId, String resourceInstanceId, @@ -2110,19 +2073,6 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { } } - private void setJsonObjectForSubProperty(final JSONObject jObject, final List<String> path, String value) { - if (path.size() == 1) { - Object valueAsObject = new Yaml().loadAs(value, Object.class); - jObject.put(path.get(0), valueAsObject); - } else { - if (!jObject.has(path.get(0))) { - jObject.put(path.get(0), new JSONObject()); - } - final JSONObject jsonObject = jObject.getJSONObject(path.get(0)); - setJsonObjectForSubProperty(jsonObject, path.subList(1, path.size()), value); - } - } - public Either<List<ComponentInstanceAttribute>, ResponseFormat> createOrUpdateAttributeValues(final ComponentTypeEnum componentTypeEnum, final String componentId, final String resourceInstanceId, @@ -2519,42 +2469,6 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { return Either.left(newValue); } - private <T extends PropertyDefinition> void validateToscaGetFunction(T property, Component parentComponent) { - final ToscaGetFunctionDataDefinition toscaGetFunction = (ToscaGetFunctionDataDefinition) property.getToscaFunction(); - validateGetToscaFunctionAttributes(toscaGetFunction); - validateGetPropertySource(toscaGetFunction.getFunctionType(), toscaGetFunction.getPropertySource()); - if (toscaGetFunction.getFunctionType() == ToscaGetFunctionType.GET_INPUT) { - validateGetFunction(property, parentComponent.getInputs(), parentComponent.getModel()); - return; - } - if (toscaGetFunction.getFunctionType() == ToscaGetFunctionType.GET_PROPERTY) { - if (toscaGetFunction.getPropertySource() == PropertySource.SELF) { - validateGetFunction(property, parentComponent.getProperties(), parentComponent.getModel()); - } else if (toscaGetFunction.getPropertySource() == PropertySource.INSTANCE) { - final ComponentInstance componentInstance = - parentComponent.getComponentInstanceById(toscaGetFunction.getSourceUniqueId()) - .orElseThrow(ToscaGetFunctionExceptionSupplier.instanceNotFound(toscaGetFunction.getSourceName())); - validateGetFunction(property, componentInstance.getProperties(), parentComponent.getModel()); - } - - return; - } - if (toscaGetFunction.getFunctionType() == ToscaGetFunctionType.GET_ATTRIBUTE) { - if (toscaGetFunction.getPropertySource() == PropertySource.SELF) { - validateGetFunction(property, parentComponent.getAttributes(), parentComponent.getModel()); - } else if (toscaGetFunction.getPropertySource() == PropertySource.INSTANCE) { - final ComponentInstance componentInstance = - parentComponent.getComponentInstanceById(toscaGetFunction.getSourceUniqueId()) - .orElseThrow(ToscaGetFunctionExceptionSupplier.instanceNotFound(toscaGetFunction.getSourceName())); - validateGetFunction(property, componentInstance.getAttributes(), parentComponent.getModel()); - } - - return; - } - - throw ToscaGetFunctionExceptionSupplier.functionNotSupported(toscaGetFunction.getFunctionType()).get(); - } - private <T extends PropertyDefinition> void validateGetFunction(final T property, final List<? extends ToscaPropertyData> parentProperties, final String model) { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ConsumerBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ConsumerBusinessLogic.java index 93fb171539..f895a20c0c 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ConsumerBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ConsumerBusinessLogic.java @@ -248,10 +248,6 @@ public class ConsumerBusinessLogic extends BaseBusinessLogic { return Either.left(consumer); } - public Either<ConsumerDefinition, ResponseFormat> getConsumer(String consumerId) { - return getConsumer(consumerId, null); - } - public Either<ConsumerDefinition, ResponseFormat> deleteConsumer(String consumerId, User user) { ConsumerDefinition tmpConsumer = new ConsumerDefinition(); tmpConsumer.setConsumerName(consumerId); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogic.java index 363b8d64df..4156e3da35 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogic.java @@ -265,9 +265,6 @@ public class ElementBusinessLogic extends BaseBusinessLogic { return elementOperation.getAllResourceCategories(); } - public Either<List<CategoryDefinition>, ActionStatus> getAllServiceCategories() { - return elementOperation.getAllServiceCategories(); - } public Either<CategoryDefinition, ResponseFormat> createCategory(CategoryDefinition category, String componentTypeParamName, String userId) { AuditingActionEnum auditingAction = AuditingActionEnum.ADD_CATEGORY; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ExternalRefsBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ExternalRefsBusinessLogic.java index acd19e4bee..f1d4825b08 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ExternalRefsBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ExternalRefsBusinessLogic.java @@ -42,7 +42,6 @@ import org.openecomp.sdc.common.log.wrappers.Logger; @org.springframework.stereotype.Component public class ExternalRefsBusinessLogic { - private static final Logger log = Logger.getLogger(ExternalRefsBusinessLogic.class); private final ExternalReferencesOperation externalReferencesOperation; private final ToscaOperationFacade toscaOperationFacade; private final AccessValidations accessValidations; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/HealthCheckInformer.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/HealthCheckInformer.java deleted file mode 100644 index ccc7feb4da..0000000000 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/HealthCheckInformer.java +++ /dev/null @@ -1,27 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. 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.sdc.be.components.impl; - -import org.openecomp.sdc.common.api.HealthCheckInfo; - -public interface HealthCheckInformer { - - HealthCheckInfo getHealthCheckInfo(); -} diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/AbstractValidationsServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/AbstractValidationsServlet.java index 58756642c1..fe779779d0 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/AbstractValidationsServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/AbstractValidationsServlet.java @@ -331,10 +331,6 @@ public abstract class AbstractValidationsServlet extends BeGenericServlet { return servletUtils; } - public Gson getGson() { - return getServletUtils().getGson(); - } - @Override public ComponentsUtils getComponentsUtils() { return getServletUtils().getComponentsUtils(); @@ -837,30 +833,6 @@ public abstract class AbstractValidationsServlet extends BeGenericServlet { } } - void validateComponentInstanceBusinessLogic(HttpServletRequest request, String containerComponentType, - Wrapper<ComponentInstanceBusinessLogic> blWrapper, Wrapper<ResponseFormat> errorWrapper) { - ServletContext context = request.getSession().getServletContext(); - ComponentInstanceBusinessLogic componentInstanceLogic = getComponentInstanceBL(context); - if (componentInstanceLogic == null) { - log.debug("Unsupported component type {}", containerComponentType); - errorWrapper.setInnerElement(getComponentsUtils().getResponseFormat(ActionStatus.UNSUPPORTED_ERROR, containerComponentType)); - } else { - blWrapper.setInnerElement(componentInstanceLogic); - } - } - - <T> Response buildResponseFromElement(Wrapper<ResponseFormat> errorWrapper, Wrapper<T> attributeWrapper) throws IOException { - Response response; - if (errorWrapper.isEmpty()) { - ObjectMapper mapper = new ObjectMapper(); - String result = mapper.writeValueAsString(attributeWrapper.getInnerElement()); - response = buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), result); - } else { - response = buildErrorResponse(errorWrapper.getInnerElement()); - } - return response; - } - protected void validateXECOMPInstanceIDHeader(String instanceIdHeader, Wrapper<ResponseFormat> responseWrapper) { ResponseFormat responseFormat; if (StringUtils.isEmpty(instanceIdHeader)) { @@ -890,17 +862,6 @@ public abstract class AbstractValidationsServlet extends BeGenericServlet { } } - public <T> Either<List<T>, ResponseFormat> parseListOfObjects(String json, Type type) { - try { - List<T> listOfObjects = gson.fromJson(json, type); - return Either.left(listOfObjects); - } catch (Exception e) { - log.debug("Failed to parse json to {} object", type.getClass().getName(), e); - ResponseFormat responseFormat = getComponentsUtils().getResponseFormat(ActionStatus.INVALID_CONTENT); - return Either.right(responseFormat); - } - } - protected void validateNotEmptyBody(String data) { if (StringUtils.isEmpty(data)) { throw new ByActionStatusComponentException(ActionStatus.MISSING_BODY); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/RepresentationUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/RepresentationUtils.java index bc1893b770..707f89800e 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/RepresentationUtils.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/RepresentationUtils.java @@ -195,10 +195,6 @@ public class RepresentationUtils { .writeValueAsString(elementToRepresent); } - public static class ResourceRep { - - } - @JsonFilter(REMOVE_IS_EMPTY_FROM_COLLECTIONS_FILTER) private static class IsEmptyFilterMixIn { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/AttributeConverter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/AttributeConverter.java index 143fb7b34b..847947badd 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/AttributeConverter.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/AttributeConverter.java @@ -97,16 +97,6 @@ public class AttributeConverter { return toscaAttribute; } - private ToscaSchemaDefinition convert(final EntrySchema entrySchema) { - if (entrySchema == null) { - return null; - } - final ToscaSchemaDefinition toscaSchemaDefinition = new ToscaSchemaDefinition(); - toscaSchemaDefinition.setType(entrySchema.getType()); - toscaSchemaDefinition.setDescription(entrySchema.getDescription()); - return toscaSchemaDefinition; - } - private Object convertToToscaObject(final AttributeDefinition attributeDefinition, String value, final boolean preserveEmptyValue) { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java index 163b67a44f..09c93ed408 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java @@ -277,44 +277,6 @@ public class ToscaExportHandler { return Either.left(toscaRepresentation); } - public Either<ToscaRepresentation, ToscaError> exportComponentInterface(final Component component, final boolean isAssociatedComponent, - final boolean isSkipImports) { - final List<Map<String, Map<String, String>>> imports = new ArrayList<>(getDefaultToscaImports(component.getModel(), isSkipImports)); - if (CollectionUtils.isEmpty(imports)) { - log.debug(FAILED_TO_GET_DEFAULT_IMPORTS_CONFIGURATION); - return Either.right(ToscaError.GENERAL_ERROR); - } - List<Triple<String, String, Component>> dependencies = new ArrayList<>(); - if (component.getDerivedFromGenericType() != null && !component.getDerivedFromGenericType() - .startsWith("org.openecomp.resource.abstract.nodes.")) { - final Either<Component, StorageOperationStatus> baseType = toscaOperationFacade - .getByToscaResourceNameAndVersion(component.getDerivedFromGenericType(), component.getDerivedFromGenericVersion(), - component.getModel()); - if (baseType.isLeft() && baseType.left().value() != null) { - addDependencies(imports, dependencies, baseType.left().value(), isSkipImports); - } else { - log.debug("Failed to fetch derived from type {}", component.getDerivedFromGenericType()); - } - } - - String toscaVersion = null; - if (component instanceof Resource) { - toscaVersion = ((Resource) component).getToscaVersion(); - } - ToscaTemplate toscaTemplate = new ToscaTemplate(toscaVersion != null ? toscaVersion : TOSCA_VERSION); - toscaTemplate.setImports(imports); - final Map<String, ToscaNodeType> nodeTypes = new HashMap<>(); - final Either<ToscaTemplate, ToscaError> toscaTemplateRes = convertInterfaceNodeType(new HashMap<>(), component, toscaTemplate, nodeTypes, - isAssociatedComponent); - if (toscaTemplateRes.isRight()) { - return Either.right(toscaTemplateRes.right().value()); - } - toscaTemplate = toscaTemplateRes.left().value(); - toscaTemplate.setDependencies(dependencies); - ToscaRepresentation toscaRepresentation = this.createToscaRepresentation(toscaTemplate); - return Either.left(toscaRepresentation); - } - private ToscaRepresentation createToscaRepresentation(ToscaTemplate toscaTemplate) { CustomRepresenter representer = new CustomRepresenter(); DumperOptions options = new DumperOptions(); @@ -342,15 +304,6 @@ public class ToscaExportHandler { return Either.left(fillImports.left().value().left); } - public Either<ToscaTemplate, ToscaError> getDependencies(Component component, boolean isSkipImports) { - ToscaTemplate toscaTemplate = new ToscaTemplate(null); - Either<ImmutablePair<ToscaTemplate, Map<String, Component>>, ToscaError> fillImports = fillImports(component, toscaTemplate, isSkipImports); - if (fillImports.isRight()) { - return Either.right(fillImports.right().value()); - } - return Either.left(fillImports.left().value().left); - } - public Either<ToscaTemplate, ToscaError> convertToToscaTemplate(final Component component, final boolean isSkipImports) { final List<Map<String, Map<String, String>>> defaultToscaImportConfig = getDefaultToscaImports(component.getModel(), isSkipImports); if (CollectionUtils.isEmpty(defaultToscaImportConfig)) { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaAnnotation.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaAnnotation.java index 5aee23ddbb..9a3253d6d8 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaAnnotation.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaAnnotation.java @@ -21,41 +21,15 @@ package org.openecomp.sdc.be.tosca.model; import java.util.HashMap; import java.util.Map; +import lombok.Getter; +import lombok.Setter; +@Getter +@Setter public class ToscaAnnotation { private String type; private Map<String, Object> properties; private String description; - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public void addProperty(String name, Object property) { - if (properties == null) { - properties = new HashMap<>(); - } - properties.put(name, property); - } - - public Map<String, Object> getProperties() { - return properties; - } - - public void setProperties(Map<String, Object> properties) { - this.properties = properties; - } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaFilter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaFilter.java deleted file mode 100644 index 3ff29e8df9..0000000000 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaFilter.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * - * ============LICENSE_START======================================================= - * Copyright (C) 2023 Nordix Foundation. - * ================================================================================ - * 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========================================================= - */ - -package org.openecomp.sdc.be.tosca.model; - -import lombok.Data; - -@Data -public class ToscaFilter { - - private String name; - private String constraint; - private Object value; //ToscaFunction or String or float, etc I guess -} diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaGroupTemplate.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaGroupTemplate.java index c7763e6dc8..6e05cc08a5 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaGroupTemplate.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaGroupTemplate.java @@ -21,7 +21,11 @@ package org.openecomp.sdc.be.tosca.model; import java.util.List; import java.util.Map; +import lombok.AllArgsConstructor; +import lombok.Data; +@Data +@AllArgsConstructor public class ToscaGroupTemplate { private String type; @@ -30,58 +34,9 @@ public class ToscaGroupTemplate { private Map<String, Object> properties; private Map<String, ToscaTemplateCapability> capabilities; - public ToscaGroupTemplate(String type, List<String> members, IToscaMetadata metadata, Map<String, Object> properties, - Map<String, ToscaTemplateCapability> capabilities) { - this.type = type; - this.members = members; - this.metadata = metadata; - this.properties = properties; - this.capabilities = capabilities; - } - public ToscaGroupTemplate(String type, IToscaMetadata metadata, Map<String, Object> properties) { this.type = type; this.metadata = metadata; this.properties = properties; } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public List<String> getMembers() { - return members; - } - - public void setMembers(List<String> members) { - this.members = members; - } - - public IToscaMetadata getMetadata() { - return metadata; - } - - public void setMetadata(IToscaMetadata metadata) { - this.metadata = metadata; - } - - public Map<String, Object> getProperties() { - return properties; - } - - public void setProperties(Map<String, Object> properties) { - this.properties = properties; - } - - public Map<String, ToscaTemplateCapability> getCapabilities() { - return capabilities; - } - - public void setCapabilities(Map<String, ToscaTemplateCapability> capabilities) { - this.capabilities = capabilities; - } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaInput.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaInput.java index a06f67c005..694430fa74 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaInput.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaInput.java @@ -17,32 +17,28 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.openecomp.sdc.be.tosca.model; import java.util.HashMap; import java.util.Map; +import lombok.Getter; +import lombok.Setter; +@Getter +@Setter public class ToscaInput extends ToscaProperty { private Map<String, ToscaAnnotation> annotations; - //copy constructor public ToscaInput(ToscaProperty toscaProperty) { super(toscaProperty); } - public Map<String, ToscaAnnotation> getAnnotations() { - return annotations; - } - - public void setAnnotations(Map<String, ToscaAnnotation> annotations) { - this.annotations = annotations; - } - - public void addAnnotation(String name, ToscaAnnotation annotaion) { + public void addAnnotation(String name, ToscaAnnotation annotation) { if (annotations == null) { annotations = new HashMap<>(); } - annotations.put(name, annotaion); + annotations.put(name, annotation); } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaNodeTemplate.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaNodeTemplate.java index eb34732db9..fe0af5f1a1 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaNodeTemplate.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaNodeTemplate.java @@ -51,10 +51,4 @@ public class ToscaNodeTemplate { this.directives = CollectionUtils.isEmpty(directives) ? null : directives; } - public void addInterface(String interfaceName, Object interfaceDataDefinition) { - if (MapUtils.isEmpty(this.interfaces)) { - this.interfaces = new HashMap<>(); - } - this.interfaces.put(interfaceName, interfaceDataDefinition); - } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/types/ServiceConsumptionData.java b/catalog-be/src/main/java/org/openecomp/sdc/be/types/ServiceConsumptionData.java index 51b36538e5..f7022e3929 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/types/ServiceConsumptionData.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/types/ServiceConsumptionData.java @@ -15,6 +15,11 @@ */ package org.openecomp.sdc.be.types; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter public class ServiceConsumptionData { private String inputId; @@ -22,35 +27,4 @@ public class ServiceConsumptionData { private String value; private String type; - public String getInputId() { - return inputId; - } - - public void setInputId(String inputId) { - this.inputId = inputId; - } - - public String getSource() { - return source; - } - - public void setSource(String source) { - this.source = source; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/user/Role.java b/catalog-be/src/main/java/org/openecomp/sdc/be/user/Role.java index 4274532e93..7308a6caa5 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/user/Role.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/user/Role.java @@ -26,12 +26,4 @@ package org.openecomp.sdc.be.user; public enum Role { ADMIN, TESTER, DESIGNER, PRODUCT_MANAGER, PRODUCT_STRATEGIST; - public static Role getByNameIgnoreCase(String name) { - for (Role inst : Role.values()) { - if (inst.name().equalsIgnoreCase(name)) { - return inst; - } - } - return null; - } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/user/UserAdminAction.java b/catalog-be/src/main/java/org/openecomp/sdc/be/user/UserAdminAction.java deleted file mode 100644 index 4aa852cf7e..0000000000 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/user/UserAdminAction.java +++ /dev/null @@ -1,24 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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.sdc.be.user; - -public enum UserAdminAction { - ADD_USER, UPDATE_USER, DELET_USER -} diff --git a/catalog-be/src/main/java/org/openecomp/sdc/config/HttpClientFactory.java b/catalog-be/src/main/java/org/openecomp/sdc/config/HttpClientFactory.java index 176f05a25c..cadab4e8fd 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/config/HttpClientFactory.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/config/HttpClientFactory.java @@ -45,7 +45,6 @@ public class HttpClientFactory { private static final int DEFAULT_MAX_CONNECTION_PER_ROUTE = 5; private static final int VALIDATE_CONNECTION_AFTER_INACTIVITY_MS = 10000; private static final int CONNECT_TIMEOUT_MS = 15000; - private static final Logger log = Logger.getLogger(HttpClientFactory.class); private static final UserTokenHandler userTokenHandler = context -> null; private HttpClientConnectionManager createConnectionManager() { |