From 2623c8402a57e2035db69a9d92d2851050916801 Mon Sep 17 00:00:00 2001 From: shrikantawachar Date: Mon, 20 May 2019 12:11:54 +0530 Subject: Upgrade SDC from Titan to Janus Graph Upgrade SDC from Titan to Janus Graph Change-Id: I67fb8b8e60cc6751697bc5ff2f06754c92803786 Issue-ID: SDC-2296 Signed-off-by: shrikantawachar --- .../csar/YamlTemplateParsingHandler.java | 14 ++-- .../ServiceDistributionArtifactsBuilder.java | 2 +- .../health/HealthCheckBusinessLogic.java | 28 ++++---- .../impl/AdditionalInformationBusinessLogic.java | 6 +- .../be/components/impl/ArchiveBusinessLogic.java | 14 ++-- .../be/components/impl/ArtifactsBusinessLogic.java | 18 +++--- .../sdc/be/components/impl/BaseBusinessLogic.java | 53 ++++++++-------- .../components/impl/CapabilitiesBusinessLogic.java | 46 +++++++------- .../be/components/impl/CassandraHealthCheck.java | 19 +++--- .../be/components/impl/CommonImportManager.java | 10 +-- .../be/components/impl/ComponentBusinessLogic.java | 8 +-- .../impl/ComponentInstanceBusinessLogic.java | 68 ++++++++++---------- .../sdc/be/components/impl/DataTypesService.java | 8 +-- .../be/components/impl/ElementBusinessLogic.java | 23 ++++--- .../components/impl/ExternalRefsBusinessLogic.java | 4 +- .../sdc/be/components/impl/GroupBusinessLogic.java | 56 ++++++++-------- .../be/components/impl/GroupBusinessLogicNew.java | 2 +- .../be/components/impl/GroupTypeBusinessLogic.java | 12 ++-- .../be/components/impl/GroupTypeImportManager.java | 2 +- .../be/components/impl/InputsBusinessLogic.java | 25 ++++---- .../impl/InterfaceOperationBusinessLogic.java | 34 +++++----- .../be/components/impl/PolicyBusinessLogic.java | 2 +- .../components/impl/PolicyTypeBusinessLogic.java | 8 +-- .../components/impl/PolicyTypeImportManager.java | 2 +- .../be/components/impl/ProductBusinessLogic.java | 10 +-- .../be/components/impl/PropertyBusinessLogic.java | 10 +-- .../impl/RelationshipTypeBusinessLogic.java | 8 +-- .../impl/RelationshipTypeImportManager.java | 2 +- .../components/impl/RequirementBusinessLogic.java | 26 ++++---- .../be/components/impl/ResourceBusinessLogic.java | 54 ++++++++-------- .../be/components/impl/ResourceImportManager.java | 2 +- .../be/components/impl/ServiceBusinessLogic.java | 74 +++++++++++----------- .../impl/generic/GenericTypeBusinessLogic.java | 2 +- .../impl/instance/GroupMembersUpdateOperation.java | 2 +- .../impl/policy/PolicyTargetsUpdateHandler.java | 2 +- .../be/components/impl/utils/ExceptionUtils.java | 20 +++--- .../lifecycle/CertificationChangeTransition.java | 20 +++--- .../lifecycle/CertificationRequestTransition.java | 18 +++--- .../be/components/lifecycle/CheckinTransition.java | 20 +++--- .../components/lifecycle/CheckoutTransition.java | 20 +++--- .../components/lifecycle/LifeCycleTransition.java | 12 ++-- .../lifecycle/LifecycleBusinessLogic.java | 41 +++++++----- .../lifecycle/StartCertificationTransition.java | 18 +++--- .../lifecycle/UndoCheckoutTransition.java | 18 +++--- .../merge/GlobalInputsFilteringBusinessLogic.java | 2 +- .../be/components/merge/TopologyComparator.java | 2 +- .../merge/group/ComponentGroupMergeCommand.java | 2 +- .../merge/group/GroupPropertiesMergeCommand.java | 2 +- .../merge/input/ComponentInputsMergeBL.java | 2 +- .../merge/input/GlobalInputsMergeCommand.java | 2 +- .../components/merge/input/InputsMergeCommand.java | 2 +- .../ComponentCapabilitiesPropertiesMergeBL.java | 2 +- .../instance/ComponentInstanceArtifactsMerge.java | 2 +- .../ComponentInstanceForwardingPathMerge.java | 2 +- .../instance/ComponentInstanceInputsMergeBL.java | 2 +- .../ComponentInstanceInputsRedeclareHandler.java | 2 +- .../instance/ComponentInstanceInterfacesMerge.java | 2 +- .../ComponentInstanceMergeDataBusinessLogic.java | 2 +- .../ComponentInstancePropertiesMergeBL.java | 2 +- .../ComponentInstancePropsAndInputsMerge.java | 2 +- .../instance/ComponentInstanceRelationMerge.java | 2 +- .../merge/instance/ExternalRefsMergeBL.java | 2 +- .../merge/policy/PoliciesMergeCommand.java | 2 +- .../PropertyDataValueMergeBusinessLogic.java | 4 +- .../components/merge/utils/MergeInstanceUtils.java | 4 +- .../components/path/ForwardingPathValidator.java | 2 +- .../ComponentInstanceInputPropertyDeclarator.java | 2 +- .../ComponentInstancePropertyDeclarator.java | 2 +- .../property/ComponentPropertyDeclarator.java | 2 +- .../property/DefaultPropertyDeclarator.java | 8 ++- .../property/PolicyPropertyDeclarator.java | 2 +- ...omponentInstancePropertyToPolicyDeclarator.java | 2 +- .../ComponentPropertyToPolicyDeclarator.java | 2 +- .../components/upgrade/UpgradeBusinessLogic.java | 14 ++-- .../validation/ComponentValidations.java | 2 +- .../components/validation/NodeFilterValidator.java | 2 +- .../components/validation/PropertyValidator.java | 8 +-- .../validation/ServiceDistributionValidation.java | 2 +- .../ecomp/converters/AssetMetadataConverter.java | 2 +- .../openecomp/sdc/be/filters/BeServletFilter.java | 18 +++--- .../be/filters/ComponentsAvailabilityFilter.java | 2 +- .../be/tosca/CapabilityRequirementConverter.java | 4 +- .../java/org/openecomp/sdc/be/tosca/CsarUtils.java | 4 +- .../sdc/be/tosca/GroupExportParserImpl.java | 4 +- .../sdc/be/tosca/PolicyExportParserImpl.java | 4 +- .../openecomp/sdc/be/tosca/ToscaExportHandler.java | 12 ++-- .../org/openecomp/sdc/be/tosca/ToscaUtils.java | 3 - .../be/tosca/utils/ForwardingPathToscaUtil.java | 2 +- .../openecomp/sdc/be/user/UserBusinessLogic.java | 8 +-- .../common/transaction/api/ITransactionSdnc.java | 2 +- .../common/transaction/api/TransactionUtils.java | 2 +- .../transaction/impl/JanusGraphCommitHandler.java | 52 +++++++++++++++ .../impl/JanusGraphRollbackHandler.java | 55 ++++++++++++++++ .../transaction/impl/TitanCommitHandler.java | 52 --------------- .../transaction/impl/TitanRollbackHandler.java | 55 ---------------- .../transaction/mngr/TransactionManager.java | 7 +- .../transaction/mngr/TransactionSdncImpl.java | 21 +++--- 97 files changed, 632 insertions(+), 616 deletions(-) create mode 100644 catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/JanusGraphCommitHandler.java create mode 100644 catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/JanusGraphRollbackHandler.java delete mode 100644 catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/TitanCommitHandler.java delete mode 100644 catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/TitanRollbackHandler.java (limited to 'catalog-be/src/main/java') diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandler.java index 04df614b9d..7b3d4fac25 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandler.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandler.java @@ -35,7 +35,7 @@ import org.openecomp.sdc.be.components.impl.NodeFilterUploadCreator; import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentException; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition; import org.openecomp.sdc.be.datatypes.elements.GetInputValueDataDefinition; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; @@ -67,13 +67,13 @@ public class YamlTemplateParsingHandler { private Gson gson = new Gson(); - private TitanDao titanDao; + private JanusGraphDao janusGraphDao; private GroupTypeBusinessLogic groupTypeBusinessLogic; private AnnotationBusinessLogic annotationBusinessLogic; - public YamlTemplateParsingHandler(TitanDao titanDao, + public YamlTemplateParsingHandler(JanusGraphDao janusGraphDao, GroupTypeBusinessLogic groupTypeBusinessLogic, AnnotationBusinessLogic annotationBusinessLogic) { - this.titanDao = titanDao; + this.janusGraphDao = janusGraphDao; this.groupTypeBusinessLogic = groupTypeBusinessLogic; this.annotationBusinessLogic = annotationBusinessLogic; } @@ -865,17 +865,17 @@ public class YamlTemplateParsingHandler { } private Map failIfNoNodeTemplates(String fileName) { - titanDao.rollback(); + janusGraphDao.rollback(); throw new ByActionStatusComponentException(ActionStatus.NOT_TOPOLOGY_TOSCA_TEMPLATE, fileName); } private Object failIfNotTopologyTemplate(String fileName) { - titanDao.rollback(); + janusGraphDao.rollback(); throw new ByActionStatusComponentException(ActionStatus.NOT_TOPOLOGY_TOSCA_TEMPLATE, fileName); } private void rollbackWithException(ActionStatus actionStatus, String... params) { - titanDao.rollback(); + janusGraphDao.rollback(); throw new ByActionStatusComponentException(actionStatus, params); } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilder.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilder.java index 0303b3f5e7..04c4d11679 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilder.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilder.java @@ -27,7 +27,7 @@ import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.model.*; import org.openecomp.sdc.be.model.category.CategoryDefinition; import org.openecomp.sdc.be.model.category.SubCategoryDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.IArtifactOperation; import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation; import org.openecomp.sdc.common.api.ArtifactTypeEnum; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogic.java index c0a89d6954..00efd80200 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogic.java @@ -31,7 +31,7 @@ import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.config.Configuration; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.impl.EsHealthCheckDao; -import org.openecomp.sdc.be.dao.titan.TitanGenericDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao; import org.openecomp.sdc.be.switchover.detector.SwitchoverDetector; import org.openecomp.sdc.common.api.HealthCheckInfo; import org.openecomp.sdc.common.api.HealthCheckInfo.HealthCheckStatus; @@ -78,7 +78,7 @@ public class HealthCheckBusinessLogic { private final ScheduledExecutorService healthCheckScheduler = newSingleThreadScheduledExecutor((Runnable r) -> new Thread(r, "BE-Health-Check-Task")); private HealthCheckScheduledTask healthCheckScheduledTask = null; @Resource - private TitanGenericDao titanGenericDao; + private JanusGraphGenericDao janusGraphGenericDao; @Resource private EsHealthCheckDao esHealthCheckDao; @Resource @@ -130,8 +130,8 @@ public class HealthCheckBusinessLogic { // BE getBeHealthCheck(healthCheckInfos); - // Titan - getTitanHealthCheck(healthCheckInfos); + // JanusGraph + getJanusGraphHealthCheck(healthCheckInfos); // ES getEsHealthCheck(healthCheckInfos); @@ -195,25 +195,25 @@ public class HealthCheckBusinessLogic { } - public List getTitanHealthCheck(List healthCheckInfos) { - // Titan health check and version + public List getJanusGraphHealthCheck(List healthCheckInfos) { + // JanusGraph health check and version String description; - boolean isTitanUp; + boolean isJanusGraphUp; try { - isTitanUp = titanGenericDao.isGraphOpen(); + isJanusGraphUp = janusGraphGenericDao.isGraphOpen(); } catch (Exception e) { - description = "Titan error: "; - healthCheckInfos.add(new HealthCheckInfo(HC_COMPONENT_TITAN, DOWN, null, description)); + description = "JanusGraph error: "; + healthCheckInfos.add(new HealthCheckInfo(HC_COMPONENT_JANUSGRAPH, DOWN, null, description)); log.error(description, e); return healthCheckInfos; } - if (isTitanUp) { + if (isJanusGraphUp) { description = "OK"; - healthCheckInfos.add(new HealthCheckInfo(HC_COMPONENT_TITAN, UP, null, description)); + healthCheckInfos.add(new HealthCheckInfo(HC_COMPONENT_JANUSGRAPH, UP, null, description)); } else { - description = "Titan graph is down"; - healthCheckInfos.add(new HealthCheckInfo(HC_COMPONENT_TITAN, DOWN, null, description)); + description = "JanusGraph graph is down"; + healthCheckInfos.add(new HealthCheckInfo(HC_COMPONENT_JANUSGRAPH, DOWN, null, description)); } return healthCheckInfos; } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogic.java index 7f6565c88e..19e696c07a 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogic.java @@ -25,7 +25,7 @@ import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.graph.datatype.AdditionalInformationEnum; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.datatypes.elements.AdditionalInfoParameterInfo; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.impl.WebAppContextWrapper; @@ -471,9 +471,9 @@ public class AdditionalInformationBusinessLogic extends BaseBusinessLogic { try { - Either findIdRes = additionalInformationOperation.getAllAdditionalInformationParameters(nodeType, resourceId, false); + Either findIdRes = additionalInformationOperation.getAllAdditionalInformationParameters(nodeType, resourceId, false); if (findIdRes.isRight()) { - StorageOperationStatus status = DaoStatusConverter.convertTitanStatusToStorageStatus(findIdRes.right().value()); + StorageOperationStatus status = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(findIdRes.right().value()); ActionStatus actionStatus = componentsUtils.convertFromStorageResponseForAdditionalInformation(status); result = Either.right(componentsUtils.getResponseFormatAdditionalProperty(actionStatus)); } else { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArchiveBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArchiveBusinessLogic.java index 3cf520d30e..c836e91b9b 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArchiveBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArchiveBusinessLogic.java @@ -26,7 +26,7 @@ import fj.data.Either; import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentException; import org.openecomp.sdc.be.components.validation.AccessValidations; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; @@ -34,8 +34,8 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentParametersView; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.catalog.CatalogComponent; -import org.openecomp.sdc.be.model.jsontitan.operations.ArchiveOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArchiveOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.common.log.enums.EcompLoggerErrorCode; @@ -49,14 +49,14 @@ public class ArchiveBusinessLogic { private static final Logger log = Logger.getLogger(ArchiveBusinessLogic.class.getName()); - private final TitanDao titanDao; + private final JanusGraphDao janusGraphDao; private final AccessValidations accessValidations; private final ArchiveOperation archiveOperation; private final ToscaOperationFacade toscaOperationFacade; private final ComponentsUtils componentUtils; - public ArchiveBusinessLogic(TitanDao titanDao, AccessValidations accessValidations, ArchiveOperation archiveOperation, ToscaOperationFacade tof, ComponentsUtils componentsUtils) { - this.titanDao = titanDao; + public ArchiveBusinessLogic(JanusGraphDao janusGraphDao, AccessValidations accessValidations, ArchiveOperation archiveOperation, ToscaOperationFacade tof, ComponentsUtils componentsUtils) { + this.janusGraphDao = janusGraphDao; this.accessValidations = accessValidations; this.archiveOperation = archiveOperation; this.toscaOperationFacade = tof; @@ -143,7 +143,7 @@ public class ArchiveBusinessLogic { throw e; } finally { - titanDao.commit(); + janusGraphDao.commit(); } } 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 f23057cad0..dcc6eee01a 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 @@ -73,7 +73,7 @@ import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.heat.HeatParameterType; -import org.openecomp.sdc.be.model.jsontitan.operations.NodeTemplateOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeTemplateOperation; import org.openecomp.sdc.be.model.operations.api.IElementOperation; import org.openecomp.sdc.be.model.operations.api.IHeatParametersOperation; import org.openecomp.sdc.be.model.operations.api.IInterfaceLifecycleOperation; @@ -652,13 +652,13 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { if (resultOp == null || resultOp.isRight()) { log.debug(ROLLBACK); if (!inTransaction) { - titanDao.rollback(); + janusGraphDao.rollback(); } } else { log.debug(COMMIT); if (!inTransaction) { - titanDao.commit(); + janusGraphDao.commit(); } } if (shouldLock) { @@ -804,11 +804,11 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { // unlock resource if (resultOp == null || resultOp.isRight()) { log.debug(ROLLBACK); - titanDao.rollback(); + janusGraphDao.rollback(); } else { log.debug(COMMIT); - titanDao.commit(); + janusGraphDao.commit(); } componentType = component.getComponentType(); @@ -4072,7 +4072,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { if (saveArtifactStatus.equals(CassandraOperationStatus.OK)) { if (!inTransaction) { - titanDao.commit(); + janusGraphDao.commit(); } log.debug("Artifact Saved In ES {}", artifactData.getId()); ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.OK); @@ -4083,7 +4083,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { } else { if (!inTransaction) { - titanDao.rollback(); + janusGraphDao.rollback(); } log.info("Failed to save artifact {}.", artifactData.getId()); ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR); @@ -4228,13 +4228,13 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { if (resultOp == null || resultOp.isRight()) { log.debug(ROLLBACK); if (!inTransaction) { - titanDao.rollback(); + janusGraphDao.rollback(); } } else { log.debug(COMMIT); if (!inTransaction) { - titanDao.commit(); + janusGraphDao.commit(); } } if (shouldLock) { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java index c77223ba59..8a4b761a5a 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java @@ -38,9 +38,9 @@ import org.openecomp.sdc.be.components.validation.UserValidations; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.config.BeEcompErrorManager.ErrorSeverity; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; -import org.openecomp.sdc.be.dao.titan.TitanGenericDao; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.datatypes.elements.PropertyRule; import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition; @@ -59,9 +59,9 @@ import org.openecomp.sdc.be.model.PropertyConstraint; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache; -import org.openecomp.sdc.be.model.jsontitan.operations.ArtifactsOperations; -import org.openecomp.sdc.be.model.jsontitan.operations.InterfaceOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArtifactsOperations; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.InterfaceOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.StorageException; import org.openecomp.sdc.be.model.operations.api.IElementOperation; import org.openecomp.sdc.be.model.operations.api.IGraphLockOperation; @@ -108,10 +108,10 @@ public abstract class BaseBusinessLogic { protected IGraphLockOperation graphLockOperation; @Autowired - protected TitanDao titanDao; + protected JanusGraphDao janusGraphDao; @Autowired - protected TitanGenericDao titanGenericDao; + protected JanusGraphGenericDao janusGraphGenericDao; @Autowired protected IElementOperation elementDao; @@ -283,9 +283,9 @@ public abstract class BaseBusinessLogic { NodeTypeEnum nodeType = componentType.getNodeType(); if (!inTransaction) { if (either == null || either.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); } else { - titanDao.commit(); + janusGraphDao.commit(); } } // unlock resource @@ -339,11 +339,11 @@ public abstract class BaseBusinessLogic { } Either updateInputPropertyObjectValue(T property) { - Either, TitanOperationStatus> allDataTypesEither = dataTypeCache.getAll(); + Either, JanusGraphOperationStatus> allDataTypesEither = dataTypeCache.getAll(); if (allDataTypesEither.isRight()) { - TitanOperationStatus status = allDataTypesEither.right().value(); + JanusGraphOperationStatus status = allDataTypesEither.right().value(); BeEcompErrorManager.getInstance().logInternalFlowError("UpdatePropertyValueOnComponentInstance", "Failed to update property value on instance. Status is " + status, ErrorSeverity.ERROR); - return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(status)))); + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status)))); } Map allDataTypes = allDataTypesEither.left().value(); String propertyType = property.getType(); @@ -356,7 +356,8 @@ public abstract class BaseBusinessLogic { if (isValid.isRight()) { Boolean res = isValid.right().value(); if (Boolean.FALSE.equals(res)) { - return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(TitanOperationStatus.ILLEGAL_ARGUMENT)))); + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus( + JanusGraphOperationStatus.ILLEGAL_ARGUMENT)))); } } else { Object object = isValid.left().value(); @@ -429,15 +430,15 @@ public abstract class BaseBusinessLogic { } // For UT - public void setTitanGenericDao(TitanDao titanDao) { - this.titanDao = titanDao; + public void setJanusGraphGenericDao(JanusGraphDao janusGraphDao) { + this.janusGraphDao = janusGraphDao; } protected Either, ResponseFormat> getAllDataTypes(ApplicationDataTypeCache applicationDataTypeCache) { - Either, TitanOperationStatus> allDataTypes = applicationDataTypeCache.getAll(); + Either, JanusGraphOperationStatus> allDataTypes = applicationDataTypeCache.getAll(); if (allDataTypes.isRight()) { - TitanOperationStatus operationStatus = allDataTypes.right().value(); - if (operationStatus == TitanOperationStatus.NOT_FOUND) { + JanusGraphOperationStatus operationStatus = allDataTypes.right().value(); + if (operationStatus == JanusGraphOperationStatus.NOT_FOUND) { BeEcompErrorManager.getInstance().logInternalDataError("FetchDataTypes", "Data types are not loaded", ErrorSeverity.ERROR); return Either.right(componentsUtils.getResponseFormat(ActionStatus.DATA_TYPE_CANNOT_BE_EMPTY)); } else { @@ -536,10 +537,10 @@ public abstract class BaseBusinessLogic { void commitOrRollback(Either result) { if (result == null || result.isRight()) { log.warn("operation failed. do rollback"); - titanDao.rollback(); + janusGraphDao.rollback(); } else { log.debug("operation success. do commit"); - titanDao.commit(); + janusGraphDao.commit(); } } @@ -587,7 +588,8 @@ public abstract class BaseBusinessLogic { if (isValid.isRight()) { Boolean res = isValid.right().value(); if (Boolean.FALSE.equals(res)) { - throw new StorageException(DaoStatusConverter.convertTitanStatusToStorageStatus(TitanOperationStatus.ILLEGAL_ARGUMENT)); + throw new StorageException(DaoStatusConverter.convertJanusGraphStatusToStorageStatus( + JanusGraphOperationStatus.ILLEGAL_ARGUMENT)); } } else { Object object = isValid.left().value(); @@ -599,7 +601,8 @@ public abstract class BaseBusinessLogic { log.trace("After validateAndUpdateRules. pair = {}", pair); if (Boolean.FALSE.equals(pair.getRight())) { BeEcompErrorManager.getInstance().logBeInvalidValueError(ADD_PROPERTY_VALUE, pair.getLeft(), property.getName(), propertyType); - throw new StorageException(DaoStatusConverter.convertTitanStatusToStorageStatus(TitanOperationStatus.ILLEGAL_ARGUMENT)); + throw new StorageException(DaoStatusConverter.convertJanusGraphStatusToStorageStatus( + JanusGraphOperationStatus.ILLEGAL_ARGUMENT)); } return newValue; } @@ -625,7 +628,7 @@ public abstract class BaseBusinessLogic { private void failOnIllegalArgument() { throw new ByActionStatusComponentException( componentsUtils.convertFromStorageResponse( - DaoStatusConverter.convertTitanStatusToStorageStatus(TitanOperationStatus.ILLEGAL_ARGUMENT))); + DaoStatusConverter.convertJanusGraphStatusToStorageStatus(JanusGraphOperationStatus.ILLEGAL_ARGUMENT))); } public Either validateAndUpdatePropertyValue(String propertyType, String value, boolean isValidate, String innerType, Map dataTypes) { @@ -712,7 +715,7 @@ public abstract class BaseBusinessLogic { } protected void rollbackWithException(ActionStatus actionStatus, String... params) { - titanDao.rollback(); + janusGraphDao.rollback(); throw new ByActionStatusComponentException(actionStatus, params); } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogic.java index f2fd37704d..425458f518 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogic.java @@ -23,7 +23,7 @@ import org.apache.commons.lang.StringUtils; import org.openecomp.sdc.be.components.validation.CapabilitiesValidation; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.datatypes.elements.MapPropertiesDataDefinition; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; @@ -33,8 +33,8 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstanceProperty; import org.openecomp.sdc.be.model.ComponentParametersView; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.jsontitan.operations.CapabilitiesOperation; -import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.CapabilitiesOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter; import org.openecomp.sdc.be.model.operations.api.ICapabilityTypeOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder; @@ -94,7 +94,7 @@ public class CapabilitiesBusinessLogic extends BaseBusinessLogic { try { return createCapability(componentId, capabilityDefinitions, storedComponent); } catch (Exception e) { - titanDao.rollback(); + janusGraphDao.rollback(); LOGGER.error(EXCEPTION_OCCURRED_DURING_CAPABILITIES, "addOrUpdate", e); return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); } finally { @@ -151,7 +151,7 @@ public class CapabilitiesBusinessLogic extends BaseBusinessLogic { result = capabilitiesOperation.addCapabilities(componentId, capabilitiesToReturn); } if (result.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(result .right().value(), storedComponent.getComponentType()), "")); } @@ -161,11 +161,11 @@ public class CapabilitiesBusinessLogic extends BaseBusinessLogic { StorageOperationStatus storageOperationStatus = capabilitiesOperation .createOrUpdateCapabilityProperties(componentId, propertiesMap); if (storageOperationStatus != StorageOperationStatus.OK) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(storageOperationStatus)); } } - titanDao.commit(); + janusGraphDao.commit(); return Either.left(capabilitiesToReturn); } @@ -242,7 +242,7 @@ public class CapabilitiesBusinessLogic extends BaseBusinessLogic { result = capabilitiesOperation.addCapabilities(componentId, capabilitiesToReturn); } if (result.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(result .right().value(), storedComponent.getComponentType()), "")); } @@ -252,14 +252,14 @@ public class CapabilitiesBusinessLogic extends BaseBusinessLogic { StorageOperationStatus storageOperationStatus = capabilitiesOperation .createOrUpdateCapabilityProperties(componentId, propertiesMap); if (storageOperationStatus != StorageOperationStatus.OK) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(storageOperationStatus)); } } - titanDao.commit(); + janusGraphDao.commit(); return Either.left(capabilitiesToReturn); } catch (Exception e) { - titanDao.rollback(); + janusGraphDao.rollback(); LOGGER.error(EXCEPTION_OCCURRED_DURING_CAPABILITIES, "addOrUpdate", e); return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); } finally { @@ -292,13 +292,13 @@ public class CapabilitiesBusinessLogic extends BaseBusinessLogic { Either, StorageOperationStatus> deleteCapabilityEither = deleteCapability(storedComponent, storedComponentCapabilities, capabilityDefinitionToDelete); if (deleteCapabilityEither.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(deleteCapabilityEither.right().value())); } StorageOperationStatus deleteStorageOperationStatus = capabilitiesOperation .deleteCapabilityProperties(storedComponent, buildCapPropKey(capabilityDefinitionToDelete)); if (deleteStorageOperationStatus != StorageOperationStatus.OK) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(deleteStorageOperationStatus)); } capabilitiesToReturn.add(initiateNewCapability(storedComponent, capabilityDefinitionToUpdate)); @@ -334,13 +334,13 @@ public class CapabilitiesBusinessLogic extends BaseBusinessLogic { Either, StorageOperationStatus> deleteCapabilityEither = deleteCapability(storedComponent, storedComponentCapabilities, capabilityDefinitionToDelete); if (deleteCapabilityEither.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(deleteCapabilityEither.right().value())); } StorageOperationStatus deleteStorageOperationStatus = capabilitiesOperation .deleteCapabilityProperties(storedComponent, buildCapPropKey(capabilityDefinitionToDelete)); if (deleteStorageOperationStatus != StorageOperationStatus.OK) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(deleteStorageOperationStatus)); } } @@ -416,7 +416,7 @@ public class CapabilitiesBusinessLogic extends BaseBusinessLogic { return deleteCapability(capabilityIdToDelete, storedComponent); } catch (Exception e) { LOGGER.error(EXCEPTION_OCCURRED_DURING_CAPABILITIES, "delete", e); - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(ActionStatus.CAPABILITY_NOT_FOUND)); } finally { if (lockResult.isLeft() && lockResult.left().value()) { @@ -441,14 +441,14 @@ public class CapabilitiesBusinessLogic extends BaseBusinessLogic { Either, StorageOperationStatus> result = deleteCapability(storedComponent, storedComponentCapabilities, capabilityDefinitionToDeleteEither.left().value()); if (result.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); LOGGER.error("Failed to delete capability from component {}. Response is {}", storedComponent.getName(), result.right().value()); return Either.right(componentsUtils.getResponseFormat( componentsUtils.convertFromStorageResponse(result.right().value(), storedComponent.getComponentType()))); } - titanDao.commit(); + janusGraphDao.commit(); return Either.left(capabilityDefinitionToDeleteEither.left().value()); } @@ -528,7 +528,7 @@ public class CapabilitiesBusinessLogic extends BaseBusinessLogic { if (lockResult.isRight()) { LOGGER.debug(FAILED_TO_LOCK_COMPONENT_RESPONSE_IS, component.getName(), lockResult.right().value().getFormattedMessage()); - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(lockResult.right().value()); } } @@ -584,7 +584,7 @@ public class CapabilitiesBusinessLogic extends BaseBusinessLogic { StorageOperationStatus deleteStorageOperationStatus = capabilitiesOperation .deleteCapabilityProperties(component, buildCapPropKey(storedCapability)); if (deleteStorageOperationStatus != StorageOperationStatus.OK) { - titanDao.rollback(); + janusGraphDao.rollback(); } } @@ -605,11 +605,11 @@ public class CapabilitiesBusinessLogic extends BaseBusinessLogic { } public Either, ResponseFormat> getAllCapabilityTypes() { - Either, TitanOperationStatus> capabilityTypeCacheAll = + Either, JanusGraphOperationStatus> capabilityTypeCacheAll = capabilityTypeOperation.getAllCapabilityTypes(); if (capabilityTypeCacheAll.isRight()) { - TitanOperationStatus operationStatus = capabilityTypeCacheAll.right().value(); - if (TitanOperationStatus.NOT_FOUND == operationStatus) { + JanusGraphOperationStatus operationStatus = capabilityTypeCacheAll.right().value(); + if (JanusGraphOperationStatus.NOT_FOUND == operationStatus) { BeEcompErrorManager.getInstance().logInternalDataError("FetchCapabilityTypes", "Capability types are not loaded", BeEcompErrorManager.ErrorSeverity.ERROR); return Either.right(componentsUtils.getResponseFormat(ActionStatus.DATA_TYPE_CANNOT_BE_EMPTY)); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CassandraHealthCheck.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CassandraHealthCheck.java index bc5f77ba1b..c77877fac4 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CassandraHealthCheck.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CassandraHealthCheck.java @@ -68,20 +68,21 @@ public class CassandraHealthCheck { sdcKeyspaces.add(table.getTableDescription().getKeyspace()); } - String titanCfgFile = ConfigurationManager.getConfigurationManager().getConfiguration().getTitanCfgFile(); + String janusGraphCfgFile = ConfigurationManager.getConfigurationManager() + .getConfiguration().getJanusGraphCfgFile(); Properties prop = new Properties(); - InputStream titanProp = null; + InputStream janusGraphProp = null; try { //load a properties file - titanProp = new FileInputStream(titanCfgFile); - prop.load(titanProp); - //Add titan keyspace - String titanKeyspace = prop.getProperty("storage.cassandra.keyspace"); - if (!GeneralUtility.isEmptyString(titanKeyspace)) { - sdcKeyspaces.add(titanKeyspace); + janusGraphProp = new FileInputStream(janusGraphCfgFile); + prop.load(janusGraphProp); + //Add janusgraph keyspace + String janusGraphKeyspace = prop.getProperty("storage.cassandra.keyspace"); + if (!GeneralUtility.isEmptyString(janusGraphKeyspace)) { + sdcKeyspaces.add(janusGraphKeyspace); } } catch (Exception e) { - log.error("Failed to open titen.properties file , url is : {}", titanCfgFile, e); + log.error("Failed to open titen.properties file , url is : {}", janusGraphCfgFile, e); } log.info("All sdc keyspaces are : {}", sdcKeyspaces); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CommonImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CommonImportManager.java index d2f845cc00..1de92e2e15 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CommonImportManager.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CommonImportManager.java @@ -237,17 +237,17 @@ public class CommonImportManager { typeOperations.addType(newTypeDefinition); } else { if (typeOperations.isSameType(newTypeDefinition, existingDefinition)) { - propertyOperation.getTitanGenericDao().rollback(); + propertyOperation.getJanusGraphGenericDao().rollback(); createdElementTypes.add(new ImmutablePair<>(newTypeDefinition, null)); continue; } else { typeOperations.updateType(existingDefinition, newTypeDefinition); } } - propertyOperation.getTitanGenericDao().commit(); + propertyOperation.getJanusGraphGenericDao().commit(); createdElementTypes.add(new ImmutablePair<>(newTypeDefinition, true)); } catch (Exception e) { - propertyOperation.getTitanGenericDao().rollback(); + propertyOperation.getJanusGraphGenericDao().rollback(); createdElementTypes.add(new ImmutablePair<>(newTypeDefinition, false)); } @@ -287,10 +287,10 @@ public class CommonImportManager { } finally { if (eitherResult.isLeft()) { - propertyOperation.getTitanGenericDao().commit(); + propertyOperation.getJanusGraphGenericDao().commit(); } else { - propertyOperation.getTitanGenericDao().rollback(); + propertyOperation.getJanusGraphGenericDao().rollback(); } } 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 dcd0c7b7f0..18d8688036 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 @@ -561,7 +561,7 @@ public abstract class ComponentBusinessLogic extends BaseBusinessLogic { return Either.left(result); } finally{ - titanDao.commit(); + janusGraphDao.commit(); } } @@ -596,7 +596,7 @@ public abstract class ComponentBusinessLogic extends BaseBusinessLogic { } responseFormat = componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(nonCheckoutCompResponse.right().value())); } finally { - titanDao.commit(); + janusGraphDao.commit(); } return Either.right(responseFormat); } @@ -771,12 +771,12 @@ public abstract class ComponentBusinessLogic extends BaseBusinessLogic { if ( deleteMarkedElements.isRight()){ - titanDao.rollback(); + janusGraphDao.rollback(); ResponseFormat responseFormat = componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(deleteMarkedElements.right().value(), componentType)); return Either.right(responseFormat); } log.trace("end deleteMarkedComponents"); - titanDao.commit(); + janusGraphDao.commit(); return Either.left(deleteMarkedElements.left().value()); } 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 71b125737e..eebbb0a2bf 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 @@ -37,7 +37,7 @@ import org.openecomp.sdc.be.config.BeEcompErrorManager.ErrorSeverity; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.datamodel.utils.PropertyValueConstraintValidationUtil; import org.openecomp.sdc.be.datatypes.elements.CINodeFilterDataDefinition; import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition; @@ -76,10 +76,10 @@ import org.openecomp.sdc.be.model.RequirementDefinition; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.jsontitan.operations.ForwardingPathOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.NodeFilterOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; -import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ForwardingPathOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeFilterOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter; import org.openecomp.sdc.be.model.operations.api.IComponentInstanceOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter; @@ -1042,13 +1042,13 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { if (deleteServiceFilterEither.isRight()) { ActionStatus status = componentsUtils.convertFromStorageResponse(deleteServiceFilterEither.right().value(), containerComponentType); - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(status, componentInstanceId)); } resultOp = deleteServiceFiltersRelatedTobeDeletedComponentInstance((Service) containerComponent, componentInstance, ComponentTypeEnum.SERVICE, userId); if (resultOp.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return resultOp; } } @@ -1672,9 +1672,9 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { finally { if (result == null || result.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); } else { - titanDao.commit(); + janusGraphDao.commit(); } // unlock resource graphLockOperation.unlockComponent(componentId, componentTypeEnum.getNodeType()); @@ -1800,9 +1800,9 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { } finally { if (resultOp == null || resultOp.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); } else { - titanDao.commit(); + janusGraphDao.commit(); } // unlock resource graphLockOperation.unlockComponent(componentId, componentTypeEnum.getNodeType()); @@ -1926,11 +1926,11 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { } private Either updatePropertyObjectValue(T property, boolean isInput) { - Either, TitanOperationStatus> allDataTypesEither = dataTypeCache.getAll(); + Either, JanusGraphOperationStatus> allDataTypesEither = dataTypeCache.getAll(); if (allDataTypesEither.isRight()) { - TitanOperationStatus status = allDataTypesEither.right().value(); + JanusGraphOperationStatus status = allDataTypesEither.right().value(); BeEcompErrorManager.getInstance().logInternalFlowError("UpdatePropertyValueOnComponentInstance", "Failed to update property value on instance. Status is " + status, ErrorSeverity.ERROR); - return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(status)))); + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status)))); } Map allDataTypes = allDataTypesEither.left().value(); String innerType = null; @@ -1957,7 +1957,7 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { if (isValid.isRight()) { Boolean res = isValid.right().value(); if (!res) { - return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(TitanOperationStatus.ILLEGAL_ARGUMENT)))); + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(JanusGraphOperationStatus.ILLEGAL_ARGUMENT)))); } } else { Object object = isValid.left().value(); @@ -1969,7 +1969,7 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { ImmutablePair pair = propertyOperation.validateAndUpdateRules(propertyType, ((ComponentInstanceProperty) property).getRules(), innerType, allDataTypes, true); if (pair.getRight() != null && pair.getRight() == false) { BeEcompErrorManager.getInstance().logBeInvalidValueError("Add property value", pair.getLeft(), property.getName(), propertyType); - return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(TitanOperationStatus.ILLEGAL_ARGUMENT)))); + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(JanusGraphOperationStatus.ILLEGAL_ARGUMENT)))); } } return Either.left(newValue); @@ -2052,9 +2052,9 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { } finally { if (resultOp == null || resultOp.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); } else { - titanDao.commit(); + janusGraphDao.commit(); } // unlock resource graphLockOperation.unlockComponent(componentId, componentTypeEnum.getNodeType()); @@ -2147,9 +2147,9 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { } finally { if (resultOp == null || resultOp.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); } else { - titanDao.commit(); + janusGraphDao.commit(); } // unlock resource graphLockOperation.unlockComponent(componentId, componentTypeEnum.getNodeType()); @@ -2236,9 +2236,9 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { } finally { if (resultOp == null || resultOp.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); } else { - titanDao.commit(); + janusGraphDao.commit(); } // unlock resource graphLockOperation.unlockComponent(componentId, componentTypeEnum.getNodeType()); @@ -2292,9 +2292,9 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { } finally { if (resultOp == null || resultOp.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); } else { - titanDao.commit(); + janusGraphDao.commit(); } // unlock resource graphLockOperation.unlockComponent(serviceId, componentTypeEnum.getNodeType()); @@ -2894,11 +2894,11 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(lockStatus))); } - Either, TitanOperationStatus> allDataTypes = dataTypeCache.getAll(); + Either, JanusGraphOperationStatus> allDataTypes = dataTypeCache.getAll(); if (allDataTypes.isRight()) { - TitanOperationStatus status = allDataTypes.right().value(); + JanusGraphOperationStatus status = allDataTypes.right().value(); BeEcompErrorManager.getInstance().logInternalFlowError("UpdatePropertyValueOnComponentInstance", "Failed to update property value on instance. Status is " + status, ErrorSeverity.ERROR); - return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(status)))); + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status)))); } try { @@ -2920,9 +2920,9 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { } finally { if (resultOp == null || resultOp.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); } else { - titanDao.commit(); + janusGraphDao.commit(); } // unlock resource graphLockOperation.unlockComponent(containerComponentId, componentTypeEnum.getNodeType()); @@ -2982,9 +2982,9 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { } finally { if (resultOp == null || resultOp.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); } else { - titanDao.commit(); + janusGraphDao.commit(); } // unlock resource graphLockOperation.unlockComponent(containerComponentId, componentTypeEnum.getNodeType()); @@ -3028,7 +3028,7 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { // on failure of the create instance unlock the resource and rollback the transaction. if (null == actionResponse || actionResponse.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); } unlockComponent(actionResponse, origComponent); } @@ -3053,10 +3053,10 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { } finally { if (resultOp == null || resultOp.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); } else { - titanDao.commit(); + janusGraphDao.commit(); log.debug("Success trasaction commit"); } // unlock resource diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypesService.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypesService.java index 3ddfe4bfc4..a1a6555630 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypesService.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypesService.java @@ -3,7 +3,7 @@ package org.openecomp.sdc.be.components.impl; import fj.data.Either; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.DataTypeDefinition; import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache; @@ -22,10 +22,10 @@ public class DataTypesService { } public Either, ResponseFormat> getAllDataTypes(ApplicationDataTypeCache applicationDataTypeCache) { - Either, TitanOperationStatus> allDataTypes = applicationDataTypeCache.getAll(); + Either, JanusGraphOperationStatus> allDataTypes = applicationDataTypeCache.getAll(); if (allDataTypes.isRight()) { - TitanOperationStatus operationStatus = allDataTypes.right().value(); - if (operationStatus == TitanOperationStatus.NOT_FOUND) { + JanusGraphOperationStatus operationStatus = allDataTypes.right().value(); + if (operationStatus == JanusGraphOperationStatus.NOT_FOUND) { BeEcompErrorManager.getInstance().logInternalDataError("FetchDataTypes", "Data types are not loaded", BeEcompErrorManager.ErrorSeverity.ERROR); return Either.right(componentsUtils.getResponseFormat(ActionStatus.DATA_TYPE_CANNOT_BE_EMPTY)); } else { 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 746f4e9c27..91d7fa6034 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 @@ -32,10 +32,10 @@ import org.openecomp.sdc.be.components.impl.exceptions.ComponentException; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; import org.openecomp.sdc.be.datamodel.api.CategoryTypeEnum; import org.openecomp.sdc.be.datamodel.utils.NodeTypeConvertUtils; import org.openecomp.sdc.be.datatypes.components.ComponentMetadataDataDefinition; @@ -250,7 +250,7 @@ public class ElementBusinessLogic extends BaseBusinessLogic { return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(resources.right().value()))); } } finally { - titanDao.commit(); + janusGraphDao.commit(); } } @@ -999,7 +999,7 @@ public class ElementBusinessLogic extends BaseBusinessLogic { .bimap(this::groupByComponentType, err -> componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(err))); } finally { - titanDao.commit(); + janusGraphDao.commit(); } } @@ -1229,10 +1229,11 @@ public class ElementBusinessLogic extends BaseBusinessLogic { } CategoryData categoryData = categoryResult.left().value(); - Either>, TitanOperationStatus> childrenNodes = titanGenericDao.getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.ResourceNewCategory), (String) categoryData.getUniqueId(), + Either>, JanusGraphOperationStatus> childrenNodes = janusGraphGenericDao + .getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.ResourceNewCategory), (String) categoryData.getUniqueId(), GraphEdgeLabels.SUB_CATEGORY, NodeTypeEnum.ResourceSubcategory, SubCategoryData.class); if (childrenNodes.isRight()) { - return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(childrenNodes.right().value())); + return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(childrenNodes.right().value())); } return Either.left(childrenNodes.left().value()); } @@ -1248,7 +1249,7 @@ public class ElementBusinessLogic extends BaseBusinessLogic { return collectComponents(neededType, categoryUid, categoryType, clazz, resourceType); } finally { if (!inTransaction) { - titanDao.commit(); + janusGraphDao.commit(); } } } @@ -1260,7 +1261,8 @@ public class ElementBusinessLogic extends BaseBusinessLogic { Class categoryClazz = categoryType == NodeTypeEnum.ServiceNewCategory ? CategoryData.class : SubCategoryData.class; Map props = new HashMap<>(); props.put(GraphPropertiesDictionary.NORMALIZED_NAME.getProperty(), ValidationUtils.normalizeCategoryName4Uniqueness(categoryName)); - Either, TitanOperationStatus> getCategory = titanGenericDao.getByCriteria(categoryType, props, categoryClazz); + Either, JanusGraphOperationStatus> getCategory = janusGraphGenericDao + .getByCriteria(categoryType, props, categoryClazz); if (getCategory.isRight()) { return Either.right(StorageOperationStatus.CATEGORY_NOT_FOUND); } @@ -1275,7 +1277,7 @@ public class ElementBusinessLogic extends BaseBusinessLogic { return Either.left(components); } finally { if (!inTransaction) { - titanDao.commit(); + janusGraphDao.commit(); } } } @@ -1283,7 +1285,8 @@ public class ElementBusinessLogic extends BaseBusinessLogic { private Either, StorageOperationStatus> collectComponents(NodeTypeEnum neededType, String categoryUid, NodeTypeEnum categoryType, Class clazz, ResourceTypeEnum resourceType) { List components = new ArrayList<>(); - Either>, TitanOperationStatus> parentNodes = titanGenericDao.getParentNodes(UniqueIdBuilder.getKeyByNodeType(categoryType), categoryUid, GraphEdgeLabels.CATEGORY, neededType, clazz); + Either>, JanusGraphOperationStatus> parentNodes = janusGraphGenericDao + .getParentNodes(UniqueIdBuilder.getKeyByNodeType(categoryType), categoryUid, GraphEdgeLabels.CATEGORY, neededType, clazz); if (parentNodes.isLeft()) { for (ImmutablePair component : parentNodes.left().value()) { ComponentMetadataDataDefinition componentData = component.getLeft().getMetadataDataDefinition(); @@ -1359,7 +1362,7 @@ public class ElementBusinessLogic extends BaseBusinessLogic { return result; } finally { if (!inTransaction) { - titanDao.commit(); + janusGraphDao.commit(); } } } 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 0b53da0018..d3037a9e53 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 @@ -8,8 +8,8 @@ import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; import org.openecomp.sdc.be.dto.ExternalRefDTO; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.LifecycleStateEnum; -import org.openecomp.sdc.be.model.jsontitan.operations.ExternalReferencesOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ExternalReferencesOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.common.log.wrappers.Logger; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogic.java index 9bab155cdf..7c5a596319 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogic.java @@ -41,7 +41,7 @@ import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.config.BeEcompErrorManager.ErrorSeverity; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition; import org.openecomp.sdc.be.datatypes.elements.GroupDataDefinition; import org.openecomp.sdc.be.datatypes.elements.PolicyTargetType; @@ -54,8 +54,8 @@ import org.openecomp.sdc.be.info.GroupDefinitionInfo; import org.openecomp.sdc.be.model.*; import org.openecomp.sdc.be.model.PropertyDefinition.GroupInstancePropertyValueUpdateBehavior; import org.openecomp.sdc.be.model.PropertyDefinition.PropertyNames; -import org.openecomp.sdc.be.model.jsontitan.operations.GroupsOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.TopologyTemplateOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.GroupsOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.TopologyTemplateOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter; import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder; @@ -71,8 +71,8 @@ import java.util.regex.Pattern; import java.util.stream.Collectors; import static java.util.stream.Collectors.toList; -import static org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter.extractCapabilitiesFromGroups; -import static org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter.extractCapabilityPropertiesFromGroups; +import static org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter.extractCapabilitiesFromGroups; +import static org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter.extractCapabilityPropertiesFromGroups; @org.springframework.stereotype.Component("groupBusinessLogic") public class GroupBusinessLogic extends BaseBusinessLogic { @@ -247,9 +247,9 @@ public class GroupBusinessLogic extends BaseBusinessLogic { } finally { if (result != null && result.isLeft()) { - titanDao.commit(); + janusGraphDao.commit(); } else { - titanDao.rollback(); + janusGraphDao.rollback(); } if (shouldLock) { graphLockOperation.unlockComponent(componentId, componentType.getNodeType()); @@ -488,10 +488,10 @@ public class GroupBusinessLogic extends BaseBusinessLogic { if (result == null || result.isRight()) { log.debug("Going to execute rollback on create group."); - titanDao.rollback(); + janusGraphDao.rollback(); } else { log.debug("Going to execute commit on create group."); - titanDao.commit(); + janusGraphDao.commit(); } } @@ -718,10 +718,10 @@ public class GroupBusinessLogic extends BaseBusinessLogic { if (result == null || result.isRight()) { log.debug("Going to execute rollback on create group."); - titanDao.rollback(); + janusGraphDao.rollback(); } else { log.debug("Going to execute commit on create group."); - titanDao.commit(); + janusGraphDao.commit(); } } @@ -1109,12 +1109,12 @@ public class GroupBusinessLogic extends BaseBusinessLogic { } private List onFailedGroupDBOperation(ResponseFormat responseFormat) { - titanDao.rollback(); + janusGraphDao.rollback(); throw new ByResponseFormatComponentException(responseFormat); } private GroupDefinition onFailedUpdateGroupDBOperation(ResponseFormat responseFormat) { - titanDao.rollback(); + janusGraphDao.rollback(); throw new ByResponseFormatComponentException(responseFormat); } @@ -1132,7 +1132,7 @@ public class GroupBusinessLogic extends BaseBusinessLogic { log.debug("#updatePolicyTargetReferencingDeletedGroup - removing all component {} policy targets referencing group {}", component.getUniqueId(), groupId); ActionStatus actionStatus = policyTargetsUpdateHandler.removePoliciesTargets(component, groupId, PolicyTargetType.GROUPS); if (ActionStatus.OK != actionStatus) { - titanDao.rollback(); + janusGraphDao.rollback(); throw new ByActionStatusComponentException(actionStatus, groupId); } } @@ -1143,11 +1143,11 @@ public class GroupBusinessLogic extends BaseBusinessLogic { Map groups = new HashMap<>(); Either, ResponseFormat> result = null; Either, StorageOperationStatus> createGroupsResult = null; - Either, TitanOperationStatus> allDataTypes = dataTypeCache.getAll(); + Either, JanusGraphOperationStatus> allDataTypes = dataTypeCache.getAll(); if (allDataTypes.isRight()) { - TitanOperationStatus status = allDataTypes.right().value(); + JanusGraphOperationStatus status = allDataTypes.right().value(); BeEcompErrorManager.getInstance().logInternalFlowError("AddPropertyToGroup", "Failed to add property to group. Status is " + status, ErrorSeverity.ERROR); - return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(status)))); + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status)))); } @@ -1213,11 +1213,11 @@ public class GroupBusinessLogic extends BaseBusinessLogic { Either, StorageOperationStatus> createGroupsResult = null; List groups = new ArrayList<>(); - Either, TitanOperationStatus> allDataTypes = dataTypeCache.getAll(); + Either, JanusGraphOperationStatus> allDataTypes = dataTypeCache.getAll(); if (allDataTypes.isRight()) { - TitanOperationStatus status = allDataTypes.right().value(); + JanusGraphOperationStatus status = allDataTypes.right().value(); BeEcompErrorManager.getInstance().logInternalFlowError("AddPropertyToGroup", "Failed to add property to group. Status is " + status, ErrorSeverity.ERROR); - return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(status)))); + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status)))); } @@ -1331,18 +1331,18 @@ public class GroupBusinessLogic extends BaseBusinessLogic { if (CollectionUtils.isNotEmpty(properties)) { if (CollectionUtils.isEmpty(groupTypeProperties)) { BeEcompErrorManager.getInstance().logInvalidInputError(ADDING_GROUP, "group type does not have properties", ErrorSeverity.INFO); - return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(TitanOperationStatus.MATCH_NOT_FOUND)))); + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(JanusGraphOperationStatus.MATCH_NOT_FOUND)))); } Map groupTypePropertiesMap = groupTypeProperties.stream().collect(Collectors.toMap(PropertyDefinition::getName, p -> p)); - Either addPropertyResult; + Either addPropertyResult; int i = 1; for (GroupProperty prop : properties) { addPropertyResult = handleProperty(prop, groupTypePropertiesMap.get(prop.getName()), i, allDAtaTypes, groupType); if (addPropertyResult.isRight()) { BeEcompErrorManager.getInstance().logInvalidInputError(ADDING_GROUP, "failed to validate property", ErrorSeverity.INFO); - return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(addPropertyResult.right().value())))); + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(addPropertyResult.right().value())))); } updatedGroupTypeProperties.add(addPropertyResult.left().value()); @@ -1372,18 +1372,18 @@ public class GroupBusinessLogic extends BaseBusinessLogic { return found; } - private Either handleProperty(GroupProperty groupProperty, PropertyDefinition prop, Integer index, Map allDataTypes, String groupType) { + private Either handleProperty(GroupProperty groupProperty, PropertyDefinition prop, Integer index, Map allDataTypes, String groupType) { if (prop == null) { - return Either.right(TitanOperationStatus.ILLEGAL_ARGUMENT); + return Either.right(JanusGraphOperationStatus.ILLEGAL_ARGUMENT); } String propertyType = prop.getType(); String value = groupProperty.getValue(); - Either checkInnerType = propertyOperation.checkInnerType(prop); + Either checkInnerType = propertyOperation.checkInnerType(prop); if (checkInnerType.isRight()) { - TitanOperationStatus status = checkInnerType.right().value(); + JanusGraphOperationStatus status = checkInnerType.right().value(); return Either.right(status); } @@ -1397,7 +1397,7 @@ public class GroupBusinessLogic extends BaseBusinessLogic { if (isValid.isRight()) { Boolean res = isValid.right().value(); if (!res) { - return Either.right(TitanOperationStatus.ILLEGAL_ARGUMENT); + return Either.right(JanusGraphOperationStatus.ILLEGAL_ARGUMENT); } } else { Object object = isValid.left().value(); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogicNew.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogicNew.java index b234bb6bd6..5a5e941c24 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogicNew.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogicNew.java @@ -34,7 +34,7 @@ import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.model.*; -import org.openecomp.sdc.be.model.jsontitan.operations.GroupsOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.GroupsOperation; import org.openecomp.sdc.be.model.operations.StorageException; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.GroupOperation; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeBusinessLogic.java index 5bc0e5e3c3..80d6d65a06 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeBusinessLogic.java @@ -26,7 +26,7 @@ import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentEx import org.openecomp.sdc.be.components.validation.UserValidations; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.GroupTypeDefinition; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; @@ -43,13 +43,13 @@ import static java.util.Collections.emptySet; public class GroupTypeBusinessLogic { private final GroupTypeOperation groupTypeOperation; - private final TitanDao titanDao; + private final JanusGraphDao janusGraphDao; private final UserValidations userValidations; private final ComponentsUtils componentsUtils; - public GroupTypeBusinessLogic(GroupTypeOperation groupTypeOperation, TitanDao titanDao, UserValidations userValidations, ComponentsUtils componentsUtils) { + public GroupTypeBusinessLogic(GroupTypeOperation groupTypeOperation, JanusGraphDao janusGraphDao, UserValidations userValidations, ComponentsUtils componentsUtils) { this.groupTypeOperation = groupTypeOperation; - this.titanDao = titanDao; + this.janusGraphDao = janusGraphDao; this.userValidations = userValidations; this.componentsUtils = componentsUtils; } @@ -61,7 +61,7 @@ public class GroupTypeBusinessLogic { Set excludeGroupTypes = getExcludedGroupTypes(internalComponentType); return groupTypeOperation.getAllGroupTypes(excludeGroupTypes); } finally { - titanDao.commit(); + janusGraphDao.commit(); } } @@ -81,7 +81,7 @@ public class GroupTypeBusinessLogic { } private GroupTypeDefinition failOnGetGroupType(StorageOperationStatus status, String groupType) { - titanDao.rollback(); + janusGraphDao.rollback(); if (status == StorageOperationStatus.NOT_FOUND) { throw new ByActionStatusComponentException(ActionStatus.GROUP_TYPE_IS_INVALID, groupType); } else { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeImportManager.java index 4a7b080fbc..0be6ed9c3a 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeImportManager.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeImportManager.java @@ -31,7 +31,7 @@ import org.openecomp.sdc.be.model.CapabilityDefinition; import org.openecomp.sdc.be.model.ComponentInstanceProperty; import org.openecomp.sdc.be.model.GroupTypeDefinition; import org.openecomp.sdc.be.model.PropertyDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.GroupTypeOperation; import org.openecomp.sdc.be.model.utils.TypeCompareUtils; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogic.java index 0936472bb7..8aec0cdfe2 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogic.java @@ -43,7 +43,7 @@ import org.openecomp.sdc.be.components.impl.exceptions.ComponentException; import org.openecomp.sdc.be.components.property.PropertyDeclarationOrchestrator; import org.openecomp.sdc.be.components.validation.ComponentValidations; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.utils.MapUtil; import org.openecomp.sdc.be.datamodel.utils.PropertyValueConstraintValidationUtil; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; @@ -241,7 +241,8 @@ public class InputsBusinessLogic extends BaseBusinessLogic { if (isValid.isRight()) { Boolean res = isValid.right().value(); if (Boolean.FALSE.equals(res)) { - return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(TitanOperationStatus.ILLEGAL_ARGUMENT)))); + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus( + JanusGraphOperationStatus.ILLEGAL_ARGUMENT)))); } } else { Object object = isValid.left().value(); @@ -342,10 +343,10 @@ public class InputsBusinessLogic extends BaseBusinessLogic { if (!inTransaction) { if (result == null || result.isRight()) { log.debug(GOING_TO_EXECUTE_ROLLBACK_ON_CREATE_GROUP); - titanDao.rollback(); + janusGraphDao.rollback(); } else { log.debug(GOING_TO_EXECUTE_COMMIT_ON_CREATE_GROUP); - titanDao.commit(); + janusGraphDao.commit(); } } // unlock resource @@ -442,10 +443,10 @@ public class InputsBusinessLogic extends BaseBusinessLogic { if (!inTransaction) { if (result == null || result.isRight()) { log.debug(GOING_TO_EXECUTE_ROLLBACK_ON_CREATE_GROUP); - titanDao.rollback(); + janusGraphDao.rollback(); } else { log.debug(GOING_TO_EXECUTE_COMMIT_ON_CREATE_GROUP); - titanDao.commit(); + janusGraphDao.commit(); } } // unlock resource @@ -529,10 +530,10 @@ public class InputsBusinessLogic extends BaseBusinessLogic { if (!inTransaction) { if (result == null || result.isRight()) { log.debug(GOING_TO_EXECUTE_ROLLBACK_ON_CREATE_GROUP); - titanDao.rollback(); + janusGraphDao.rollback(); } else { log.debug(GOING_TO_EXECUTE_COMMIT_ON_CREATE_GROUP); - titanDao.commit(); + janusGraphDao.commit(); } } // unlock resource @@ -771,10 +772,10 @@ public class InputsBusinessLogic extends BaseBusinessLogic { } finally { if (deleteEither == null || deleteEither.isRight()) { log.debug("Component id: {} delete input id: {} failed", componentId, inputId); - titanDao.rollback(); + janusGraphDao.rollback(); } else { log.debug("Component id: {} delete input id: {} success", componentId, inputId); - titanDao.commit(); + janusGraphDao.commit(); } unlockComponent(deleteEither, component); } @@ -882,10 +883,10 @@ public class InputsBusinessLogic extends BaseBusinessLogic { if (result == null || result.isRight()) { log.debug(GOING_TO_EXECUTE_ROLLBACK_ON_CREATE_GROUP); - titanDao.rollback(); + janusGraphDao.rollback(); } else { log.debug(GOING_TO_EXECUTE_COMMIT_ON_CREATE_GROUP); - titanDao.commit(); + janusGraphDao.commit(); } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogic.java index 5cdaa6a590..7815b81755 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogic.java @@ -139,7 +139,7 @@ public class InterfaceOperationBusinessLogic extends BaseBusinessLogic { NodeTypeEnum.getByNameIgnoreCase(storedComponent.getComponentType().getValue()), true); if(removeArifactFromComponent.isRight()){ - titanDao.rollback(); + janusGraphDao.rollback(); ResponseFormat responseFormatByArtifactId = componentsUtils.getResponseFormatByArtifactId( componentsUtils.convertFromStorageResponse(removeArifactFromComponent.right().value()), storedOperation.getImplementation().getArtifactDisplayName()); @@ -148,7 +148,7 @@ public class InterfaceOperationBusinessLogic extends BaseBusinessLogic { CassandraOperationStatus cassandraStatus = artifactCassandraDao.deleteArtifact(artifactUniqueId); if (cassandraStatus != CassandraOperationStatus.OK) { - titanDao.rollback(); + janusGraphDao.rollback(); ResponseFormat responseFormatByArtifactId = componentsUtils.getResponseFormatByArtifactId( componentsUtils.convertFromStorageResponse( componentsUtils.convertToStorageOperationStatus(cassandraStatus)), @@ -166,7 +166,7 @@ public class InterfaceOperationBusinessLogic extends BaseBusinessLogic { interfaceOperation.updateInterfaces(storedComponent.getUniqueId(), Collections.singletonList(interfaceDefinition)); if (deleteOperationEither.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse( deleteOperationEither.right().value(), storedComponent.getComponentType()))); } @@ -175,19 +175,19 @@ public class InterfaceOperationBusinessLogic extends BaseBusinessLogic { Either deleteInterfaceEither = interfaceOperation.deleteInterface( storedComponent.getUniqueId(), interfaceDefinition.getUniqueId()); if (deleteInterfaceEither.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse( deleteInterfaceEither.right().value(), storedComponent.getComponentType()))); } } - titanDao.commit(); + janusGraphDao.commit(); interfaceDefinition.getOperations().putAll(operationsCollection); interfaceDefinition.getOperations().keySet().removeIf(key -> !(operationsToDelete.contains(key))); return Either.left(Collections.singletonList(interfaceDefinition)); } catch (Exception e) { LOGGER.error(EXCEPTION_OCCURRED_DURING_INTERFACE_OPERATION, "delete", e); - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(ActionStatus.INTERFACE_OPERATION_NOT_DELETED)); } finally { if (lockResult.isLeft() && lockResult.left().value()) { @@ -212,7 +212,7 @@ public class InterfaceOperationBusinessLogic extends BaseBusinessLogic { if (lock) { Either lockResult = lockComponent(component.getUniqueId(), component, action); if (lockResult.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(lockResult.right().value()); } } @@ -253,12 +253,12 @@ public class InterfaceOperationBusinessLogic extends BaseBusinessLogic { } } - titanDao.commit(); + janusGraphDao.commit(); interfaceDefinition.getOperations().keySet().removeIf(key -> !(operationsToGet.contains(key))); return Either.left(Collections.singletonList(interfaceDefinition)); } catch (Exception e) { LOGGER.error(EXCEPTION_OCCURRED_DURING_INTERFACE_OPERATION, "get", e); - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right( componentsUtils.getResponseFormat(ActionStatus.INTERFACE_OPERATION_NOT_FOUND, componentId)); } finally { @@ -335,7 +335,7 @@ public class InterfaceOperationBusinessLogic extends BaseBusinessLogic { getOperationFromInterfaceDefinition(interfaceDef, operation.getUniqueId()); if (!optionalOperation.isPresent()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils .getResponseFormat(ActionStatus.INTERFACE_OPERATION_NOT_FOUND, storedComponent.getUniqueId())); @@ -354,7 +354,7 @@ public class InterfaceOperationBusinessLogic extends BaseBusinessLogic { NodeTypeEnum.getByNameIgnoreCase(storedComponent.getComponentType().getValue()), true); if(removeArifactFromComponent.isRight()){ - titanDao.rollback(); + janusGraphDao.rollback(); ResponseFormat responseFormatByArtifactId = componentsUtils.getResponseFormatByArtifactId( componentsUtils.convertFromStorageResponse(removeArifactFromComponent.right().value()), storedOperation.getImplementation().getArtifactDisplayName()); @@ -363,7 +363,7 @@ public class InterfaceOperationBusinessLogic extends BaseBusinessLogic { CassandraOperationStatus cassandraStatus = artifactCassandraDao.deleteArtifact(artifactUniqueId); if (cassandraStatus != CassandraOperationStatus.OK) { - titanDao.rollback(); + janusGraphDao.rollback(); ResponseFormat responseFormatByArtifactId = componentsUtils.getResponseFormatByArtifactId( componentsUtils.convertFromStorageResponse( @@ -383,18 +383,18 @@ public class InterfaceOperationBusinessLogic extends BaseBusinessLogic { Either, StorageOperationStatus> addCreateOperationEither = interfaceOperation.updateInterfaces(storedComponent.getUniqueId(), interfacesCollection); if (addCreateOperationEither.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse( addCreateOperationEither.right().value(), storedComponent.getComponentType()))); } - titanDao.commit(); + janusGraphDao.commit(); interfacesCollection.forEach(interfaceDefinition -> interfaceDefinition.getOperations().entrySet().removeIf( entry -> !operationsCollection.values().stream().map(OperationDataDefinition::getName) .collect(Collectors.toList()).contains(entry.getValue().getName()))); return Either.left(interfacesCollection); } catch (Exception e) { - titanDao.rollback(); + janusGraphDao.rollback(); LOGGER.error(EXCEPTION_OCCURRED_DURING_INTERFACE_OPERATION, "addOrUpdate", e); return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); } finally { @@ -431,7 +431,7 @@ public class InterfaceOperationBusinessLogic extends BaseBusinessLogic { interfaceOperation.addInterfaces(component.getUniqueId(), Collections.singletonList(interfaceDefinition)); if (interfaceCreateEither.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse( interfaceCreateEither.right().value(), component.getComponentType()))); } @@ -580,7 +580,7 @@ public class InterfaceOperationBusinessLogic extends BaseBusinessLogic { } catch (Exception e) { LOGGER.error(EXCEPTION_OCCURRED_DURING_INTERFACE_OPERATION, "get", e); - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(ActionStatus.INTERFACE_OPERATION_NOT_FOUND)); } finally { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyBusinessLogic.java index 752ec4098a..54b7d2ea02 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyBusinessLogic.java @@ -398,7 +398,7 @@ public class PolicyBusinessLogic extends BaseBusinessLogic { .left() .bind(cmpt -> getPolicyById(cmpt, policyId)).left().map(PolicyDataDefinition::getProperties); } finally { - titanDao.commit(); + janusGraphDao.commit(); } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeBusinessLogic.java index cb4b6ff58c..a59156cd87 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeBusinessLogic.java @@ -4,7 +4,7 @@ import fj.data.Either; import org.apache.commons.lang.StringUtils; import org.openecomp.sdc.be.components.validation.UserValidations; import org.openecomp.sdc.be.config.ConfigurationManager; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.PolicyTypeDefinition; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; @@ -25,13 +25,13 @@ public class PolicyTypeBusinessLogic { private static final Logger log = Logger.getLogger(PolicyTypeBusinessLogic.class); private PolicyTypeOperation policyTypeOperation; - private TitanDao titanDao; + private JanusGraphDao janusGraphDao; private ComponentsUtils componentsUtils; private UserValidations userValidations; - public PolicyTypeBusinessLogic(PolicyTypeOperation policyTypeOperation, TitanDao titanDao, ComponentsUtils componentsUtils, UserValidations userValidations) { + public PolicyTypeBusinessLogic(PolicyTypeOperation policyTypeOperation, JanusGraphDao janusGraphDao, ComponentsUtils componentsUtils, UserValidations userValidations) { this.policyTypeOperation = policyTypeOperation; - this.titanDao = titanDao; + this.janusGraphDao = janusGraphDao; this.componentsUtils = componentsUtils; this.userValidations = userValidations; } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeImportManager.java index edd3b936a2..d0dc9fe7c0 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeImportManager.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeImportManager.java @@ -29,7 +29,7 @@ import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.GroupTypeDefinition; import org.openecomp.sdc.be.model.PolicyTypeDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.IGroupOperation; import org.openecomp.sdc.be.model.operations.api.IGroupTypeOperation; import org.openecomp.sdc.be.model.operations.api.IPolicyTypeOperation; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ProductBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ProductBusinessLogic.java index 30a9f799fe..ff532b237d 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ProductBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ProductBusinessLogic.java @@ -232,7 +232,7 @@ public class ProductBusinessLogic extends ComponentBusinessLogic { validateUserExists(userId, "validate Product Name Exists", false); Either dataModelResponse = toscaOperationFacade.validateComponentNameUniqueness(productName, null, ComponentTypeEnum.PRODUCT); // DE242223 - titanDao.commit(); + janusGraphDao.commit(); if (dataModelResponse.isLeft()) { Map result = new HashMap<>(); @@ -378,7 +378,7 @@ public class ProductBusinessLogic extends ComponentBusinessLogic { for (Map.Entry>> entry : nonDuplicatedCategories.entrySet()) { catExist = false; CategoryDefinition categoryDefinition = null; - // over all categories from Titan + // over all categories from JanusGraph List categoriesList = allProductCategories.left().value(); if (categoriesList != null) { for (CategoryDefinition catInDb : categoriesList) { @@ -415,7 +415,7 @@ public class ProductBusinessLogic extends ComponentBusinessLogic { } if (!groupExist) { // error grouping isn't defined - // in Titan + // in JanusGraph ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.INVALID_GROUP_ASSOCIATION, CategoryTypeEnum.GROUPING.getValue(), group); componentsUtils.auditComponentAdmin(responseFormat, user, product, actionEnum, ComponentTypeEnum.PRODUCT); return Either.right(responseFormat); @@ -426,7 +426,7 @@ public class ProductBusinessLogic extends ComponentBusinessLogic { } } if (!subcatExist) { - // error sub category isn't defined in Titan + // error sub category isn't defined in JanusGraph ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.INVALID_GROUP_ASSOCIATION, CategoryTypeEnum.SUBCATEGORY.getValue(), subcat.getKey()); componentsUtils.auditComponentAdmin(responseFormat, user, product, actionEnum, ComponentTypeEnum.PRODUCT); return Either.right(responseFormat); @@ -437,7 +437,7 @@ public class ProductBusinessLogic extends ComponentBusinessLogic { } } if (!catExist) { - // error category isn't defined in Titan + // error category isn't defined in JanusGraph ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.INVALID_GROUP_ASSOCIATION, CategoryTypeEnum.CATEGORY.getValue(), entry.getKey()); componentsUtils.auditComponentAdmin(responseFormat, user, product, actionEnum, ComponentTypeEnum.PRODUCT); return Either.right(responseFormat); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PropertyBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PropertyBusinessLogic.java index 275d1726ed..f3a40ad9f7 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PropertyBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PropertyBusinessLogic.java @@ -34,7 +34,7 @@ import org.apache.commons.collections.MapUtils; import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition; import org.openecomp.sdc.be.datatypes.elements.OperationDataDefinition; import org.openecomp.sdc.be.datatypes.elements.OperationInputDefinition; @@ -489,7 +489,7 @@ public class PropertyBusinessLogic extends BaseBusinessLogic { } String innerType; - Either checkInnerType = getInnerType(type, propertyDefinition::getSchema); + Either checkInnerType = getInnerType(type, propertyDefinition::getSchema); if (checkInnerType.isRight()) { return StorageOperationStatus.INVALID_TYPE; } @@ -551,19 +551,19 @@ public class PropertyBusinessLogic extends BaseBusinessLogic { return jsonElement.toString(); } - private Either getInnerType(ToscaPropertyType type, Supplier schemeGen) { + private Either getInnerType(ToscaPropertyType type, Supplier schemeGen) { String innerType = null; if (type == ToscaPropertyType.LIST || type == ToscaPropertyType.MAP) { SchemaDefinition def = schemeGen.get(); if (def == null) { log.debug("Schema doesn't exists for property of type {}", type); - return Either.right(TitanOperationStatus.ILLEGAL_ARGUMENT); + return Either.right(JanusGraphOperationStatus.ILLEGAL_ARGUMENT); } PropertyDataDefinition propDef = def.getProperty(); if (propDef == null) { log.debug("Property in Schema Definition inside property of type {} doesn't exist", type); - return Either.right(TitanOperationStatus.ILLEGAL_ARGUMENT); + return Either.right(JanusGraphOperationStatus.ILLEGAL_ARGUMENT); } innerType = propDef.getType(); } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeBusinessLogic.java index 4a909785b2..695d82f5d9 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeBusinessLogic.java @@ -21,7 +21,7 @@ import java.util.Map; import fj.data.Either; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.RelationshipTypeDefinition; import org.openecomp.sdc.be.model.operations.impl.RelationshipTypeOperation; @@ -39,11 +39,11 @@ public class RelationshipTypeBusinessLogic { protected ComponentsUtils componentsUtils; public Either, ResponseFormat> getAllRelationshipTypes() { - Either, TitanOperationStatus> allRelationshipTypes = + Either, JanusGraphOperationStatus> allRelationshipTypes = relationshipTypeOperation.getAllRelationshipTypes(); if (allRelationshipTypes.isRight()) { - TitanOperationStatus operationStatus = allRelationshipTypes.right().value(); - if (TitanOperationStatus.NOT_FOUND == operationStatus) { + JanusGraphOperationStatus operationStatus = allRelationshipTypes.right().value(); + if (JanusGraphOperationStatus.NOT_FOUND == operationStatus) { BeEcompErrorManager.getInstance().logInternalDataError("FetchRelationshipTypes", "Relationship types " + "are " + "not loaded", diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeImportManager.java index 18671f8caf..19dd0f41a3 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeImportManager.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeImportManager.java @@ -68,7 +68,7 @@ public class RelationshipTypeImportManager { return commonImportManager.createElementTypesByDao(relationshipTypesToCreate, this::validateRelationshipType, relationshipType -> new ImmutablePair<>(ElementTypeEnum.RELATIONSHIP_TYPE, relationshipType.getType()), relationshipTypeName -> relationshipTypeOperation.getRelationshipTypeByName(relationshipTypeName) - .right().map(DaoStatusConverter::convertTitanStatusToStorageStatus), + .right().map(DaoStatusConverter::convertJanusGraphStatusToStorageStatus), relationshipType -> relationshipTypeOperation.addRelationshipType(relationshipType, inTransaction), (newRelationshipType, oldRelationshipType) -> relationshipTypeOperation .updateRelationshipType(newRelationshipType, oldRelationshipType, inTransaction)); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RequirementBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RequirementBusinessLogic.java index c07a9fc09f..c2d9c95cf7 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RequirementBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RequirementBusinessLogic.java @@ -25,7 +25,7 @@ import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.model.ComponentParametersView; import org.openecomp.sdc.be.model.RequirementDefinition; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.jsontitan.operations.RequirementOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.RequirementOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; @@ -120,15 +120,15 @@ public class RequirementBusinessLogic extends BaseBusinessLogic { result = requirementOperation.addRequirement(componentId, requirementsToReturn); } if (result.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat( componentsUtils.convertFromStorageResponse(result.right().value(), storedComponent.getComponentType()), "")); } - titanDao.commit(); + janusGraphDao.commit(); return Either.left(requirementsToReturn); } catch (Exception e) { - titanDao.rollback(); + janusGraphDao.rollback(); LOGGER.error(EXCEPTION_OCCURRED_DURING_REQUIREMENTS, "addOrUpdate", e); return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); } finally { @@ -222,15 +222,15 @@ public class RequirementBusinessLogic extends BaseBusinessLogic { result = requirementOperation.addRequirement(componentId, requirementsToReturn); } if (result.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat( componentsUtils.convertFromStorageResponse(result.right().value(), storedComponent.getComponentType()), "")); } - titanDao.commit(); + janusGraphDao.commit(); return Either.left(requirementsToReturn); } catch (Exception e) { - titanDao.rollback(); + janusGraphDao.rollback(); LOGGER.error(EXCEPTION_OCCURRED_DURING_REQUIREMENTS, "addOrUpdate", e); return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); } finally { @@ -263,7 +263,7 @@ public class RequirementBusinessLogic extends BaseBusinessLogic { Either, StorageOperationStatus> deleteRequirementEither = deleteRequirement(storedComponent, storedComponentRequirements, requirementDefinitionToDelete); if (deleteRequirementEither.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(deleteRequirementEither.right().value())); } requirementsToReturn.add(initiateNewRequirement(storedComponent, requirementDefinitionToUpdate)); @@ -300,7 +300,7 @@ public class RequirementBusinessLogic extends BaseBusinessLogic { Either, StorageOperationStatus> deleteRequirementEither = deleteRequirement(storedComponent, storedComponentRequirements, requirementDefinitionToDelete); if (deleteRequirementEither.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(deleteRequirementEither.right().value())); } } @@ -392,17 +392,17 @@ public class RequirementBusinessLogic extends BaseBusinessLogic { Either, StorageOperationStatus> result = deleteRequirement(storedComponent, storedComponentRequirements, requirementDefinitionToDelete); if (result.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); LOGGER.error("Failed to delete requirement from component {}. Response is {}", storedComponent.getName(), result.right().value()); return Either.right(componentsUtils.getResponseFormat(componentsUtils .convertFromStorageResponse(result.right().value(), storedComponent.getComponentType()))); } - titanDao.commit(); + janusGraphDao.commit(); return Either.left(requirementDefinitionToDelete); } catch (Exception e) { LOGGER.error(EXCEPTION_OCCURRED_DURING_REQUIREMENTS, "delete", e); - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(ActionStatus.REQUIREMENT_NOT_FOUND)); } finally { if (lockResult.isLeft() && lockResult.left().value()) { @@ -462,7 +462,7 @@ public class RequirementBusinessLogic extends BaseBusinessLogic { if (lockResult.isRight()) { LOGGER.debug(FAILED_TO_LOCK_COMPONENT_RESPONSE_IS, component.getName(), lockResult.right().value().getFormattedMessage()); - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(lockResult.right().value()); } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java index 0968e157e4..1fa9051a9a 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java @@ -75,7 +75,7 @@ import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.config.BeEcompErrorManager.ErrorSeverity; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.datamodel.api.HighestFilterEnum; import org.openecomp.sdc.be.datamodel.utils.ArtifactUtils; import org.openecomp.sdc.be.datamodel.utils.UiComponentDataConverter; @@ -127,7 +127,7 @@ import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache; import org.openecomp.sdc.be.model.category.CategoryDefinition; import org.openecomp.sdc.be.model.category.SubCategoryDefinition; -import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter; +import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter; import org.openecomp.sdc.be.model.operations.StorageException; import org.openecomp.sdc.be.model.operations.api.ICacheMangerOperation; import org.openecomp.sdc.be.model.operations.api.ICapabilityTypeOperation; @@ -321,7 +321,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { Either dataModelResponse = toscaOperationFacade .validateComponentNameUniqueness(resourceName, resourceTypeEnum, ComponentTypeEnum.RESOURCE); // DE242223 - titanDao.commit(); + janusGraphDao.commit(); if (dataModelResponse.isLeft()) { Map result = new HashMap<>(); @@ -487,7 +487,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { throw e; } finally { - titanDao.commit(); + janusGraphDao.commit(); log.debug("unlock resource {}", lockedResourceId); graphLockOperation.unlockComponent(lockedResourceId, NodeTypeEnum.Resource); } @@ -1420,7 +1420,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { throw e; } finally { if (!inTransaction) { - titanDao.commit(); + janusGraphDao.commit(); } if (shouldLock) { graphLockOperation.unlockComponentByName(resource.getSystemName(), resource.getUniqueId(), @@ -1431,7 +1431,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { private void rollback(boolean inTransaction, Resource resource, List createdArtifacts, List nodeTypesNewCreatedArtifacts) { if(!inTransaction) { - titanDao.rollback(); + janusGraphDao.rollback(); } if (isNotEmpty(createdArtifacts) && isNotEmpty(nodeTypesNewCreatedArtifacts)) { createdArtifacts.addAll(nodeTypesNewCreatedArtifacts); @@ -2181,13 +2181,13 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { Map> instInputs = new HashMap<>(); log.debug("#createResourceInstancesRelations - Before get all datatypes. "); - Either, TitanOperationStatus> allDataTypes = dataTypeCache.getAll(); + Either, JanusGraphOperationStatus> allDataTypes = dataTypeCache.getAll(); if (allDataTypes.isRight()) { - TitanOperationStatus status = allDataTypes.right().value(); + JanusGraphOperationStatus status = allDataTypes.right().value(); BeEcompErrorManager.getInstance().logInternalFlowError("UpdatePropertyValueOnComponentInstance", "Failed to update property value on instance. Status is " + status, ErrorSeverity.ERROR); throw new ByResponseFormatComponentException(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse( - DaoStatusConverter.convertTitanStatusToStorageStatus(status)), yamlName)); + DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status)), yamlName)); } Resource finalResource = resource; @@ -2369,7 +2369,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { } } - private void processComponentInstance(String yamlName, Resource resource, List componentInstancesList, Either, TitanOperationStatus> allDataTypes, Map> instProperties, Map>> instCapabilties, Map>> instRequirements, Map> instDeploymentArtifacts, Map> instArtifacts, Map> instAttributes, Map originCompMap, Map> instInputs, UploadComponentInstanceInfo uploadComponentInstanceInfo) { + private void processComponentInstance(String yamlName, Resource resource, List componentInstancesList, Either, JanusGraphOperationStatus> allDataTypes, Map> instProperties, Map>> instCapabilties, Map>> instRequirements, Map> instDeploymentArtifacts, Map> instArtifacts, Map> instAttributes, Map originCompMap, Map> instInputs, UploadComponentInstanceInfo uploadComponentInstanceInfo) { Optional currentCompInstanceOpt = componentInstancesList.stream() .filter(i->i.getName().equals(uploadComponentInstanceInfo.getName())) .findFirst(); @@ -2435,7 +2435,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { return originResource; } - private void processComponentInstanceCapabilities(Either, TitanOperationStatus> allDataTypes, Map>> instCapabilties, UploadComponentInstanceInfo uploadComponentInstanceInfo, ComponentInstance currentCompInstance, Resource originResource) { + private void processComponentInstanceCapabilities(Either, JanusGraphOperationStatus> allDataTypes, Map>> instCapabilties, UploadComponentInstanceInfo uploadComponentInstanceInfo, ComponentInstance currentCompInstance, Resource originResource) { Map> originCapabilities; if (isNotEmpty(uploadComponentInstanceInfo.getCapabilities())) { originCapabilities = new HashMap<>(); @@ -2449,7 +2449,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { instCapabilties.put(currentCompInstance, originCapabilities); } - private void updateCapabilityPropertiesValues(Either, TitanOperationStatus> allDataTypes, Map> originCapabilities, Map> newPropertiesMap) { + private void updateCapabilityPropertiesValues(Either, JanusGraphOperationStatus> allDataTypes, Map> originCapabilities, Map> newPropertiesMap) { originCapabilities.values().stream() .flatMap(Collection::stream) .filter(c -> newPropertiesMap.containsKey(c.getName())) @@ -3240,10 +3240,10 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { if (result == null || result.isRight()) { BeEcompErrorManager.getInstance().logBeSystemError("Change LifecycleState - Certify"); if (!inTransaction) { - titanDao.rollback(); + janusGraphDao.rollback(); } } else if (!inTransaction) { - titanDao.commit(); + janusGraphDao.commit(); } } } @@ -3429,9 +3429,9 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { } finally { if (resourcePair == null) { BeEcompErrorManager.getInstance().logBeSystemError("Change LifecycleState - Certify"); - titanDao.rollback(); + janusGraphDao.rollback(); } else if (!inTransaction) { - titanDao.commit(); + janusGraphDao.commit(); } if (needLock) { log.debug("unlock resource {}", lockedResourceId); @@ -3919,9 +3919,9 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { } finally { if (result == null || !result.equals(StorageOperationStatus.OK)) { - titanDao.rollback(); + janusGraphDao.rollback(); } else { - titanDao.commit(); + janusGraphDao.commit(); } graphLockOperation.unlockComponent(resourceId, NodeTypeEnum.Resource); } @@ -3947,11 +3947,11 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { } finally { if (result == null || !result.equals(StorageOperationStatus.OK)) { - titanDao.rollback(); + janusGraphDao.rollback(); ActionStatus actionStatus = componentsUtils.convertFromStorageResponse(result); responseFormat = componentsUtils.getResponseFormatByResource(actionStatus, resourceName); } else { - titanDao.commit(); + janusGraphDao.commit(); } } if (resource != null) { @@ -3971,9 +3971,9 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { } finally { if (result == null || !result.equals(StorageOperationStatus.OK)) { - titanDao.rollback(); + janusGraphDao.rollback(); } else { - titanDao.commit(); + janusGraphDao.commit(); } graphLockOperation.unlockComponent(resource.getUniqueId(), NodeTypeEnum.Resource); } @@ -4097,7 +4097,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { } finally { if (!inTransaction) { - titanDao.commit(); + janusGraphDao.commit(); } if (needToUnlock) { graphLockOperation.unlockComponent(resourceIdToUpdate, NodeTypeEnum.Resource); @@ -4643,7 +4643,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { Either, ActionStatus> categories = elementDao .getAllCategories(NodeTypeEnum.ResourceNewCategory, inTransaction); if (categories.isRight()) { - log.debug("failed to retrieve resource categories from Titan"); + log.debug("failed to retrieve resource categories from JanusGraph"); responseFormat = componentsUtils.getResponseFormat(categories.right().value()); componentsUtils.auditResource(responseFormat, user, resource, actionEnum); throw new ByActionStatusComponentException(categories.right().value()); @@ -4830,7 +4830,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { if (deleteArtifactByInterface.isRight()) { log.debug("Couldn't remove artifact definition with id {}", uniqueId); if (!inTransaction) { - titanDao.rollback(); + janusGraphDao.rollback(); } return Either.right(deleteArtifactByInterface.right().value()); } @@ -4852,7 +4852,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { && !findPropertiesOfNode.right().value().equals(StorageOperationStatus.OK)) { log.debug("Failed to remove all properties of resource"); if (!inTransaction) { - titanDao.rollback(); + janusGraphDao.rollback(); } return Either.right(componentsUtils.getResponseFormat( componentsUtils.convertFromStorageResponse(findPropertiesOfNode.right().value()))); @@ -4865,7 +4865,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { if (inTransaction) { return Either.left(true); } - titanDao.commit(); + janusGraphDao.commit(); return Either.left(true); } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceImportManager.java index cd9be0fe72..dbb421b6a0 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceImportManager.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceImportManager.java @@ -46,7 +46,7 @@ import org.openecomp.sdc.be.impl.WebAppContextWrapper; import org.openecomp.sdc.be.model.*; import org.openecomp.sdc.be.model.category.CategoryDefinition; import org.openecomp.sdc.be.model.category.SubCategoryDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.IGraphLockOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.CapabilityTypeOperation; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java index 6c41985c9a..2c0af5fec5 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java @@ -117,9 +117,9 @@ import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.category.CategoryDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ForwardingPathOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.NodeFilterOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ForwardingPathOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeFilterOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.ICacheMangerOperation; import org.openecomp.sdc.be.model.operations.api.IElementOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; @@ -236,14 +236,14 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { } Either result = toscaOperationFacade.updateDistributionStatus(service, user, newState); if (result.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); BeEcompErrorManager.getInstance().logBeSystemError("ChangeServiceDistributionState"); log.debug("service {} is change destribuation status failed", service.getUniqueId()); ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR, service.getVersion(), service.getName()); createAudit(user, auditAction, comment, service, responseFormat); return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); } - titanDao.commit(); + janusGraphDao.commit(); Service updatedService = result.left().value(); ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.OK); log.debug(AUDIT_BEFORE_SENDING_RESPONSE); @@ -322,10 +322,10 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { operationList.add(operationEither.left().value()); } - titanDao.commit(); + janusGraphDao.commit(); return Either.left(operationList); } catch (Exception e) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); } finally { @@ -1013,7 +1013,7 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { Either dataModelResponse = toscaOperationFacade.validateComponentNameUniqueness(serviceName, null, ComponentTypeEnum.SERVICE); // DE242223 - titanDao.commit(); + janusGraphDao.commit(); if (dataModelResponse.isLeft()) { Map result = new HashMap<>(); @@ -1073,12 +1073,12 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { try { Either updateResponse = toscaOperationFacade.updateToscaElement(serviceToUpdate); if (updateResponse.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); BeEcompErrorManager.getInstance().logBeSystemError("Update Service Metadata"); log.debug("failed to update sevice {}", serviceToUpdate.getUniqueId()); return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); } - titanDao.commit(); + janusGraphDao.commit(); return Either.left(updateResponse.left().value()); } finally { graphLockOperation.unlockComponent(serviceId, NodeTypeEnum.Service); @@ -1099,7 +1099,7 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { if (lock) { Either lockResult = lockComponent(service.getUniqueId(), service, "Delete Forwarding Path on Service"); if (lockResult.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(componentsUtils .convertFromStorageResponse(storageStatus.right().value(), ComponentTypeEnum.SERVICE), "")); } @@ -1108,15 +1108,15 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { result = forwardingPathOperation.deleteForwardingPath(service ,pathIdsToDelete); if (result.isRight()) { log.debug(FAILED_TO_LOCK_SERVICE_RESPONSE_IS, service.getName(), result.right().value()); - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(storageStatus.right().value(), ComponentTypeEnum.SERVICE))); } - titanDao.commit(); + janusGraphDao.commit(); log.debug(THE_SERVICE_WITH_SYSTEM_NAME_LOCKED, service.getSystemName()); } catch (Exception e){ log.error("Exception occurred during delete forwarding path : {}", e.getMessage(), e); - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); } finally { graphLockOperation.unlockComponent(service.getUniqueId(), NodeTypeEnum.Service); @@ -1214,7 +1214,7 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { result = forwardingPathOperation.addForwardingPath(serviceId, forwardingPathDataDefinition); } if (result.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat( componentsUtils.convertFromStorageResponse(result.right().value(), ComponentTypeEnum.SERVICE), "")); @@ -1225,12 +1225,12 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { } } catch (Exception e) { - titanDao.rollback(); + janusGraphDao.rollback(); log.error("Exception occurred during add or update forwarding path property values: {}", e.getMessage(), e); return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); } - titanDao.commit(); + janusGraphDao.commit(); } finally { if (lockResult != null && lockResult.isLeft() && lockResult.left().value()) { graphLockOperation.unlockComponent(storedService.getUniqueId(), NodeTypeEnum.Service); @@ -1608,7 +1608,7 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { log.debug("validating service category {} against valid categories list", list); Either, ActionStatus> categorys = elementDao.getAllServiceCategories(); if (categorys.isRight()) { - log.debug("failed to retrieve service categories from Titan"); + log.debug("failed to retrieve service categories from JanusGraph"); ResponseFormat responseFormat = componentsUtils.getResponseFormat(categorys.right().value()); return Either.right(responseFormat); } @@ -1666,10 +1666,10 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { if (result == null || !result.equals(StorageOperationStatus.OK)) { log.warn("operation failed. do rollback"); BeEcompErrorManager.getInstance().logBeSystemError("Delete Service"); - titanDao.rollback(); + janusGraphDao.rollback(); } else { log.debug("operation success. do commit"); - titanDao.commit(); + janusGraphDao.commit(); } graphLockOperation.unlockComponent(serviceId, NodeTypeEnum.Service); } @@ -1708,10 +1708,10 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { if (result == null || !result.equals(StorageOperationStatus.OK)) { log.warn("operation failed. do rollback"); BeEcompErrorManager.getInstance().logBeSystemError("Delete Service"); - titanDao.rollback(); + janusGraphDao.rollback(); } else { log.debug("operation success. do commit"); - titanDao.commit(); + janusGraphDao.commit(); } graphLockOperation.unlockComponent(service.getUniqueId(), NodeTypeEnum.Service); } @@ -2006,12 +2006,12 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { try { Either result = toscaOperationFacade.updateDistributionStatus(service, user, state); if (result.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); BeEcompErrorManager.getInstance().logBeSystemError("updateDistributionStatusForActivation"); log.debug("service {} change distribution status failed", serviceId); return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); } - titanDao.commit(); + janusGraphDao.commit(); return Either.left(result.left().value()); } finally { graphLockOperation.unlockComponent(serviceId, NodeTypeEnum.Service); @@ -2688,7 +2688,7 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { if (lock) { Either lockResult = lockComponent(service.getUniqueId(), service, "Delete Service Filter from service"); if (lockResult.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(componentsUtils .convertFromStorageResponse(storageStatus.right().value(), ComponentTypeEnum.SERVICE), "")); } @@ -2697,15 +2697,15 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { result = serviceFilterOperation.deleteNodeFilter(service , resourceId); if (result.isRight()) { log.debug("Failed to delete node filter in service {}. Response is {}. ", service.getName(), result.right().value()); - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(storageStatus.right().value(), ComponentTypeEnum.SERVICE))); } - titanDao.commit(); + janusGraphDao.commit(); log.debug("Node filter successfully changed in service {} . ", service.getSystemName()); } catch (Exception e){ log.error("Exception occurred during delete forwarding path : {}", e.getMessage(), e); - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); } finally { graphLockOperation.unlockComponent(service.getUniqueId(), NodeTypeEnum.Service); @@ -2760,17 +2760,17 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { try { result = serviceFilterOperation.createNodeFilter(serviceId, componentInstanceId); if (result.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat( componentsUtils.convertFromStorageResponse(result.right().value(), ComponentTypeEnum.SERVICE), "")); } else { serviceFilterResult = result.left().value(); } - titanDao.commit(); + janusGraphDao.commit(); } catch (Exception e) { - titanDao.rollback(); + janusGraphDao.rollback(); log.error("Exception occurred during add or update service filter property values: {}", e.getMessage(), e); return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); @@ -2832,17 +2832,17 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { Either result = serviceFilterOperation.updateProperties(serviceId, componentInstanceId, serviceFilter ,properties); if (result.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat( componentsUtils.convertFromStorageResponse(result.right().value(), ComponentTypeEnum.SERVICE), "")); } else { serviceFilterResult = result.left().value(); } - titanDao.commit(); + janusGraphDao.commit(); } catch (Exception e) { - titanDao.rollback(); + janusGraphDao.rollback(); log.error("Exception occurred during add or update service filter property values: {}", e.getMessage(), e); return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); @@ -2926,17 +2926,17 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { } if (result.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat( componentsUtils.convertFromStorageResponse(result.right().value(), ComponentTypeEnum.SERVICE), "")); } else { serviceFilterResult = result.left().value(); } - titanDao.commit(); + janusGraphDao.commit(); } catch (Exception e) { - titanDao.rollback(); + janusGraphDao.rollback(); log.error("Exception occurred during add or update node filter property values: {}", e.getMessage(), e); return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/generic/GenericTypeBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/generic/GenericTypeBusinessLogic.java index 93d79a361e..9346c41cac 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/generic/GenericTypeBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/generic/GenericTypeBusinessLogic.java @@ -10,7 +10,7 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.common.log.wrappers.Logger; import org.openecomp.sdc.exception.ResponseFormat; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/instance/GroupMembersUpdateOperation.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/instance/GroupMembersUpdateOperation.java index cc6e9e9cd3..a85a9c73bf 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/instance/GroupMembersUpdateOperation.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/instance/GroupMembersUpdateOperation.java @@ -6,7 +6,7 @@ import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.GroupDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.GroupsOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.GroupsOperation; import org.openecomp.sdc.common.log.wrappers.Logger; import java.util.List; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/policy/PolicyTargetsUpdateHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/policy/PolicyTargetsUpdateHandler.java index 10a35d0128..cb2fc5b5af 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/policy/PolicyTargetsUpdateHandler.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/policy/PolicyTargetsUpdateHandler.java @@ -5,7 +5,7 @@ import org.openecomp.sdc.be.datatypes.elements.PolicyTargetType; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.PolicyDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.common.log.wrappers.Logger; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/utils/ExceptionUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/utils/ExceptionUtils.java index 2d6f354139..e51caabd00 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/utils/ExceptionUtils.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/utils/ExceptionUtils.java @@ -24,8 +24,8 @@ package org.openecomp.sdc.be.components.impl.utils; import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentException; import org.openecomp.sdc.be.components.impl.exceptions.ByResponseFormatComponentException; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.model.operations.StorageException; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.exception.ResponseFormat; @@ -34,29 +34,29 @@ import org.springframework.stereotype.Component; @Component public class ExceptionUtils { - private final TitanDao titanDao; + private final JanusGraphDao janusGraphDao; - public ExceptionUtils(TitanDao titanDao) { - this.titanDao = titanDao; + public ExceptionUtils(JanusGraphDao janusGraphDao) { + this.janusGraphDao = janusGraphDao; } public T rollBackAndThrow(ActionStatus actionStatus, String ... params) { - titanDao.rollback(); + janusGraphDao.rollback(); throw new ByActionStatusComponentException(actionStatus, params); } public T rollBackAndThrow(ResponseFormat responseFormat) { - titanDao.rollback(); + janusGraphDao.rollback(); throw new ByResponseFormatComponentException(responseFormat); } public T rollBackAndThrow(StorageOperationStatus status, String ... params) { - titanDao.rollback(); + janusGraphDao.rollback(); throw new StorageException(status, params); } - public T rollBackAndThrow(TitanOperationStatus status, String ... params) { - titanDao.rollback(); + public T rollBackAndThrow(JanusGraphOperationStatus status, String ... params) { + janusGraphDao.rollback(); throw new StorageException(status, params); } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CertificationChangeTransition.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CertificationChangeTransition.java index e9289de839..5826ef1254 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CertificationChangeTransition.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CertificationChangeTransition.java @@ -25,16 +25,16 @@ import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic; import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.*; import org.openecomp.sdc.be.model.category.CategoryDefinition; -import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement; -import org.openecomp.sdc.be.model.jsontitan.operations.NodeTemplateOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementLifecycleOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; -import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter; +import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeTemplateOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaElementLifecycleOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.be.tosca.ToscaUtils; @@ -62,8 +62,8 @@ public class CertificationChangeTransition extends LifeCycleTransition { private ArtifactsBusinessLogic artifactsManager; private NodeTemplateOperation nodeTemplateOperation; - public CertificationChangeTransition(LifeCycleTransitionEnum name, ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation, ToscaOperationFacade toscaOperationFacade, TitanDao titanDao) { - super(componentUtils, lifecycleOperation, toscaOperationFacade, titanDao); + public CertificationChangeTransition(LifeCycleTransitionEnum name, ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation, ToscaOperationFacade toscaOperationFacade, JanusGraphDao janusGraphDao) { + super(componentUtils, lifecycleOperation, toscaOperationFacade, janusGraphDao); this.name = name; @@ -202,12 +202,12 @@ public class CertificationChangeTransition extends LifeCycleTransition { BeEcompErrorManager.getInstance().logBeDaoSystemError("Change LifecycleState"); if ( !inTransaction ) { log.debug("operation failed. do rollback"); - titanDao.rollback(); + janusGraphDao.rollback(); } } else { if ( !inTransaction ) { log.debug("operation success. do commit"); - titanDao.commit(); + janusGraphDao.commit(); } } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTransition.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTransition.java index 7456a58994..a0e9bc8c15 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTransition.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTransition.java @@ -25,17 +25,17 @@ import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic; import org.openecomp.sdc.be.components.impl.ServiceBusinessLogic; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.*; -import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementLifecycleOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; -import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter; +import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaElementLifecycleOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.be.user.Role; @@ -52,8 +52,8 @@ public class CertificationRequestTransition extends LifeCycleTransition { private ServiceBusinessLogic serviceBusinessLogic; public CertificationRequestTransition(ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation, ServiceBusinessLogic serviceBusinessLogic, - ToscaOperationFacade toscaOperationFacade, TitanDao titanDao) { - super(componentUtils, lifecycleOperation, toscaOperationFacade, titanDao); + ToscaOperationFacade toscaOperationFacade, JanusGraphDao janusGraphDao) { + super(componentUtils, lifecycleOperation, toscaOperationFacade, janusGraphDao); // authorized roles Role[] resourceServiceCheckoutRoles = { Role.ADMIN, Role.DESIGNER }; @@ -193,12 +193,12 @@ public class CertificationRequestTransition extends LifeCycleTransition { BeEcompErrorManager.getInstance().logBeDaoSystemError("Change LifecycleState"); if (!inTransaction) { log.debug("operation failed. do rollback"); - titanDao.rollback(); + janusGraphDao.rollback(); } } else { if (!inTransaction) { log.debug("operation success. do commit"); - titanDao.commit(); + janusGraphDao.commit(); } } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CheckinTransition.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CheckinTransition.java index 89ed22f5c4..f6cc7dcb53 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CheckinTransition.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CheckinTransition.java @@ -24,7 +24,7 @@ import fj.data.Either; import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; @@ -32,11 +32,11 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.LifeCycleTransitionEnum; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement; -import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementLifecycleOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; -import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter; +import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement; +import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElementTypeEnum; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaElementLifecycleOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.be.user.Role; @@ -49,8 +49,8 @@ public class CheckinTransition extends LifeCycleTransition { private static final Logger log = Logger.getLogger(CheckinTransition.class); - public CheckinTransition(ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation, ToscaOperationFacade toscaOperationFacade, TitanDao titanDao) { - super(componentUtils, lifecycleOperation, toscaOperationFacade, titanDao); + public CheckinTransition(ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation, ToscaOperationFacade toscaOperationFacade, JanusGraphDao janusGraphDao) { + super(componentUtils, lifecycleOperation, toscaOperationFacade, janusGraphDao); // authorized roles Role[] resourceServiceCheckoutRoles = { Role.ADMIN, Role.DESIGNER }; @@ -100,12 +100,12 @@ public class CheckinTransition extends LifeCycleTransition { BeEcompErrorManager.getInstance().logBeDaoSystemError("Change LifecycleState"); if (!inTransaction) { log.debug("operation failed. do rollback"); - titanDao.rollback(); + janusGraphDao.rollback(); } } else { if (!inTransaction) { log.debug("operation success. do commit"); - titanDao.commit(); + janusGraphDao.commit(); } } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CheckoutTransition.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CheckoutTransition.java index 33b625002f..d97c171868 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CheckoutTransition.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CheckoutTransition.java @@ -24,18 +24,18 @@ import fj.data.Either; import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.*; -import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement; -import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementLifecycleOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; -import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter; +import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement; +import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElementTypeEnum; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaElementLifecycleOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.be.tosca.ToscaUtils; @@ -50,8 +50,8 @@ public class CheckoutTransition extends LifeCycleTransition { private static final Logger log = Logger.getLogger(CheckoutTransition.class); - CheckoutTransition(ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation, ToscaOperationFacade toscaOperationFacade, TitanDao titanDao) { - super(componentUtils, lifecycleOperation, toscaOperationFacade, titanDao); + CheckoutTransition(ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation, ToscaOperationFacade toscaOperationFacade, JanusGraphDao janusGraphDao) { + super(componentUtils, lifecycleOperation, toscaOperationFacade, janusGraphDao); // authorized roles Role[] resourceServiceCheckoutRoles = { Role.ADMIN, Role.DESIGNER }; @@ -131,12 +131,12 @@ public class CheckoutTransition extends LifeCycleTransition { BeEcompErrorManager.getInstance().logBeDaoSystemError("Change LifecycleState"); if (!inTransaction) { log.debug("operation failed. do rollback"); - titanDao.rollback(); + janusGraphDao.rollback(); } } else { if (!inTransaction) { log.debug("operation success. do commit"); - titanDao.commit(); + janusGraphDao.commit(); } } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifeCycleTransition.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifeCycleTransition.java index 0057f615bf..180b7f0286 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifeCycleTransition.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifeCycleTransition.java @@ -25,7 +25,7 @@ import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic; import org.openecomp.sdc.be.components.lifecycle.LifecycleChangeInfoWithAction.LifecycleChanceActionEnum; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; @@ -34,8 +34,8 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.LifeCycleTransitionEnum; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementLifecycleOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaElementLifecycleOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.be.user.Role; @@ -52,7 +52,7 @@ public abstract class LifeCycleTransition { @Autowired protected ToscaElementLifecycleOperation lifeCycleOperation; @Autowired - protected TitanDao titanDao; + protected JanusGraphDao janusGraphDao; protected ComponentsUtils componentUtils; protected Map> authorizedRoles; @@ -60,7 +60,7 @@ public abstract class LifeCycleTransition { ToscaOperationFacade toscaOperationFacade; - protected LifeCycleTransition(ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation2, ToscaOperationFacade toscaOperationFacade, TitanDao titanDao) { + protected LifeCycleTransition(ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation2, ToscaOperationFacade toscaOperationFacade, JanusGraphDao janusGraphDao) { this.configurationManager = ConfigurationManager.getConfigurationManager(); this.lifeCycleOperation = lifecycleOperation2; @@ -68,7 +68,7 @@ public abstract class LifeCycleTransition { this.authorizedRoles = new HashMap<>(); this.resourceAuthorizedRoles = new HashMap<>(); this.toscaOperationFacade = toscaOperationFacade; - this.titanDao = titanDao; + this.janusGraphDao = janusGraphDao; } public abstract LifeCycleTransitionEnum getName(); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifecycleBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifecycleBusinessLogic.java index 981f0bdff2..befca2480a 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifecycleBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifecycleBusinessLogic.java @@ -29,18 +29,18 @@ import org.openecomp.sdc.be.components.impl.*; import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentException; import org.openecomp.sdc.be.components.lifecycle.LifecycleChangeInfoWithAction.LifecycleChanceActionEnum; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.*; -import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement; -import org.openecomp.sdc.be.model.jsontitan.operations.NodeTemplateOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementLifecycleOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; -import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter; +import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeTemplateOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaElementLifecycleOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter; import org.openecomp.sdc.be.model.operations.api.ICacheMangerOperation; import org.openecomp.sdc.be.model.operations.api.IGraphLockOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; @@ -71,7 +71,7 @@ public class LifecycleBusinessLogic { private ArtifactsBusinessLogic artifactsBusinessLogic; @Autowired - private TitanDao titanDao; + private JanusGraphDao janusGraphDao; @Autowired private CapabilityOperation capabilityOperation; @@ -129,30 +129,37 @@ public class LifecycleBusinessLogic { private void initStateOperations() { stateTransitions = new HashMap<>(); - LifeCycleTransition checkoutOp = new CheckoutTransition(componentUtils, lifecycleOperation, toscaOperationFacade, titanDao); + LifeCycleTransition checkoutOp = new CheckoutTransition(componentUtils, lifecycleOperation, toscaOperationFacade, + janusGraphDao); stateTransitions.put(checkoutOp.getName().name(), checkoutOp); - UndoCheckoutTransition undoCheckoutOp = new UndoCheckoutTransition(componentUtils, lifecycleOperation, toscaOperationFacade, titanDao); + UndoCheckoutTransition undoCheckoutOp = new UndoCheckoutTransition(componentUtils, lifecycleOperation, toscaOperationFacade, + janusGraphDao); undoCheckoutOp.setArtifactsBusinessLogic(artifactsBusinessLogic); stateTransitions.put(undoCheckoutOp.getName().name(), undoCheckoutOp); - LifeCycleTransition checkinOp = new CheckinTransition(componentUtils, lifecycleOperation, toscaOperationFacade, titanDao); + LifeCycleTransition checkinOp = new CheckinTransition(componentUtils, lifecycleOperation, toscaOperationFacade, + janusGraphDao); stateTransitions.put(checkinOp.getName().name(), checkinOp); LifeCycleTransition certificationRequest = new CertificationRequestTransition(componentUtils, lifecycleOperation, serviceBusinessLogic, toscaOperationFacade, - titanDao); + janusGraphDao); stateTransitions.put(certificationRequest.getName().name(), certificationRequest); - LifeCycleTransition startCertification = new StartCertificationTransition(componentUtils, lifecycleOperation, toscaOperationFacade, titanDao); + LifeCycleTransition startCertification = new StartCertificationTransition(componentUtils, lifecycleOperation, toscaOperationFacade, + janusGraphDao); stateTransitions.put(startCertification.getName().name(), startCertification); - LifeCycleTransition failCertification = new CertificationChangeTransition(LifeCycleTransitionEnum.FAIL_CERTIFICATION, componentUtils, lifecycleOperation, toscaOperationFacade, titanDao); + LifeCycleTransition failCertification = new CertificationChangeTransition(LifeCycleTransitionEnum.FAIL_CERTIFICATION, componentUtils, lifecycleOperation, toscaOperationFacade, + janusGraphDao); stateTransitions.put(failCertification.getName().name(), failCertification); - LifeCycleTransition cancelCertification = new CertificationChangeTransition(LifeCycleTransitionEnum.CANCEL_CERTIFICATION, componentUtils, lifecycleOperation, toscaOperationFacade, titanDao); + LifeCycleTransition cancelCertification = new CertificationChangeTransition(LifeCycleTransitionEnum.CANCEL_CERTIFICATION, componentUtils, lifecycleOperation, toscaOperationFacade, + janusGraphDao); stateTransitions.put(cancelCertification.getName().name(), cancelCertification); - CertificationChangeTransition successCertification = new CertificationChangeTransition(LifeCycleTransitionEnum.CERTIFY, componentUtils, lifecycleOperation, toscaOperationFacade, titanDao); + CertificationChangeTransition successCertification = new CertificationChangeTransition(LifeCycleTransitionEnum.CERTIFY, componentUtils, lifecycleOperation, toscaOperationFacade, + janusGraphDao); successCertification.setArtifactsManager(artifactsBusinessLogic); successCertification.setNodeTemplateOperation(nodeTemplateOperation); stateTransitions.put(successCertification.getName().name(), successCertification); @@ -534,9 +541,9 @@ public class LifecycleBusinessLogic { log.info("unlock component {}", resource.getUniqueId()); if (!inTransaction) { if (result.isLeft()) { - titanDao.commit(); + janusGraphDao.commit(); } else { - titanDao.rollback(); + janusGraphDao.rollback(); } if (needLock) { NodeTypeEnum nodeType = resource.getComponentType().getNodeType(); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/StartCertificationTransition.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/StartCertificationTransition.java index fd3e24f2fb..582b3fd81c 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/StartCertificationTransition.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/StartCertificationTransition.java @@ -24,17 +24,17 @@ import fj.data.Either; import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.LifeCycleTransitionEnum; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementLifecycleOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; -import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter; +import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaElementLifecycleOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.be.user.Role; @@ -47,8 +47,8 @@ public class StartCertificationTransition extends LifeCycleTransition { private static final Logger log = Logger.getLogger(StartCertificationTransition.class); - public StartCertificationTransition(ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation, ToscaOperationFacade toscaOperationFacade, TitanDao titanDao) { - super(componentUtils, lifecycleOperation, toscaOperationFacade, titanDao); + public StartCertificationTransition(ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation, ToscaOperationFacade toscaOperationFacade, JanusGraphDao janusGraphDao) { + super(componentUtils, lifecycleOperation, toscaOperationFacade, janusGraphDao); // authorized roles Role[] rsrcServiceStartCertificationRoles = { Role.ADMIN, Role.TESTER }; @@ -97,12 +97,12 @@ public class StartCertificationTransition extends LifeCycleTransition { BeEcompErrorManager.getInstance().logBeDaoSystemError("Change LifecycleState"); if (!inTransaction) { log.debug("operation failed. do rollback"); - titanDao.rollback(); + janusGraphDao.rollback(); } } else { if (!inTransaction) { log.debug("operation success. do commit"); - titanDao.commit(); + janusGraphDao.commit(); } } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/UndoCheckoutTransition.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/UndoCheckoutTransition.java index c6429c70bb..ff4746dcc3 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/UndoCheckoutTransition.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/UndoCheckoutTransition.java @@ -25,17 +25,17 @@ import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic; import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.LifeCycleTransitionEnum; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementLifecycleOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; -import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter; +import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaElementLifecycleOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.be.user.Role; @@ -48,8 +48,8 @@ public class UndoCheckoutTransition extends LifeCycleTransition { private static final Logger log = Logger.getLogger(CheckoutTransition.class); private ArtifactsBusinessLogic artifactsManager; - public UndoCheckoutTransition(ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation, ToscaOperationFacade toscaOperationFacade, TitanDao titanDao) { - super(componentUtils, lifecycleOperation, toscaOperationFacade, titanDao); + public UndoCheckoutTransition(ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation, ToscaOperationFacade toscaOperationFacade, JanusGraphDao janusGraphDao) { + super(componentUtils, lifecycleOperation, toscaOperationFacade, janusGraphDao); // authorized roles Role[] resourceServiceCheckoutRoles = { Role.ADMIN, Role.DESIGNER }; @@ -126,10 +126,10 @@ public class UndoCheckoutTransition extends LifeCycleTransition { if (result == null || result.isRight()) { BeEcompErrorManager.getInstance().logBeDaoSystemError("Change LifecycleState - Undo Checkout failed on graph"); log.debug("operation failed. do rollback"); - titanDao.rollback(); + janusGraphDao.rollback(); } else { log.debug("operation success. do commit"); - titanDao.commit(); + janusGraphDao.commit(); } } return result; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/GlobalInputsFilteringBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/GlobalInputsFilteringBusinessLogic.java index 00e49dcbc0..9e01fb9c30 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/GlobalInputsFilteringBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/GlobalInputsFilteringBusinessLogic.java @@ -7,7 +7,7 @@ import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import java.util.List; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/TopologyComparator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/TopologyComparator.java index 1220ec4d97..eddff124b5 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/TopologyComparator.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/TopologyComparator.java @@ -8,7 +8,7 @@ import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.common.log.wrappers.Logger; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/group/ComponentGroupMergeCommand.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/group/ComponentGroupMergeCommand.java index 1638aea737..90b0ed4e8e 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/group/ComponentGroupMergeCommand.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/group/ComponentGroupMergeCommand.java @@ -7,7 +7,7 @@ import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.GroupDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.GroupsOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.GroupsOperation; import org.openecomp.sdc.common.log.wrappers.Logger; import org.springframework.core.annotation.Order; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/group/GroupPropertiesMergeCommand.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/group/GroupPropertiesMergeCommand.java index a84360b69b..68ee15e877 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/group/GroupPropertiesMergeCommand.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/group/GroupPropertiesMergeCommand.java @@ -9,7 +9,7 @@ import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.GroupDefinition; import org.openecomp.sdc.be.model.InputDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.GroupsOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.GroupsOperation; import org.springframework.core.annotation.Order; import java.util.List; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/ComponentInputsMergeBL.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/ComponentInputsMergeBL.java index 802dc2271f..fd45f9c59d 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/ComponentInputsMergeBL.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/ComponentInputsMergeBL.java @@ -6,7 +6,7 @@ import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.InputDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.springframework.core.annotation.Order; import java.util.List; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/GlobalInputsMergeCommand.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/GlobalInputsMergeCommand.java index 66e8dc4ee0..84cb111d51 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/GlobalInputsMergeCommand.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/GlobalInputsMergeCommand.java @@ -8,7 +8,7 @@ import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.InputDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.springframework.core.annotation.Order; import java.util.List; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/InputsMergeCommand.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/InputsMergeCommand.java index 3cf4c0df65..8580844f7c 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/InputsMergeCommand.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/InputsMergeCommand.java @@ -5,7 +5,7 @@ import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.InputDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.common.log.wrappers.Logger; import java.util.List; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentCapabilitiesPropertiesMergeBL.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentCapabilitiesPropertiesMergeBL.java index 7863243765..28a6623ee7 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentCapabilitiesPropertiesMergeBL.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentCapabilitiesPropertiesMergeBL.java @@ -12,7 +12,7 @@ import org.openecomp.sdc.be.model.CapabilityDefinition; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.ComponentParametersView; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.common.log.wrappers.Logger; import org.springframework.core.annotation.Order; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMerge.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMerge.java index f6de767ed4..6ed252d2d2 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMerge.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMerge.java @@ -3,7 +3,7 @@ package org.openecomp.sdc.be.components.merge.instance; import fj.data.Either; import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic; import org.openecomp.sdc.be.model.*; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.exception.ResponseFormat; import org.springframework.beans.factory.annotation.Autowired; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceForwardingPathMerge.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceForwardingPathMerge.java index 13e85085d6..5e7d3628d2 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceForwardingPathMerge.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceForwardingPathMerge.java @@ -8,7 +8,7 @@ import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.impl.ForwardingPathUtils; import org.openecomp.sdc.be.model.*; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.common.log.wrappers.Logger; import org.openecomp.sdc.exception.ResponseFormat; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInputsMergeBL.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInputsMergeBL.java index 037ab86368..b04ee22f7e 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInputsMergeBL.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInputsMergeBL.java @@ -9,7 +9,7 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.ComponentInstanceInput; import org.openecomp.sdc.be.model.InputDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.springframework.core.annotation.Order; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInputsRedeclareHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInputsRedeclareHandler.java index c09fb91d1f..4feef4bb5d 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInputsRedeclareHandler.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInputsRedeclareHandler.java @@ -8,7 +8,7 @@ import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.InputDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.utils.ComponentUtilities; import org.openecomp.sdc.common.log.wrappers.Logger; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInterfacesMerge.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInterfacesMerge.java index 60e60b0408..bc8288896a 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInterfacesMerge.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInterfacesMerge.java @@ -12,7 +12,7 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.ComponentInstanceInterface; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.exception.ResponseFormat; import org.springframework.beans.factory.annotation.Autowired; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeDataBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeDataBusinessLogic.java index 31b3207d6c..e6260286f7 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeDataBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeDataBusinessLogic.java @@ -8,7 +8,7 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.ComponentParametersView; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.common.log.wrappers.Logger; import org.openecomp.sdc.exception.ResponseFormat; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropertiesMergeBL.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropertiesMergeBL.java index 04c43b4c65..7eb5518d44 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropertiesMergeBL.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropertiesMergeBL.java @@ -9,7 +9,7 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.ComponentInstanceProperty; import org.openecomp.sdc.be.model.InputDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.springframework.core.annotation.Order; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropsAndInputsMerge.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropsAndInputsMerge.java index dc037abe80..0bcbaf0556 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropsAndInputsMerge.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropsAndInputsMerge.java @@ -4,7 +4,7 @@ import fj.data.Either; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.*; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.common.log.wrappers.Logger; import org.openecomp.sdc.exception.ResponseFormat; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceRelationMerge.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceRelationMerge.java index 995eae701c..de7179865d 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceRelationMerge.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceRelationMerge.java @@ -11,7 +11,7 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.common.datastructure.Wrapper; import org.openecomp.sdc.common.log.wrappers.Logger; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ExternalRefsMergeBL.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ExternalRefsMergeBL.java index 68a8333e31..bc6e0309ef 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ExternalRefsMergeBL.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ExternalRefsMergeBL.java @@ -27,7 +27,7 @@ import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.jsontitan.operations.ExternalReferencesOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ExternalReferencesOperation; import org.openecomp.sdc.exception.ResponseFormat; import java.util.List; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/policy/PoliciesMergeCommand.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/policy/PoliciesMergeCommand.java index e57317f165..2f5698af4e 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/policy/PoliciesMergeCommand.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/policy/PoliciesMergeCommand.java @@ -9,7 +9,7 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.GroupDefinition; import org.openecomp.sdc.be.model.PolicyDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.common.log.wrappers.Logger; import org.springframework.core.annotation.Order; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogic.java index df7b877364..82bc0f4b75 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogic.java @@ -7,7 +7,7 @@ import java.util.Map; import java.util.Optional; import java.util.stream.Collectors; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.datatypes.elements.GetInputValueDataDefinition; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.model.DataTypeDefinition; @@ -44,7 +44,7 @@ public class PropertyDataValueMergeBusinessLogic { * @param newProp the new property to merge value into */ public void mergePropertyValue(PropertyDataDefinition oldProp, PropertyDataDefinition newProp, List getInputNamesToMerge) { - Either, TitanOperationStatus> dataTypesEither = dataTypeCache.getAll(); + Either, JanusGraphOperationStatus> dataTypesEither = dataTypeCache.getAll(); if (dataTypesEither.isRight()) { LOGGER.debug("failed to fetch data types, skip merging of previous property values. status: {}", dataTypesEither.right().value()); } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/utils/MergeInstanceUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/utils/MergeInstanceUtils.java index 55cf75b769..2dde63f1f2 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/utils/MergeInstanceUtils.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/utils/MergeInstanceUtils.java @@ -8,8 +8,8 @@ import org.openecomp.sdc.be.components.merge.instance.RelationMergeInfo; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.*; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; -import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.common.log.wrappers.Logger; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/path/ForwardingPathValidator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/path/ForwardingPathValidator.java index a099aad15c..837872917e 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/path/ForwardingPathValidator.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/path/ForwardingPathValidator.java @@ -7,7 +7,7 @@ import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition; import org.openecomp.sdc.be.model.ComponentParametersView; import org.openecomp.sdc.be.model.Service; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.common.log.wrappers.Logger; import org.openecomp.sdc.exception.ResponseFormat; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDeclarator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDeclarator.java index d7b366e0a8..fdcfd35ca4 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDeclarator.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDeclarator.java @@ -20,7 +20,7 @@ import org.openecomp.sdc.be.model.ComponentInstanceInput; import org.openecomp.sdc.be.model.ComponentInstancePropInput; import org.openecomp.sdc.be.model.ComponentParametersView; import org.openecomp.sdc.be.model.InputDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; import org.openecomp.sdc.common.log.wrappers.Logger; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstancePropertyDeclarator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstancePropertyDeclarator.java index 14ea9300fe..2026e1136d 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstancePropertyDeclarator.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstancePropertyDeclarator.java @@ -16,7 +16,7 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.ComponentInstanceProperty; import org.openecomp.sdc.be.model.InputDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; import org.openecomp.sdc.common.log.wrappers.Logger; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentPropertyDeclarator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentPropertyDeclarator.java index ae76dadbf0..b1910ad217 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentPropertyDeclarator.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentPropertyDeclarator.java @@ -30,7 +30,7 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstanceProperty; import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.PropertyDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/DefaultPropertyDeclarator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/DefaultPropertyDeclarator.java index bdb79c71bb..9f43284104 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/DefaultPropertyDeclarator.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/DefaultPropertyDeclarator.java @@ -21,7 +21,7 @@ import org.apache.commons.collections.MapUtils; import org.apache.commons.lang.StringUtils; import org.json.simple.JSONObject; import org.openecomp.sdc.be.components.utils.PropertiesUtils; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.datatypes.elements.GetInputValueDataDefinition; import org.openecomp.sdc.be.datatypes.elements.GetPolicyValueDataDefinition; import org.openecomp.sdc.be.datatypes.elements.PropertiesOwner; @@ -466,10 +466,12 @@ public abstract class DefaultPropertyDeclarator prepareValueBeforeDelete(InputDefinition inputForDelete, PropertyDataDefinition inputValue, List pathOfComponentInstances) { Either deleteEither = prepareValueBeforeDelete(inputForDelete, inputValue); - Either findDefaultValue = propertyOperation.findDefaultValueFromSecondPosition(pathOfComponentInstances, inputValue.getUniqueId(), + Either findDefaultValue = propertyOperation + .findDefaultValueFromSecondPosition(pathOfComponentInstances, inputValue.getUniqueId(), (String) inputValue.getDefaultValue()); if (findDefaultValue.isRight()) { - deleteEither = Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(findDefaultValue.right().value())))); + deleteEither = Either.right(componentsUtils.getResponseFormat(componentsUtils + .convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(findDefaultValue.right().value())))); return deleteEither; } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeclarator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeclarator.java index 17059104ff..9cf6ff9fa4 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeclarator.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeclarator.java @@ -35,7 +35,7 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstanceProperty; import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.PolicyDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.PolicyOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.PolicyOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; import org.openecomp.sdc.common.log.wrappers.Logger; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentInstancePropertyToPolicyDeclarator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentInstancePropertyToPolicyDeclarator.java index 2726f67342..0c6f8a24b4 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentInstancePropertyToPolicyDeclarator.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentInstancePropertyToPolicyDeclarator.java @@ -15,7 +15,7 @@ import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.ComponentInstanceProperty; import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.PolicyDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentPropertyToPolicyDeclarator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentPropertyToPolicyDeclarator.java index 6bd09c1622..362f80ff1f 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentPropertyToPolicyDeclarator.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentPropertyToPolicyDeclarator.java @@ -13,7 +13,7 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.PolicyDefinition; import org.openecomp.sdc.be.model.PropertyDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/upgrade/UpgradeBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/upgrade/UpgradeBusinessLogic.java index ef3ffb8953..ffb4805285 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/upgrade/UpgradeBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/upgrade/UpgradeBusinessLogic.java @@ -6,13 +6,13 @@ import org.openecomp.sdc.be.components.lifecycle.LifecycleBusinessLogic; import org.openecomp.sdc.be.components.lifecycle.LifecycleChangeInfoWithAction; import org.openecomp.sdc.be.components.validation.UserValidations; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.*; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; -import org.openecomp.sdc.be.model.jsontitan.operations.UpgradeOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.UpgradeOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.be.user.Role; @@ -31,7 +31,7 @@ public class UpgradeBusinessLogic { private final ToscaOperationFacade toscaOperationFacade; private final ComponentsUtils componentsUtils; private final UpgradeOperation upgradeOperation; - private final TitanDao titanDao; + private final JanusGraphDao janusGraphDao; private LifecycleChangeInfoWithAction changeInfo = new LifecycleChangeInfoWithAction("automated upgrade"); private static final List UUID_PROPS_NAMES = Arrays.asList("depending_service_uuid", "providing_service_uuid"); @@ -41,14 +41,14 @@ public class UpgradeBusinessLogic { private static final Logger LOGGER = Logger.getLogger(UpgradeBusinessLogic.class); public UpgradeBusinessLogic(LifecycleBusinessLogic lifecycleBusinessLogic, ComponentInstanceBusinessLogic componentInstanceBusinessLogic, UserValidations userValidations, ToscaOperationFacade toscaOperationFacade, ComponentsUtils componentsUtils, - UpgradeOperation upgradeOperation, TitanDao titanDao) { + UpgradeOperation upgradeOperation, JanusGraphDao janusGraphDao) { this.lifecycleBusinessLogic = lifecycleBusinessLogic; this.componentInstanceBusinessLogic = componentInstanceBusinessLogic; this.userValidations = userValidations; this.toscaOperationFacade = toscaOperationFacade; this.componentsUtils = componentsUtils; this.upgradeOperation = upgradeOperation; - this.titanDao = titanDao; + this.janusGraphDao = janusGraphDao; } @@ -113,7 +113,7 @@ public class UpgradeBusinessLogic { .map(rf -> componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(rf))); } finally { // all operation were read only. no commit needed - titanDao.rollback(); + janusGraphDao.rollback(); } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/ComponentValidations.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/ComponentValidations.java index 9dbf012653..bdd7f656b3 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/ComponentValidations.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/ComponentValidations.java @@ -32,7 +32,7 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.ComponentParametersView; import org.openecomp.sdc.be.model.GroupDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.StorageException; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.utils.ComponentValidationUtils; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/NodeFilterValidator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/NodeFilterValidator.java index 8d2808851b..c16927f040 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/NodeFilterValidator.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/NodeFilterValidator.java @@ -20,7 +20,7 @@ import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.ComponentInstanceProperty; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.Service; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.tosca.ToscaPropertyType; import org.openecomp.sdc.be.ui.model.UIConstraint; import org.openecomp.sdc.exception.ResponseFormat; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/PropertyValidator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/PropertyValidator.java index 94751593fa..b42aa4cfa7 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/PropertyValidator.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/PropertyValidator.java @@ -6,7 +6,7 @@ import org.openecomp.sdc.be.components.impl.ResourceBusinessLogic; import org.openecomp.sdc.be.components.impl.utils.ExceptionUtils; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.DataTypeDefinition; import org.openecomp.sdc.be.model.PropertyDefinition; @@ -92,11 +92,11 @@ public class PropertyValidator { break; } - Either, TitanOperationStatus> allDataTypes = applicationDataTypeCache.getAll(); + Either, JanusGraphOperationStatus> allDataTypes = applicationDataTypeCache.getAll(); if (allDataTypes.isRight()) { - TitanOperationStatus status = allDataTypes.right().value(); + JanusGraphOperationStatus status = allDataTypes.right().value(); BeEcompErrorManager.getInstance().logInternalFlowError("AddPropertyToGroup", "Failed to validate property. Status is " + status, BeEcompErrorManager.ErrorSeverity.ERROR); - return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(status)))); + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status)))); } type = property.getType(); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/ServiceDistributionValidation.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/ServiceDistributionValidation.java index fa35b64cf3..8611321b87 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/ServiceDistributionValidation.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/ServiceDistributionValidation.java @@ -12,7 +12,7 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.resources.data.OperationalEnvironmentEntry; import org.openecomp.sdc.common.log.wrappers.Logger; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/converters/AssetMetadataConverter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/converters/AssetMetadataConverter.java index 78bb5e67e1..c71c7960ab 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/converters/AssetMetadataConverter.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/converters/AssetMetadataConverter.java @@ -30,7 +30,7 @@ import org.openecomp.sdc.be.externalapi.servlet.representation.*; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.*; import org.openecomp.sdc.be.model.category.CategoryDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.common.log.wrappers.Logger; import org.openecomp.sdc.exception.ResponseFormat; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/filters/BeServletFilter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/filters/BeServletFilter.java index 3a823ded76..c9430107df 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/filters/BeServletFilter.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/filters/BeServletFilter.java @@ -25,7 +25,7 @@ import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.config.Configuration; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.HealingTitanDao; +import org.openecomp.sdc.be.dao.jsongraph.HealingJanusGraphDao; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.impl.WebAppContextWrapper; import org.openecomp.sdc.common.api.Constants; @@ -118,7 +118,7 @@ public class BeServletFilter implements ContainerRequestFilter, ContainerRespons audit.startLog(requestContext); } - writeToTitan(responseContext); + writeToJanusGraph(responseContext); //write to Audit log in case it's valuable action // (e.g. ignoring healthCheck and any other unlogged urls as in yaml @@ -144,18 +144,18 @@ public class BeServletFilter implements ContainerRequestFilter, ContainerRespons } } - private void writeToTitan(ContainerResponseContext responseContext) { + private void writeToJanusGraph(ContainerResponseContext responseContext) { log.debug("Close transaction from filter"); - HealingTitanDao titanDao = getTitanDao(); - if (titanDao != null) { + HealingJanusGraphDao janusGraphDao = getJanusGraphDao(); + if (janusGraphDao != null) { int status = responseContext.getStatus(); if (status == Response.Status.OK.getStatusCode() || status == Response.Status.CREATED.getStatusCode() || status == Response.Status.NO_CONTENT.getStatusCode()) { - titanDao.commit(); + janusGraphDao.commit(); log.debug("Doing commit from filter"); } else { - titanDao.rollback(); + janusGraphDao.rollback(); log.debug("Doing rollback from filter"); } } @@ -202,12 +202,12 @@ public class BeServletFilter implements ContainerRequestFilter, ContainerRespons return webApplicationContext.getBean(ComponentsUtils.class); } - private HealingTitanDao getTitanDao() { + private HealingJanusGraphDao getJanusGraphDao() { ServletContext context = this.sr.getSession().getServletContext(); WebAppContextWrapper webApplicationContextWrapper = (WebAppContextWrapper) context.getAttribute(Constants.WEB_APPLICATION_CONTEXT_WRAPPER_ATTR); WebApplicationContext webApplicationContext = webApplicationContextWrapper.getWebAppContext(context); - return webApplicationContext.getBean(HealingTitanDao.class); + return webApplicationContext.getBean(HealingJanusGraphDao.class); } // Extracted for purpose of clear method name, for logback %M parameter diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/filters/ComponentsAvailabilityFilter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/filters/ComponentsAvailabilityFilter.java index 31ba52749a..158cc2d842 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/filters/ComponentsAvailabilityFilter.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/filters/ComponentsAvailabilityFilter.java @@ -92,7 +92,7 @@ public class ComponentsAvailabilityFilter implements ContainerRequestFilter { List healthCheckInfos = new ArrayList<>(); HealthCheckBusinessLogic healthCheckBusinessLogic = getHealthCheckBL(servletContext); - healthCheckBusinessLogic.getTitanHealthCheck(healthCheckInfos); // Titan + healthCheckBusinessLogic.getJanusGraphHealthCheck(healthCheckInfos); // JanusGraph return healthCheckInfos; } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CapabilityRequirementConverter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CapabilityRequirementConverter.java index 245eb59301..8e06c02767 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CapabilityRequirementConverter.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CapabilityRequirementConverter.java @@ -31,8 +31,8 @@ import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition; import org.openecomp.sdc.be.datatypes.elements.RequirementDataDefinition; import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; import org.openecomp.sdc.be.model.*; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; -import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.utils.ComponentUtilities; import org.openecomp.sdc.be.tosca.ToscaUtils.SubstitutionEntry; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java index 7b40781f3f..2f1357ea13 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java @@ -40,8 +40,8 @@ import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.*; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; -import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter; import org.openecomp.sdc.be.resources.data.ESArtifactData; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/GroupExportParserImpl.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/GroupExportParserImpl.java index d7adb54c08..ff69eaa90b 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/GroupExportParserImpl.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/GroupExportParserImpl.java @@ -3,7 +3,7 @@ package org.openecomp.sdc.be.tosca; import fj.data.Either; import org.apache.commons.lang.StringUtils; import org.openecomp.sdc.be.components.impl.exceptions.SdcResourceNotFoundException; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.model.*; import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache; @@ -44,7 +44,7 @@ public class GroupExportParserImpl implements GroupExportParser { } private Map getDataTypes() { - Either, TitanOperationStatus> dataTypesEither = dataTypeCache.getAll(); + Either, JanusGraphOperationStatus> dataTypesEither = dataTypeCache.getAll(); if (dataTypesEither.isRight()) { log.error("Failed to retrieve all data types {}", dataTypesEither.right().value()); throw new SdcResourceNotFoundException(); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/PolicyExportParserImpl.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/PolicyExportParserImpl.java index 0ebdf0e362..84b4193940 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/PolicyExportParserImpl.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/PolicyExportParserImpl.java @@ -3,7 +3,7 @@ package org.openecomp.sdc.be.tosca; import fj.data.Either; import org.openecomp.sdc.be.components.impl.exceptions.SdcResourceNotFoundException; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.datatypes.elements.PolicyTargetType; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.model.*; @@ -43,7 +43,7 @@ public class PolicyExportParserImpl implements PolicyExportParser { } private Map getDataTypes() { - Either, TitanOperationStatus> dataTypesEither = dataTypeCache.getAll(); + Either, JanusGraphOperationStatus> dataTypesEither = dataTypeCache.getAll(); if (dataTypesEither.isRight()) { log.error("Failed to retrieve all data types {}", dataTypesEither.right().value()); throw new SdcResourceNotFoundException(); 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 e6e69bf8de..603da09a1d 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 @@ -32,7 +32,7 @@ import org.apache.commons.lang3.tuple.Triple; import org.onap.sdc.tosca.services.YamlUtil; import org.openecomp.sdc.be.components.impl.exceptions.SdcResourceNotFoundException; import org.openecomp.sdc.be.config.ConfigurationManager; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition; import org.openecomp.sdc.be.datatypes.elements.*; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; @@ -41,8 +41,8 @@ import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.*; import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache; import org.openecomp.sdc.be.model.category.CategoryDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; -import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation; import org.openecomp.sdc.be.model.tosca.converters.ToscaValueBaseConverter; @@ -249,7 +249,7 @@ public class ToscaExportHandler { toscaNode.setInterface_types(proxyInterfaceTypes); } - Either, TitanOperationStatus> dataTypesEither = dataTypeCache.getAll(); + Either, JanusGraphOperationStatus> dataTypesEither = dataTypeCache.getAll(); if (dataTypesEither.isRight()) { log.debug("Failed to retrieve all data types {}", dataTypesEither.right().value()); return Either.right(ToscaError.GENERAL_ERROR); @@ -548,7 +548,7 @@ public class ToscaExportHandler { .collect(Collectors.toList()); toscaNode.setInterface_types(addInterfaceTypeElement(component, allGlobalInterfaceTypes)); - Either, TitanOperationStatus> dataTypesEither = dataTypeCache.getAll(); + Either, JanusGraphOperationStatus> dataTypesEither = dataTypeCache.getAll(); if (dataTypesEither.isRight()) { log.debug("Failed to fetch all data types :", dataTypesEither.right().value()); return Either.right(ToscaError.GENERAL_ERROR); @@ -1028,7 +1028,7 @@ public class ToscaExportHandler { String derivedFrom = ((Resource) origComponent).getToscaResourceName(); toscaNodeType.setDerived_from(derivedFrom); - Either, TitanOperationStatus> dataTypesEither = dataTypeCache.getAll(); + Either, JanusGraphOperationStatus> dataTypesEither = dataTypeCache.getAll(); if (dataTypesEither.isRight()) { log.debug("Failed to retrieve all data types {}", dataTypesEither.right().value()); } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaUtils.java index 59dd8d0f00..32cb604e76 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaUtils.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaUtils.java @@ -20,13 +20,10 @@ package org.openecomp.sdc.be.tosca; -import org.apache.commons.lang3.StringUtils; import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.Component; -import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement; -import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum; import java.lang.reflect.Field; import java.util.*; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/ForwardingPathToscaUtil.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/ForwardingPathToscaUtil.java index a332e6401a..62a5e8ccfe 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/ForwardingPathToscaUtil.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/ForwardingPathToscaUtil.java @@ -8,7 +8,7 @@ import org.openecomp.sdc.be.model.CapabilityDefinition; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Service; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.tosca.CapabilityRequirementConverter; import org.openecomp.sdc.be.tosca.model.ToscaNodeTemplate; import org.openecomp.sdc.be.tosca.model.ToscaTemplateRequirement; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/user/UserBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/user/UserBusinessLogic.java index b7e4c53844..a56607d4ce 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/user/UserBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/user/UserBusinessLogic.java @@ -25,7 +25,7 @@ import org.apache.tinkerpop.gremlin.structure.Edge; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; -import org.openecomp.sdc.be.dao.titan.TitanGenericDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao; import org.openecomp.sdc.be.dao.utils.UserStatusEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.LifecycleStateEnum; @@ -57,7 +57,7 @@ public class UserBusinessLogic implements IUserBusinessLogic { @Resource private ComponentsUtils componentsUtils; @Autowired - private TitanGenericDao titanDao; + private JanusGraphGenericDao janusGraphDao; @Override public Either getUser(String userId, boolean inTransaction) { @@ -603,9 +603,9 @@ public class UserBusinessLogic implements IUserBusinessLogic { // commit will be perform outside!!! if (result == null || result.isRight()) { log.debug("getUserPendingTasksList failed to perform fetching"); - titanDao.rollback(); + janusGraphDao.rollback(); } else { - titanDao.commit(); + janusGraphDao.commit(); } } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/api/ITransactionSdnc.java b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/api/ITransactionSdnc.java index ea041359fd..b964321c8a 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/api/ITransactionSdnc.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/api/ITransactionSdnc.java @@ -34,6 +34,6 @@ public interface ITransactionSdnc { Either invokeGeneralDBAction(boolean isLastAction, DBTypeEnum dbType, IDBAction dbAction, IDBAction dbRollbackAction); - Either invokeTitanAction(boolean isLastAction, IDBAction dbAction); + Either invokeJanusGraphAction(boolean isLastAction, IDBAction dbAction); } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/api/TransactionUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/api/TransactionUtils.java index fc7c90509f..60f89ce012 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/api/TransactionUtils.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/api/TransactionUtils.java @@ -30,7 +30,7 @@ public final class TransactionUtils { } public enum DBTypeEnum { - ELASTIC_SEARCH, TITAN, MYSTERY, SWIFT + ELASTIC_SEARCH, JANUSGRAPH, MYSTERY, SWIFT } public enum TransactionCodeEnum { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/JanusGraphCommitHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/JanusGraphCommitHandler.java new file mode 100644 index 0000000000..dad79b5f76 --- /dev/null +++ b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/JanusGraphCommitHandler.java @@ -0,0 +1,52 @@ +/*- + * ============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.common.transaction.impl; + +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; +import org.openecomp.sdc.common.transaction.api.ICommitHandler; +import org.openecomp.sdc.common.transaction.api.TransactionUtils.DBActionCodeEnum; +import org.openecomp.sdc.common.transaction.api.TransactionUtils.DBTypeEnum; + +public class JanusGraphCommitHandler implements ICommitHandler { + + private JanusGraphGenericDao janusGraphGenericDao; + + public JanusGraphCommitHandler(JanusGraphGenericDao janusGraphGenericDao) { + this.janusGraphGenericDao = janusGraphGenericDao; + } + + @Override + public DBActionCodeEnum doCommit() { + DBActionCodeEnum result = DBActionCodeEnum.SUCCESS; + JanusGraphOperationStatus janusGraphStatus = janusGraphGenericDao.commit(); + if (janusGraphStatus != JanusGraphOperationStatus.OK) { + result = DBActionCodeEnum.FAIL_GENERAL; + } + return result; + } + + @Override + public DBTypeEnum getDBType() { + return DBTypeEnum.JANUSGRAPH; + } + +} diff --git a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/JanusGraphRollbackHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/JanusGraphRollbackHandler.java new file mode 100644 index 0000000000..ed2633fa11 --- /dev/null +++ b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/JanusGraphRollbackHandler.java @@ -0,0 +1,55 @@ +/*- + * ============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.common.transaction.impl; + +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; +import org.openecomp.sdc.common.transaction.api.RollbackHandler; +import org.openecomp.sdc.common.transaction.api.TransactionUtils.DBActionCodeEnum; +import org.openecomp.sdc.common.transaction.api.TransactionUtils.DBTypeEnum; + +public class JanusGraphRollbackHandler extends RollbackHandler { + + private JanusGraphGenericDao janusGraphGenericDao; + + public JanusGraphRollbackHandler(Integer transactionId, String userId, String actionType, JanusGraphGenericDao janusGraphGenericDao) { + super(transactionId, userId, actionType); + this.janusGraphGenericDao = janusGraphGenericDao; + } + + public DBTypeEnum getDBType() { + return DBTypeEnum.JANUSGRAPH; + } + + protected boolean isRollbackForPersistenceData() { + return false; + } + + public DBActionCodeEnum doNonPersistenceDataRollback() { + DBActionCodeEnum result = DBActionCodeEnum.SUCCESS; + JanusGraphOperationStatus janusGraphStatus = janusGraphGenericDao.rollback(); + if (janusGraphStatus != JanusGraphOperationStatus.OK) { + result = DBActionCodeEnum.FAIL_GENERAL; + } + return result; + } + +} diff --git a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/TitanCommitHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/TitanCommitHandler.java deleted file mode 100644 index c86241ebf1..0000000000 --- a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/TitanCommitHandler.java +++ /dev/null @@ -1,52 +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.common.transaction.impl; - -import org.openecomp.sdc.be.dao.titan.TitanGenericDao; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; -import org.openecomp.sdc.common.transaction.api.ICommitHandler; -import org.openecomp.sdc.common.transaction.api.TransactionUtils.DBActionCodeEnum; -import org.openecomp.sdc.common.transaction.api.TransactionUtils.DBTypeEnum; - -public class TitanCommitHandler implements ICommitHandler { - - private TitanGenericDao titanGenericDao; - - public TitanCommitHandler(TitanGenericDao titanGenericDao) { - this.titanGenericDao = titanGenericDao; - } - - @Override - public DBActionCodeEnum doCommit() { - DBActionCodeEnum result = DBActionCodeEnum.SUCCESS; - TitanOperationStatus titanStatus = titanGenericDao.commit(); - if (titanStatus != TitanOperationStatus.OK) { - result = DBActionCodeEnum.FAIL_GENERAL; - } - return result; - } - - @Override - public DBTypeEnum getDBType() { - return DBTypeEnum.TITAN; - } - -} diff --git a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/TitanRollbackHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/TitanRollbackHandler.java deleted file mode 100644 index 89d2b9da8e..0000000000 --- a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/TitanRollbackHandler.java +++ /dev/null @@ -1,55 +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.common.transaction.impl; - -import org.openecomp.sdc.be.dao.titan.TitanGenericDao; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; -import org.openecomp.sdc.common.transaction.api.RollbackHandler; -import org.openecomp.sdc.common.transaction.api.TransactionUtils.DBActionCodeEnum; -import org.openecomp.sdc.common.transaction.api.TransactionUtils.DBTypeEnum; - -public class TitanRollbackHandler extends RollbackHandler { - - private TitanGenericDao titanGenericDao; - - public TitanRollbackHandler(Integer transactionId, String userId, String actionType, TitanGenericDao titanGenericDao) { - super(transactionId, userId, actionType); - this.titanGenericDao = titanGenericDao; - } - - public DBTypeEnum getDBType() { - return DBTypeEnum.TITAN; - } - - protected boolean isRollbackForPersistenceData() { - return false; - } - - public DBActionCodeEnum doNonPersistenceDataRollback() { - DBActionCodeEnum result = DBActionCodeEnum.SUCCESS; - TitanOperationStatus titanStatus = titanGenericDao.rollback(); - if (titanStatus != TitanOperationStatus.OK) { - result = DBActionCodeEnum.FAIL_GENERAL; - } - return result; - } - -} diff --git a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/mngr/TransactionManager.java b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/mngr/TransactionManager.java index 9d95c26ec9..78264484fb 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/mngr/TransactionManager.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/mngr/TransactionManager.java @@ -23,7 +23,7 @@ package org.openecomp.sdc.common.transaction.mngr; import com.google.common.collect.EvictingQueue; import com.google.common.collect.Queues; import org.openecomp.sdc.be.dao.impl.ESCatalogDAO; -import org.openecomp.sdc.be.dao.titan.TitanGenericDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao; import org.openecomp.sdc.common.log.wrappers.Logger; import org.openecomp.sdc.common.transaction.api.ITransactionSdnc; import org.openecomp.sdc.common.transaction.api.TransactionUtils; @@ -45,7 +45,7 @@ public class TransactionManager { @Resource private ESCatalogDAO esCatalogDao; @Resource - private TitanGenericDao titanGenericDao; + private JanusGraphGenericDao janusGraphGenericDao; /** * userId and actionType parameters are used only for logging purposes. @@ -55,7 +55,8 @@ public class TransactionManager { init(); } log.debug("TransactionManager creating new SdncTransaction"); - ITransactionSdnc tx = new TransactionSdncImpl(generateTransactionID(), userId, actionType, esCatalogDao, titanGenericDao); + ITransactionSdnc tx = new TransactionSdncImpl(generateTransactionID(), userId, actionType, esCatalogDao, + janusGraphGenericDao); transactions.add(tx); return tx; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/mngr/TransactionSdncImpl.java b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/mngr/TransactionSdncImpl.java index 1c07e50e0a..93a2c9db82 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/mngr/TransactionSdncImpl.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/mngr/TransactionSdncImpl.java @@ -23,15 +23,15 @@ package org.openecomp.sdc.common.transaction.mngr; import fj.data.Either; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.impl.ESCatalogDAO; -import org.openecomp.sdc.be.dao.titan.TitanGenericDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao; import org.openecomp.sdc.be.resources.data.ESArtifactData; import org.openecomp.sdc.common.log.wrappers.Logger; import org.openecomp.sdc.common.transaction.api.*; import org.openecomp.sdc.common.transaction.api.TransactionUtils.*; import org.openecomp.sdc.common.transaction.impl.ESAction; import org.openecomp.sdc.common.transaction.impl.ESRollbackHandler; -import org.openecomp.sdc.common.transaction.impl.TitanCommitHandler; -import org.openecomp.sdc.common.transaction.impl.TitanRollbackHandler; +import org.openecomp.sdc.common.transaction.impl.JanusGraphCommitHandler; +import org.openecomp.sdc.common.transaction.impl.JanusGraphRollbackHandler; import org.openecomp.sdc.common.util.MethodActivationStatusEnum; import java.util.ArrayList; @@ -45,14 +45,14 @@ public class TransactionSdncImpl implements ITransactionSdnc { private RollbackManager rollbackManager; private CommitManager commitManager; private ESCatalogDAO esCatalogDao; - private TitanGenericDao titanGenericDao; + private JanusGraphGenericDao janusGraphGenericDao; private Integer transactionId; private TransactionStatusEnum status; private String userId, actionType; - TransactionSdncImpl(Integer transactionId, String userId, ActionTypeEnum actionTypeEnum, ESCatalogDAO esCatalogDao, TitanGenericDao titanGenericDao) { + TransactionSdncImpl(Integer transactionId, String userId, ActionTypeEnum actionTypeEnum, ESCatalogDAO esCatalogDao, JanusGraphGenericDao janusGraphGenericDao) { this.esCatalogDao = esCatalogDao; - this.titanGenericDao = titanGenericDao; + this.janusGraphGenericDao = janusGraphGenericDao; this.transactionId = transactionId; this.userId = userId; actionType = actionTypeEnum.name(); @@ -64,13 +64,14 @@ public class TransactionSdncImpl implements ITransactionSdnc { private List initCommitHandlers() { List commitHandlers = new ArrayList<>(); - commitHandlers.add(new TitanCommitHandler(titanGenericDao)); + commitHandlers.add(new JanusGraphCommitHandler(janusGraphGenericDao)); return commitHandlers; } private List initRollbackHandlers() { List rolebackHandlers = new ArrayList<>(); - rolebackHandlers.add(new TitanRollbackHandler(transactionId, userId, actionType, titanGenericDao)); + rolebackHandlers.add(new JanusGraphRollbackHandler(transactionId, userId, actionType, + janusGraphGenericDao)); rolebackHandlers.add(new ESRollbackHandler(transactionId, userId, actionType)); return rolebackHandlers; } @@ -115,10 +116,10 @@ public class TransactionSdncImpl implements ITransactionSdnc { return result; } - public Either invokeTitanAction(boolean isLastAction, IDBAction dbAction) { + public Either invokeJanusGraphAction(boolean isLastAction, IDBAction dbAction) { Either result; if (status == TransactionStatusEnum.OPEN) { - result = invokeAction(isLastAction, dbAction, DBTypeEnum.TITAN); + result = invokeAction(isLastAction, dbAction, DBTypeEnum.JANUSGRAPH); } else { result = handleActionOnClosedTransaction(); } -- cgit 1.2.3-korg