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.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus.COMPLETE;
23 import static org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus.ERROR;
24 import static org.openecomp.core.nosqldb.impl.cassandra.CassandraSessionFactory.getSession;
25 import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_CATEGORY;
26 import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_MODEL;
27 import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_NAME;
28 import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_NONE;
29 import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_OPEN_ECOMP_COMPONENT;
30 import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_VENDOR;
31 import static org.openecomp.sdc.action.ActionConstants.STATUS;
32 import static org.openecomp.sdc.action.ActionConstants.TARGET_ENTITY;
33 import static org.openecomp.sdc.action.ActionConstants.TARGET_ENTITY_DB;
34 import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ARTIFACT_DEL_LOCKED_OTHER_USER;
35 import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ARTIFACT_DEL_LOCKED_OTHER_USER_CODE;
36 import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG;
37 import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ENTITY_NOT_EXIST;
38 import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ENTITY_NOT_EXIST_CODE;
39 import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_INTERNAL_SERVER_ERR_CODE;
40 import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_NOT_LOCKED_CODE;
41 import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_NOT_LOCKED_MSG;
42 import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_QUERY_FAILURE_CODE;
43 import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_QUERY_FAILURE_MSG;
45 import com.datastax.driver.core.ResultSet;
46 import com.datastax.driver.core.Row;
47 import com.datastax.driver.core.Statement;
48 import com.datastax.driver.core.exceptions.NoHostAvailableException;
49 import com.datastax.driver.core.querybuilder.QueryBuilder;
50 import com.datastax.driver.mapping.Mapper;
51 import com.datastax.driver.mapping.Result;
52 import com.datastax.driver.mapping.annotations.Accessor;
53 import com.datastax.driver.mapping.annotations.Query;
55 import java.util.ArrayList;
56 import java.util.Collection;
57 import java.util.HashSet;
58 import java.util.LinkedHashMap;
59 import java.util.List;
62 import java.util.stream.Collectors;
64 import org.openecomp.core.dao.impl.CassandraBaseDao;
65 import org.openecomp.core.nosqldb.api.NoSqlDb;
66 import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
67 import org.openecomp.core.utilities.json.JsonUtil;
68 import org.openecomp.sdc.action.ActionConstants;
69 import org.openecomp.sdc.action.dao.ActionDao;
70 import org.openecomp.sdc.action.dao.types.ActionEntity;
71 import org.openecomp.sdc.action.dao.types.OpenEcompComponentEntity;
72 import org.openecomp.sdc.action.errors.ActionException;
73 import org.openecomp.sdc.action.logging.CategoryLogLevel;
74 import org.openecomp.sdc.action.types.Action;
75 import org.openecomp.sdc.action.types.ActionStatus;
76 import org.openecomp.sdc.action.types.ActionSubOperation;
77 import org.openecomp.sdc.action.types.OpenEcompComponent;
78 import org.openecomp.sdc.action.util.ActionUtil;
79 import org.openecomp.sdc.logging.api.Logger;
80 import org.openecomp.sdc.logging.api.LoggerFactory;
81 import org.openecomp.sdc.versioning.ActionVersioningManagerFactory;
82 import org.openecomp.sdc.versioning.dao.VersionInfoDao;
83 import org.openecomp.sdc.versioning.dao.VersionInfoDaoFactory;
84 import org.openecomp.sdc.versioning.dao.VersionInfoDeletedDao;
85 import org.openecomp.sdc.versioning.dao.VersionInfoDeletedDaoFactory;
86 import org.openecomp.sdc.versioning.dao.types.Version;
87 import org.openecomp.sdc.versioning.dao.types.VersionInfoDeletedEntity;
88 import org.openecomp.sdc.versioning.dao.types.VersionInfoEntity;
89 import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
92 public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements ActionDao {
93 private static final String FOR_VERSIONS = " for versions ";
94 private static final String VERSION = "version";
95 private static final String ACTION = "Action";
96 private static NoSqlDb noSqlDb = NoSqlDbFactory.getInstance()
98 private static Mapper<ActionEntity> mapper = noSqlDb.getMappingManager()
99 .mapper(ActionEntity.class);
100 private static ActionAccessor accessor = noSqlDb.getMappingManager()
101 .createAccessor(ActionAccessor.class);
102 private static VersionInfoDao versionInfoDao = VersionInfoDaoFactory.getInstance()
104 private static VersionInfoDeletedDao versionInfoDeletedDao = VersionInfoDeletedDaoFactory.getInstance()
107 private final Logger log = LoggerFactory.getLogger(this.getClass()
111 public void registerVersioning(String versionableEntityType) {
112 ActionVersioningManagerFactory.getInstance()
114 .register(versionableEntityType, new VersionableEntityMetadata(mapper.getTableMetadata()
116 mapper.getTableMetadata()
120 mapper.getTableMetadata()
127 public Action createAction(Action action) {
129 ActionUtil.actionLogPreProcessor(ActionSubOperation.CREATE_ACTION_ENTITY, TARGET_ENTITY_DB);
130 this.create(action.toEntity());
131 ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false);
134 } catch (NoHostAvailableException exception) {
135 logGenericException(exception);
136 throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE, ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
141 public Action updateAction(Action action) {
143 log.debug(" entering updateAction with actionUUID= " + action.getActionUuId());
144 ActionUtil.actionLogPreProcessor(ActionSubOperation.UPDATE_ACTION, TARGET_ENTITY_DB);
145 this.update(action.toEntity());
146 ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false);
148 log.debug(" exit updateAction with actionUUID= " + action.getActionUuId());
150 } catch (NoHostAvailableException exception) {
151 logGenericException(exception);
152 throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE, ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
157 public void deleteAction(String actionInvariantUuId) {
159 log.debug("entering deleteAction with actionInvariantUuId = " + actionInvariantUuId);
160 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION, TARGET_ENTITY_DB);
161 VersionInfoDeletedEntity activeVersionEntity = versionInfoDeletedDao
162 .get(new VersionInfoDeletedEntity(ActionConstants.ACTION_VERSIONABLE_TYPE, actionInvariantUuId));
163 ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false);
166 Version activeVersion = activeVersionEntity.getActiveVersion();
167 Statement getNameFromInvUuId = QueryBuilder.select()
170 .where(eq("actioninvariantuuid", actionInvariantUuId))
171 .and(in(VERSION, activeVersion));
172 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_NAME_BY_ACTIONINVID, TARGET_ENTITY_DB);
173 ResultSet results = getSession().execute(getNameFromInvUuId);
174 ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false);
177 if (!results.isExhausted()) {
178 String name = results.one()
180 List<Version> versions = getVersionsByName(name);
181 updateActionStatusForDelete(actionInvariantUuId, versions);
183 } catch (NoHostAvailableException noHostAvailableException) {
184 logGenericException(noHostAvailableException);
185 throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE, ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
187 log.debug("exit deleteAction");
191 public List<Action> getFilteredActions(String filterType, String filterId) {
192 List<Action> actions = new ArrayList<>();
193 Result<ActionEntity> result = null;
194 log.debug(" entering getFilteredActions By filterType = " + filterType + " With value = " + filterId);
196 switch (filterType) {
197 case FILTER_TYPE_VENDOR:
198 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_VENDOR, TARGET_ENTITY_DB);
199 result = accessor.getActionsByVendor(filterId);
200 ActionUtil.actionLogPostProcessor(COMPLETE);
203 case FILTER_TYPE_CATEGORY:
204 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_CATEGORY, TARGET_ENTITY_DB);
205 result = accessor.getActionsByCategory(filterId);
206 ActionUtil.actionLogPostProcessor(COMPLETE);
209 case FILTER_TYPE_MODEL:
210 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_MODEL, TARGET_ENTITY_DB);
211 result = accessor.getActionsByModel(filterId);
212 ActionUtil.actionLogPostProcessor(COMPLETE);
215 case FILTER_TYPE_OPEN_ECOMP_COMPONENT:
216 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_COMPONENT, TARGET_ENTITY_DB);
217 result = accessor.getActionsByOpenEcompComponent(filterId);
218 ActionUtil.actionLogPostProcessor(COMPLETE);
221 case FILTER_TYPE_NONE:
222 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ALL_ACTIONS, TARGET_ENTITY_DB);
223 result = accessor.getAllActions();
224 ActionUtil.actionLogPostProcessor(COMPLETE);
227 case FILTER_TYPE_NAME:
228 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONINVID_BY_NAME, TARGET_ENTITY_DB);
229 result = accessor.getInvIdByName(filterId);
230 ActionUtil.actionLogPostProcessor(COMPLETE);
232 List<ActionEntity> actionEntities = result.all();
233 if (actionEntities != null && !actionEntities.isEmpty()) {
234 String actionInvariantUuId = actionEntities.get(0)
235 .getActionInvariantUuId();
236 if (actionInvariantUuId != null) {
237 return getActionsByActionInvariantUuId(actionInvariantUuId);
246 if (result != null) {
247 actions.addAll(result.all()
249 .map(ActionEntity::toDto)
250 .collect(Collectors.toList()));
252 log.debug(" exit getFilteredActions By filterType = " + filterType + " With value = " + filterId);
253 } catch (NoHostAvailableException noHostAvailableException) {
254 logGenericException(noHostAvailableException);
255 throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE, ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
261 public Action getActionsByActionUuId(String actionUuId) {
263 log.debug(" entering getActionsByActionUuId with actionUUID= " + actionUuId);
264 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_ACTIONUUID, TARGET_ENTITY_DB);
265 Result<ActionEntity> result = accessor.actionInvariantUuId(actionUuId);
266 ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false);
268 if (result != null) {
269 log.debug(" exit getActionsByActionUuId with actionUUID= " + actionUuId);
270 ActionEntity entity = result.one();
271 if (entity != null) {
272 return entity.toDto();
275 log.debug(" exit getActionsByActionUuId with actionUUID= " + actionUuId);
277 } catch (NoHostAvailableException noHostAvailableException) {
278 logGenericException(noHostAvailableException);
279 throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE, ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
284 public List<OpenEcompComponent> getOpenEcompComponents() {
285 List<OpenEcompComponent> openEcompComponents = new ArrayList<>();
286 Result<OpenEcompComponentEntity> result;
288 log.debug(" entering getOpenEcompComponents ");
289 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_OPEN_ECOMP_COMPONENTS_ENTITY, TARGET_ENTITY_DB);
290 result = accessor.getOpenEcompComponents();
291 ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false);
293 if (result != null) {
294 openEcompComponents.addAll(result.all()
296 .map(OpenEcompComponentEntity::toDto)
297 .collect(Collectors.toList()));
299 } catch (NoHostAvailableException noHostAvailableException) {
300 logGenericException(noHostAvailableException);
301 throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE, 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= " + actionInvariantUuId);
312 Set<Version> viewableVersions = new HashSet<>();
313 VersionPredicate filter = new VersionPredicate();
314 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION, TARGET_ENTITY_DB);
315 VersionInfoEntity versionInfoEntity = versionInfoDao
316 .get(new VersionInfoEntity(ActionConstants.ACTION_VERSIONABLE_TYPE, actionInvariantUuId));
317 if (versionInfoEntity == null) {
318 // Check for action in the Delete version info table
319 VersionInfoDeletedEntity versionInfoDeletedEntity = versionInfoDeletedDao.get(
320 new VersionInfoDeletedEntity(ActionConstants.ACTION_VERSIONABLE_TYPE, 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()
345 MDC.put(TARGET_ENTITY, TARGET_ENTITY_DB);
346 ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false);
349 log.debug("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, TARGET_ENTITY_DB);
355 Result<ActionEntity> result = accessor.getActionsByInvId(actionInvariantUuId,
356 new ArrayList<>(viewableVersions));
357 ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false);
359 if (result != null) {
360 actions.addAll(result.all()
362 .map(ActionEntity::toDto)
363 .collect(Collectors.toList()));
366 } catch (NoHostAvailableException noHostAvailableException) {
367 logGenericException(noHostAvailableException);
368 throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE, ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
370 log.debug(" exit getActionsByActionInvariantUuId with actionInvariantUuId= " + actionInvariantUuId);
375 public Action getLockedAction(String actionInvariantUuId, String user) {
376 log.debug(" entering getLockedAction with actionInvariantUuId= " + actionInvariantUuId);
377 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION, TARGET_ENTITY_DB);
378 Action action = null;
379 VersionInfoEntity versionInfoEntity = versionInfoDao
380 .get(new VersionInfoEntity(ActionConstants.ACTION_VERSIONABLE_TYPE, actionInvariantUuId));
381 ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false);
383 if (versionInfoEntity != null) {
384 if (versionInfoEntity.getCandidate() != null) {
385 String actionUser = versionInfoEntity.getCandidate()
387 if (actionUser != null && actionUser.equals(user)) {
388 Set<Version> versions = new HashSet<>();
389 versions.add(versionInfoEntity.getCandidate()
391 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_ACTIONINVID,
393 Result<ActionEntity> result = accessor.getActionsByInvId(actionInvariantUuId,
394 new ArrayList<>(versions));
395 ActionUtil.actionLogPostProcessor(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(ERROR, ACTION_QUERY_FAILURE_CODE,
416 ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG, false);
418 ActionUtil.actionErrorLogProcessor(CategoryLogLevel.FATAL, ACTION_QUERY_FAILURE_CODE, ACTION_QUERY_FAILURE_MSG);
419 log.error(exception.getMessage());
423 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()
438 private void updateActionStatusForDelete(String actionInvariantUuId, List<Version> versions) {
439 log.debug("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 = QueryBuilder.update("dox", ACTION)
444 .with(set("status", ActionStatus.Deleted.name()))
445 .where(eq("actioninvariantuuid", actionInvariantUuId))
446 .and(in(VERSION, versions));
447 getSession().execute(updateStatusStatement);
448 ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false);
450 // Update the status in the data field of action table
451 updateStatusInActionData(actionInvariantUuId, versions, ActionStatus.Deleted);
452 log.debug("exit updateActionStatusForDelete with actionInvariantUuId = " + actionInvariantUuId + FOR_VERSIONS
457 * Update status for a list of versions for a given action.
459 * @param actionInvariantUuId
460 * Invariant UUID of the action.
462 * List of {@link Version} for which the status has to be
467 private void updateStatusInActionData(String actionInvariantUuId, List<Version> versions, ActionStatus status) {
468 log.debug("entering updateStatusInActionData for actionInvariantUuId = " + actionInvariantUuId
469 + " and status = " + status + FOR_VERSIONS + versions);
470 for (Version v : versions) {
471 ActionEntity entity = this.get(new ActionEntity(actionInvariantUuId, v));
472 String currentData = entity.getData();
473 Map<String, Object> currentDataMap = JsonUtil.json2Object(currentData, LinkedHashMap.class);
474 currentDataMap.put(STATUS, status);
475 String updatedActionData = JsonUtil.object2Json(currentDataMap);
476 entity.setData(updatedActionData);
477 this.updateAction(entity.toDto());
479 log.debug("exit updateStatusInActionData");
483 * Get list of all major and minor version values for a given action by
487 * Name of the action.
488 * @return List of {@link Version} objects for the action.
490 private List<Version> getVersionsByName(String name) {
491 log.debug("entering getVersionsByName for Action Name = " + name);
492 ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION, TARGET_ENTITY_DB);
493 Statement statement = QueryBuilder.select()
496 .where(eq("name", name));
497 ResultSet results = getSession().execute(statement);
498 ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false);
501 List<Version> versionList = new ArrayList<>();
502 for (Row row : results) {
503 Version version = row.get(VERSION, Version.class);
504 versionList.add(version);
506 log.debug("exit getVersionsByName for Action Name = " + name);
511 interface ActionAccessor {
513 @Query("SELECT * FROM Action")
514 Result<ActionEntity> getAllActions();
516 @Query("SELECT * FROM Action where actionInvariantUuId = ? and version in ? ")
517 Result<ActionEntity> getActionsByInvId(String actionInvariantUuId, List<Version> versions);
519 @Query("SELECT * FROM Action where supportedModels CONTAINS ?")
520 Result<ActionEntity> getActionsByModel(String resource);
522 @Query("SELECT * FROM Action where supportedComponents CONTAINS ?")
523 Result<ActionEntity> getActionsByOpenEcompComponent(String resource);
525 @Query("SELECT * FROM Action where vendor_list CONTAINS ?")
526 Result<ActionEntity> getActionsByVendor(String vendor);
528 @Query("SELECT * FROM Action where category_list CONTAINS ?")
529 Result<ActionEntity> getActionsByCategory(String vendor);
531 @Query("SELECT actionInvariantUuId FROM Action where name = ? limit 1")
532 Result<ActionEntity> getInvIdByName(String name);
534 @Query("SELECT * FROM EcompComponent")
535 Result<OpenEcompComponentEntity> getOpenEcompComponents();
537 @Query("SELECT * FROM Action where actionUUID = ?")
538 Result<ActionEntity> actionInvariantUuId(String actionUuId);
542 class VersionPredicate {
543 Version activeVersion;
544 Version finalVersion;
546 public boolean isIntermediateMinorVersion(Version version) {
547 int activeMajorVersion = activeVersion.getMajor();
548 int activeMinorVersion = activeVersion.getMinor();
549 int currentMinorVersion = version.getMinor();
550 int currentMajorVersion = version.getMajor();
552 if (finalVersion != null) {
553 if (finalVersion.getMajor() == activeMajorVersion && currentMajorVersion == finalVersion.getMajor()) {
554 if (currentMinorVersion < activeMinorVersion && currentMinorVersion != 0) {
561 if (!version.equals(activeVersion)) {