-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import fj.data.Either;
import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-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.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.MapComponentInstanceExternalRefs;
-import org.openecomp.sdc.be.model.jsontitan.utils.IdMapper;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.IdMapper;
import org.openecomp.sdc.be.model.operations.impl.OperationUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* Constructor
*/
- public ExternalReferencesOperation(TitanDao titanDao, NodeTypeOperation nto, TopologyTemplateOperation tto, IdMapper idMapper){
- this.titanDao = titanDao;
+ public ExternalReferencesOperation(JanusGraphDao janusGraphDao, NodeTypeOperation nto, TopologyTemplateOperation tto, IdMapper idMapper){
+ this.janusGraphDao = janusGraphDao;
this.topologyTemplateOperation = tto;
this.nodeTypeOperation = nto;
this.idMapper = idMapper;
public Either<String, ActionStatus> addExternalReferenceWithCommit(String serviceUuid, String componentInstanceName, String objectType, String reference) {
Either<String, ActionStatus> addResult = addExternalReference(serviceUuid, componentInstanceName, objectType, reference);
- titanDao.commit();
+ janusGraphDao.commit();
return addResult;
}
public Either<String, ActionStatus> deleteExternalReferenceWithCommit(String serviceUuid, String componentInstanceName, String objectType, String reference) {
Either<String, ActionStatus> result = deleteExternalReference(serviceUuid, componentInstanceName, objectType, reference);
- titanDao.commit();
+ janusGraphDao.commit();
return result;
}
public Either<String, ActionStatus> updateExternalReferenceWithCommit(String serviceVertexUuid, String componentInstanceName, String objectType, String oldRef, String newRef) {
Either<String, ActionStatus> updateResult = updateExternalReference(serviceVertexUuid, componentInstanceName, objectType, oldRef, newRef);
- titanDao.commit();
+ janusGraphDao.commit();
return updateResult;
}
public Either<String, ActionStatus> addExternalReference(String assetUuid, String componentInstanceName, String objectType, String reference) {
//Get Container vertex
- Either<GraphVertex, TitanOperationStatus> vertexById = titanDao.getVertexById(assetUuid);
+ Either<GraphVertex, JanusGraphOperationStatus> vertexById = janusGraphDao.getVertexById(assetUuid);
if (vertexById.isRight()){
return Either.right(ActionStatus.RESOURCE_NOT_FOUND);
}
}
//Get the external references map vertex
- final Either<GraphVertex, TitanOperationStatus> dataVertexResult = getDataVertex(serviceVertex, EdgeLabelEnum.EXTERNAL_REFS);
+ final Either<GraphVertex, JanusGraphOperationStatus> dataVertexResult = getDataVertex(serviceVertex, EdgeLabelEnum.EXTERNAL_REFS);
//Check whether data vertex found
GraphVertex externalRefsVertex = dataVertexResult.isLeft() ? dataVertexResult.left().value() : null;
public Either<String, ActionStatus> deleteExternalReference(String assetUuid, String componentInstanceName, String objectType, String reference){
//Get Service vertex
- Either<GraphVertex, TitanOperationStatus> vertexById = titanDao.getVertexById(assetUuid);
+ Either<GraphVertex, JanusGraphOperationStatus> vertexById = janusGraphDao.getVertexById(assetUuid);
if (vertexById.isRight()){
return Either.right(ActionStatus.RESOURCE_NOT_FOUND);
}
}
//Get the external references map vertex
- final Either<GraphVertex, TitanOperationStatus> dataVertexResult = getDataVertex(serviceVertex, EdgeLabelEnum.EXTERNAL_REFS);
+ final Either<GraphVertex, JanusGraphOperationStatus> dataVertexResult = getDataVertex(serviceVertex, EdgeLabelEnum.EXTERNAL_REFS);
//Check whether data vertex found
GraphVertex externalRefsVertex = dataVertexResult.isLeft() ? dataVertexResult.left().value() : null;
public Either<String, ActionStatus> updateExternalReference(String assetUuid, String componentInstanceName, String objectType, String oldRef, String newRef) {
//Get Service vertex
- Either<GraphVertex, TitanOperationStatus> vertexById = titanDao.getVertexById(assetUuid);
+ Either<GraphVertex, JanusGraphOperationStatus> vertexById = janusGraphDao.getVertexById(assetUuid);
if (vertexById.isRight()){
return Either.right(ActionStatus.RESOURCE_NOT_FOUND);
}
}
//Get the external references map vertex
- final Either<GraphVertex, TitanOperationStatus> dataVertexResult = getDataVertex(serviceVertex, EdgeLabelEnum.EXTERNAL_REFS);
+ final Either<GraphVertex, JanusGraphOperationStatus> dataVertexResult = getDataVertex(serviceVertex, EdgeLabelEnum.EXTERNAL_REFS);
//Check whether data vertex found
GraphVertex externalRefsVertex = dataVertexResult.isLeft() ? dataVertexResult.left().value() : null;
public Either<Map<String, List<String>>, ActionStatus> getExternalReferences(String assetUuid, String objectType) {
//Get Service vertex
- Either<GraphVertex, TitanOperationStatus> vertexById = titanDao.getVertexById(assetUuid);
+ Either<GraphVertex, JanusGraphOperationStatus> vertexById = janusGraphDao.getVertexById(assetUuid);
if (vertexById.isRight()){
return Either.right(ActionStatus.RESOURCE_NOT_FOUND);
}
Map<String, List<String>> result = new HashMap();
//Get the external references map vertex
- final Either<GraphVertex, TitanOperationStatus> dataVertexResult = getDataVertex(serviceVertex, EdgeLabelEnum.EXTERNAL_REFS);
+ final Either<GraphVertex, JanusGraphOperationStatus> dataVertexResult = getDataVertex(serviceVertex, EdgeLabelEnum.EXTERNAL_REFS);
//Check whether data vertex found
GraphVertex externalRefsVertex = dataVertexResult.isLeft() ? dataVertexResult.left().value() : null;
if (externalRefsVertex != null) {
String compInstanceUniqueId,
Map<String, List<String>> instanceExternalReferences) {
- GraphVertex serviceVertex = titanDao.getVertexById(containerUniqueId)
+ GraphVertex serviceVertex = janusGraphDao.getVertexById(containerUniqueId)
.left()
- .on(operationUtils::onTitanOperationFailure);
- Either<GraphVertex, TitanOperationStatus> dataVertex = getDataVertex(serviceVertex, EdgeLabelEnum.EXTERNAL_REFS);
+ .on(operationUtils::onJanusGraphOperationFailure);
+ Either<GraphVertex, JanusGraphOperationStatus> dataVertex = getDataVertex(serviceVertex, EdgeLabelEnum.EXTERNAL_REFS);
Map<String, MapComponentInstanceExternalRefs> externalReferencesFullData;
if (dataVertex.isLeft()) {
externalReferencesFullData = (Map<String, MapComponentInstanceExternalRefs>) dataVertex.left().value().getJson();
public Map<String, List<String>> getAllExternalReferences(String containerUniqueId,
String compInstanceUniqueId) {
- GraphVertex serviceVertex = titanDao.getVertexById(containerUniqueId)
+ GraphVertex serviceVertex = janusGraphDao.getVertexById(containerUniqueId)
.left()
- .on(operationUtils::onTitanOperationFailure);
+ .on(operationUtils::onJanusGraphOperationFailure);
- Either<GraphVertex, TitanOperationStatus> dataVertex = getDataVertex(serviceVertex, EdgeLabelEnum.EXTERNAL_REFS);
+ Either<GraphVertex, JanusGraphOperationStatus> dataVertex = getDataVertex(serviceVertex, EdgeLabelEnum.EXTERNAL_REFS);
if (dataVertex.isRight()) {
return new HashMap<>();
}
public Either<List<String>, ActionStatus> getExternalReferences(String assetUuid, String componentInstanceName, String objectType) {
//Get Service vertex
- Either<GraphVertex, TitanOperationStatus> vertexById = titanDao.getVertexById(assetUuid);
+ Either<GraphVertex, JanusGraphOperationStatus> vertexById = janusGraphDao.getVertexById(assetUuid);
if (vertexById.isRight()){
return Either.right(ActionStatus.RESOURCE_NOT_FOUND);
}
}
//Get the external references map vertex
- final Either<GraphVertex, TitanOperationStatus> dataVertexResult = getDataVertex(serviceVertex, EdgeLabelEnum.EXTERNAL_REFS);
+ final Either<GraphVertex, JanusGraphOperationStatus> dataVertexResult = getDataVertex(serviceVertex, EdgeLabelEnum.EXTERNAL_REFS);
//Check whether data vertex found
GraphVertex externalRefsVertex = dataVertexResult.isLeft() ? dataVertexResult.left().value() : null;