aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-action-lib
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-action-lib')
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/Action.java5
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionArtifactDaoFactoryImpl.java4
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionArtifactDaoImpl.java2
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoFactoryImpl.java4
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoImpl.java882
5 files changed, 449 insertions, 448 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/Action.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/Action.java
index 0acd051004..b7d5568c8c 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/Action.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/Action.java
@@ -261,11 +261,8 @@ public class Action implements Comparable {
if (!version.equals(action.version)) {
return false;
}
- if (!name.equals(action.name)) {
- return false;
- }
- return true;
+ return name.equals(action.name);
}
@Override
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionArtifactDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionArtifactDaoFactoryImpl.java
index 51f3cac607..5c308e7f64 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionArtifactDaoFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionArtifactDaoFactoryImpl.java
@@ -25,10 +25,10 @@ import org.openecomp.sdc.action.dao.ActionArtifactDaoFactory;
public class ActionArtifactDaoFactoryImpl extends ActionArtifactDaoFactory {
- private static ActionArtifactDao INSTANCE = new ActionArtifactDaoImpl();
+ private static ActionArtifactDao instance = new ActionArtifactDaoImpl();
@Override
public ActionArtifactDao createInterface() {
- return INSTANCE;
+ return instance;
}
}
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionArtifactDaoImpl.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionArtifactDaoImpl.java
index 06ebd6c9e0..efac856788 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionArtifactDaoImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionArtifactDaoImpl.java
@@ -53,7 +53,7 @@ public class ActionArtifactDaoImpl extends CassandraBaseDao<ActionArtifactEntity
noSqlDb.getMappingManager().mapper(ActionArtifactEntity.class);
private static ActionArtifactAccessor accessor =
noSqlDb.getMappingManager().createAccessor(ActionArtifactAccessor.class);
- private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
+ private final Logger log = LoggerFactory.getLogger(this.getClass().getName());
@Override
protected Mapper<ActionArtifactEntity> getMapper() {
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoFactoryImpl.java
index 7ecda7844d..72279d41fd 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoFactoryImpl.java
@@ -25,10 +25,10 @@ import org.openecomp.sdc.action.dao.ActionDaoFactory;
public class ActionDaoFactoryImpl extends ActionDaoFactory {
- private static ActionDao INSTANCE = new ActionDaoImpl();
+ private static ActionDao instance = new ActionDaoImpl();
@Override
public ActionDao createInterface() {
- return INSTANCE;
+ return instance;
}
}
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoImpl.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoImpl.java
index 5320b5d5c5..4562606339 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoImpl.java
@@ -88,478 +88,482 @@ import org.openecomp.sdc.versioning.dao.types.VersionInfoEntity;
import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
import org.slf4j.MDC;
-
public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements ActionDao {
- private static NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static Mapper<ActionEntity> mapper =
- noSqlDb.getMappingManager().mapper(ActionEntity.class);
- private static ActionAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(ActionAccessor.class);
- private static VersionInfoDao versionInfoDao =
- VersionInfoDaoFactory.getInstance().createInterface();
- private static VersionInfoDeletedDao versionInfoDeletedDao =
- VersionInfoDeletedDaoFactory.getInstance().createInterface();
-
- private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
-
- @Override
- public void registerVersioning(String versionableEntityType) {
- ActionVersioningManagerFactory.getInstance().createInterface()
- .register(versionableEntityType, new VersionableEntityMetadata(
- mapper.getTableMetadata().getName(),
- mapper.getTableMetadata().getPartitionKey().get(0).getName(),
- mapper.getTableMetadata().getPartitionKey().get(1).getName()));
- }
-
- @Override
- public Action createAction(Action action) {
- try {
- ActionUtil.actionLogPreProcessor(ActionSubOperation.CREATE_ACTION_ENTITY, TARGET_ENTITY_DB);
- this.create(action.toEntity());
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
- log.metrics("");
- return action;
- } catch (NoHostAvailableException exception) {
- logGenericException(exception);
- throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE,
- ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
+ private static final String FOR_VERSIONS = " for versions ";
+ private static final String VERSION = "version";
+ private static final String ACTION = "Action";
+ private static NoSqlDb noSqlDb = NoSqlDbFactory.getInstance()
+ .createInterface();
+ private static Mapper<ActionEntity> mapper = noSqlDb.getMappingManager()
+ .mapper(ActionEntity.class);
+ private static ActionAccessor accessor = noSqlDb.getMappingManager()
+ .createAccessor(ActionAccessor.class);
+ private static VersionInfoDao versionInfoDao = VersionInfoDaoFactory.getInstance()
+ .createInterface();
+ private static VersionInfoDeletedDao versionInfoDeletedDao = VersionInfoDeletedDaoFactory.getInstance()
+ .createInterface();
+
+ private final Logger log = LoggerFactory.getLogger(this.getClass()
+ .getName());
+
+ @Override
+ public void registerVersioning(String versionableEntityType) {
+ ActionVersioningManagerFactory.getInstance()
+ .createInterface()
+ .register(versionableEntityType, new VersionableEntityMetadata(mapper.getTableMetadata()
+ .getName(),
+ mapper.getTableMetadata()
+ .getPartitionKey()
+ .get(0)
+ .getName(),
+ mapper.getTableMetadata()
+ .getPartitionKey()
+ .get(1)
+ .getName()));
}
- }
-
- @Override
- public Action updateAction(Action action) {
- try {
- log.debug(" entering updateAction with actionUUID= " + action.getActionUuId());
- ActionUtil.actionLogPreProcessor(ActionSubOperation.UPDATE_ACTION, TARGET_ENTITY_DB);
- this.update(action.toEntity());
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
- log.metrics("");
- log.debug(" exit updateAction with actionUUID= " + action.getActionUuId());
- return action;
- } catch (NoHostAvailableException exception) {
- logGenericException(exception);
- throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE,
- ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
+
+ @Override
+ public Action createAction(Action action) {
+ try {
+ ActionUtil.actionLogPreProcessor(ActionSubOperation.CREATE_ACTION_ENTITY, TARGET_ENTITY_DB);
+ this.create(action.toEntity());
+ ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
+ log.metrics("");
+ return action;
+ } catch (NoHostAvailableException exception) {
+ logGenericException(exception);
+ throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE, ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
+ }
}
- }
-
- @Override
- public void deleteAction(String actionInvariantUuId) {
- try {
- log.debug("entering deleteAction with actionInvariantUuId = " + actionInvariantUuId);
- ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION, TARGET_ENTITY_DB);
- VersionInfoDeletedEntity activeVersionEntity = versionInfoDeletedDao.get(
- new VersionInfoDeletedEntity(ActionConstants.ACTION_VERSIONABLE_TYPE,
- actionInvariantUuId));
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
- log.metrics("");
-
- Version activeVersion = activeVersionEntity.getActiveVersion();
- Statement getNameFromInvUuId = QueryBuilder.select().column("name").from("dox", "Action")
- .where(eq("actioninvariantuuid", actionInvariantUuId))
- .and(in("version", activeVersion));
- ActionUtil
- .actionLogPreProcessor(ActionSubOperation.GET_NAME_BY_ACTIONINVID, TARGET_ENTITY_DB);
- ResultSet results = getSession().execute(getNameFromInvUuId);
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
- log.metrics("");
-
- if (!results.isExhausted()) {
- String name = results.one().getString("name");
- List<Version> versions = getVersionsByName(name);
- updateActionStatusForDelete(actionInvariantUuId, versions);
- }
- } catch (NoHostAvailableException noHostAvailableException) {
- logGenericException(noHostAvailableException);
- throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE,
- ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
+
+ @Override
+ public Action updateAction(Action action) {
+ try {
+ log.debug(" entering updateAction with actionUUID= " + action.getActionUuId());
+ ActionUtil.actionLogPreProcessor(ActionSubOperation.UPDATE_ACTION, TARGET_ENTITY_DB);
+ this.update(action.toEntity());
+ ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
+ log.metrics("");
+ log.debug(" exit updateAction with actionUUID= " + action.getActionUuId());
+ return action;
+ } catch (NoHostAvailableException exception) {
+ logGenericException(exception);
+ throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE, ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
+ }
}
- log.debug("exit deleteAction");
- }
-
- @Override
- public List<Action> getFilteredActions(String filterType, String filterId) {
- List<Action> actions = new ArrayList<>();
- Result<ActionEntity> result = null;
- log.debug(
- " entering getFilteredActions By filterType = " + filterType + " With value = " + filterId);
- try {
- switch (filterType) {
- case FILTER_TYPE_VENDOR:
- ActionUtil
- .actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_VENDOR,
- TARGET_ENTITY_DB);
- result = accessor.getActionsByVendor(filterId);
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
- log.metrics("");
- break;
- case FILTER_TYPE_CATEGORY:
- ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_CATEGORY,
- TARGET_ENTITY_DB);
- result = accessor.getActionsByCategory(filterId);
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
- log.metrics("");
- break;
- case FILTER_TYPE_MODEL:
- ActionUtil
- .actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_MODEL,
- TARGET_ENTITY_DB);
- result = accessor.getActionsByModel(filterId);
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
- log.metrics("");
- break;
- case FILTER_TYPE_OPEN_ECOMP_COMPONENT:
- ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_COMPONENT,
- TARGET_ENTITY_DB);
- result = accessor.getActionsByOpenEcompComponent(filterId);
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
- log.metrics("");
- break;
- case FILTER_TYPE_NONE:
- ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ALL_ACTIONS, TARGET_ENTITY_DB);
- result = accessor.getAllActions();
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
- log.metrics("");
- break;
- case FILTER_TYPE_NAME:
- ActionUtil
- .actionLogPreProcessor(ActionSubOperation.GET_ACTIONINVID_BY_NAME, TARGET_ENTITY_DB);
- result = accessor.getInvIdByName(filterId);
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
- log.metrics("");
- List<ActionEntity> actionEntities = result.all();
- if (actionEntities != null && !actionEntities.isEmpty()) {
- String actionInvariantUuId = actionEntities.get(0).getActionInvariantUuId();
- if (actionInvariantUuId != null) {
- return getActionsByActionInvariantUuId(actionInvariantUuId);
- } else {
- return actions;
+
+ @Override
+ public void deleteAction(String actionInvariantUuId) {
+ try {
+ log.debug("entering deleteAction with actionInvariantUuId = " + actionInvariantUuId);
+ ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION, TARGET_ENTITY_DB);
+ VersionInfoDeletedEntity activeVersionEntity = versionInfoDeletedDao
+ .get(new VersionInfoDeletedEntity(ActionConstants.ACTION_VERSIONABLE_TYPE, actionInvariantUuId));
+ ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
+ log.metrics("");
+
+ Version activeVersion = activeVersionEntity.getActiveVersion();
+ Statement getNameFromInvUuId = QueryBuilder.select()
+ .column("name")
+ .from("dox", ACTION)
+ .where(eq("actioninvariantuuid", actionInvariantUuId))
+ .and(in(VERSION, activeVersion));
+ ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_NAME_BY_ACTIONINVID, TARGET_ENTITY_DB);
+ ResultSet results = getSession().execute(getNameFromInvUuId);
+ ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
+ log.metrics("");
+
+ if (!results.isExhausted()) {
+ String name = results.one()
+ .getString("name");
+ List<Version> versions = getVersionsByName(name);
+ updateActionStatusForDelete(actionInvariantUuId, versions);
}
- }
- break;
- default:
- break;
- }
- if (result != null) {
- actions.addAll(result.all().stream().map(ActionEntity::toDto).collect(Collectors.toList()));
- }
- log.debug(
- " exit getFilteredActions By filterType = " + filterType + " With value = " + filterId);
- } catch (NoHostAvailableException noHostAvailableException) {
- logGenericException(noHostAvailableException);
- throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE,
- ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
- }
- return actions;
- }
-
- @Override
- public Action getActionsByActionUuId(String actionUuId) {
- try {
- log.debug(" entering getActionsByActionUuId with actionUUID= " + actionUuId);
- ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_ACTIONUUID,
- TARGET_ENTITY_DB);
- Result<ActionEntity> result = accessor.actionInvariantUuId(actionUuId);
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
- log.metrics("");
- if (result != null) {
- log.debug(" exit getActionsByActionUuId with actionUUID= " + actionUuId);
- ActionEntity entity = result.one();
- if (entity != null) {
- return entity.toDto();
+ } catch (NoHostAvailableException noHostAvailableException) {
+ logGenericException(noHostAvailableException);
+ throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE, ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
}
- }
- log.debug(" exit getActionsByActionUuId with actionUUID= " + actionUuId);
- return null;
- } catch (NoHostAvailableException noHostAvailableException) {
- logGenericException(noHostAvailableException);
- throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE,
- ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
+ log.debug("exit deleteAction");
}
- }
-
- @Override
- public List<OpenEcompComponent> getOpenEcompComponents() {
- List<OpenEcompComponent> openEcompComponents = new ArrayList<>();
- Result<OpenEcompComponentEntity> result;
- try {
- log.debug(" entering getOpenEcompComponents ");
- ActionUtil
- .actionLogPreProcessor(ActionSubOperation.GET_OPEN_ECOMP_COMPONENTS_ENTITY,
- TARGET_ENTITY_DB);
- result = accessor.getOpenEcompComponents();
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
- log.metrics("");
- if (result != null) {
- openEcompComponents.addAll(
- result.all().stream().map(OpenEcompComponentEntity::toDto)
- .collect(Collectors.toList()));
- }
- } catch (NoHostAvailableException noHostAvailableException) {
- logGenericException(noHostAvailableException);
- throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE,
- ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
+
+ @Override
+ public List<Action> getFilteredActions(String filterType, String filterId) {
+ List<Action> actions = new ArrayList<>();
+ Result<ActionEntity> result = null;
+ log.debug(" entering getFilteredActions By filterType = " + filterType + " With value = " + filterId);
+ try {
+ switch (filterType) {
+ case FILTER_TYPE_VENDOR:
+ ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_VENDOR, TARGET_ENTITY_DB);
+ result = accessor.getActionsByVendor(filterId);
+ ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
+ log.metrics("");
+ break;
+ case FILTER_TYPE_CATEGORY:
+ ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_CATEGORY, TARGET_ENTITY_DB);
+ result = accessor.getActionsByCategory(filterId);
+ ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
+ log.metrics("");
+ break;
+ case FILTER_TYPE_MODEL:
+ ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_MODEL, TARGET_ENTITY_DB);
+ result = accessor.getActionsByModel(filterId);
+ ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
+ log.metrics("");
+ break;
+ case FILTER_TYPE_OPEN_ECOMP_COMPONENT:
+ ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_COMPONENT, TARGET_ENTITY_DB);
+ result = accessor.getActionsByOpenEcompComponent(filterId);
+ ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
+ log.metrics("");
+ break;
+ case FILTER_TYPE_NONE:
+ ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ALL_ACTIONS, TARGET_ENTITY_DB);
+ result = accessor.getAllActions();
+ ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
+ log.metrics("");
+ break;
+ case FILTER_TYPE_NAME:
+ ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONINVID_BY_NAME, TARGET_ENTITY_DB);
+ result = accessor.getInvIdByName(filterId);
+ ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
+ log.metrics("");
+ List<ActionEntity> actionEntities = result.all();
+ if (actionEntities != null && !actionEntities.isEmpty()) {
+ String actionInvariantUuId = actionEntities.get(0)
+ .getActionInvariantUuId();
+ if (actionInvariantUuId != null) {
+ return getActionsByActionInvariantUuId(actionInvariantUuId);
+ } else {
+ return actions;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ if (result != null) {
+ actions.addAll(result.all()
+ .stream()
+ .map(ActionEntity::toDto)
+ .collect(Collectors.toList()));
+ }
+ log.debug(" exit getFilteredActions By filterType = " + filterType + " With value = " + filterId);
+ } catch (NoHostAvailableException noHostAvailableException) {
+ logGenericException(noHostAvailableException);
+ throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE, ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
+ }
+ return actions;
}
- log.debug(" exit getOpenEcompComponents ");
- return openEcompComponents;
- }
-
- @Override
- public List<Action> getActionsByActionInvariantUuId(String actionInvariantUuId) {
- List<Action> actions = new ArrayList<Action>();
- try {
- log.debug(" entering getActionsByActionInvariantUuId with actionInvariantUuId= "
- + actionInvariantUuId);
- Set<Version> viewableVersions = new HashSet<>();
- VersionPredicate filter = new VersionPredicate();
- ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION, TARGET_ENTITY_DB);
- VersionInfoEntity versionInfoEntity = versionInfoDao
- .get(new VersionInfoEntity(ActionConstants.ACTION_VERSIONABLE_TYPE, actionInvariantUuId));
- if (versionInfoEntity == null) {
- //Check for action in the Delete version info table
- VersionInfoDeletedEntity versionInfoDeletedEntity = versionInfoDeletedDao.get(
- new VersionInfoDeletedEntity(ActionConstants.ACTION_VERSIONABLE_TYPE,
- actionInvariantUuId));
- if (versionInfoDeletedEntity != null) {
- viewableVersions = versionInfoDeletedEntity.getViewableVersions();
- //Remove intermediate minor versions from viewable versions
- if (versionInfoDeletedEntity.getActiveVersion() != null) {
- filter.activeVersion = versionInfoDeletedEntity.getActiveVersion();
- filter.finalVersion = versionInfoDeletedEntity.getLatestFinalVersion();
- viewableVersions.removeIf(filter::isIntermediateMinorVersion);
- }
+
+ @Override
+ public Action getActionsByActionUuId(String actionUuId) {
+ try {
+ log.debug(" entering getActionsByActionUuId with actionUUID= " + actionUuId);
+ ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_ACTIONUUID, TARGET_ENTITY_DB);
+ Result<ActionEntity> result = accessor.actionInvariantUuId(actionUuId);
+ ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
+ log.metrics("");
+ if (result != null) {
+ log.debug(" exit getActionsByActionUuId with actionUUID= " + actionUuId);
+ ActionEntity entity = result.one();
+ if (entity != null) {
+ return entity.toDto();
+ }
+ }
+ log.debug(" exit getActionsByActionUuId with actionUUID= " + actionUuId);
+ return null;
+ } catch (NoHostAvailableException noHostAvailableException) {
+ logGenericException(noHostAvailableException);
+ throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE, ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
}
- } else {
- viewableVersions = versionInfoEntity.getViewableVersions();
- //Remove intermediate minor versions from viewable versions
- if (versionInfoEntity.getActiveVersion() != null) {
- filter.activeVersion = versionInfoEntity.getActiveVersion();
- filter.finalVersion = versionInfoEntity.getLatestFinalVersion();
- viewableVersions.removeIf(filter::isIntermediateMinorVersion);
+ }
+
+ @Override
+ public List<OpenEcompComponent> getOpenEcompComponents() {
+ List<OpenEcompComponent> openEcompComponents = new ArrayList<>();
+ Result<OpenEcompComponentEntity> result;
+ try {
+ log.debug(" entering getOpenEcompComponents ");
+ ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_OPEN_ECOMP_COMPONENTS_ENTITY, TARGET_ENTITY_DB);
+ result = accessor.getOpenEcompComponents();
+ ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
+ log.metrics("");
+ if (result != null) {
+ openEcompComponents.addAll(result.all()
+ .stream()
+ .map(OpenEcompComponentEntity::toDto)
+ .collect(Collectors.toList()));
+ }
+ } catch (NoHostAvailableException noHostAvailableException) {
+ logGenericException(noHostAvailableException);
+ throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE, ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
}
- //Add candidate version if available
- if (versionInfoEntity.getCandidate() != null) {
- viewableVersions.add(versionInfoEntity.getCandidate().getVersion());
+ log.debug(" exit getOpenEcompComponents ");
+ return openEcompComponents;
+ }
+
+ @Override
+ public List<Action> getActionsByActionInvariantUuId(String actionInvariantUuId) {
+ List<Action> actions = new ArrayList<Action>();
+ try {
+ log.debug(" entering getActionsByActionInvariantUuId with actionInvariantUuId= " + actionInvariantUuId);
+ Set<Version> viewableVersions = new HashSet<>();
+ VersionPredicate filter = new VersionPredicate();
+ ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION, TARGET_ENTITY_DB);
+ VersionInfoEntity versionInfoEntity = versionInfoDao
+ .get(new VersionInfoEntity(ActionConstants.ACTION_VERSIONABLE_TYPE, actionInvariantUuId));
+ if (versionInfoEntity == null) {
+ // Check for action in the Delete version info table
+ VersionInfoDeletedEntity versionInfoDeletedEntity = versionInfoDeletedDao.get(
+ new VersionInfoDeletedEntity(ActionConstants.ACTION_VERSIONABLE_TYPE, actionInvariantUuId));
+ if (versionInfoDeletedEntity != null) {
+ viewableVersions = versionInfoDeletedEntity.getViewableVersions();
+ // Remove intermediate minor versions from viewable versions
+ if (versionInfoDeletedEntity.getActiveVersion() != null) {
+ filter.activeVersion = versionInfoDeletedEntity.getActiveVersion();
+ filter.finalVersion = versionInfoDeletedEntity.getLatestFinalVersion();
+ viewableVersions.removeIf(filter::isIntermediateMinorVersion);
+ }
+ }
+ } else {
+ viewableVersions = versionInfoEntity.getViewableVersions();
+ // Remove intermediate minor versions from viewable versions
+ if (versionInfoEntity.getActiveVersion() != null) {
+ filter.activeVersion = versionInfoEntity.getActiveVersion();
+ filter.finalVersion = versionInfoEntity.getLatestFinalVersion();
+ viewableVersions.removeIf(filter::isIntermediateMinorVersion);
+ }
+ // Add candidate version if available
+ if (versionInfoEntity.getCandidate() != null) {
+ viewableVersions.add(versionInfoEntity.getCandidate()
+ .getVersion());
+ }
+ }
+
+ MDC.put(TARGET_ENTITY, TARGET_ENTITY_DB);
+ ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
+ log.metrics("");
+
+ log.debug("Found " + viewableVersions + " viewable version for action with actionInvariantUuId "
+ + actionInvariantUuId);
+
+ // Fetch action data for the viewable versions
+ if (!viewableVersions.isEmpty()) {
+ ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_ACTIONINVID, TARGET_ENTITY_DB);
+ Result<ActionEntity> result = accessor.getActionsByInvId(actionInvariantUuId,
+ new ArrayList<>(viewableVersions));
+ ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
+ log.metrics("");
+ if (result != null) {
+ actions.addAll(result.all()
+ .stream()
+ .map(ActionEntity::toDto)
+ .collect(Collectors.toList()));
+ }
+ }
+ } catch (NoHostAvailableException noHostAvailableException) {
+ logGenericException(noHostAvailableException);
+ throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE, ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
}
- }
-
- MDC.put(TARGET_ENTITY, TARGET_ENTITY_DB);
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
- log.metrics("");
-
- log.debug(
- "Found " + viewableVersions + " viewable version for action with actionInvariantUuId "
- + actionInvariantUuId);
-
- //Fetch action data for the viewable versions
- if (!viewableVersions.isEmpty()) {
- ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_ACTIONINVID,
- TARGET_ENTITY_DB);
- Result<ActionEntity> result =
- accessor.getActionsByInvId(actionInvariantUuId, new ArrayList<>(viewableVersions));
+ log.debug(" exit getActionsByActionInvariantUuId with actionInvariantUuId= " + actionInvariantUuId);
+ return actions;
+ }
+
+ @Override
+ public Action getLockedAction(String actionInvariantUuId, String user) {
+ log.debug(" entering getLockedAction with actionInvariantUuId= " + actionInvariantUuId);
+ ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION, TARGET_ENTITY_DB);
+ Action action = null;
+ VersionInfoEntity versionInfoEntity = versionInfoDao
+ .get(new VersionInfoEntity(ActionConstants.ACTION_VERSIONABLE_TYPE, actionInvariantUuId));
ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
log.metrics("");
- if (result != null) {
- actions
- .addAll(result.all().stream().map(ActionEntity::toDto).collect(Collectors.toList()));
- }
- }
- } catch (NoHostAvailableException noHostAvailableException) {
- logGenericException(noHostAvailableException);
- throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE,
- ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
- }
- log.debug(
- " exit getActionsByActionInvariantUuId with actionInvariantUuId= " + actionInvariantUuId);
- return actions;
- }
-
- @Override
- public Action getLockedAction(String actionInvariantUuId, String user) throws ActionException {
- log.debug(" entering getLockedAction with actionInvariantUuId= " + actionInvariantUuId);
- ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION, TARGET_ENTITY_DB);
- Action action = null;
- VersionInfoEntity versionInfoEntity = versionInfoDao
- .get(new VersionInfoEntity(ActionConstants.ACTION_VERSIONABLE_TYPE, actionInvariantUuId));
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
- log.metrics("");
- if (versionInfoEntity != null) {
- if (versionInfoEntity.getCandidate() != null) {
- String actionUser = versionInfoEntity.getCandidate().getUser();
- if (actionUser != null && actionUser.equals(user)) {
- Set<Version> versions = new HashSet<>();
- versions.add(versionInfoEntity.getCandidate().getVersion());
- ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_ACTIONINVID,
- TARGET_ENTITY_DB);
- Result<ActionEntity> result = accessor.getActionsByInvId(actionInvariantUuId, new ArrayList<>(versions));
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
- log.metrics("");
- if (result != null) {
- ActionEntity actionEntity = result.one();
- action = actionEntity != null ? actionEntity.toDto() : null;
- }
+ if (versionInfoEntity != null) {
+ if (versionInfoEntity.getCandidate() != null) {
+ String actionUser = versionInfoEntity.getCandidate()
+ .getUser();
+ if (actionUser != null && actionUser.equals(user)) {
+ Set<Version> versions = new HashSet<>();
+ versions.add(versionInfoEntity.getCandidate()
+ .getVersion());
+ ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_ACTIONINVID,
+ TARGET_ENTITY_DB);
+ Result<ActionEntity> result = accessor.getActionsByInvId(actionInvariantUuId,
+ new ArrayList<>(versions));
+ ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
+ log.metrics("");
+ if (result != null) {
+ ActionEntity actionEntity = result.one();
+ action = actionEntity != null ? actionEntity.toDto() : null;
+ }
+ } else {
+ throw new ActionException(ACTION_ARTIFACT_DEL_LOCKED_OTHER_USER_CODE,
+ String.format(ACTION_ARTIFACT_DEL_LOCKED_OTHER_USER, actionUser));
+ }
+ } else {
+ throw new ActionException(ACTION_NOT_LOCKED_CODE, ACTION_NOT_LOCKED_MSG);
+ }
} else {
- throw new ActionException(ACTION_ARTIFACT_DEL_LOCKED_OTHER_USER_CODE,
- String.format(ACTION_ARTIFACT_DEL_LOCKED_OTHER_USER, actionUser));
+ throw new ActionException(ACTION_ENTITY_NOT_EXIST_CODE, ACTION_ENTITY_NOT_EXIST);
}
- } else {
- throw new ActionException(ACTION_NOT_LOCKED_CODE, ACTION_NOT_LOCKED_MSG);
- }
- } else {
- throw new ActionException(ACTION_ENTITY_NOT_EXIST_CODE, ACTION_ENTITY_NOT_EXIST);
+ return action;
}
- return action;
- }
-
- private void logGenericException(Exception exception) {
- ActionUtil.actionLogPostProcessor(StatusCode.ERROR, ACTION_QUERY_FAILURE_CODE,
- ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG, false);
- log.metrics("");
- ActionUtil.actionErrorLogProcessor(CategoryLogLevel.FATAL, ACTION_QUERY_FAILURE_CODE,
- ACTION_QUERY_FAILURE_MSG);
- log.error(exception.getMessage());
- }
-
- @Override
- protected Mapper<ActionEntity> getMapper() {
- return mapper;
- }
-
-
- @Override
- protected Object[] getKeys(ActionEntity entity) {
- return new Object[]{entity.getActionInvariantUuId(), entity.getVersion()};
- }
-
- @Override
- public Collection<ActionEntity> list(ActionEntity entity) {
- return accessor.getAllActions().all();
- }
-
- private void updateActionStatusForDelete(String actionInvariantUuId, List<Version> versions) {
- log.debug(
- "entering updateActionStatusForDelete with actionInvariantUuId = " + actionInvariantUuId
- + " for versions " + versions);
- ActionUtil.actionLogPreProcessor(ActionSubOperation.UPDATE_ACTION_STATUS, TARGET_ENTITY_DB);
- //Update the status column of action table
- Statement updateStatusStatement =
- QueryBuilder.update("dox", "Action").with(set("status", ActionStatus.Deleted.name()))
- .where(eq("actioninvariantuuid", actionInvariantUuId)).and(in("version", versions));
- getSession().execute(updateStatusStatement);
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
- log.metrics("");
- //Update the status in the data field of action table
- updateStatusInActionData(actionInvariantUuId, versions, ActionStatus.Deleted);
- log.debug("exit updateActionStatusForDelete with actionInvariantUuId = " + actionInvariantUuId
- + " for versions " + versions);
- }
-
- /**
- * Update status for a list of versions for a given action.
- *
- * @param actionInvariantUuId Invariant UUID of the action.
- * @param versions List of {@link Version} for which the status has to be updated.
- * @param status The status value.
- */
- private void updateStatusInActionData(String actionInvariantUuId, List<Version> versions,
- ActionStatus status) {
- log.debug("entering updateStatusInActionData for actionInvariantUuId = " + actionInvariantUuId
- + " and status = " + status + " for versions " + versions);
- for (Version v : versions) {
- ActionEntity entity = this.get(new ActionEntity(actionInvariantUuId, v));
- String currentData = entity.getData();
- Map<String, Object> currentDataMap = JsonUtil.json2Object(currentData, LinkedHashMap.class);
- currentDataMap.put(STATUS, status);
- String updatedActionData = JsonUtil.object2Json(currentDataMap);
- entity.setData(updatedActionData);
- this.updateAction(entity.toDto());
+
+ private void logGenericException(Exception exception) {
+ ActionUtil.actionLogPostProcessor(StatusCode.ERROR, ACTION_QUERY_FAILURE_CODE,
+ ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG, false);
+ log.metrics("");
+ ActionUtil.actionErrorLogProcessor(CategoryLogLevel.FATAL, ACTION_QUERY_FAILURE_CODE, ACTION_QUERY_FAILURE_MSG);
+ log.error(exception.getMessage());
}
- log.debug("exit updateStatusInActionData");
- }
-
- /**
- * Get list of all major and minor version values for a given action by action name.
- *
- * @param name Name of the action.
- * @return List of {@link Version} objects for the action.
- */
- private List<Version> getVersionsByName(String name) {
- log.debug("entering getVersionsByName for Action Name = " + name);
- ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION, TARGET_ENTITY_DB);
- Statement statement =
- QueryBuilder.select().column("version").from("dox", "Action").where(eq("name", name));
- ResultSet results = getSession().execute(statement);
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
- log.metrics("");
-
- List<Version> versionList = new ArrayList<>();
- for (Row row : results) {
- Version version = row.get("version",Version.class);
- versionList.add(version);
+
+ @Override
+ protected Mapper<ActionEntity> getMapper() {
+ return mapper;
}
- log.debug("exit getVersionsByName for Action Name = " + name);
- return versionList;
- }
- @Accessor
- interface ActionAccessor {
+ @Override
+ protected Object[] getKeys(ActionEntity entity) {
+ return new Object[] { entity.getActionInvariantUuId(), entity.getVersion() };
+ }
- @Query("SELECT * FROM Action")
- Result<ActionEntity> getAllActions();
+ @Override
+ public Collection<ActionEntity> list(ActionEntity entity) {
+ return accessor.getAllActions()
+ .all();
+ }
- @Query("SELECT * FROM Action where actionInvariantUuId = ? and version in ? ")
- Result<ActionEntity> getActionsByInvId(String actionInvariantUuId, List<Version> versions);
+ private void updateActionStatusForDelete(String actionInvariantUuId, List<Version> versions) {
+ log.debug("entering updateActionStatusForDelete with actionInvariantUuId = " + actionInvariantUuId
+ + FOR_VERSIONS + versions);
+ ActionUtil.actionLogPreProcessor(ActionSubOperation.UPDATE_ACTION_STATUS, TARGET_ENTITY_DB);
+ // Update the status column of action table
+ Statement updateStatusStatement = QueryBuilder.update("dox", ACTION)
+ .with(set("status", ActionStatus.Deleted.name()))
+ .where(eq("actioninvariantuuid", actionInvariantUuId))
+ .and(in(VERSION, versions));
+ getSession().execute(updateStatusStatement);
+ ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
+ log.metrics("");
+ // Update the status in the data field of action table
+ updateStatusInActionData(actionInvariantUuId, versions, ActionStatus.Deleted);
+ log.debug("exit updateActionStatusForDelete with actionInvariantUuId = " + actionInvariantUuId + FOR_VERSIONS
+ + versions);
+ }
- @Query("SELECT * FROM Action where supportedModels CONTAINS ?")
- Result<ActionEntity> getActionsByModel(String resource);
+ /**
+ * Update status for a list of versions for a given action.
+ *
+ * @param actionInvariantUuId
+ * Invariant UUID of the action.
+ * @param versions
+ * List of {@link Version} for which the status has to be
+ * updated.
+ * @param status
+ * The status value.
+ */
+ private void updateStatusInActionData(String actionInvariantUuId, List<Version> versions, ActionStatus status) {
+ log.debug("entering updateStatusInActionData for actionInvariantUuId = " + actionInvariantUuId
+ + " and status = " + status + FOR_VERSIONS + versions);
+ for (Version v : versions) {
+ ActionEntity entity = this.get(new ActionEntity(actionInvariantUuId, v));
+ String currentData = entity.getData();
+ Map<String, Object> currentDataMap = JsonUtil.json2Object(currentData, LinkedHashMap.class);
+ currentDataMap.put(STATUS, status);
+ String updatedActionData = JsonUtil.object2Json(currentDataMap);
+ entity.setData(updatedActionData);
+ this.updateAction(entity.toDto());
+ }
+ log.debug("exit updateStatusInActionData");
+ }
- @Query("SELECT * FROM Action where supportedComponents CONTAINS ?")
- Result<ActionEntity> getActionsByOpenEcompComponent(String resource);
+ /**
+ * Get list of all major and minor version values for a given action by
+ * action name.
+ *
+ * @param name
+ * Name of the action.
+ * @return List of {@link Version} objects for the action.
+ */
+ private List<Version> getVersionsByName(String name) {
+ log.debug("entering getVersionsByName for Action Name = " + name);
+ ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION, TARGET_ENTITY_DB);
+ Statement statement = QueryBuilder.select()
+ .column(VERSION)
+ .from("dox", ACTION)
+ .where(eq("name", name));
+ ResultSet results = getSession().execute(statement);
+ ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
+ log.metrics("");
- @Query("SELECT * FROM Action where vendor_list CONTAINS ?")
- Result<ActionEntity> getActionsByVendor(String vendor);
+ List<Version> versionList = new ArrayList<>();
+ for (Row row : results) {
+ Version version = row.get(VERSION, Version.class);
+ versionList.add(version);
+ }
+ log.debug("exit getVersionsByName for Action Name = " + name);
+ return versionList;
+ }
- @Query("SELECT * FROM Action where category_list CONTAINS ?")
- Result<ActionEntity> getActionsByCategory(String vendor);
+ @Accessor
+ interface ActionAccessor {
- @Query("SELECT actionInvariantUuId FROM Action where name = ? limit 1")
- Result<ActionEntity> getInvIdByName(String name);
+ @Query("SELECT * FROM Action")
+ Result<ActionEntity> getAllActions();
- @Query("SELECT * FROM EcompComponent")
- Result<OpenEcompComponentEntity> getOpenEcompComponents();
+ @Query("SELECT * FROM Action where actionInvariantUuId = ? and version in ? ")
+ Result<ActionEntity> getActionsByInvId(String actionInvariantUuId, List<Version> versions);
- @Query("SELECT * FROM Action where actionUUID = ?")
- Result<ActionEntity> actionInvariantUuId(String actionUuId);
+ @Query("SELECT * FROM Action where supportedModels CONTAINS ?")
+ Result<ActionEntity> getActionsByModel(String resource);
- }
+ @Query("SELECT * FROM Action where supportedComponents CONTAINS ?")
+ Result<ActionEntity> getActionsByOpenEcompComponent(String resource);
- class VersionPredicate {
- Version activeVersion;
- Version finalVersion;
+ @Query("SELECT * FROM Action where vendor_list CONTAINS ?")
+ Result<ActionEntity> getActionsByVendor(String vendor);
- public boolean isIntermediateMinorVersion(Version version) {
- int activeMajorVersion = activeVersion.getMajor();
- int activeMinorVersion = activeVersion.getMinor();
- int currentMinorVersion = version.getMinor();
- int currentMajorVersion = version.getMajor();
+ @Query("SELECT * FROM Action where category_list CONTAINS ?")
+ Result<ActionEntity> getActionsByCategory(String vendor);
- if (finalVersion != null) {
- if (finalVersion.getMajor() == activeMajorVersion
- && currentMajorVersion == finalVersion.getMajor()) {
- if (currentMinorVersion < activeMinorVersion && currentMinorVersion != 0) {
- return true;
- }
- } else {
- return false;
- }
- } else {
- if (!version.equals(activeVersion)) {
- return true;
- }
- }
+ @Query("SELECT actionInvariantUuId FROM Action where name = ? limit 1")
+ Result<ActionEntity> getInvIdByName(String name);
+
+ @Query("SELECT * FROM EcompComponent")
+ Result<OpenEcompComponentEntity> getOpenEcompComponents();
+
+ @Query("SELECT * FROM Action where actionUUID = ?")
+ Result<ActionEntity> actionInvariantUuId(String actionUuId);
- return false;
}
- }
+ class VersionPredicate {
+ Version activeVersion;
+ Version finalVersion;
+
+ public boolean isIntermediateMinorVersion(Version version) {
+ int activeMajorVersion = activeVersion.getMajor();
+ int activeMinorVersion = activeVersion.getMinor();
+ int currentMinorVersion = version.getMinor();
+ int currentMajorVersion = version.getMajor();
+
+ if (finalVersion != null) {
+ if (finalVersion.getMajor() == activeMajorVersion && currentMajorVersion == finalVersion.getMajor()) {
+ if (currentMinorVersion < activeMinorVersion && currentMinorVersion != 0) {
+ return true;
+ }
+ } else {
+ return false;
+ }
+ } else {
+ if (!version.equals(activeVersion)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ }
}