- Either<List<GraphVertex>, JanusGraphOperationStatus> getComponentsRes = janusGraphDao
- .getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll);
- if (getComponentsRes.isRight()) {
- JanusGraphOperationStatus status = getComponentsRes.right().value();
- log.debug("Failed to fetch the component with system name {}. Status is {} ", systemName, status);
- result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
- }
- if (result == null) {
- componentVertices = getComponentsRes.left().value();
- for (GraphVertex componentVertex : componentVertices) {
- getComponentRes = getToscaElementByOperation(componentVertex);
- if (getComponentRes.isRight()) {
- log.debug("Failed to get the component {}. Status is {} ", componentVertex.getJsonMetadataField(JsonPresentationFields.NAME),
- getComponentRes.right().value());
- result = Either.right(getComponentRes.right().value());
- break;
- }
- T componentBySystemName = getComponentRes.left().value();
- log.debug("Found component, id: {}", componentBySystemName.getUniqueId());
- components.add(componentBySystemName);
- }
- }
- if (result == null) {
- result = Either.left(components);
+
+ final Either<List<GraphVertex>, JanusGraphOperationStatus> getResourceResult
+ = janusGraphDao.getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll);
+ if (getResourceResult.isRight()) {
+ final JanusGraphOperationStatus status = getResourceResult.right().value();
+ log.debug("Failed to find resource with systemName {}, version {}. Status is {} ", systemName, version, status);
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));