diff options
author | talig <talig@amdocs.com> | 2018-06-11 12:28:33 +0300 |
---|---|---|
committer | talig <talig@amdocs.com> | 2018-06-11 12:28:43 +0300 |
commit | 4dc878ccce1219a78cd64c3bdaee78421c68d11d (patch) | |
tree | f03b35d0c3ed9ed87c38de66f2ed4ed459044ba9 /openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src | |
parent | 907753f90f876574efdc4c4153ef7516e0bcf8b3 (diff) |
Upgrade datastax cassandra driver to 3.4.0
Upgrage zusammen to 1.0.0 which uses datastax cassandra driver 3.4.0
Change-Id: Ie7217986b67cd95de015daedd0f7106c2d0a972d
Issue-ID: SDC-1416
Signed-off-by: talig <talig@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src')
3 files changed, 3 insertions, 109 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionHistoryCassandraDaoImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionHistoryCassandraDaoImpl.java deleted file mode 100644 index b364da0772..0000000000 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionHistoryCassandraDaoImpl.java +++ /dev/null @@ -1,70 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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 - * - * 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.versioning.dao.impl; - -import com.datastax.driver.core.UDTValue; -import com.datastax.driver.mapping.Mapper; -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 org.openecomp.core.dao.impl.CassandraBaseDao; -import org.openecomp.core.nosqldb.api.NoSqlDb; -import org.openecomp.core.nosqldb.factory.NoSqlDbFactory; -import org.openecomp.sdc.versioning.dao.VersionHistoryDao; -import org.openecomp.sdc.versioning.dao.types.VersionHistoryEntity; -import org.openecomp.sdc.versioning.dao.types.VersionableEntityId; - -import java.util.Collection; - -public class VersionHistoryCassandraDaoImpl extends CassandraBaseDao<VersionHistoryEntity> - implements - VersionHistoryDao { - - private static NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface(); - private static Mapper<VersionHistoryEntity> mapper = - noSqlDb.getMappingManager().mapper(VersionHistoryEntity.class); - private static VersionHistoryAccessor accessor = - noSqlDb.getMappingManager().createAccessor(VersionHistoryAccessor.class); - private static UDTMapper<VersionableEntityId> versionedEntityIdMapper = - noSqlDb.getMappingManager().udtMapper(VersionableEntityId.class); - - @Override - protected Mapper<VersionHistoryEntity> getMapper() { - return mapper; - } - - @Override - protected Object[] getKeys(VersionHistoryEntity entity) { - return new Object[]{versionedEntityIdMapper.toUDT(entity.getEntityId())}; - } - - @Override - public Collection<VersionHistoryEntity> list(VersionHistoryEntity entity) { - return accessor.getAll(versionedEntityIdMapper.toUDT(entity.getEntityId())).all(); - } - - @Accessor - interface VersionHistoryAccessor { - @Query("select * from version_history where entity_id=?") - Result<VersionHistoryEntity> getAll(UDTValue entityId); - } -} diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionHistoryDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionHistoryDaoFactoryImpl.java deleted file mode 100644 index ac1c7e9634..0000000000 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionHistoryDaoFactoryImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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 - * - * 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.versioning.dao.impl; - -import org.openecomp.sdc.versioning.dao.VersionHistoryDao; -import org.openecomp.sdc.versioning.dao.VersionHistoryDaoFactory; - -public class VersionHistoryDaoFactoryImpl extends VersionHistoryDaoFactory { - private static final VersionHistoryDao INSTANCE = new VersionHistoryCassandraDaoImpl(); - - @Override - public VersionHistoryDao createInterface() { - return INSTANCE; - } -} diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoCassandraImpl.java index 0a14c7ae19..19c62ab43c 100644 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoCassandraImpl.java +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoCassandraImpl.java @@ -23,7 +23,6 @@ package org.openecomp.sdc.versioning.dao.impl; import com.datastax.driver.core.ColumnDefinitions; import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Row; -import com.datastax.driver.mapping.UDTMapper; import org.openecomp.core.dao.UniqueValueDao; import org.openecomp.core.nosqldb.api.NoSqlDb; import org.openecomp.core.nosqldb.factory.NoSqlDbFactory; @@ -49,8 +48,6 @@ class VersionableEntityDaoCassandraImpl implements VersionableEntityDao { private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface(); private static Logger Logger = (Logger) LoggerFactory.getLogger(VersionableEntityDaoCassandraImpl.class); - private static UDTMapper<Version> versionMapper = - noSqlDb.getMappingManager().udtMapper(Version.class); public VersionableEntityDaoCassandraImpl( UniqueValueDao uniqueValueDao) { @@ -88,7 +85,7 @@ class VersionableEntityDaoCassandraImpl implements VersionableEntityDao { for (String columnName : columnNames) { if (metadata.getVersionIdentifierName().equals(columnName)) { - columnValues.add(versionMapper.toUDT(newVersion)); + columnValues.add(newVersion); columnNameToValue.put(columnName, newVersion.toString()); } else { Object value = row.getObject(columnName); @@ -110,7 +107,7 @@ class VersionableEntityDaoCassandraImpl implements VersionableEntityDao { String deleteCql = String.format("delete from %s where %s=? and %s=?", metadata.getName(), metadata.getIdentifierName(), metadata.getVersionIdentifierName()); - noSqlDb.execute(deleteCql, entityId, versionMapper.toUDT(versionToDelete)); + noSqlDb.execute(deleteCql, entityId, versionToDelete); } @Override @@ -127,7 +124,7 @@ class VersionableEntityDaoCassandraImpl implements VersionableEntityDao { Logger.debug("entityId", entityId); Logger.debug("version", version); - return noSqlDb.execute(selectCql, entityId, versionMapper.toUDT(version)); + return noSqlDb.execute(selectCql, entityId, version); } private void initRowUniqueValues(List<UniqueValueMetadata> metadata, |