2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.action.dao.impl;
23 import static com.datastax.driver.core.querybuilder.QueryBuilder.eq;
24 import static com.datastax.driver.core.querybuilder.QueryBuilder.in;
25 import static com.datastax.driver.core.querybuilder.QueryBuilder.set;
26 import static org.openecomp.core.nosqldb.impl.cassandra.CassandraSessionFactory.getSession;
27 import static org.openecomp.sdc.action.util.ActionUtil.actionLogPostProcessor;
29 import com.datastax.driver.core.ResultSet;
30 import com.datastax.driver.core.Row;
31 import com.datastax.driver.core.Statement;
32 import com.datastax.driver.core.UDTValue;
33 import com.datastax.driver.core.exceptions.NoHostAvailableException;
34 import com.datastax.driver.core.querybuilder.QueryBuilder;
35 import com.datastax.driver.mapping.Mapper;
36 import com.datastax.driver.mapping.Result;
37 import com.datastax.driver.mapping.UDTMapper;
38 import com.datastax.driver.mapping.annotations.Accessor;
39 import com.datastax.driver.mapping.annotations.Query;
40 import org.openecomp.core.dao.impl.CassandraBaseDao;
41 import org.openecomp.core.logging.api.Logger;
42 import org.openecomp.core.logging.api.LoggerFactory;
43 import org.openecomp.core.nosqldb.api.NoSqlDb;
44 import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
45 import org.openecomp.core.utilities.json.JsonUtil;
46 import org.openecomp.sdc.action.ActionConstants;
47 import org.openecomp.sdc.action.dao.ActionDao;
48 import org.openecomp.sdc.action.dao.types.ActionEntity;
49 import org.openecomp.sdc.action.dao.types.EcompComponentEntity;
50 import org.openecomp.sdc.action.errors.ActionErrorConstants;
51 import org.openecomp.sdc.action.errors.ActionException;
52 import org.openecomp.sdc.action.logging.CategoryLogLevel;
53 import org.openecomp.sdc.action.logging.StatusCode;
54 import org.openecomp.sdc.action.types.Action;
55 import org.openecomp.sdc.action.types.ActionStatus;
56 import org.openecomp.sdc.action.types.ActionSubOperation;
57 import org.openecomp.sdc.action.types.EcompComponent;
58 import org.openecomp.sdc.action.util.ActionUtil;
59 import org.openecomp.sdc.versioning.VersioningManagerFactory;
60 import org.openecomp.sdc.versioning.dao.VersionInfoDao;
61 import org.openecomp.sdc.versioning.dao.VersionInfoDaoFactory;
62 import org.openecomp.sdc.versioning.dao.VersionInfoDeletedDao;
63 import org.openecomp.sdc.versioning.dao.VersionInfoDeletedDaoFactory;
64 import org.openecomp.sdc.versioning.dao.types.Version;
65 import org.openecomp.sdc.versioning.dao.types.VersionInfoDeletedEntity;
66 import org.openecomp.sdc.versioning.dao.types.VersionInfoEntity;
67 import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
70 import java.util.ArrayList;
71 import java.util.Collection;
72 import java.util.HashSet;
73 import java.util.LinkedHashMap;
74 import java.util.List;
77 import java.util.stream.Collectors;
79 public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements ActionDao {
80 private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
81 private static final Mapper<ActionEntity> mapper =
82 noSqlDb.getMappingManager().mapper(ActionEntity.class);
83 private static final ActionAccessor accessor =
84 noSqlDb.getMappingManager().createAccessor(ActionAccessor.class);
85 private static final UDTMapper<Version> versionMapper =
86 noSqlDb.getMappingManager().udtMapper(Version.class);
87 private static final VersionInfoDao versionInfoDao =
88 VersionInfoDaoFactory.getInstance().createInterface();
89 private static final VersionInfoDeletedDao versionInfoDeletedDao =
90 VersionInfoDeletedDaoFactory.getInstance().createInterface();
92 private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
96 public void registerVersioning(String versionableEntityType) {
97 VersioningManagerFactory.getInstance().createInterface()
98 .register(versionableEntityType, new VersionableEntityMetadata(
99 mapper.getTableMetadata().getName(),
100 mapper.getTableMetadata().getPartitionKey().get(0).getName(),
101 mapper.getTableMetadata().getPartitionKey().get(1).getName()));
105 public Action createAction(Action actionDto) {
107 ActionUtil.actionLogPreProcessor(
108 ActionSubOperation.CREATE_ACTION_ENTITY, ActionConstants.TARGET_ENTITY_DB);
109 this.create(actionDto.toEntity());
110 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
113 } catch (NoHostAvailableException noHostAvailableException) {
114 logGenericException(noHostAvailableException);
115 throw new ActionException(ActionErrorConstants.ACTION_INTERNAL_SERVER_ERR_CODE,
116 ActionErrorConstants.ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
121 public Action updateAction(Action actionDto) {
123 log.debug(" entering updateAction with actionUUID= " + actionDto.getActionUuId());
125 .actionLogPreProcessor(ActionSubOperation.UPDATE_ACTION,
126 ActionConstants.TARGET_ENTITY_DB);
127 this.update(actionDto.toEntity());
128 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
130 log.debug(" exit updateAction with actionUUID= " + actionDto.getActionUuId());
132 } catch (NoHostAvailableException noHostAvailableException) {
133 logGenericException(noHostAvailableException);
134 throw new ActionException(ActionErrorConstants.ACTION_INTERNAL_SERVER_ERR_CODE,
135 ActionErrorConstants.ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
140 public void deleteAction(String actionInvariantUuId) {
142 log.debug("entering deleteAction with actionInvariantUUID = " + actionInvariantUuId);
144 .actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION,
145 ActionConstants.TARGET_ENTITY_DB);
146 VersionInfoDeletedEntity activeVersionEntity = versionInfoDeletedDao.get(
147 new VersionInfoDeletedEntity(ActionConstants.ACTION_VERSIONABLE_TYPE,
148 actionInvariantUuId));
149 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
151 Version activeVersion = activeVersionEntity.getActiveVersion();
152 Statement getNameFromInvUuId = QueryBuilder.select().column("name").from("dox", "Action")
153 .where(eq("actioninvariantuuid", actionInvariantUuId))
154 .and(in("version", versionMapper.toUDT(activeVersion)));
156 .actionLogPreProcessor(ActionSubOperation.GET_NAME_BY_ACTIONINVID,
157 ActionConstants.TARGET_ENTITY_DB);
158 ResultSet results = getSession().execute(getNameFromInvUuId);
159 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
161 if (!results.isExhausted()) {
162 String name = results.one().getString("name");
163 List<Version> versions = getVersionsByName(name);
164 updateActionStatusForDelete(actionInvariantUuId, versions);
166 } catch (NoHostAvailableException noHostAvailableException) {
167 logGenericException(noHostAvailableException);
168 throw new ActionException(ActionErrorConstants.ACTION_INTERNAL_SERVER_ERR_CODE,
169 ActionErrorConstants.ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
171 log.debug("exit deleteAction");
176 public List<Action> getActionsByActionInvariantUuId(String actionInvariantUuId) {
177 List<Action> actions = new ArrayList<>();
179 log.debug(" entering getActionsByActionInvariantUUID with actionInvariantUUID= "
180 + actionInvariantUuId);
181 Set<Version> viewableVersions = new HashSet<>();
182 VersionPredicate filter = new VersionPredicate();
184 .actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION,
185 ActionConstants.TARGET_ENTITY_DB);
186 VersionInfoEntity versionInfoEntity = versionInfoDao
187 .get(new VersionInfoEntity(ActionConstants.ACTION_VERSIONABLE_TYPE, actionInvariantUuId));
188 if (versionInfoEntity == null) {
189 //Check for action in the Delete version info table
190 VersionInfoDeletedEntity versionInfoDeletedEntity = versionInfoDeletedDao.get(
191 new VersionInfoDeletedEntity(ActionConstants.ACTION_VERSIONABLE_TYPE,
192 actionInvariantUuId));
193 if (versionInfoDeletedEntity != null) {
194 viewableVersions = versionInfoDeletedEntity.getViewableVersions();
195 //Remove intermediate minor versions from viewable versions
196 if (versionInfoDeletedEntity.getActiveVersion() != null) {
197 filter.activeVersion = versionInfoDeletedEntity.getActiveVersion();
198 filter.finalVersion = versionInfoDeletedEntity.getLatestFinalVersion();
199 viewableVersions.removeIf(filter::isIntermediateMinorVersion);
203 viewableVersions = versionInfoEntity.getViewableVersions();
204 //Remove intermediate minor versions from viewable versions
205 if (versionInfoEntity.getActiveVersion() != null) {
206 filter.activeVersion = versionInfoEntity.getActiveVersion();
207 filter.finalVersion = versionInfoEntity.getLatestFinalVersion();
208 viewableVersions.removeIf(filter::isIntermediateMinorVersion);
210 //Add candidate version if available
211 if (versionInfoEntity.getCandidate() != null) {
212 viewableVersions.add(versionInfoEntity.getCandidate().getVersion());
215 MDC.put(ActionConstants.TARGET_ENTITY, ActionConstants.TARGET_ENTITY_DB);
216 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
220 "Found " + viewableVersions + " viewable version for action with actionInvariantUUID "
221 + actionInvariantUuId);
223 //Fetch action data for the viewable versions
224 if (!viewableVersions.isEmpty()) {
225 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_ACTIONINVID,
226 ActionConstants.TARGET_ENTITY_DB);
227 Result<ActionEntity> result =
228 accessor.getActionsByInvId(actionInvariantUuId, viewableVersions);
229 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
231 if (result != null) {
233 .addAll(result.all().stream().map(ActionEntity::toDto).collect(Collectors.toList()));
236 } catch (NoHostAvailableException noHostAvailableException) {
237 logGenericException(noHostAvailableException);
238 throw new ActionException(ActionErrorConstants.ACTION_INTERNAL_SERVER_ERR_CODE,
239 ActionErrorConstants.ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
242 " exit getActionsByActionInvariantUUID with actionInvariantUUID= " + actionInvariantUuId);
246 private void logGenericException(Exception exception) {
248 .actionLogPostProcessor(StatusCode.ERROR, ActionErrorConstants.ACTION_QUERY_FAILURE_CODE,
249 ActionErrorConstants.ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG, false);
251 ActionUtil.actionErrorLogProcessor(
252 CategoryLogLevel.FATAL, ActionErrorConstants.ACTION_QUERY_FAILURE_CODE,
253 ActionErrorConstants.ACTION_QUERY_FAILURE_MSG);
254 log.error(exception.getMessage());
259 public List<Action> getFilteredActions(String filterType, String filterId) {
260 List<Action> actions = new ArrayList<>();
261 Result<ActionEntity> result = null;
263 " entering getFilteredActions By filterType = " + filterType + " With value = " + filterId);
265 switch (filterType) {
266 case ActionConstants.FILTER_TYPE_VENDOR:
268 .actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_VENDOR,
269 ActionConstants.TARGET_ENTITY_DB);
270 result = accessor.getActionsByVendor(filterId);
271 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
274 case ActionConstants.FILTER_TYPE_CATEGORY:
275 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_CATEGORY,
276 ActionConstants.TARGET_ENTITY_DB);
277 result = accessor.getActionsByCategory(filterId);
278 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
281 case ActionConstants.FILTER_TYPE_MODEL:
283 .actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_MODEL,
284 ActionConstants.TARGET_ENTITY_DB);
285 result = accessor.getActionsByModel(filterId);
286 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
289 case ActionConstants.FILTER_TYPE_ECOMP_COMPONENT:
290 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_COMPONENT,
291 ActionConstants.TARGET_ENTITY_DB);
292 result = accessor.getActionsByEcompComponent(filterId);
293 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
296 case ActionConstants.FILTER_TYPE_NONE:
298 .actionLogPreProcessor(ActionSubOperation.GET_ALL_ACTIONS,
299 ActionConstants.TARGET_ENTITY_DB);
300 result = accessor.getAllActions();
301 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
304 case ActionConstants.FILTER_TYPE_NAME:
306 .actionLogPreProcessor(ActionSubOperation.GET_ACTIONINVID_BY_NAME,
307 ActionConstants.TARGET_ENTITY_DB);
308 result = accessor.getInvIdByName(filterId);
309 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
311 List<ActionEntity> actionEntities = result.all();
312 if (actionEntities != null && !actionEntities.isEmpty()) {
313 String actionInvariantUuId = actionEntities.get(0).getActionInvariantUuId();
314 if (actionInvariantUuId != null) {
315 return getActionsByActionInvariantUuId(actionInvariantUuId);
324 if (result != null) {
325 actions.addAll(result.all().stream().map(ActionEntity::toDto).collect(Collectors.toList()));
328 " exit getFilteredActions By filterType = " + filterType + " With value = " + filterId);
329 } catch (NoHostAvailableException noHostAvailableException) {
330 logGenericException(noHostAvailableException);
331 throw new ActionException(ActionErrorConstants.ACTION_INTERNAL_SERVER_ERR_CODE,
332 ActionErrorConstants.ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
338 public List<EcompComponent> getEcompComponents() {
339 List<EcompComponent> ecompComponents = new ArrayList<>();
340 Result<EcompComponentEntity> result;
342 log.debug(" entering getECOMPComponents ");
344 .actionLogPreProcessor(ActionSubOperation.GET_ECOMP_COMPONENTS_ENTITY,
345 ActionConstants.TARGET_ENTITY_DB);
346 result = accessor.getEcompComponents();
347 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
349 if (result != null) {
350 ecompComponents.addAll(
351 result.all().stream().map(EcompComponentEntity::toDto).collect(Collectors.toList()));
353 } catch (NoHostAvailableException noHostAvailableException) {
354 logGenericException(noHostAvailableException);
355 throw new ActionException(ActionErrorConstants.ACTION_INTERNAL_SERVER_ERR_CODE,
356 ActionErrorConstants.ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
358 log.debug(" exit getECOMPComponents ");
359 return ecompComponents;
363 public Action getActionsByActionUuId(String uniqueId) {
365 log.debug(" entering getActionsByActionUUID with actionUUID= " + uniqueId);
367 .actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_ACTIONUUID,
368 ActionConstants.TARGET_ENTITY_DB);
369 Result<ActionEntity> result = accessor.actionInvariantUuId(uniqueId);
370 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
372 if (result != null) {
373 log.debug(" exit getActionsByActionUUID with actionUUID= " + uniqueId);
374 ActionEntity entity = result.one();
375 if (entity != null) {
376 return entity.toDto();
379 log.debug(" exit getActionsByActionUUID with actionUUID= " + uniqueId);
381 } catch (NoHostAvailableException noHostAvailableException) {
382 logGenericException(noHostAvailableException);
383 throw new ActionException(ActionErrorConstants.ACTION_INTERNAL_SERVER_ERR_CODE,
384 ActionErrorConstants.ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
389 public Action getLockedAction(String actionInvariantUuId, String user) throws ActionException {
390 log.debug(" entering getLockedAction with actionInvariantUUID= " + actionInvariantUuId);
392 .actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION,
393 ActionConstants.TARGET_ENTITY_DB);
394 Action action = null;
395 VersionInfoEntity versionInfoEntity = versionInfoDao
396 .get(new VersionInfoEntity(ActionConstants.ACTION_VERSIONABLE_TYPE, actionInvariantUuId));
397 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
399 if (versionInfoEntity != null) {
400 if (versionInfoEntity.getCandidate() != null) {
401 String actionUser = versionInfoEntity.getCandidate().getUser();
402 if (actionUser != null && actionUser.equals(user)) {
403 Set<Version> versions = new HashSet<>();
404 versions.add(versionInfoEntity.getCandidate().getVersion());
405 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_ACTIONINVID,
406 ActionConstants.TARGET_ENTITY_DB);
407 Result<ActionEntity> result = accessor.getActionsByInvId(actionInvariantUuId, versions);
408 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
410 if (result != null) {
411 ActionEntity actionEntity = result.one();
412 action = actionEntity != null ? actionEntity.toDto() : null;
415 throw new ActionException(ActionErrorConstants.ACTION_ARTIFACT_DEL_LOCKED_OTHER_USER_CODE,
417 .format(ActionErrorConstants.ACTION_ARTIFACT_DEL_LOCKED_OTHER_USER, actionUser));
420 throw new ActionException(
421 ActionErrorConstants.ACTION_NOT_LOCKED_CODE,
422 ActionErrorConstants.ACTION_NOT_LOCKED_MSG);
425 throw new ActionException(ActionErrorConstants.ACTION_ENTITY_NOT_EXIST_CODE,
426 ActionErrorConstants.ACTION_ENTITY_NOT_EXIST);
432 protected Mapper<ActionEntity> getMapper() {
438 protected Object[] getKeys(ActionEntity entity) {
439 return new Object[]{entity.getActionInvariantUuId(), versionMapper.toUDT(entity.getVersion())};
443 public Collection<ActionEntity> list(ActionEntity entity) {
444 return accessor.getAllActions().all();
448 * param actionInvariantUuId. param versions.
450 private void updateActionStatusForDelete(String actionInvariantUuId, List<Version> versions) {
452 "entering updateActionStatusForDelete with actionInvariantUUID = " + actionInvariantUuId
453 + " for versions " + versions);
454 List<UDTValue> versionUdt = new ArrayList<>();
456 versions.forEach(v -> versionMapper.toUDT(v));
458 .actionLogPreProcessor(ActionSubOperation.UPDATE_ACTION_STATUS,
459 ActionConstants.TARGET_ENTITY_DB);
461 //Update the status column of action table
462 Statement updateStatusStatement =
463 QueryBuilder.update("dox", "Action").with(set("status", ActionStatus.Deleted.name()))
464 .where(eq("actioninvariantuuid", actionInvariantUuId)).and(in("version", versionUdt));
465 getSession().execute(updateStatusStatement);
466 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
468 //Update the status in the data field of action table
469 updateStatusInActionData(actionInvariantUuId, versions, ActionStatus.Deleted);
470 log.debug("exit updateActionStatusForDelete with actionInvariantUUID = " + actionInvariantUuId
471 + " for versions " + versions);
475 * Update status for a list of versions for a given action.
477 * @param actionInvariantUuId Invariant UUID of the action.
478 * @param versions List of {@link Version} for which the status has to be updated.
479 * @param status The status value.
481 private void updateStatusInActionData(String actionInvariantUuId, List<Version> versions,
482 ActionStatus status) {
483 log.debug("entering updateStatusInActionData for actionInvariantUUID = " + actionInvariantUuId
484 + " and status = " + status + " for versions " + versions);
485 for (Version v : versions) {
486 ActionEntity entity = this.get(new ActionEntity(actionInvariantUuId, v));
487 String currentData = entity.getData();
488 Map<String, Object> currentDataMap = JsonUtil.json2Object(currentData, LinkedHashMap.class);
489 currentDataMap.put(ActionConstants.STATUS, status);
490 String updatedActionData = JsonUtil.object2Json(currentDataMap);
491 entity.setData(updatedActionData);
492 this.updateAction(entity.toDto());
494 log.debug("exit updateStatusInActionData");
498 * Get list of all major and minor version values for a given action by action name.
500 * @param name Name of the action
501 * @return List of {@link Version} objects for the action
503 private List<Version> getVersionsByName(String name) {
504 log.debug("entering getVersionsByName for Action Name = " + name);
506 .actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION,
507 ActionConstants.TARGET_ENTITY_DB);
508 Statement statement =
509 QueryBuilder.select().column("version").from("dox", "Action").where(eq("name", name));
510 ResultSet results = getSession().execute(statement);
511 ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
513 List<Version> versionList = new ArrayList<>();
514 for (Row row : results) {
515 Version version = versionMapper.fromUDT((UDTValue) row.getObject("version"));
516 versionList.add(version);
518 log.debug("exit getVersionsByName for Action Name = " + name);
523 interface ActionAccessor {
525 @Query("SELECT * FROM Action")
526 Result<ActionEntity> getAllActions();
528 @Query("SELECT * FROM Action where actionInvariantUuId = ? and version in ? ")
529 Result<ActionEntity> getActionsByInvId(String actionInvariantUuId, Set<Version> versions);
531 @Query("SELECT * FROM Action where supportedModels CONTAINS ?")
532 Result<ActionEntity> getActionsByModel(String resource);
534 @Query("SELECT * FROM Action where supportedComponents CONTAINS ?")
535 Result<ActionEntity> getActionsByEcompComponent(String resource);
537 @Query("SELECT * FROM Action where vendor_list CONTAINS ?")
538 Result<ActionEntity> getActionsByVendor(String vendor);
540 @Query("SELECT * FROM Action where category_list CONTAINS ?")
541 Result<ActionEntity> getActionsByCategory(String vendor);
543 @Query("SELECT actionInvariantUuId FROM Action where name = ? limit 1")
544 Result<ActionEntity> getInvIdByName(String name);
546 @Query("SELECT * FROM ECOMPComponent")
547 Result<EcompComponentEntity> getEcompComponents();
549 @Query("SELECT * FROM Action where actionUUID = ?")
550 Result<ActionEntity> actionInvariantUuId(String actionUuId);
554 class VersionPredicate {
555 Version activeVersion;
556 Version finalVersion;
558 public boolean isIntermediateMinorVersion(Version version) {
559 int activeMajorVersion = activeVersion.getMajor();
560 int activeMinorVersion = activeVersion.getMinor();
561 int currentMinorVersion = version.getMinor();
562 int currentMajorVersion = version.getMajor();
564 if (finalVersion != null) {
565 if (finalVersion.getMajor() == activeMajorVersion
566 && currentMajorVersion == finalVersion.getMajor()) {
567 if (currentMinorVersion < activeMinorVersion && currentMinorVersion != 0) {
574 if (!version.equals(activeVersion)) {