* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import fj.data.Either;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.HealingTitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.HealingJanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.*;
import org.openecomp.sdc.be.datatypes.elements.MapInterfaceDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.*;
import org.openecomp.sdc.be.model.*;
import org.openecomp.sdc.be.model.catalog.CatalogComponent;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement;
-import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.TopologyTemplate;
+import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement;
+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.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter;
@Autowired
private GroupsOperation groupsOperation;
@Autowired
- private HealingTitanDao titanDao;
+ private HealingJanusGraphDao janusGraphDao;
private static final Logger log = Logger.getLogger(ToscaOperationFacade.class.getName());
// endregion
public <T extends Component> Either<T, StorageOperationStatus> getToscaElement(String componentId, ComponentParametersView filters) {
- Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, filters.detectParseFlag());
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = janusGraphDao
+ .getVertexById(componentId, filters.detectParseFlag());
if (getVertexEither.isRight()) {
log.debug(COULDNT_FETCH_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentId, getVertexEither.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value()));
}
return getToscaElementByOperation(getVertexEither.left().value(), filters);
public <T extends Component> Either<T, StorageOperationStatus> getToscaElement(String componentId, JsonParseFlagEnum parseFlag) {
- Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, parseFlag);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = janusGraphDao
+ .getVertexById(componentId, parseFlag);
if (getVertexEither.isRight()) {
log.debug(COULDNT_FETCH_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentId, getVertexEither.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value()));
}
return getToscaElementByOperation(getVertexEither.left().value());
public Either<Boolean, StorageOperationStatus> validateComponentExists(String componentId) {
- Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.NoParse);
if (getVertexEither.isRight()) {
- TitanOperationStatus status = getVertexEither.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
+ JanusGraphOperationStatus status = getVertexEither.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
return Either.left(false);
} else {
log.debug(COULDNT_FETCH_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentId, getVertexEither.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value()));
}
}
return Either.left(true);
props.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name());
props.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true);
- Either<List<GraphVertex>, TitanOperationStatus> getVertexEither = titanDao.getByCriteria(ModelConverter.getVertexType(component), props);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> getVertexEither = janusGraphDao
+ .getByCriteria(ModelConverter.getVertexType(component), props);
if (getVertexEither.isRight()) {
log.debug(COULDNT_FETCH_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, component.getUniqueId(), getVertexEither.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value()));
}
return getToscaElementByOperation(getVertexEither.left().value().get(0));
return StorageOperationStatus.OK;
} else {
- Either<GraphVertex, TitanOperationStatus> getResponse = titanDao.getVertexById(componentToDelete.getUniqueId(), JsonParseFlagEnum.ParseAll);
+ Either<GraphVertex, JanusGraphOperationStatus> getResponse = janusGraphDao
+ .getVertexById(componentToDelete.getUniqueId(), JsonParseFlagEnum.ParseAll);
if (getResponse.isRight()) {
log.debug(COULDNT_FETCH_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentToDelete.getUniqueId(), getResponse.right().value());
- return DaoStatusConverter.convertTitanStatusToStorageStatus(getResponse.right().value());
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getResponse.right().value());
}
GraphVertex componentV = getResponse.left().value();
public <T extends Component> Either<T, StorageOperationStatus> deleteToscaComponent(String componentId) {
- Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.ParseAll);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.ParseAll);
if (getVertexEither.isRight()) {
log.debug("Couldn't fetch component vertex with and unique id {}, error: {}", componentId, getVertexEither.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value()));
}
Either<ToscaElement, StorageOperationStatus> deleteElement = deleteToscaElement(getVertexEither.left().value());
Map<GraphPropertyEnum, Object> properties = new EnumMap<>(GraphPropertyEnum.class);
properties.put(GraphPropertyEnum.CSAR_UUID, csarUUID);
- Either<List<GraphVertex>, TitanOperationStatus> resources = titanDao.getByCriteria(null, properties, JsonParseFlagEnum.ParseMetadata);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> resources = janusGraphDao
+ .getByCriteria(null, properties, JsonParseFlagEnum.ParseMetadata);
if (resources.isRight()) {
- if (resources.right().value() == TitanOperationStatus.NOT_FOUND) {
+ if (resources.right().value() == JanusGraphOperationStatus.NOT_FOUND) {
return StorageOperationStatus.OK;
} else {
log.debug("failed to get resources from graph with property name: {}", csarUUID);
- return DaoStatusConverter.convertTitanStatusToStorageStatus(resources.right().value());
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(resources.right().value());
}
}
return StorageOperationStatus.ENTITY_ALREADY_EXISTS;
props.put(GraphPropertyEnum.TOSCA_RESOURCE_NAME, toscaResourceName);
props.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true);
props.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name());
- Either<List<GraphVertex>, TitanOperationStatus> getLatestRes = titanDao.getByCriteria(vertexType, props, parseFlag);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> getLatestRes = janusGraphDao
+ .getByCriteria(vertexType, props, parseFlag);
if (getLatestRes.isRight()) {
- TitanOperationStatus status = getLatestRes.right().value();
+ JanusGraphOperationStatus status = getLatestRes.right().value();
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to fetch {} with name {}. status={} ", vertexType, toscaResourceName, status);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
if (result == null) {
List<GraphVertex> resources = getLatestRes.left().value();
Map<GraphPropertyEnum, Object> properties = new EnumMap<>(GraphPropertyEnum.class);
properties.put(GraphPropertyEnum.TOSCA_RESOURCE_NAME, name);
- Either<List<GraphVertex>, TitanOperationStatus> resources = titanDao.getByCriteria(null, properties, JsonParseFlagEnum.ParseMetadata);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> resources = janusGraphDao
+ .getByCriteria(null, properties, JsonParseFlagEnum.ParseMetadata);
- if (resources.isRight() && resources.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (resources.isRight() && resources.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
log.debug("failed to get resources from graph with property name: {}", name);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(resources.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(resources.right().value()));
}
List<GraphVertex> resourceList = (resources.isLeft() ? resources.left().value() : null);
if (isNotEmpty(resourceList)) {
copyArtifactsToNewComponent(newComponent, oldComponent);
- Either<GraphVertex, TitanOperationStatus> componentVEither = titanDao.getVertexById(oldComponent.getUniqueId(), JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> componentVEither = janusGraphDao
+ .getVertexById(oldComponent.getUniqueId(), JsonParseFlagEnum.NoParse);
if (componentVEither.isRight()) {
log.debug("Falied to fetch component {} error {}", oldComponent.getUniqueId(), componentVEither.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(componentVEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(componentVEither.right().value()));
}
GraphVertex componentv = componentVEither.left().value();
- Either<GraphVertex, TitanOperationStatus> parentVertexEither = titanDao.getParentVertex(componentv, EdgeLabelEnum.VERSION, JsonParseFlagEnum.NoParse);
- if (parentVertexEither.isRight() && parentVertexEither.right().value() != TitanOperationStatus.NOT_FOUND) {
+ Either<GraphVertex, JanusGraphOperationStatus> parentVertexEither = janusGraphDao
+ .getParentVertex(componentv, EdgeLabelEnum.VERSION, JsonParseFlagEnum.NoParse);
+ if (parentVertexEither.isRight() && parentVertexEither.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
log.debug("Falied to fetch parent version for component {} error {}", oldComponent.getUniqueId(), parentVertexEither.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(parentVertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(parentVertexEither.right().value()));
}
Either<ToscaElement, StorageOperationStatus> deleteToscaComponent = deleteToscaElement(componentv);
return Either.right(createToscaComponent.right().value());
}
Resource newElement = createToscaComponent.left().value();
- Either<GraphVertex, TitanOperationStatus> newVersionEither = titanDao.getVertexById(newElement.getUniqueId(), JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> newVersionEither = janusGraphDao
+ .getVertexById(newElement.getUniqueId(), JsonParseFlagEnum.NoParse);
if (newVersionEither.isRight()) {
log.debug("Falied to fetch new tosca element component {} error {}", newComponent.getUniqueId(), newVersionEither.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(newVersionEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(newVersionEither.right().value()));
}
if (parentVertexEither.isLeft()) {
GraphVertex previousVersionV = parentVertexEither.left().value();
- TitanOperationStatus createEdge = titanDao.createEdge(previousVersionV, newVersionEither.left().value(), EdgeLabelEnum.VERSION, null);
- if (createEdge != TitanOperationStatus.OK) {
+ JanusGraphOperationStatus
+ createEdge = janusGraphDao
+ .createEdge(previousVersionV, newVersionEither.left().value(), EdgeLabelEnum.VERSION, null);
+ if (createEdge != JanusGraphOperationStatus.OK) {
log.debug("Falied to associate to previous version {} new version {} error {}", previousVersionV.getUniqueId(), newVersionEither.right().value(), createEdge);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(createEdge));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(createEdge));
}
}
return Either.left(newElement);
public <T extends Component> Either<T, StorageOperationStatus> updateToscaElement(T componentToUpdate, ComponentParametersView filterResult) {
String componentId = componentToUpdate.getUniqueId();
- Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.ParseAll);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.ParseAll);
if (getVertexEither.isRight()) {
log.debug(COULDNT_FETCH_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentId, getVertexEither.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value()));
}
GraphVertex elementV = getVertexEither.left().value();
ToscaElementOperation toscaElementOperation = getToscaElementOperation(elementV);
propertiesNotToMatch.put(GraphPropertyEnum.IS_DELETED, true);
- Either<List<GraphVertex>, TitanOperationStatus> highestResources = titanDao.getByCriteria(null, propertiesToMatch, propertiesNotToMatch, parseFlag);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> highestResources = janusGraphDao
+ .getByCriteria(null, propertiesToMatch, propertiesNotToMatch, parseFlag);
if (highestResources.isRight()) {
- TitanOperationStatus status = highestResources.right().value();
+ JanusGraphOperationStatus status = highestResources.right().value();
log.debug("failed to find resource with name {}. status={} ", nodeName, status);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
return result;
}
propertiesNotToMatch.put(GraphPropertyEnum.IS_DELETED, true);
- Either<List<GraphVertex>, TitanOperationStatus> getComponentsRes = titanDao.getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> getComponentsRes = janusGraphDao
+ .getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll);
if (getComponentsRes.isRight()) {
- TitanOperationStatus status = getComponentsRes.right().value();
+ JanusGraphOperationStatus status = getComponentsRes.right().value();
log.debug("Failed to fetch the component with system name {}. Status is {} ", systemName, status);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
if (result == null) {
componentVertices = getComponentsRes.left().value();
if (componentType != null) {
hasProperties.put(GraphPropertyEnum.COMPONENT_TYPE, componentType.name());
}
- Either<List<GraphVertex>, TitanOperationStatus> getResourceRes = titanDao.getByCriteria(null, hasProperties, hasNotProperties, parseFlag);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> getResourceRes = janusGraphDao
+ .getByCriteria(null, hasProperties, hasNotProperties, parseFlag);
if (getResourceRes.isRight()) {
- TitanOperationStatus status = getResourceRes.right().value();
+ JanusGraphOperationStatus status = getResourceRes.right().value();
log.debug("failed to find resource with name {}, version {}. Status is {} ", name, version, status);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
return result;
}
return getToscaElementByOperation(getResourceRes.left().value().get(0));
boolean isAllowedToDelete = true;
for (EdgeLabelEnum edgeLabelEnum : forbiddenEdgeLabelEnums) {
- Either<Edge, TitanOperationStatus> belongingEdgeByCriteria = titanDao.getBelongingEdgeByCriteria(elementV, edgeLabelEnum, null);
+ Either<Edge, JanusGraphOperationStatus> belongingEdgeByCriteria = janusGraphDao
+ .getBelongingEdgeByCriteria(elementV, edgeLabelEnum, null);
if (belongingEdgeByCriteria.isLeft()){
log.debug("Marked element {} in use. don't delete it", elementV.getUniqueId());
isAllowedToDelete = false;
StorageOperationStatus result = null;
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Going to add component instances to component {}", containerComponent.getUniqueId());
- Either<GraphVertex, TitanOperationStatus> metadataVertex = titanDao.getVertexById(containerComponent.getUniqueId(), JsonParseFlagEnum.ParseAll);
+ Either<GraphVertex, JanusGraphOperationStatus> metadataVertex = janusGraphDao
+ .getVertexById(containerComponent.getUniqueId(), JsonParseFlagEnum.ParseAll);
if (metadataVertex.isRight()) {
- TitanOperationStatus status = metadataVertex.right().value();
- if (status == TitanOperationStatus.NOT_FOUND) {
- status = TitanOperationStatus.INVALID_ID;
+ JanusGraphOperationStatus status = metadataVertex.right().value();
+ if (status == JanusGraphOperationStatus.NOT_FOUND) {
+ status = JanusGraphOperationStatus.INVALID_ID;
}
- result = DaoStatusConverter.convertTitanStatusToStorageStatus(status);
+ result = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
}
if (result == null) {
result = nodeTemplateOperation.associateComponentInstancesToComponent(containerComponent, resourcesInstancesMap, metadataVertex.left().value(), allowDeleted);
public Either<List<InputDefinition>, StorageOperationStatus> createAndAssociateInputs(Map<String, InputDefinition> inputs, String componentId) {
- Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.NoParse);
if (getVertexEither.isRight()) {
log.debug(COULDNT_FETCH_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentId, getVertexEither.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value()));
}
public Either<List<InputDefinition>, StorageOperationStatus> addInputsToComponent(Map<String, InputDefinition> inputs, String componentId) {
- Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.NoParse);
if (getVertexEither.isRight()) {
log.debug(COULDNT_FETCH_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentId, getVertexEither.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value()));
}
log.trace("#addDataTypesToComponent - enter, componentId={}", componentId);
/* get component vertex */
- Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.NoParse);
if (getVertexEither.isRight()) {
/* not found / error */
log.debug(COULDNT_FETCH_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentId, getVertexEither.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value()));
}
GraphVertex vertex = getVertexEither.left().value();
log.trace("#addDataTypesToComponent - get vertex ok");
public Either<List<InputDefinition>, StorageOperationStatus> getComponentInputs(String componentId) {
- Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.NoParse);
if (getVertexEither.isRight()) {
log.debug("Couldn't fetch component with and unique id {}, error: {}", componentId, getVertexEither.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value()));
}
public Either<List<InputDefinition>, StorageOperationStatus> updateInputsToComponent(List<InputDefinition> inputs, String componentId) {
- Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.NoParse);
if (getVertexEither.isRight()) {
log.debug(COULDNT_FETCH_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentId, getVertexEither.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value()));
}
// region - ComponentInstance
public Either<Map<String, List<ComponentInstanceProperty>>, StorageOperationStatus> associateComponentInstancePropertiesToComponent(Map<String, List<ComponentInstanceProperty>> instProperties, String componentId) {
- Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.NoParse);
if (getVertexEither.isRight()) {
log.debug(COULDNT_FETCH_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentId, getVertexEither.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value()));
}
public Either<Map<String, List<ComponentInstanceInput>>, StorageOperationStatus> associateComponentInstanceInputsToComponent(Map<String, List<ComponentInstanceInput>> instInputs, String componentId) {
- Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.NoParse);
if (getVertexEither.isRight()) {
log.debug(COULDNT_FETCH_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentId, getVertexEither.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value()));
}
GraphVertex vertex = getVertexEither.left().value();
public StorageOperationStatus associateDeploymentArtifactsToInstances(Map<String, Map<String, ArtifactDefinition>> instDeploymentArtifacts, String componentId, User user) {
- Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.NoParse);
if (getVertexEither.isRight()) {
log.debug(COULDNT_FETCH_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentId, getVertexEither.right().value());
- return DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value());
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value());
}
public StorageOperationStatus associateArtifactsToInstances(Map<String, Map<String, ArtifactDefinition>> instArtifacts, String componentId) {
- Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.NoParse);
if (getVertexEither.isRight()) {
log.debug(COULDNT_FETCH_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentId, getVertexEither.right().value());
- return DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value());
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value());
}
public StorageOperationStatus associateInstAttributeToComponentToInstances(Map<String, List<PropertyDefinition>> instArttributes, String componentId) {
- Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.NoParse);
if (getVertexEither.isRight()) {
log.debug(COULDNT_FETCH_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentId, getVertexEither.right().value());
- return DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value());
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value());
}
// endregion
public StorageOperationStatus associateOrAddCalculatedCapReq(Map<ComponentInstance, Map<String, List<CapabilityDefinition>>> instCapabilties, Map<ComponentInstance, Map<String, List<RequirementDefinition>>> instReg, String componentId) {
- Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.NoParse);
if (getVertexEither.isRight()) {
log.debug(COULDNT_FETCH_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentId, getVertexEither.right().value());
- return DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value());
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value());
}
Map<GraphPropertyEnum, Object> hasProps = new EnumMap<>(GraphPropertyEnum.class);
Map<GraphPropertyEnum, Object> hasNotProps = new EnumMap<>(GraphPropertyEnum.class);
fillPropsMap(hasProps, hasNotProps, internalComponentType, componentTypeEnum, isAbstract, vertexType);
- Either<List<GraphVertex>, TitanOperationStatus> getRes = titanDao.getByCriteria(vertexType, hasProps, hasNotProps, JsonParseFlagEnum.ParseMetadata);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> getRes = janusGraphDao
+ .getByCriteria(vertexType, hasProps, hasNotProps, JsonParseFlagEnum.ParseMetadata);
if (getRes.isRight()) {
- if (getRes.right().value().equals(TitanOperationStatus.NOT_FOUND)) {
+ if (getRes.right().value().equals(JanusGraphOperationStatus.NOT_FOUND)) {
return Either.left(new ArrayList<>());
} else {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getRes.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getRes.right().value()));
}
}
// region -> Fetch non checked-out services
propertiesNotToMatch.put(GraphPropertyEnum.IS_DELETED, true);
propertiesNotToMatch.put(GraphPropertyEnum.IS_ARCHIVED, true); //US382674, US382683
- Either<List<GraphVertex>, TitanOperationStatus> getRes = titanDao.getByCriteria(null, hasProperties, propertiesNotToMatch, parseFlag);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> getRes = janusGraphDao
+ .getByCriteria(null, hasProperties, propertiesNotToMatch, parseFlag);
if (getRes.isRight()) {
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getRes.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getRes.right().value()));
} else {
List<ComponentMetadataData> latestVersionList = getRes.left().value().stream().map(ModelConverter::convertToComponentMetadata).collect(Collectors.toList());
ComponentMetadataData latestVersion = latestVersionList.size() == 1 ? latestVersionList.get(0)
public Either<ComponentMetadataData, StorageOperationStatus> getComponentMetadata(String componentId) {
Either<ComponentMetadataData, StorageOperationStatus> result;
- Either<GraphVertex, TitanOperationStatus> getRes = titanDao.getVertexById(componentId, JsonParseFlagEnum.ParseMetadata);
+ Either<GraphVertex, JanusGraphOperationStatus> getRes = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.ParseMetadata);
if (getRes.isRight()) {
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getRes.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getRes.right().value()));
} else {
ComponentMetadataData componentMetadata = ModelConverter.convertToComponentMetadata(getRes.left().value());
result = Either.left(componentMetadata);
properties.put(GraphPropertyEnum.NORMALIZED_NAME, normalizedName);
properties.put(GraphPropertyEnum.COMPONENT_TYPE, componentType.name());
- Either<List<GraphVertex>, TitanOperationStatus> vertexEither = titanDao.getByCriteria(vertexType, properties, JsonParseFlagEnum.NoParse);
- if (vertexEither.isRight() && vertexEither.right().value() != TitanOperationStatus.NOT_FOUND) {
+ Either<List<GraphVertex>, JanusGraphOperationStatus> vertexEither = janusGraphDao
+ .getByCriteria(vertexType, properties, JsonParseFlagEnum.NoParse);
+ if (vertexEither.isRight() && vertexEither.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
log.debug("failed to get vertex from graph with property normalizedName: {}", normalizedName);
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(vertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(vertexEither.right().value()));
}
List<GraphVertex> vertexList = vertexEither.isLeft() ? vertexEither.left().value() : null;
if (vertexList != null && !vertexList.isEmpty()) {
Map<GraphPropertyEnum, Object> propertiesNotToMatch = new EnumMap<>(GraphPropertyEnum.class);
propertiesNotToMatch.put(GraphPropertyEnum.IS_DELETED, true);
- Either<List<GraphVertex>, TitanOperationStatus> vertexEither = titanDao.getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> vertexEither = janusGraphDao
+ .getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll);
if (vertexEither.isRight()) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(vertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(vertexEither.right().value()));
}
List<GraphVertex> vertexList = vertexEither.isLeft() ? vertexEither.left().value() : null;
propertiesNotToMatch.put(GraphPropertyEnum.IS_DELETED, true);
propertiesNotToMatch.put(GraphPropertyEnum.IS_ARCHIVED, true); //US382674, US382683
- Either<List<GraphVertex>, TitanOperationStatus> vertexEither = titanDao.getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> vertexEither = janusGraphDao
+ .getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll);
if (vertexEither.isRight()) {
log.debug("Couldn't fetch metadata for component with uuid {}, error: {}", componentUuid, vertexEither.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(vertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(vertexEither.right().value()));
}
List<GraphVertex> vertexList = vertexEither.isLeft() ? vertexEither.left().value() : null;
propertiesToMatch.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.RESOURCE.name());
propertiesNotToMatch.put(GraphPropertyEnum.IS_DELETED, true);
- Either<List<GraphVertex>, TitanOperationStatus> getResourcesRes = titanDao.getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> getResourcesRes = janusGraphDao
+ .getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll);
if (getResourcesRes.isRight()) {
log.debug("Failed to fetch all certified resources. Status is {}", getResourcesRes.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getResourcesRes.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getResourcesRes.right().value()));
}
List<GraphVertex> resourceVerticies = getResourcesRes.left().value();
for (GraphVertex resourceV : resourceVerticies) {
hasNotProperties.put(GraphPropertyEnum.IS_DELETED, true);
- Either<List<GraphVertex>, TitanOperationStatus> getResourceRes = titanDao.getByCriteria(null, hasProperties, hasNotProperties, parseFlag);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> getResourceRes = janusGraphDao
+ .getByCriteria(null, hasProperties, hasNotProperties, parseFlag);
if (getResourceRes.isRight()) {
- TitanOperationStatus status = getResourceRes.right().value();
+ JanusGraphOperationStatus status = getResourceRes.right().value();
log.debug("failed to find resource with name {}, version {}. Status is {} ", name, version, status);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
return result;
}
return getToscaElementByOperation(getResourceRes.left().value().get(0));
GraphVertex resourceMetadataData = null;
List<GraphVertex> resourceMetadataDataList = null;
- Either<List<GraphVertex>, TitanOperationStatus> byCsar = titanDao.getByCriteria(null, props, propsHasNot, JsonParseFlagEnum.ParseMetadata);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> byCsar = janusGraphDao
+ .getByCriteria(null, props, propsHasNot, JsonParseFlagEnum.ParseMetadata);
if (byCsar.isRight()) {
- if (TitanOperationStatus.NOT_FOUND == byCsar.right().value()) {
+ if (JanusGraphOperationStatus.NOT_FOUND == byCsar.right().value()) {
// Fix Defect DE256036
if (StringUtils.isEmpty(systemName)) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(TitanOperationStatus.NOT_FOUND));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(
+ JanusGraphOperationStatus.NOT_FOUND));
}
props.clear();
props.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true);
props.put(GraphPropertyEnum.SYSTEM_NAME, systemName);
- Either<List<GraphVertex>, TitanOperationStatus> bySystemname = titanDao.getByCriteria(null, props, JsonParseFlagEnum.ParseMetadata);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> bySystemname = janusGraphDao
+ .getByCriteria(null, props, JsonParseFlagEnum.ParseMetadata);
if (bySystemname.isRight()) {
log.debug("getLatestResourceByCsarOrName - Failed to find by system name {} error {} ", systemName, bySystemname.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(bySystemname.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(bySystemname.right().value()));
}
if (bySystemname.left().value().size() > 2) {
log.debug("getLatestResourceByCsarOrName - getByCriteria(by system name) must return only 2 latest version, but was returned - {}", bySystemname.left().value().size());
props.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true);
Map<GraphPropertyEnum, Object> propsHasNotToMatch = new EnumMap<>(GraphPropertyEnum.class);
propsHasNotToMatch.put(GraphPropertyEnum.IS_DELETED, true);
- Either<List<GraphVertex>, TitanOperationStatus> resourcesByTypeEither = titanDao.getByCriteria(null, props, propsHasNotToMatch, JsonParseFlagEnum.ParseMetadata);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> resourcesByTypeEither = janusGraphDao
+ .getByCriteria(null, props, propsHasNotToMatch, JsonParseFlagEnum.ParseMetadata);
if (resourcesByTypeEither.isRight()) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(resourcesByTypeEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(resourcesByTypeEither.right().value()));
}
List<GraphVertex> vertexList = resourcesByTypeEither.left().value();
}
public void commit() {
- titanDao.commit();
+ janusGraphDao.commit();
}
public Either<Service, StorageOperationStatus> updateDistributionStatus(Service service, User user, DistributionStatusEnum distributionStatus) {
Either<ComponentMetadataData, StorageOperationStatus> result = null;
GraphVertex serviceVertex;
- Either<GraphVertex, TitanOperationStatus> updateRes = null;
- Either<GraphVertex, TitanOperationStatus> getRes = titanDao.getVertexById(component.getUniqueId(), JsonParseFlagEnum.ParseMetadata);
+ Either<GraphVertex, JanusGraphOperationStatus> updateRes = null;
+ Either<GraphVertex, JanusGraphOperationStatus> getRes = janusGraphDao
+ .getVertexById(component.getUniqueId(), JsonParseFlagEnum.ParseMetadata);
if (getRes.isRight()) {
- TitanOperationStatus status = getRes.right().value();
+ JanusGraphOperationStatus status = getRes.right().value();
log.error("Failed to fetch component {}. status is {}", component.getUniqueId(), status);
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
if (result == null) {
serviceVertex = getRes.left().value();
long lastUpdateDate = System.currentTimeMillis();
serviceVertex.setJsonMetadataField(JsonPresentationFields.LAST_UPDATE_DATE, lastUpdateDate);
component.setLastUpdateDate(lastUpdateDate);
- updateRes = titanDao.updateVertex(serviceVertex);
+ updateRes = janusGraphDao.updateVertex(serviceVertex);
if (updateRes.isRight()) {
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(updateRes.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(updateRes.right().value()));
}
}
if (result == null) {
return result;
}
- public HealingTitanDao getTitanDao() {
- return titanDao;
+ public HealingJanusGraphDao getJanusGraphDao() {
+ return janusGraphDao;
}
public Either<List<Service>, StorageOperationStatus> getCertifiedServicesWithDistStatus(Set<DistributionStatusEnum> distStatus) {
}
private Either<List<Service>, StorageOperationStatus> fetchServicesByCriteria(List<Service> servicesAll, Map<GraphPropertyEnum, Object> propertiesToMatch, Map<GraphPropertyEnum, Object> propertiesNotToMatch) {
- Either<List<GraphVertex>, TitanOperationStatus> getRes = titanDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> getRes = janusGraphDao
+ .getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll);
if (getRes.isRight()) {
- if (getRes.right().value() != TitanOperationStatus.NOT_FOUND) {
+ if (getRes.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to fetch certified services by match properties {} not match properties {} . Status is {}. ", propertiesToMatch, propertiesNotToMatch, getRes.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getRes.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getRes.right().value()));
}
} else {
for (GraphVertex vertex : getRes.left().value()) {
}
public void rollback() {
- titanDao.rollback();
+ janusGraphDao.rollback();
}
public StorageOperationStatus addDeploymentArtifactsToInstance(String componentId, ComponentInstance componentInstance, Map<String, ArtifactDefinition> finalDeploymentArtifacts) {
public Either<Component, StorageOperationStatus> shouldUpgradeToLatestDerived(Resource clonedResource) {
String componentId = clonedResource.getUniqueId();
- Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.NoParse);
if (getVertexEither.isRight()) {
log.debug(COULDNT_FETCH_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentId, getVertexEither.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value()));
}
GraphVertex nodeTypeV = getVertexEither.left().value();
Either<ToscaElement, StorageOperationStatus> shouldUpdateDerivedVersion = nodeTypeOperation.shouldUpdateDerivedVersion(toscaElementToUpdate, nodeTypeV);
if (shouldUpdateDerivedVersion.isRight() && StorageOperationStatus.OK != shouldUpdateDerivedVersion.right().value()) {
log.debug("Failed to update derived version for node type {} derived {}, error: {}", componentId, clonedResource.getDerivedFrom().get(0), shouldUpdateDerivedVersion.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value()));
}
if (shouldUpdateDerivedVersion.isLeft()) {
return Either.left(ModelConverter.convertFromToscaElement(shouldUpdateDerivedVersion.left().value()));
public Either<PolicyDefinition, StorageOperationStatus> associatePolicyToComponent(String componentId, PolicyDefinition policyDefinition, int counter) {
Either<PolicyDefinition, StorageOperationStatus> result = null;
- Either<GraphVertex, TitanOperationStatus> getVertexEither;
- getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.ParseMetadata);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither;
+ getVertexEither = janusGraphDao.getVertexById(componentId, JsonParseFlagEnum.ParseMetadata);
if (getVertexEither.isRight()) {
log.error(COULDNT_FETCH_A_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentId, getVertexEither.right().value());
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value()));
} else {
if (getVertexEither.left().value().getLabel() != VertexTypeEnum.TOPOLOGY_TEMPLATE) {
log.error("Policy association to component of Tosca type {} is not allowed. ", getVertexEither.left().value().getLabel());
public StorageOperationStatus associatePoliciesToComponent(String componentId, List<PolicyDefinition> policies) {
log.debug("#associatePoliciesToComponent - associating policies for component {}.", componentId);
- return titanDao.getVertexById(componentId, JsonParseFlagEnum.ParseMetadata)
+ return janusGraphDao.getVertexById(componentId, JsonParseFlagEnum.ParseMetadata)
.either(containerVertex -> topologyTemplateOperation.addPoliciesToToscaElement(containerVertex, policies),
- DaoStatusConverter::convertTitanStatusToStorageStatus);
+ DaoStatusConverter::convertJanusGraphStatusToStorageStatus);
}
public Either<PolicyDefinition, StorageOperationStatus> updatePolicyOfComponent(String componentId, PolicyDefinition policyDefinition) {
Either<PolicyDefinition, StorageOperationStatus> result = null;
- Either<GraphVertex, TitanOperationStatus> getVertexEither;
- getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither;
+ getVertexEither = janusGraphDao.getVertexById(componentId, JsonParseFlagEnum.NoParse);
if (getVertexEither.isRight()) {
log.error(COULDNT_FETCH_A_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentId, getVertexEither.right().value());
- result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()));
+ result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value()));
}
if (result == null) {
StorageOperationStatus status = topologyTemplateOperation.updatePolicyOfToscaElement(getVertexEither.left().value(), policyDefinition);
public StorageOperationStatus updatePoliciesOfComponent(String componentId, List<PolicyDefinition> policyDefinition) {
log.debug("#updatePoliciesOfComponent - updating policies for component {}", componentId);
- return titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse)
+ return janusGraphDao.getVertexById(componentId, JsonParseFlagEnum.NoParse)
.right()
- .map(DaoStatusConverter::convertTitanStatusToStorageStatus)
+ .map(DaoStatusConverter::convertJanusGraphStatusToStorageStatus)
.either(containerVertex -> topologyTemplateOperation.updatePoliciesOfToscaElement(containerVertex, policyDefinition),
err -> err);
}
public StorageOperationStatus removePolicyFromComponent(String componentId, String policyId) {
StorageOperationStatus status = null;
- Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse);
+ Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = janusGraphDao
+ .getVertexById(componentId, JsonParseFlagEnum.NoParse);
if (getVertexEither.isRight()) {
log.error(COULDNT_FETCH_A_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentId, getVertexEither.right().value());
- status = DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value());
+ status = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value());
}
if (status == null) {
status = topologyTemplateOperation.removePolicyFromToscaElement(getVertexEither.left().value(), policyId);
}
public boolean canAddGroups(String componentId) {
- GraphVertex vertex = titanDao.getVertexById(componentId)
+ GraphVertex vertex = janusGraphDao.getVertexById(componentId)
.left()
- .on(this::onTitanError);
+ .on(this::onJanusGraphError);
return topologyTemplateOperation.hasEdgeOfType(vertex, EdgeLabelEnum.GROUPS);
}
- GraphVertex onTitanError(TitanOperationStatus toe) {
+ GraphVertex onJanusGraphError(JanusGraphOperationStatus toe) {
throw new StorageException(
- DaoStatusConverter.convertTitanStatusToStorageStatus(toe));
+ DaoStatusConverter.convertJanusGraphStatusToStorageStatus(toe));
}
public void updateNamesOfCalculatedCapabilitiesRequirements(String componentId){
public Either<Boolean, StorageOperationStatus> isComponentInUse(String componentId) {
final List<EdgeLabelEnum> forbiddenEdgeLabelEnums = Arrays.asList(EdgeLabelEnum.INSTANCE_OF, EdgeLabelEnum.PROXY_OF, EdgeLabelEnum.ALLOTTED_OF);
- Either<GraphVertex, TitanOperationStatus> vertexById = titanDao.getVertexById(componentId);
+ Either<GraphVertex, JanusGraphOperationStatus> vertexById = janusGraphDao.getVertexById(componentId);
if (vertexById.isLeft()) {
for (EdgeLabelEnum edgeLabelEnum : forbiddenEdgeLabelEnums) {
Iterator<Edge> edgeItr = vertexById.left().value().getVertex().edges(Direction.IN, edgeLabelEnum.name());
}
propertiesToMatch.put(GraphPropertyEnum.INVARIANT_UUID, componentInvariantUuid);
- Either<List<GraphVertex>, TitanOperationStatus> vertexEither = titanDao.getByCriteria(null, propertiesToMatch, JsonParseFlagEnum.ParseMetadata);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> vertexEither = janusGraphDao
+ .getByCriteria(null, propertiesToMatch, JsonParseFlagEnum.ParseMetadata);
if (vertexEither.isRight()) {
log.debug("Couldn't fetch metadata for component with type {} and invariantUUId {}, error: {}", componentInvariantUuid, vertexEither.right().value());
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(vertexEither.right().value()));
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(vertexEither.right().value()));
}
List<GraphVertex> vertexList = vertexEither.isLeft() ? vertexEither.left().value() : null;
public Either<List<Component>, StorageOperationStatus> getParentComponents(String componentId) {
List<Component> parentComponents = new ArrayList<>();
final List<EdgeLabelEnum> relationEdgeLabelEnums = Arrays.asList(EdgeLabelEnum.INSTANCE_OF, EdgeLabelEnum.PROXY_OF);
- Either<GraphVertex, TitanOperationStatus> vertexById = titanDao.getVertexById(componentId);
+ Either<GraphVertex, JanusGraphOperationStatus> vertexById = janusGraphDao.getVertexById(componentId);
if (vertexById.isLeft()) {
for (EdgeLabelEnum edgeLabelEnum : relationEdgeLabelEnums) {
- Either<GraphVertex, TitanOperationStatus> parentVertexEither = titanDao.getParentVertex(vertexById.left().value(), edgeLabelEnum, JsonParseFlagEnum.ParseJson);
+ Either<GraphVertex, JanusGraphOperationStatus> parentVertexEither = janusGraphDao
+ .getParentVertex(vertexById.left().value(), edgeLabelEnum, JsonParseFlagEnum.ParseJson);
if(parentVertexEither.isLeft()){
Either<Component, StorageOperationStatus> componentEither = getToscaElement(parentVertexEither.left().value().getUniqueId());
if(componentEither.isLeft()){