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;
53 import java.util.ArrayList;
54 import java.util.Collection;
55 import java.util.HashSet;
56 import java.util.LinkedHashMap;
57 import java.util.List;
60 import java.util.stream.Collectors;
62 import org.openecomp.core.dao.impl.CassandraBaseDao;
63 import org.openecomp.core.nosqldb.api.NoSqlDb;
64 import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
65 import org.openecomp.core.utilities.json.JsonUtil;
66 import org.openecomp.sdc.action.ActionConstants;
67 import org.openecomp.sdc.action.dao.ActionDao;
68 import org.openecomp.sdc.action.dao.types.ActionEntity;
69 import org.openecomp.sdc.action.dao.types.OpenEcompComponentEntity;
70 import org.openecomp.sdc.action.errors.ActionException;
71 import org.openecomp.sdc.action.logging.CategoryLogLevel;
72 import org.openecomp.sdc.action.logging.StatusCode;
73 import org.openecomp.sdc.action.types.Action;
74 import org.openecomp.sdc.action.types.ActionStatus;
75 import org.openecomp.sdc.action.types.ActionSubOperation;
76 import org.openecomp.sdc.action.types.OpenEcompComponent;
77 import org.openecomp.sdc.action.util.ActionUtil;
78 import org.openecomp.sdc.logging.api.Logger;
79 import org.openecomp.sdc.logging.api.LoggerFactory;
80 import org.openecomp.sdc.versioning.ActionVersioningManagerFactory;
81 import org.openecomp.sdc.versioning.dao.VersionInfoDao;
82 import org.openecomp.sdc.versioning.dao.VersionInfoDaoFactory;
83 import org.openecomp.sdc.versioning.dao.VersionInfoDeletedDao;
84 import org.openecomp.sdc.versioning.dao.VersionInfoDeletedDaoFactory;
85 import org.openecomp.sdc.versioning.dao.types.Version;
86 import org.openecomp.sdc.versioning.dao.types.VersionInfoDeletedEntity;
87 import org.openecomp.sdc.versioning.dao.types.VersionInfoEntity;
88 import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
92 public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements ActionDao {
93 private static NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
94 private static Mapper<ActionEntity> mapper =
95 noSqlDb.getMappingManager().mapper(ActionEntity.class);
96 private static ActionAccessor accessor =
97 noSqlDb.getMappingManager().createAccessor(ActionAccessor.class);
98 private static VersionInfoDao versionInfoDao =
99 VersionInfoDaoFactory.getInstance().createInterface();
100 private static VersionInfoDeletedDao versionInfoDeletedDao =
101 VersionInfoDeletedDaoFactory.getInstance().createInterface();
103 private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
106 public void registerVersioning(String versionableEntityType) {
107 ActionVersioningManagerFactory.getInstance().createInterface()
108 .register(versionableEntityType, new VersionableEntityMetadata(
109 mapper.getTableMetadata().getName(),
110 mapper.getTableMetadata().getPartitionKey().get(0).getName(),
111 mapper.getTableMetadata().getPartitionKey().get(1).getName()));
115 public Action createAction(Action action) {
117 ActionUtil.actionLogPreProcessor(ActionSubOperation.CREATE_ACTION_ENTITY, TARGET_ENTITY_DB);
118 this.create(action.toEntity());
119 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
122 } catch (NoHostAvailableException exception) {
123 logGenericException(exception);
124 throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE,
125 ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
130 public Action updateAction(Action action) {
132 log.debug(" entering updateAction with actionUUID= " + action.getActionUuId());
133 ActionUtil.actionLogPreProcessor(ActionSubOperation.UPDATE_ACTION, TARGET_ENTITY_DB);
134 this.update(action.toEntity());
135 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
137 log.debug(" exit updateAction with actionUUID= " + action.getActionUuId());
139 } catch (NoHostAvailableException exception) {
140 logGenericException(exception);
141 throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE,
142 ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
147 public void deleteAction(String actionInvariantUuId) {
149 log.debug("entering deleteAction with actionInvariantUuId = " + actionInvariantUuId);
150 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION, TARGET_ENTITY_DB);
151 VersionInfoDeletedEntity activeVersionEntity = versionInfoDeletedDao.get(
152 new VersionInfoDeletedEntity(ActionConstants.ACTION_VERSIONABLE_TYPE,
153 actionInvariantUuId));
154 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
157 Version activeVersion = activeVersionEntity.getActiveVersion();
158 Statement getNameFromInvUuId = QueryBuilder.select().column("name").from("dox", "Action")
159 .where(eq("actioninvariantuuid", actionInvariantUuId))
160 .and(in("version", activeVersion));
162 .actionLogPreProcessor(ActionSubOperation.GET_NAME_BY_ACTIONINVID, TARGET_ENTITY_DB);
163 ResultSet results = getSession().execute(getNameFromInvUuId);
164 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
167 if (!results.isExhausted()) {
168 String name = results.one().getString("name");
169 List<Version> versions = getVersionsByName(name);
170 updateActionStatusForDelete(actionInvariantUuId, versions);
172 } catch (NoHostAvailableException noHostAvailableException) {
173 logGenericException(noHostAvailableException);
174 throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE,
175 ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
177 log.debug("exit deleteAction");
181 public List<Action> getFilteredActions(String filterType, String filterId) {
182 List<Action> actions = new ArrayList<>();
183 Result<ActionEntity> result = null;
185 " entering getFilteredActions By filterType = " + filterType + " With value = " + filterId);
187 switch (filterType) {
188 case FILTER_TYPE_VENDOR:
190 .actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_VENDOR,
192 result = accessor.getActionsByVendor(filterId);
193 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
196 case FILTER_TYPE_CATEGORY:
197 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_CATEGORY,
199 result = accessor.getActionsByCategory(filterId);
200 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
203 case FILTER_TYPE_MODEL:
205 .actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_MODEL,
207 result = accessor.getActionsByModel(filterId);
208 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
211 case FILTER_TYPE_OPEN_ECOMP_COMPONENT:
212 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_COMPONENT,
214 result = accessor.getActionsByOpenEcompComponent(filterId);
215 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
218 case FILTER_TYPE_NONE:
219 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ALL_ACTIONS, TARGET_ENTITY_DB);
220 result = accessor.getAllActions();
221 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
224 case FILTER_TYPE_NAME:
226 .actionLogPreProcessor(ActionSubOperation.GET_ACTIONINVID_BY_NAME, TARGET_ENTITY_DB);
227 result = accessor.getInvIdByName(filterId);
228 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
230 List<ActionEntity> actionEntities = result.all();
231 if (actionEntities != null && !actionEntities.isEmpty()) {
232 String actionInvariantUuId = actionEntities.get(0).getActionInvariantUuId();
233 if (actionInvariantUuId != null) {
234 return getActionsByActionInvariantUuId(actionInvariantUuId);
243 if (result != null) {
244 actions.addAll(result.all().stream().map(ActionEntity::toDto).collect(Collectors.toList()));
247 " exit getFilteredActions By filterType = " + filterType + " With value = " + filterId);
248 } catch (NoHostAvailableException noHostAvailableException) {
249 logGenericException(noHostAvailableException);
250 throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE,
251 ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
257 public Action getActionsByActionUuId(String actionUuId) {
259 log.debug(" entering getActionsByActionUuId with actionUUID= " + actionUuId);
260 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_ACTIONUUID,
262 Result<ActionEntity> result = accessor.actionInvariantUuId(actionUuId);
263 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
265 if (result != null) {
266 log.debug(" exit getActionsByActionUuId with actionUUID= " + actionUuId);
267 ActionEntity entity = result.one();
268 if (entity != null) {
269 return entity.toDto();
272 log.debug(" exit getActionsByActionUuId with actionUUID= " + actionUuId);
274 } catch (NoHostAvailableException noHostAvailableException) {
275 logGenericException(noHostAvailableException);
276 throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE,
277 ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
282 public List<OpenEcompComponent> getOpenEcompComponents() {
283 List<OpenEcompComponent> openEcompComponents = new ArrayList<>();
284 Result<OpenEcompComponentEntity> result;
286 log.debug(" entering getOpenEcompComponents ");
288 .actionLogPreProcessor(ActionSubOperation.GET_OPEN_ECOMP_COMPONENTS_ENTITY,
290 result = accessor.getOpenEcompComponents();
291 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
293 if (result != null) {
294 openEcompComponents.addAll(
295 result.all().stream().map(OpenEcompComponentEntity::toDto)
296 .collect(Collectors.toList()));
298 } catch (NoHostAvailableException noHostAvailableException) {
299 logGenericException(noHostAvailableException);
300 throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE,
301 ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
303 log.debug(" exit getOpenEcompComponents ");
304 return openEcompComponents;
308 public List<Action> getActionsByActionInvariantUuId(String actionInvariantUuId) {
309 List<Action> actions = new ArrayList<Action>();
311 log.debug(" entering getActionsByActionInvariantUuId with actionInvariantUuId= "
312 + actionInvariantUuId);
313 Set<Version> viewableVersions = new HashSet<>();
314 VersionPredicate filter = new VersionPredicate();
315 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION, TARGET_ENTITY_DB);
316 VersionInfoEntity versionInfoEntity = versionInfoDao
317 .get(new VersionInfoEntity(ActionConstants.ACTION_VERSIONABLE_TYPE, actionInvariantUuId));
318 if (versionInfoEntity == null) {
319 //Check for action in the Delete version info table
320 VersionInfoDeletedEntity versionInfoDeletedEntity = versionInfoDeletedDao.get(
321 new VersionInfoDeletedEntity(ActionConstants.ACTION_VERSIONABLE_TYPE,
322 actionInvariantUuId));
323 if (versionInfoDeletedEntity != null) {
324 viewableVersions = versionInfoDeletedEntity.getViewableVersions();
325 //Remove intermediate minor versions from viewable versions
326 if (versionInfoDeletedEntity.getActiveVersion() != null) {
327 filter.activeVersion = versionInfoDeletedEntity.getActiveVersion();
328 filter.finalVersion = versionInfoDeletedEntity.getLatestFinalVersion();
329 viewableVersions.removeIf(filter::isIntermediateMinorVersion);
333 viewableVersions = versionInfoEntity.getViewableVersions();
334 //Remove intermediate minor versions from viewable versions
335 if (versionInfoEntity.getActiveVersion() != null) {
336 filter.activeVersion = versionInfoEntity.getActiveVersion();
337 filter.finalVersion = versionInfoEntity.getLatestFinalVersion();
338 viewableVersions.removeIf(filter::isIntermediateMinorVersion);
340 //Add candidate version if available
341 if (versionInfoEntity.getCandidate() != null) {
342 viewableVersions.add(versionInfoEntity.getCandidate().getVersion());
346 MDC.put(TARGET_ENTITY, TARGET_ENTITY_DB);
347 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
351 "Found " + viewableVersions + " viewable version for action with actionInvariantUuId "
352 + actionInvariantUuId);
354 //Fetch action data for the viewable versions
355 if (!viewableVersions.isEmpty()) {
356 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_ACTIONINVID,
358 Result<ActionEntity> result =
359 accessor.getActionsByInvId(actionInvariantUuId, new ArrayList<>(viewableVersions));
360 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
362 if (result != null) {
364 .addAll(result.all().stream().map(ActionEntity::toDto).collect(Collectors.toList()));
367 } catch (NoHostAvailableException noHostAvailableException) {
368 logGenericException(noHostAvailableException);
369 throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE,
370 ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
373 " exit getActionsByActionInvariantUuId with actionInvariantUuId= " + actionInvariantUuId);
378 public Action getLockedAction(String actionInvariantUuId, String user) throws ActionException {
379 log.debug(" entering getLockedAction with actionInvariantUuId= " + actionInvariantUuId);
380 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION, TARGET_ENTITY_DB);
381 Action action = null;
382 VersionInfoEntity versionInfoEntity = versionInfoDao
383 .get(new VersionInfoEntity(ActionConstants.ACTION_VERSIONABLE_TYPE, actionInvariantUuId));
384 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
386 if (versionInfoEntity != null) {
387 if (versionInfoEntity.getCandidate() != null) {
388 String actionUser = versionInfoEntity.getCandidate().getUser();
389 if (actionUser != null && actionUser.equals(user)) {
390 Set<Version> versions = new HashSet<>();
391 versions.add(versionInfoEntity.getCandidate().getVersion());
392 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_ACTIONINVID,
394 Result<ActionEntity> result = accessor.getActionsByInvId(actionInvariantUuId, new ArrayList<>(versions));
395 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
397 if (result != null) {
398 ActionEntity actionEntity = result.one();
399 action = actionEntity != null ? actionEntity.toDto() : null;
402 throw new ActionException(ACTION_ARTIFACT_DEL_LOCKED_OTHER_USER_CODE,
403 String.format(ACTION_ARTIFACT_DEL_LOCKED_OTHER_USER, actionUser));
406 throw new ActionException(ACTION_NOT_LOCKED_CODE, ACTION_NOT_LOCKED_MSG);
409 throw new ActionException(ACTION_ENTITY_NOT_EXIST_CODE, ACTION_ENTITY_NOT_EXIST);
414 private void logGenericException(Exception exception) {
415 ActionUtil.actionLogPostProcessor(StatusCode.ERROR, ACTION_QUERY_FAILURE_CODE,
416 ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG, false);
418 ActionUtil.actionErrorLogProcessor(CategoryLogLevel.FATAL, ACTION_QUERY_FAILURE_CODE,
419 ACTION_QUERY_FAILURE_MSG);
420 log.error(exception.getMessage());
424 protected Mapper<ActionEntity> getMapper() {
430 protected Object[] getKeys(ActionEntity entity) {
431 return new Object[]{entity.getActionInvariantUuId(), entity.getVersion()};
435 public Collection<ActionEntity> list(ActionEntity entity) {
436 return accessor.getAllActions().all();
439 private void updateActionStatusForDelete(String actionInvariantUuId, List<Version> versions) {
441 "entering updateActionStatusForDelete with actionInvariantUuId = " + actionInvariantUuId
442 + " for versions " + versions);
443 ActionUtil.actionLogPreProcessor(ActionSubOperation.UPDATE_ACTION_STATUS, TARGET_ENTITY_DB);
444 //Update the status column of action table
445 Statement updateStatusStatement =
446 QueryBuilder.update("dox", "Action").with(set("status", ActionStatus.Deleted.name()))
447 .where(eq("actioninvariantuuid", actionInvariantUuId)).and(in("version", versions));
448 getSession().execute(updateStatusStatement);
449 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
451 //Update the status in the data field of action table
452 updateStatusInActionData(actionInvariantUuId, versions, ActionStatus.Deleted);
453 log.debug("exit updateActionStatusForDelete with actionInvariantUuId = " + actionInvariantUuId
454 + " for versions " + versions);
458 * Update status for a list of versions for a given action.
460 * @param actionInvariantUuId Invariant UUID of the action.
461 * @param versions List of {@link Version} for which the status has to be updated.
462 * @param status The status value.
464 private void updateStatusInActionData(String actionInvariantUuId, List<Version> versions,
465 ActionStatus status) {
466 log.debug("entering updateStatusInActionData for actionInvariantUuId = " + actionInvariantUuId
467 + " and status = " + status + " for versions " + versions);
468 for (Version v : versions) {
469 ActionEntity entity = this.get(new ActionEntity(actionInvariantUuId, v));
470 String currentData = entity.getData();
471 Map<String, Object> currentDataMap = JsonUtil.json2Object(currentData, LinkedHashMap.class);
472 currentDataMap.put(STATUS, status);
473 String updatedActionData = JsonUtil.object2Json(currentDataMap);
474 entity.setData(updatedActionData);
475 this.updateAction(entity.toDto());
477 log.debug("exit updateStatusInActionData");
481 * Get list of all major and minor version values for a given action by action name.
483 * @param name Name of the action.
484 * @return List of {@link Version} objects for the action.
486 private List<Version> getVersionsByName(String name) {
487 log.debug("entering getVersionsByName for Action Name = " + name);
488 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION, TARGET_ENTITY_DB);
489 Statement statement =
490 QueryBuilder.select().column("version").from("dox", "Action").where(eq("name", name));
491 ResultSet results = getSession().execute(statement);
492 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
495 List<Version> versionList = new ArrayList<>();
496 for (Row row : results) {
497 Version version = row.get("version",Version.class);
498 versionList.add(version);
500 log.debug("exit getVersionsByName for Action Name = " + name);
505 interface ActionAccessor {
507 @Query("SELECT * FROM Action")
508 Result<ActionEntity> getAllActions();
510 @Query("SELECT * FROM Action where actionInvariantUuId = ? and version in ? ")
511 Result<ActionEntity> getActionsByInvId(String actionInvariantUuId, List<Version> versions);
513 @Query("SELECT * FROM Action where supportedModels CONTAINS ?")
514 Result<ActionEntity> getActionsByModel(String resource);
516 @Query("SELECT * FROM Action where supportedComponents CONTAINS ?")
517 Result<ActionEntity> getActionsByOpenEcompComponent(String resource);
519 @Query("SELECT * FROM Action where vendor_list CONTAINS ?")
520 Result<ActionEntity> getActionsByVendor(String vendor);
522 @Query("SELECT * FROM Action where category_list CONTAINS ?")
523 Result<ActionEntity> getActionsByCategory(String vendor);
525 @Query("SELECT actionInvariantUuId FROM Action where name = ? limit 1")
526 Result<ActionEntity> getInvIdByName(String name);
528 @Query("SELECT * FROM EcompComponent")
529 Result<OpenEcompComponentEntity> getOpenEcompComponents();
531 @Query("SELECT * FROM Action where actionUUID = ?")
532 Result<ActionEntity> actionInvariantUuId(String actionUuId);
536 class VersionPredicate {
537 Version activeVersion;
538 Version finalVersion;
540 public boolean isIntermediateMinorVersion(Version version) {
541 int activeMajorVersion = activeVersion.getMajor();
542 int activeMinorVersion = activeVersion.getMinor();
543 int currentMinorVersion = version.getMinor();
544 int currentMajorVersion = version.getMajor();
546 if (finalVersion != null) {
547 if (finalVersion.getMajor() == activeMajorVersion
548 && currentMajorVersion == finalVersion.getMajor()) {
549 if (currentMinorVersion < activeMinorVersion && currentMinorVersion != 0) {
556 if (!version.equals(activeVersion)) {