2 * Copyright © 2016-2018 European Support Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.openecomp.sdc.action.dao.impl;
19 import static com.datastax.driver.core.querybuilder.QueryBuilder.eq;
20 import static com.datastax.driver.core.querybuilder.QueryBuilder.in;
21 import static com.datastax.driver.core.querybuilder.QueryBuilder.set;
22 import static org.openecomp.core.nosqldb.impl.cassandra.CassandraSessionFactory.getSession;
23 import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_CATEGORY;
24 import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_MODEL;
25 import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_NAME;
26 import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_NONE;
27 import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_OPEN_ECOMP_COMPONENT;
28 import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_VENDOR;
29 import static org.openecomp.sdc.action.ActionConstants.STATUS;
30 import static org.openecomp.sdc.action.ActionConstants.TARGET_ENTITY;
31 import static org.openecomp.sdc.action.ActionConstants.TARGET_ENTITY_DB;
32 import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ARTIFACT_DEL_LOCKED_OTHER_USER;
33 import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ARTIFACT_DEL_LOCKED_OTHER_USER_CODE;
34 import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG;
35 import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ENTITY_NOT_EXIST;
36 import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ENTITY_NOT_EXIST_CODE;
37 import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_INTERNAL_SERVER_ERR_CODE;
38 import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_NOT_LOCKED_CODE;
39 import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_NOT_LOCKED_MSG;
40 import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_QUERY_FAILURE_CODE;
41 import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_QUERY_FAILURE_MSG;
43 import com.datastax.driver.core.ResultSet;
44 import com.datastax.driver.core.Row;
45 import com.datastax.driver.core.Statement;
46 import com.datastax.driver.core.exceptions.NoHostAvailableException;
47 import com.datastax.driver.core.querybuilder.QueryBuilder;
48 import com.datastax.driver.mapping.Mapper;
49 import com.datastax.driver.mapping.Result;
50 import com.datastax.driver.mapping.annotations.Accessor;
51 import com.datastax.driver.mapping.annotations.Query;
52 import java.util.ArrayList;
53 import java.util.Collection;
54 import java.util.HashSet;
55 import java.util.LinkedHashMap;
56 import java.util.List;
59 import java.util.stream.Collectors;
60 import org.openecomp.core.dao.impl.CassandraBaseDao;
61 import org.openecomp.core.nosqldb.api.NoSqlDb;
62 import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
63 import org.openecomp.core.utilities.json.JsonUtil;
64 import org.openecomp.sdc.action.ActionConstants;
65 import org.openecomp.sdc.action.dao.ActionDao;
66 import org.openecomp.sdc.action.dao.types.ActionEntity;
67 import org.openecomp.sdc.action.dao.types.OpenEcompComponentEntity;
68 import org.openecomp.sdc.action.errors.ActionException;
69 import org.openecomp.sdc.action.logging.CategoryLogLevel;
70 import org.openecomp.sdc.action.logging.StatusCode;
71 import org.openecomp.sdc.action.types.Action;
72 import org.openecomp.sdc.action.types.ActionStatus;
73 import org.openecomp.sdc.action.types.ActionSubOperation;
74 import org.openecomp.sdc.action.types.OpenEcompComponent;
75 import org.openecomp.sdc.action.util.ActionUtil;
76 import org.openecomp.sdc.logging.api.Logger;
77 import org.openecomp.sdc.logging.api.LoggerFactory;
78 import org.openecomp.sdc.versioning.ActionVersioningManagerFactory;
79 import org.openecomp.sdc.versioning.dao.VersionInfoDao;
80 import org.openecomp.sdc.versioning.dao.VersionInfoDaoFactory;
81 import org.openecomp.sdc.versioning.dao.VersionInfoDeletedDao;
82 import org.openecomp.sdc.versioning.dao.VersionInfoDeletedDaoFactory;
83 import org.openecomp.sdc.versioning.dao.types.Version;
84 import org.openecomp.sdc.versioning.dao.types.VersionInfoDeletedEntity;
85 import org.openecomp.sdc.versioning.dao.types.VersionInfoEntity;
86 import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
90 public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements ActionDao {
91 private static NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
92 private static Mapper<ActionEntity> mapper =
93 noSqlDb.getMappingManager().mapper(ActionEntity.class);
94 private static ActionAccessor accessor =
95 noSqlDb.getMappingManager().createAccessor(ActionAccessor.class);
96 private static VersionInfoDao versionInfoDao =
97 VersionInfoDaoFactory.getInstance().createInterface();
98 private static VersionInfoDeletedDao versionInfoDeletedDao =
99 VersionInfoDeletedDaoFactory.getInstance().createInterface();
101 private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
104 public void registerVersioning(String versionableEntityType) {
105 ActionVersioningManagerFactory.getInstance().createInterface()
106 .register(versionableEntityType, new VersionableEntityMetadata(
107 mapper.getTableMetadata().getName(),
108 mapper.getTableMetadata().getPartitionKey().get(0).getName(),
109 mapper.getTableMetadata().getPartitionKey().get(1).getName()));
113 public Action createAction(Action action) {
115 ActionUtil.actionLogPreProcessor(ActionSubOperation.CREATE_ACTION_ENTITY, TARGET_ENTITY_DB);
116 this.create(action.toEntity());
117 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
120 } catch (NoHostAvailableException exception) {
121 logGenericException(exception);
122 throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE,
123 ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
128 public Action updateAction(Action action) {
130 log.debug(" entering updateAction with actionUUID= " + action.getActionUuId());
131 ActionUtil.actionLogPreProcessor(ActionSubOperation.UPDATE_ACTION, TARGET_ENTITY_DB);
132 this.update(action.toEntity());
133 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
135 log.debug(" exit updateAction with actionUUID= " + action.getActionUuId());
137 } catch (NoHostAvailableException exception) {
138 logGenericException(exception);
139 throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE,
140 ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
145 public void deleteAction(String actionInvariantUuId) {
147 log.debug("entering deleteAction with actionInvariantUuId = " + actionInvariantUuId);
148 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION, TARGET_ENTITY_DB);
149 VersionInfoDeletedEntity activeVersionEntity = versionInfoDeletedDao.get(
150 new VersionInfoDeletedEntity(ActionConstants.ACTION_VERSIONABLE_TYPE,
151 actionInvariantUuId));
152 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
155 Version activeVersion = activeVersionEntity.getActiveVersion();
156 Statement getNameFromInvUuId = QueryBuilder.select().column("name").from("dox", "Action")
157 .where(eq("actioninvariantuuid", actionInvariantUuId))
158 .and(in("version", activeVersion));
160 .actionLogPreProcessor(ActionSubOperation.GET_NAME_BY_ACTIONINVID, TARGET_ENTITY_DB);
161 ResultSet results = getSession().execute(getNameFromInvUuId);
162 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
165 if (!results.isExhausted()) {
166 String name = results.one().getString("name");
167 List<Version> versions = getVersionsByName(name);
168 updateActionStatusForDelete(actionInvariantUuId, versions);
170 } catch (NoHostAvailableException noHostAvailableException) {
171 logGenericException(noHostAvailableException);
172 throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE,
173 ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
175 log.debug("exit deleteAction");
179 public List<Action> getFilteredActions(String filterType, String filterId) {
180 List<Action> actions = new ArrayList<>();
181 Result<ActionEntity> result = null;
183 " entering getFilteredActions By filterType = " + filterType + " With value = " + filterId);
185 switch (filterType) {
186 case FILTER_TYPE_VENDOR:
188 .actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_VENDOR,
190 result = accessor.getActionsByVendor(filterId);
191 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
194 case FILTER_TYPE_CATEGORY:
195 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_CATEGORY,
197 result = accessor.getActionsByCategory(filterId);
198 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
201 case FILTER_TYPE_MODEL:
203 .actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_MODEL,
205 result = accessor.getActionsByModel(filterId);
206 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
209 case FILTER_TYPE_OPEN_ECOMP_COMPONENT:
210 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_COMPONENT,
212 result = accessor.getActionsByOpenEcompComponent(filterId);
213 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
216 case FILTER_TYPE_NONE:
217 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ALL_ACTIONS, TARGET_ENTITY_DB);
218 result = accessor.getAllActions();
219 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
222 case FILTER_TYPE_NAME:
224 .actionLogPreProcessor(ActionSubOperation.GET_ACTIONINVID_BY_NAME, TARGET_ENTITY_DB);
225 result = accessor.getInvIdByName(filterId);
226 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
228 List<ActionEntity> actionEntities = result.all();
229 if (actionEntities != null && !actionEntities.isEmpty()) {
230 String actionInvariantUuId = actionEntities.get(0).getActionInvariantUuId();
231 if (actionInvariantUuId != null) {
232 return getActionsByActionInvariantUuId(actionInvariantUuId);
241 if (result != null) {
242 actions.addAll(result.all().stream().map(ActionEntity::toDto).collect(Collectors.toList()));
245 " exit getFilteredActions By filterType = " + filterType + " With value = " + filterId);
246 } catch (NoHostAvailableException noHostAvailableException) {
247 logGenericException(noHostAvailableException);
248 throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE,
249 ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
255 public Action getActionsByActionUuId(String actionUuId) {
257 log.debug(" entering getActionsByActionUuId with actionUUID= " + actionUuId);
258 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_ACTIONUUID,
260 Result<ActionEntity> result = accessor.actionInvariantUuId(actionUuId);
261 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
263 if (result != null) {
264 log.debug(" exit getActionsByActionUuId with actionUUID= " + actionUuId);
265 ActionEntity entity = result.one();
266 if (entity != null) {
267 return entity.toDto();
270 log.debug(" exit getActionsByActionUuId with actionUUID= " + actionUuId);
272 } catch (NoHostAvailableException noHostAvailableException) {
273 logGenericException(noHostAvailableException);
274 throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE,
275 ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
280 public List<OpenEcompComponent> getOpenEcompComponents() {
281 List<OpenEcompComponent> openEcompComponents = new ArrayList<>();
282 Result<OpenEcompComponentEntity> result;
284 log.debug(" entering getOpenEcompComponents ");
286 .actionLogPreProcessor(ActionSubOperation.GET_OPEN_ECOMP_COMPONENTS_ENTITY,
288 result = accessor.getOpenEcompComponents();
289 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
291 if (result != null) {
292 openEcompComponents.addAll(
293 result.all().stream().map(OpenEcompComponentEntity::toDto)
294 .collect(Collectors.toList()));
296 } catch (NoHostAvailableException noHostAvailableException) {
297 logGenericException(noHostAvailableException);
298 throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE,
299 ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
301 log.debug(" exit getOpenEcompComponents ");
302 return openEcompComponents;
306 public List<Action> getActionsByActionInvariantUuId(String actionInvariantUuId) {
307 List<Action> actions = new ArrayList<Action>();
309 log.debug(" entering getActionsByActionInvariantUuId with actionInvariantUuId= "
310 + actionInvariantUuId);
311 Set<Version> viewableVersions = new HashSet<>();
312 VersionPredicate filter = new VersionPredicate();
313 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION, TARGET_ENTITY_DB);
314 VersionInfoEntity versionInfoEntity = versionInfoDao
315 .get(new VersionInfoEntity(ActionConstants.ACTION_VERSIONABLE_TYPE, actionInvariantUuId));
316 if (versionInfoEntity == null) {
317 //Check for action in the Delete version info table
318 VersionInfoDeletedEntity versionInfoDeletedEntity = versionInfoDeletedDao.get(
319 new VersionInfoDeletedEntity(ActionConstants.ACTION_VERSIONABLE_TYPE,
320 actionInvariantUuId));
321 if (versionInfoDeletedEntity != null) {
322 viewableVersions = versionInfoDeletedEntity.getViewableVersions();
323 //Remove intermediate minor versions from viewable versions
324 if (versionInfoDeletedEntity.getActiveVersion() != null) {
325 filter.activeVersion = versionInfoDeletedEntity.getActiveVersion();
326 filter.finalVersion = versionInfoDeletedEntity.getLatestFinalVersion();
327 viewableVersions.removeIf(filter::isIntermediateMinorVersion);
331 viewableVersions = versionInfoEntity.getViewableVersions();
332 //Remove intermediate minor versions from viewable versions
333 if (versionInfoEntity.getActiveVersion() != null) {
334 filter.activeVersion = versionInfoEntity.getActiveVersion();
335 filter.finalVersion = versionInfoEntity.getLatestFinalVersion();
336 viewableVersions.removeIf(filter::isIntermediateMinorVersion);
338 //Add candidate version if available
339 if (versionInfoEntity.getCandidate() != null) {
340 viewableVersions.add(versionInfoEntity.getCandidate().getVersion());
344 MDC.put(TARGET_ENTITY, TARGET_ENTITY_DB);
345 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
349 "Found " + viewableVersions + " viewable version for action with actionInvariantUuId "
350 + actionInvariantUuId);
352 //Fetch action data for the viewable versions
353 if (!viewableVersions.isEmpty()) {
354 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_ACTIONINVID,
356 Result<ActionEntity> result =
357 accessor.getActionsByInvId(actionInvariantUuId, viewableVersions);
358 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
360 if (result != null) {
362 .addAll(result.all().stream().map(ActionEntity::toDto).collect(Collectors.toList()));
365 } catch (NoHostAvailableException noHostAvailableException) {
366 logGenericException(noHostAvailableException);
367 throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE,
368 ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
371 " exit getActionsByActionInvariantUuId with actionInvariantUuId= " + actionInvariantUuId);
376 public Action getLockedAction(String actionInvariantUuId, String user) throws ActionException {
377 log.debug(" entering getLockedAction with actionInvariantUuId= " + actionInvariantUuId);
378 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION, TARGET_ENTITY_DB);
379 Action action = null;
380 VersionInfoEntity versionInfoEntity = versionInfoDao
381 .get(new VersionInfoEntity(ActionConstants.ACTION_VERSIONABLE_TYPE, actionInvariantUuId));
382 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
384 if (versionInfoEntity != null) {
385 if (versionInfoEntity.getCandidate() != null) {
386 String actionUser = versionInfoEntity.getCandidate().getUser();
387 if (actionUser != null && actionUser.equals(user)) {
388 Set<Version> versions = new HashSet<>();
389 versions.add(versionInfoEntity.getCandidate().getVersion());
390 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_ACTIONINVID,
392 Result<ActionEntity> result = accessor.getActionsByInvId(actionInvariantUuId, versions);
393 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
395 if (result != null) {
396 ActionEntity actionEntity = result.one();
397 action = actionEntity != null ? actionEntity.toDto() : null;
400 throw new ActionException(ACTION_ARTIFACT_DEL_LOCKED_OTHER_USER_CODE,
401 String.format(ACTION_ARTIFACT_DEL_LOCKED_OTHER_USER, actionUser));
404 throw new ActionException(ACTION_NOT_LOCKED_CODE, ACTION_NOT_LOCKED_MSG);
407 throw new ActionException(ACTION_ENTITY_NOT_EXIST_CODE, ACTION_ENTITY_NOT_EXIST);
412 private void logGenericException(Exception exception) {
413 ActionUtil.actionLogPostProcessor(StatusCode.ERROR, ACTION_QUERY_FAILURE_CODE,
414 ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG, false);
416 ActionUtil.actionErrorLogProcessor(CategoryLogLevel.FATAL, ACTION_QUERY_FAILURE_CODE,
417 ACTION_QUERY_FAILURE_MSG);
418 log.error(exception.getMessage());
422 protected Mapper<ActionEntity> getMapper() {
428 protected Object[] getKeys(ActionEntity entity) {
429 return new Object[]{entity.getActionInvariantUuId(), entity.getVersion()};
433 public Collection<ActionEntity> list(ActionEntity entity) {
434 return accessor.getAllActions().all();
437 private void updateActionStatusForDelete(String actionInvariantUuId, List<Version> versions) {
439 "entering updateActionStatusForDelete with actionInvariantUuId = " + actionInvariantUuId
440 + " for versions " + versions);
441 ActionUtil.actionLogPreProcessor(ActionSubOperation.UPDATE_ACTION_STATUS, TARGET_ENTITY_DB);
442 //Update the status column of action table
443 Statement updateStatusStatement =
444 QueryBuilder.update("dox", "Action").with(set("status", ActionStatus.Deleted.name()))
445 .where(eq("actioninvariantuuid", actionInvariantUuId)).and(in("version", versions));
446 getSession().execute(updateStatusStatement);
447 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
449 //Update the status in the data field of action table
450 updateStatusInActionData(actionInvariantUuId, versions, ActionStatus.Deleted);
451 log.debug("exit updateActionStatusForDelete with actionInvariantUuId = " + actionInvariantUuId
452 + " for versions " + versions);
456 * Update status for a list of versions for a given action.
458 * @param actionInvariantUuId Invariant UUID of the action.
459 * @param versions List of {@link Version} for which the status has to be updated.
460 * @param status The status value.
462 private void updateStatusInActionData(String actionInvariantUuId, List<Version> versions,
463 ActionStatus status) {
464 log.debug("entering updateStatusInActionData for actionInvariantUuId = " + actionInvariantUuId
465 + " and status = " + status + " for versions " + versions);
466 for (Version v : versions) {
467 ActionEntity entity = this.get(new ActionEntity(actionInvariantUuId, v));
468 String currentData = entity.getData();
469 Map<String, Object> currentDataMap = JsonUtil.json2Object(currentData, LinkedHashMap.class);
470 currentDataMap.put(STATUS, status);
471 String updatedActionData = JsonUtil.object2Json(currentDataMap);
472 entity.setData(updatedActionData);
473 this.updateAction(entity.toDto());
475 log.debug("exit updateStatusInActionData");
479 * Get list of all major and minor version values for a given action by action name.
481 * @param name Name of the action.
482 * @return List of {@link Version} objects for the action.
484 private List<Version> getVersionsByName(String name) {
485 log.debug("entering getVersionsByName for Action Name = " + name);
486 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION, TARGET_ENTITY_DB);
487 Statement statement =
488 QueryBuilder.select().column("version").from("dox", "Action").where(eq("name", name));
489 ResultSet results = getSession().execute(statement);
490 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
493 List<Version> versionList = new ArrayList<>();
494 for (Row row : results) {
495 Version version = row.get("version",Version.class);
496 versionList.add(version);
498 log.debug("exit getVersionsByName for Action Name = " + name);
503 interface ActionAccessor {
505 @Query("SELECT * FROM Action")
506 Result<ActionEntity> getAllActions();
508 @Query("SELECT * FROM Action where actionInvariantUuId = ? and version in ? ")
509 Result<ActionEntity> getActionsByInvId(String actionInvariantUuId, Set<Version> versions);
511 @Query("SELECT * FROM Action where supportedModels CONTAINS ?")
512 Result<ActionEntity> getActionsByModel(String resource);
514 @Query("SELECT * FROM Action where supportedComponents CONTAINS ?")
515 Result<ActionEntity> getActionsByOpenEcompComponent(String resource);
517 @Query("SELECT * FROM Action where vendor_list CONTAINS ?")
518 Result<ActionEntity> getActionsByVendor(String vendor);
520 @Query("SELECT * FROM Action where category_list CONTAINS ?")
521 Result<ActionEntity> getActionsByCategory(String vendor);
523 @Query("SELECT actionInvariantUuId FROM Action where name = ? limit 1")
524 Result<ActionEntity> getInvIdByName(String name);
526 @Query("SELECT * FROM EcompComponent")
527 Result<OpenEcompComponentEntity> getOpenEcompComponents();
529 @Query("SELECT * FROM Action where actionUUID = ?")
530 Result<ActionEntity> actionInvariantUuId(String actionUuId);
534 class VersionPredicate {
535 Version activeVersion;
536 Version finalVersion;
538 public boolean isIntermediateMinorVersion(Version version) {
539 int activeMajorVersion = activeVersion.getMajor();
540 int activeMinorVersion = activeVersion.getMinor();
541 int currentMinorVersion = version.getMinor();
542 int currentMajorVersion = version.getMajor();
544 if (finalVersion != null) {
545 if (finalVersion.getMajor() == activeMajorVersion
546 && currentMajorVersion == finalVersion.getMajor()) {
547 if (currentMinorVersion < activeMinorVersion && currentMinorVersion != 0) {
554 if (!version.equals(activeVersion)) {