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;
91 public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements ActionDao {
92 private static final String FOR_VERSIONS = " for versions ";
93 private static final String VERSION = "version";
94 private static final String ACTION = "Action";
95 private static NoSqlDb noSqlDb = NoSqlDbFactory.getInstance()
97 private static Mapper<ActionEntity> mapper = noSqlDb.getMappingManager()
98 .mapper(ActionEntity.class);
99 private static ActionAccessor accessor = noSqlDb.getMappingManager()
100 .createAccessor(ActionAccessor.class);
101 private static VersionInfoDao versionInfoDao = VersionInfoDaoFactory.getInstance()
103 private static VersionInfoDeletedDao versionInfoDeletedDao = VersionInfoDeletedDaoFactory.getInstance()
106 private final Logger log = LoggerFactory.getLogger(this.getClass()
110 public void registerVersioning(String versionableEntityType) {
111 ActionVersioningManagerFactory.getInstance()
113 .register(versionableEntityType, new VersionableEntityMetadata(mapper.getTableMetadata()
115 mapper.getTableMetadata()
119 mapper.getTableMetadata()
126 public Action createAction(Action action) {
128 ActionUtil.actionLogPreProcessor(ActionSubOperation.CREATE_ACTION_ENTITY, TARGET_ENTITY_DB);
129 this.create(action.toEntity());
130 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
133 } catch (NoHostAvailableException exception) {
134 logGenericException(exception);
135 throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE, ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
140 public Action updateAction(Action action) {
142 log.debug(" entering updateAction with actionUUID= " + action.getActionUuId());
143 ActionUtil.actionLogPreProcessor(ActionSubOperation.UPDATE_ACTION, TARGET_ENTITY_DB);
144 this.update(action.toEntity());
145 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
147 log.debug(" exit updateAction with actionUUID= " + action.getActionUuId());
149 } catch (NoHostAvailableException exception) {
150 logGenericException(exception);
151 throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE, ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
156 public void deleteAction(String actionInvariantUuId) {
158 log.debug("entering deleteAction with actionInvariantUuId = " + actionInvariantUuId);
159 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION, TARGET_ENTITY_DB);
160 VersionInfoDeletedEntity activeVersionEntity = versionInfoDeletedDao
161 .get(new VersionInfoDeletedEntity(ActionConstants.ACTION_VERSIONABLE_TYPE, actionInvariantUuId));
162 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
165 Version activeVersion = activeVersionEntity.getActiveVersion();
166 Statement getNameFromInvUuId = QueryBuilder.select()
169 .where(eq("actioninvariantuuid", actionInvariantUuId))
170 .and(in(VERSION, activeVersion));
171 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_NAME_BY_ACTIONINVID, TARGET_ENTITY_DB);
172 ResultSet results = getSession().execute(getNameFromInvUuId);
173 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
176 if (!results.isExhausted()) {
177 String name = results.one()
179 List<Version> versions = getVersionsByName(name);
180 updateActionStatusForDelete(actionInvariantUuId, versions);
182 } catch (NoHostAvailableException noHostAvailableException) {
183 logGenericException(noHostAvailableException);
184 throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE, ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
186 log.debug("exit deleteAction");
190 public List<Action> getFilteredActions(String filterType, String filterId) {
191 List<Action> actions = new ArrayList<>();
192 Result<ActionEntity> result = null;
193 log.debug(" entering getFilteredActions By filterType = " + filterType + " With value = " + filterId);
195 switch (filterType) {
196 case FILTER_TYPE_VENDOR:
197 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_VENDOR, TARGET_ENTITY_DB);
198 result = accessor.getActionsByVendor(filterId);
199 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
202 case FILTER_TYPE_CATEGORY:
203 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_CATEGORY, TARGET_ENTITY_DB);
204 result = accessor.getActionsByCategory(filterId);
205 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
208 case FILTER_TYPE_MODEL:
209 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_MODEL, TARGET_ENTITY_DB);
210 result = accessor.getActionsByModel(filterId);
211 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
214 case FILTER_TYPE_OPEN_ECOMP_COMPONENT:
215 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_COMPONENT, TARGET_ENTITY_DB);
216 result = accessor.getActionsByOpenEcompComponent(filterId);
217 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
220 case FILTER_TYPE_NONE:
221 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ALL_ACTIONS, TARGET_ENTITY_DB);
222 result = accessor.getAllActions();
223 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
226 case FILTER_TYPE_NAME:
227 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONINVID_BY_NAME, TARGET_ENTITY_DB);
228 result = accessor.getInvIdByName(filterId);
229 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
231 List<ActionEntity> actionEntities = result.all();
232 if (actionEntities != null && !actionEntities.isEmpty()) {
233 String actionInvariantUuId = actionEntities.get(0)
234 .getActionInvariantUuId();
235 if (actionInvariantUuId != null) {
236 return getActionsByActionInvariantUuId(actionInvariantUuId);
245 if (result != null) {
246 actions.addAll(result.all()
248 .map(ActionEntity::toDto)
249 .collect(Collectors.toList()));
251 log.debug(" exit getFilteredActions By filterType = " + filterType + " With value = " + filterId);
252 } catch (NoHostAvailableException noHostAvailableException) {
253 logGenericException(noHostAvailableException);
254 throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE, ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
260 public Action getActionsByActionUuId(String actionUuId) {
262 log.debug(" entering getActionsByActionUuId with actionUUID= " + actionUuId);
263 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_ACTIONUUID, TARGET_ENTITY_DB);
264 Result<ActionEntity> result = accessor.actionInvariantUuId(actionUuId);
265 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
267 if (result != null) {
268 log.debug(" exit getActionsByActionUuId with actionUUID= " + actionUuId);
269 ActionEntity entity = result.one();
270 if (entity != null) {
271 return entity.toDto();
274 log.debug(" exit getActionsByActionUuId with actionUUID= " + actionUuId);
276 } catch (NoHostAvailableException noHostAvailableException) {
277 logGenericException(noHostAvailableException);
278 throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE, ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
283 public List<OpenEcompComponent> getOpenEcompComponents() {
284 List<OpenEcompComponent> openEcompComponents = new ArrayList<>();
285 Result<OpenEcompComponentEntity> result;
287 log.debug(" entering getOpenEcompComponents ");
288 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_OPEN_ECOMP_COMPONENTS_ENTITY, TARGET_ENTITY_DB);
289 result = accessor.getOpenEcompComponents();
290 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
292 if (result != null) {
293 openEcompComponents.addAll(result.all()
295 .map(OpenEcompComponentEntity::toDto)
296 .collect(Collectors.toList()));
298 } catch (NoHostAvailableException noHostAvailableException) {
299 logGenericException(noHostAvailableException);
300 throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE, ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
302 log.debug(" exit getOpenEcompComponents ");
303 return openEcompComponents;
307 public List<Action> getActionsByActionInvariantUuId(String actionInvariantUuId) {
308 List<Action> actions = new ArrayList<Action>();
310 log.debug(" entering getActionsByActionInvariantUuId with actionInvariantUuId= " + 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, actionInvariantUuId));
320 if (versionInfoDeletedEntity != null) {
321 viewableVersions = versionInfoDeletedEntity.getViewableVersions();
322 // Remove intermediate minor versions from viewable versions
323 if (versionInfoDeletedEntity.getActiveVersion() != null) {
324 filter.activeVersion = versionInfoDeletedEntity.getActiveVersion();
325 filter.finalVersion = versionInfoDeletedEntity.getLatestFinalVersion();
326 viewableVersions.removeIf(filter::isIntermediateMinorVersion);
330 viewableVersions = versionInfoEntity.getViewableVersions();
331 // Remove intermediate minor versions from viewable versions
332 if (versionInfoEntity.getActiveVersion() != null) {
333 filter.activeVersion = versionInfoEntity.getActiveVersion();
334 filter.finalVersion = versionInfoEntity.getLatestFinalVersion();
335 viewableVersions.removeIf(filter::isIntermediateMinorVersion);
337 // Add candidate version if available
338 if (versionInfoEntity.getCandidate() != null) {
339 viewableVersions.add(versionInfoEntity.getCandidate()
344 MDC.put(TARGET_ENTITY, TARGET_ENTITY_DB);
345 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
348 log.debug("Found " + viewableVersions + " viewable version for action with actionInvariantUuId "
349 + actionInvariantUuId);
351 // Fetch action data for the viewable versions
352 if (!viewableVersions.isEmpty()) {
353 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_ACTIONINVID, TARGET_ENTITY_DB);
354 Result<ActionEntity> result = accessor.getActionsByInvId(actionInvariantUuId,
355 new ArrayList<>(viewableVersions));
356 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
358 if (result != null) {
359 actions.addAll(result.all()
361 .map(ActionEntity::toDto)
362 .collect(Collectors.toList()));
365 } catch (NoHostAvailableException noHostAvailableException) {
366 logGenericException(noHostAvailableException);
367 throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE, ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
369 log.debug(" exit getActionsByActionInvariantUuId with actionInvariantUuId= " + actionInvariantUuId);
374 public Action getLockedAction(String actionInvariantUuId, String user) {
375 log.debug(" entering getLockedAction with actionInvariantUuId= " + actionInvariantUuId);
376 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION, TARGET_ENTITY_DB);
377 Action action = null;
378 VersionInfoEntity versionInfoEntity = versionInfoDao
379 .get(new VersionInfoEntity(ActionConstants.ACTION_VERSIONABLE_TYPE, actionInvariantUuId));
380 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
382 if (versionInfoEntity != null) {
383 if (versionInfoEntity.getCandidate() != null) {
384 String actionUser = versionInfoEntity.getCandidate()
386 if (actionUser != null && actionUser.equals(user)) {
387 Set<Version> versions = new HashSet<>();
388 versions.add(versionInfoEntity.getCandidate()
390 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_ACTIONINVID,
392 Result<ActionEntity> result = accessor.getActionsByInvId(actionInvariantUuId,
393 new ArrayList<>(versions));
394 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
396 if (result != null) {
397 ActionEntity actionEntity = result.one();
398 action = actionEntity != null ? actionEntity.toDto() : null;
401 throw new ActionException(ACTION_ARTIFACT_DEL_LOCKED_OTHER_USER_CODE,
402 String.format(ACTION_ARTIFACT_DEL_LOCKED_OTHER_USER, actionUser));
405 throw new ActionException(ACTION_NOT_LOCKED_CODE, ACTION_NOT_LOCKED_MSG);
408 throw new ActionException(ACTION_ENTITY_NOT_EXIST_CODE, ACTION_ENTITY_NOT_EXIST);
413 private void logGenericException(Exception exception) {
414 ActionUtil.actionLogPostProcessor(StatusCode.ERROR, ACTION_QUERY_FAILURE_CODE,
415 ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG, false);
417 ActionUtil.actionErrorLogProcessor(CategoryLogLevel.FATAL, ACTION_QUERY_FAILURE_CODE, ACTION_QUERY_FAILURE_MSG);
418 log.error(exception.getMessage());
422 protected Mapper<ActionEntity> getMapper() {
427 protected Object[] getKeys(ActionEntity entity) {
428 return new Object[] { entity.getActionInvariantUuId(), entity.getVersion() };
432 public Collection<ActionEntity> list(ActionEntity entity) {
433 return accessor.getAllActions()
437 private void updateActionStatusForDelete(String actionInvariantUuId, List<Version> versions) {
438 log.debug("entering updateActionStatusForDelete with actionInvariantUuId = " + actionInvariantUuId
439 + FOR_VERSIONS + versions);
440 ActionUtil.actionLogPreProcessor(ActionSubOperation.UPDATE_ACTION_STATUS, TARGET_ENTITY_DB);
441 // Update the status column of action table
442 Statement updateStatusStatement = QueryBuilder.update("dox", ACTION)
443 .with(set("status", ActionStatus.Deleted.name()))
444 .where(eq("actioninvariantuuid", actionInvariantUuId))
445 .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 + FOR_VERSIONS
456 * Update status for a list of versions for a given action.
458 * @param actionInvariantUuId
459 * Invariant UUID of the action.
461 * List of {@link Version} for which the status has to be
466 private void updateStatusInActionData(String actionInvariantUuId, List<Version> versions, ActionStatus status) {
467 log.debug("entering updateStatusInActionData for actionInvariantUuId = " + actionInvariantUuId
468 + " and status = " + status + FOR_VERSIONS + versions);
469 for (Version v : versions) {
470 ActionEntity entity = this.get(new ActionEntity(actionInvariantUuId, v));
471 String currentData = entity.getData();
472 Map<String, Object> currentDataMap = JsonUtil.json2Object(currentData, LinkedHashMap.class);
473 currentDataMap.put(STATUS, status);
474 String updatedActionData = JsonUtil.object2Json(currentDataMap);
475 entity.setData(updatedActionData);
476 this.updateAction(entity.toDto());
478 log.debug("exit updateStatusInActionData");
482 * Get list of all major and minor version values for a given action by
486 * Name of the action.
487 * @return List of {@link Version} objects for the action.
489 private List<Version> getVersionsByName(String name) {
490 log.debug("entering getVersionsByName for Action Name = " + name);
491 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION, TARGET_ENTITY_DB);
492 Statement statement = QueryBuilder.select()
495 .where(eq("name", name));
496 ResultSet results = getSession().execute(statement);
497 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
500 List<Version> versionList = new ArrayList<>();
501 for (Row row : results) {
502 Version version = row.get(VERSION, Version.class);
503 versionList.add(version);
505 log.debug("exit getVersionsByName for Action Name = " + name);
510 interface ActionAccessor {
512 @Query("SELECT * FROM Action")
513 Result<ActionEntity> getAllActions();
515 @Query("SELECT * FROM Action where actionInvariantUuId = ? and version in ? ")
516 Result<ActionEntity> getActionsByInvId(String actionInvariantUuId, List<Version> versions);
518 @Query("SELECT * FROM Action where supportedModels CONTAINS ?")
519 Result<ActionEntity> getActionsByModel(String resource);
521 @Query("SELECT * FROM Action where supportedComponents CONTAINS ?")
522 Result<ActionEntity> getActionsByOpenEcompComponent(String resource);
524 @Query("SELECT * FROM Action where vendor_list CONTAINS ?")
525 Result<ActionEntity> getActionsByVendor(String vendor);
527 @Query("SELECT * FROM Action where category_list CONTAINS ?")
528 Result<ActionEntity> getActionsByCategory(String vendor);
530 @Query("SELECT actionInvariantUuId FROM Action where name = ? limit 1")
531 Result<ActionEntity> getInvIdByName(String name);
533 @Query("SELECT * FROM EcompComponent")
534 Result<OpenEcompComponentEntity> getOpenEcompComponents();
536 @Query("SELECT * FROM Action where actionUUID = ?")
537 Result<ActionEntity> actionInvariantUuId(String actionUuId);
541 class VersionPredicate {
542 Version activeVersion;
543 Version finalVersion;
545 public boolean isIntermediateMinorVersion(Version version) {
546 int activeMajorVersion = activeVersion.getMajor();
547 int activeMinorVersion = activeVersion.getMinor();
548 int currentMinorVersion = version.getMinor();
549 int currentMajorVersion = version.getMajor();
551 if (finalVersion != null) {
552 if (finalVersion.getMajor() == activeMajorVersion && currentMajorVersion == finalVersion.getMajor()) {
553 if (currentMinorVersion < activeMinorVersion && currentMinorVersion != 0) {
560 if (!version.equals(activeVersion)) {