diff options
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-action-lib')
-rw-r--r-- | openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoImpl.java | 93 |
1 files changed, 45 insertions, 48 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoImpl.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoImpl.java index a79687f9a4..5b7e1b2c8e 100644 --- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoImpl.java +++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoImpl.java @@ -1,25 +1,45 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ +/* + * Copyright © 2016-2018 European Support Limited + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * ============LICENSE_END========================================================= */ package org.openecomp.sdc.action.dao.impl; +import static com.datastax.driver.core.querybuilder.QueryBuilder.eq; +import static com.datastax.driver.core.querybuilder.QueryBuilder.in; +import static com.datastax.driver.core.querybuilder.QueryBuilder.set; +import static org.openecomp.core.nosqldb.impl.cassandra.CassandraSessionFactory.getSession; +import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_CATEGORY; +import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_MODEL; +import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_NAME; +import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_NONE; +import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_OPEN_ECOMP_COMPONENT; +import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_VENDOR; +import static org.openecomp.sdc.action.ActionConstants.STATUS; +import static org.openecomp.sdc.action.ActionConstants.TARGET_ENTITY; +import static org.openecomp.sdc.action.ActionConstants.TARGET_ENTITY_DB; +import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ARTIFACT_DEL_LOCKED_OTHER_USER; +import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ARTIFACT_DEL_LOCKED_OTHER_USER_CODE; +import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG; +import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ENTITY_NOT_EXIST; +import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ENTITY_NOT_EXIST_CODE; +import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_INTERNAL_SERVER_ERR_CODE; +import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_NOT_LOCKED_CODE; +import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_NOT_LOCKED_MSG; +import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_QUERY_FAILURE_CODE; +import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_QUERY_FAILURE_MSG; + import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Row; import com.datastax.driver.core.Statement; @@ -31,6 +51,14 @@ import com.datastax.driver.mapping.Result; import com.datastax.driver.mapping.UDTMapper; import com.datastax.driver.mapping.annotations.Accessor; import com.datastax.driver.mapping.annotations.Query; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; import org.openecomp.core.dao.impl.CassandraBaseDao; import org.openecomp.core.nosqldb.api.NoSqlDb; import org.openecomp.core.nosqldb.factory.NoSqlDbFactory; @@ -49,7 +77,7 @@ import org.openecomp.sdc.action.types.OpenEcompComponent; import org.openecomp.sdc.action.util.ActionUtil; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; -import org.openecomp.sdc.versioning.VersioningManagerFactory; +import org.openecomp.sdc.versioning.ActionVersioningManagerFactory; import org.openecomp.sdc.versioning.dao.VersionInfoDao; import org.openecomp.sdc.versioning.dao.VersionInfoDaoFactory; import org.openecomp.sdc.versioning.dao.VersionInfoDeletedDao; @@ -60,39 +88,6 @@ import org.openecomp.sdc.versioning.dao.types.VersionInfoEntity; import org.openecomp.sdc.versioning.types.VersionableEntityMetadata; import org.slf4j.MDC; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - -import static com.datastax.driver.core.querybuilder.QueryBuilder.eq; -import static com.datastax.driver.core.querybuilder.QueryBuilder.in; -import static com.datastax.driver.core.querybuilder.QueryBuilder.set; -import static org.openecomp.core.nosqldb.impl.cassandra.CassandraSessionFactory.getSession; -import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_CATEGORY; -import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_MODEL; -import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_NAME; -import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_NONE; -import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_OPEN_ECOMP_COMPONENT; -import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_VENDOR; -import static org.openecomp.sdc.action.ActionConstants.STATUS; -import static org.openecomp.sdc.action.ActionConstants.TARGET_ENTITY; -import static org.openecomp.sdc.action.ActionConstants.TARGET_ENTITY_DB; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ARTIFACT_DEL_LOCKED_OTHER_USER; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ARTIFACT_DEL_LOCKED_OTHER_USER_CODE; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ENTITY_NOT_EXIST; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ENTITY_NOT_EXIST_CODE; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_INTERNAL_SERVER_ERR_CODE; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_NOT_LOCKED_CODE; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_NOT_LOCKED_MSG; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_QUERY_FAILURE_CODE; -import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_QUERY_FAILURE_MSG; - public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements ActionDao { private static NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface(); @@ -111,7 +106,7 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act @Override public void registerVersioning(String versionableEntityType) { - VersioningManagerFactory.getInstance().createInterface() + ActionVersioningManagerFactory.getInstance().createInterface() .register(versionableEntityType, new VersionableEntityMetadata( mapper.getTableMetadata().getName(), mapper.getTableMetadata().getPartitionKey().get(0).getName(), @@ -292,13 +287,15 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act try { log.debug(" entering getOpenEcompComponents "); ActionUtil - .actionLogPreProcessor(ActionSubOperation.GET_OPEN_ECOMP_COMPONENTS_ENTITY, TARGET_ENTITY_DB); + .actionLogPreProcessor(ActionSubOperation.GET_OPEN_ECOMP_COMPONENTS_ENTITY, + TARGET_ENTITY_DB); result = accessor.getOpenEcompComponents(); ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false); log.metrics(""); if (result != null) { openEcompComponents.addAll( - result.all().stream().map(OpenEcompComponentEntity::toDto).collect(Collectors.toList())); + result.all().stream().map(OpenEcompComponentEntity::toDto) + .collect(Collectors.toList())); } } catch (NoHostAvailableException noHostAvailableException) { logGenericException(noHostAvailableException); @@ -479,7 +476,7 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act private void updateStatusInActionData(String actionInvariantUuId, List<Version> versions, ActionStatus status) { log.debug("entering updateStatusInActionData for actionInvariantUuId = " + actionInvariantUuId - + " and status = " + status + " for versions " + versions); + + " and status = " + status + " for versions " + versions); for (Version v : versions) { ActionEntity entity = this.get(new ActionEntity(actionInvariantUuId, v)); String currentData = entity.getData(); |