aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-versioning-lib
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2021-03-22 15:33:06 +0000
committerChristophe Closset <christophe.closset@intl.att.com>2021-03-24 06:59:47 +0000
commitd378c37fbd1ecec7b43394926f1ca32a695e07de (patch)
tree5c8a085f8732f980d871d966ac49361644efa698 /openecomp-be/lib/openecomp-sdc-versioning-lib
parenta6ae7294ecd336d7e88f915710b08e2658eaee00 (diff)
Reformat openecomp-be
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Issue-ID: SDC-3449 Change-Id: I13e02322f8e00820cc5a1d85752caaeda9bf10d1
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-versioning-lib')
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ActionVersioningManager.java52
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ActionVersioningManagerFactory.java10
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/AsdcItemManager.java1
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/AsdcItemManagerFactory.java7
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ItemManager.java25
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ItemManagerFactory.java7
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningManager.java27
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningManagerFactory.java11
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningNotificationConstansts.java1
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningUtil.java271
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/ItemDao.java14
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/ItemDaoFactory.java8
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionDao.java23
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionDaoFactory.java8
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionInfoDao.java5
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionInfoDaoFactory.java12
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionInfoDeletedDao.java5
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionInfoDeletedDaoFactory.java16
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionableDao.java8
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionableEntityDao.java14
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionableEntityDaoFactory.java17
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/Revision.java11
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/SynchronizationState.java19
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/UserCandidateVersion.java13
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/Version.java223
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionHistoryEntity.java33
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionInfoDeletedEntity.java63
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionInfoEntity.java62
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionState.java5
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionStatus.java12
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionType.java10
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionableEntity.java27
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionableEntityId.java10
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/CheckinOnEntityLockedByOtherErrorBuilder.java36
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/CheckinOnUnlockedEntityErrorBuilder.java31
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/CheckoutOnLockedEntityErrorBuilder.java38
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/DeleteOnLockedEntityErrorBuilder.java35
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EditOnEntityLockedByOtherErrorBuilder.java36
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EditOnUnlockedEntityErrorBuilder.java39
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EntityAlreadyExistErrorBuilder.java31
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EntityAlreadyFinalizedErrorBuilder.java33
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EntityNotExistErrorBuilder.java31
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/RequestedVersionInvalidErrorBuilder.java25
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/RevisionIdNotFoundErrorBuilder.java22
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/SubmitLockedEntityNotAllowedErrorBuilder.java36
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnEntityLockedByOtherErrorBuilder.java38
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnUnlockedEntityErrorBuilder.java31
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/VersionableSubEntityNotFoundErrorBuilder.java83
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/VersioningErrorCodes.java44
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/Item.java61
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/ItemStatus.java5
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/NotificationEventTypes.java7
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/UniqueValueMetadata.java12
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionCreationMethod.java8
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionInfo.java47
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionableEntityAction.java10
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionableEntityMetadata.java40
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionableEntityStoreType.java5
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/VersionCalculator.java8
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/VersionCalculatorFactory.java7
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/ItemDaoFactoryImpl.java13
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionDaoFactoryImpl.java13
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionInfoDaoFactoryImpl.java12
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionInfoDaoImpl.java61
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionInfoDeletedDaoFactoryImpl.java17
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionInfoDeletedDaoImpl.java54
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoCassandraImpl.java203
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoFactoryImpl.java43
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoZusammenImpl.java79
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/zusammen/ItemZusammenDaoImpl.java180
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/zusammen/VersionZusammenDaoImpl.java312
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/zusammen/convertor/ItemVersionToVersionConvertor.java57
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ActionVersioningManagerFactoryImpl.java17
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ActionVersioningManagerImpl.java1057
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/AsdcItemManagerFactoryImpl.java16
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/AsdcItemManagerImpl.java67
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ItemManagerFactoryImpl.java13
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ItemManagerImpl.java141
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/MajorVersionCalculatorFactoryImpl.java12
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/MajorVersionCalculatorImpl.java69
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersionCalculatorFactoryImpl.java13
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersionCalculatorImpl.java97
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersioningManagerFactoryImpl.java14
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersioningManagerImpl.java285
84 files changed, 2124 insertions, 2550 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ActionVersioningManager.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ActionVersioningManager.java
index 4f3a756baf..5c27ef3fbf 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ActionVersioningManager.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ActionVersioningManager.java
@@ -13,9 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.versioning;
+import java.util.List;
+import java.util.Map;
import org.openecomp.sdc.versioning.dao.types.Revision;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.types.VersionCreationMethod;
@@ -23,54 +24,45 @@ import org.openecomp.sdc.versioning.types.VersionInfo;
import org.openecomp.sdc.versioning.types.VersionableEntityAction;
import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
-import java.util.List;
-import java.util.Map;
-
public interface ActionVersioningManager {
- void register(String entityType, VersionableEntityMetadata entityMetadata);
-
- Version create(String entityType, String entityId, String user);
-
- void delete(String entityType, String entityId, String user);
+ void register(String entityType, VersionableEntityMetadata entityMetadata);
- void undoDelete(String entityType, String entityId, String user);
+ Version create(String entityType, String entityId, String user);
- Version checkout(String entityType, String entityId, String user);
+ void delete(String entityType, String entityId, String user);
- Version undoCheckout(String entityType, String entityId, String user);
+ void undoDelete(String entityType, String entityId, String user);
- Version checkin(String entityType, String entityId, String user, String checkinDescription);
+ Version checkout(String entityType, String entityId, String user);
- Version submit(String entityType, String entityId, String user, String submitDescription);
+ Version undoCheckout(String entityType, String entityId, String user);
- VersionInfo getEntityVersionInfo(String entityType, String entityId, String user,
- VersionableEntityAction action);
+ Version checkin(String entityType, String entityId, String user, String checkinDescription);
- Map<String, VersionInfo> listEntitiesVersionInfo(String entityType, String user,
- VersionableEntityAction action);
+ Version submit(String entityType, String entityId, String user, String submitDescription);
- Map<String, VersionInfo> listDeletedEntitiesVersionInfo(String entityType, String user,
- VersionableEntityAction action);
+ VersionInfo getEntityVersionInfo(String entityType, String entityId, String user, VersionableEntityAction action);
+ Map<String, VersionInfo> listEntitiesVersionInfo(String entityType, String user, VersionableEntityAction action);
- List<Version> list(String itemId); // TODO: 5/24/2017 filter (by status for example)
+ Map<String, VersionInfo> listDeletedEntitiesVersionInfo(String entityType, String user, VersionableEntityAction action);
- Version get(String itemId, Version version);
+ List<Version> list(String itemId); // TODO: 5/24/2017 filter (by status for example)
- Version create(String itemId, Version version,
- VersionCreationMethod creationMethod);
+ Version get(String itemId, Version version);
- void submit(String itemId, Version version, String submitDescription);
+ Version create(String itemId, Version version, VersionCreationMethod creationMethod);
- void publish(String itemId, Version version, String message);
+ void submit(String itemId, Version version, String submitDescription);
- void sync(String itemId, Version version);
+ void publish(String itemId, Version version, String message);
- void forceSync(String itemId, Version version);
+ void sync(String itemId, Version version);
- void revert(String itemId, Version version, String revisionId);
+ void forceSync(String itemId, Version version);
- List<Revision> listRevisions(String itemId, Version version);
+ void revert(String itemId, Version version, String revisionId);
+ List<Revision> listRevisions(String itemId, Version version);
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ActionVersioningManagerFactory.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ActionVersioningManagerFactory.java
index 4ab659ac11..7fd8ba2d19 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ActionVersioningManagerFactory.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ActionVersioningManagerFactory.java
@@ -13,16 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.versioning;
import org.openecomp.core.factory.api.AbstractComponentFactory;
import org.openecomp.core.factory.api.AbstractFactory;
-public abstract class ActionVersioningManagerFactory extends
- AbstractComponentFactory<ActionVersioningManager> {
+public abstract class ActionVersioningManagerFactory extends AbstractComponentFactory<ActionVersioningManager> {
- public static ActionVersioningManagerFactory getInstance() {
- return AbstractFactory.getInstance(ActionVersioningManagerFactory.class);
- }
+ public static ActionVersioningManagerFactory getInstance() {
+ return AbstractFactory.getInstance(ActionVersioningManagerFactory.class);
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/AsdcItemManager.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/AsdcItemManager.java
index ad3d1f304c..0762be259e 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/AsdcItemManager.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/AsdcItemManager.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.versioning;
public interface AsdcItemManager extends ItemManager {
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/AsdcItemManagerFactory.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/AsdcItemManagerFactory.java
index a2095b8663..4deae0058a 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/AsdcItemManagerFactory.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/AsdcItemManagerFactory.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.versioning;
import org.openecomp.core.factory.api.AbstractComponentFactory;
@@ -21,7 +20,7 @@ import org.openecomp.core.factory.api.AbstractFactory;
public abstract class AsdcItemManagerFactory extends AbstractComponentFactory<AsdcItemManager> {
- public static AsdcItemManagerFactory getInstance() {
- return AbstractFactory.getInstance(AsdcItemManagerFactory.class);
- }
+ public static AsdcItemManagerFactory getInstance() {
+ return AbstractFactory.getInstance(AsdcItemManagerFactory.class);
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ItemManager.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ItemManager.java
index 1ab6b4fc08..3e0005d6ce 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ItemManager.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ItemManager.java
@@ -13,33 +13,30 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.versioning;
-import org.openecomp.sdc.versioning.dao.types.VersionStatus;
-import org.openecomp.sdc.versioning.types.Item;
-
import java.util.Collection;
import java.util.function.Predicate;
+import org.openecomp.sdc.versioning.dao.types.VersionStatus;
+import org.openecomp.sdc.versioning.types.Item;
public interface ItemManager {
- Collection<Item> list(Predicate<Item> predicate);
+ Collection<Item> list(Predicate<Item> predicate);
- Item get(String itemId);
+ Item get(String itemId);
- Item create(Item item);
+ Item create(Item item);
- void updateVersionStatus(String itemId, VersionStatus addedVersionStatus,
- VersionStatus removedVersionStatus);
+ void updateVersionStatus(String itemId, VersionStatus addedVersionStatus, VersionStatus removedVersionStatus);
- void archive(Item item);
+ void archive(Item item);
- void restore(Item item);
+ void restore(Item item);
- void delete(Item item);
+ void delete(Item item);
- void updateName(String itemId, String name);
+ void updateName(String itemId, String name);
- void update(Item item);
+ void update(Item item);
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ItemManagerFactory.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ItemManagerFactory.java
index 314ffceadb..fd55b0490c 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ItemManagerFactory.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ItemManagerFactory.java
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning;
import org.openecomp.core.factory.api.AbstractComponentFactory;
@@ -25,7 +24,7 @@ import org.openecomp.core.factory.api.AbstractFactory;
public abstract class ItemManagerFactory extends AbstractComponentFactory<ItemManager> {
- public static ItemManagerFactory getInstance() {
- return AbstractFactory.getInstance(ItemManagerFactory.class);
- }
+ public static ItemManagerFactory getInstance() {
+ return AbstractFactory.getInstance(ItemManagerFactory.class);
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningManager.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningManager.java
index 8d96297380..4e764dd411 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningManager.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningManager.java
@@ -13,37 +13,34 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.versioning;
+import java.util.List;
import org.openecomp.sdc.versioning.dao.types.Revision;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.types.VersionCreationMethod;
-import java.util.List;
-
public interface VersioningManager {
- List<Version> list(String itemId); // TODO: 5/24/2017 filter (by status for example)
+ List<Version> list(String itemId); // TODO: 5/24/2017 filter (by status for example)
- Version get(String itemId, Version version);
+ Version get(String itemId, Version version);
- Version create(String itemId, Version version,
- VersionCreationMethod creationMethod);
+ Version create(String itemId, Version version, VersionCreationMethod creationMethod);
- void submit(String itemId, Version version, String submitDescription);
+ void submit(String itemId, Version version, String submitDescription);
- void publish(String itemId, Version version, String message);
+ void publish(String itemId, Version version, String message);
- void sync(String itemId, Version version);
+ void sync(String itemId, Version version);
- void forceSync(String itemId, Version version);
+ void forceSync(String itemId, Version version);
- void revert(String itemId, Version version, String revisionId);
+ void revert(String itemId, Version version, String revisionId);
- List<Revision> listRevisions(String itemId, Version version);
+ List<Revision> listRevisions(String itemId, Version version);
- void updateVersion(String itemId, Version version);
+ void updateVersion(String itemId, Version version);
- void clean(String itemId, Version version);
+ void clean(String itemId, Version version);
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningManagerFactory.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningManagerFactory.java
index 089777bbe6..b0cf94355c 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningManagerFactory.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningManagerFactory.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning;
import org.openecomp.core.factory.api.AbstractComponentFactory;
@@ -25,7 +24,7 @@ import org.openecomp.core.factory.api.AbstractFactory;
public abstract class VersioningManagerFactory extends AbstractComponentFactory<VersioningManager> {
- public static VersioningManagerFactory getInstance() {
- return AbstractFactory.getInstance(VersioningManagerFactory.class);
- }
+ public static VersioningManagerFactory getInstance() {
+ return AbstractFactory.getInstance(VersioningManagerFactory.class);
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningNotificationConstansts.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningNotificationConstansts.java
index 1e5efb244e..27219ce1a4 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningNotificationConstansts.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningNotificationConstansts.java
@@ -24,6 +24,7 @@ package org.openecomp.sdc.versioning;
* @since July 10, 2017
*/
public class VersioningNotificationConstansts {
+
public static final String ITEM_NAME = "itemName";
public static final String ITEM_ID = "itemId";
public static final String SUBMIT_DESCRIPTION = "description";
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningUtil.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningUtil.java
index 7411edec08..52da00c0d1 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningUtil.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningUtil.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,9 +17,12 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
import org.openecomp.core.dao.BaseDao;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.versioning.dao.types.Version;
@@ -29,168 +32,136 @@ import org.openecomp.sdc.versioning.errors.RequestedVersionInvalidErrorBuilder;
import org.openecomp.sdc.versioning.errors.VersionableSubEntityNotFoundErrorBuilder;
import org.openecomp.sdc.versioning.types.VersionInfo;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
-
/**
* The type Versioning util.
*/
public class VersioningUtil {
- private VersioningUtil() {
- // prevent instantiation
- }
-
- /**
- * Validate entity existence.
- *
- * @param <T> the type parameter
- * @param retrievedEntity the retrieved entity
- * @param inputEntity the input entity
- * @param firstClassCitizenType the first class citizen type
- */
- public static <T extends VersionableEntity> void validateEntityExistence(Object retrievedEntity,
- T inputEntity,
- String firstClassCitizenType) {
- if (retrievedEntity == null) {
- throw new CoreException(new VersionableSubEntityNotFoundErrorBuilder(
- inputEntity.getEntityType(),
- inputEntity.getId(),
- firstClassCitizenType,
- inputEntity.getFirstClassCitizenId(),
- inputEntity.getVersion()).build());
+ private VersioningUtil() {
+ // prevent instantiation
}
- }
- /**
- * Validate entities existence.
- *
- * @param <T> the type parameter
- * @param <D> the type parameter
- * @param entityIds the entity ids
- * @param entity the entity
- * @param entityDao the entity dao
- * @param firstClassCitizenType the first class citizen type
- */
- public static <T extends VersionableEntity, D extends BaseDao<T>> void validateEntitiesExistence(
- Set<String> entityIds, T entity, D entityDao, String firstClassCitizenType) {
- if (entityIds == null) {
- return;
- }
-
- List<String> nonExistingIds = new ArrayList<>();
- for (String entityId : entityIds) {
- entity.setId(entityId);
- if (entityDao.get(entity) == null) {
- nonExistingIds.add(entityId);
- }
- }
-
- if (!nonExistingIds.isEmpty()) {
- if (nonExistingIds.size() == 1) {
- throw new CoreException(new VersionableSubEntityNotFoundErrorBuilder(
- entity.getEntityType(),
- nonExistingIds.get(0),
- firstClassCitizenType,
- entity.getFirstClassCitizenId(),
- entity.getVersion()).build());
- }
- throw new CoreException(new VersionableSubEntityNotFoundErrorBuilder(
- entity.getEntityType(),
- nonExistingIds,
- firstClassCitizenType,
- entity.getFirstClassCitizenId(),
- entity.getVersion()).build());
+ /**
+ * Validate entity existence.
+ *
+ * @param <T> the type parameter
+ * @param retrievedEntity the retrieved entity
+ * @param inputEntity the input entity
+ * @param firstClassCitizenType the first class citizen type
+ */
+ public static <T extends VersionableEntity> void validateEntityExistence(Object retrievedEntity, T inputEntity, String firstClassCitizenType) {
+ if (retrievedEntity == null) {
+ throw new CoreException(
+ new VersionableSubEntityNotFoundErrorBuilder(inputEntity.getEntityType(), inputEntity.getId(), firstClassCitizenType,
+ inputEntity.getFirstClassCitizenId(), inputEntity.getVersion()).build());
+ }
}
- }
- /**
- * Validate contained entities existence.
- *
- * @param <T> the type parameter
- * @param containedEntityType the contained entity type
- * @param inputContainedEntityIds the input contained entity ids
- * @param containingEntity the containing entity
- * @param retrievedContainedEntityIds the retrieved contained entity ids
- */
- public static <T extends VersionableEntity> void validateContainedEntitiesExistence(
- String containedEntityType, Set<String> inputContainedEntityIds, T containingEntity,
- Set<String> retrievedContainedEntityIds) {
- if (inputContainedEntityIds == null) {
- return;
+ /**
+ * Validate entities existence.
+ *
+ * @param <T> the type parameter
+ * @param <D> the type parameter
+ * @param entityIds the entity ids
+ * @param entity the entity
+ * @param entityDao the entity dao
+ * @param firstClassCitizenType the first class citizen type
+ */
+ public static <T extends VersionableEntity, D extends BaseDao<T>> void validateEntitiesExistence(Set<String> entityIds, T entity, D entityDao,
+ String firstClassCitizenType) {
+ if (entityIds == null) {
+ return;
+ }
+ List<String> nonExistingIds = new ArrayList<>();
+ for (String entityId : entityIds) {
+ entity.setId(entityId);
+ if (entityDao.get(entity) == null) {
+ nonExistingIds.add(entityId);
+ }
+ }
+ if (!nonExistingIds.isEmpty()) {
+ if (nonExistingIds.size() == 1) {
+ throw new CoreException(
+ new VersionableSubEntityNotFoundErrorBuilder(entity.getEntityType(), nonExistingIds.get(0), firstClassCitizenType,
+ entity.getFirstClassCitizenId(), entity.getVersion()).build());
+ }
+ throw new CoreException(new VersionableSubEntityNotFoundErrorBuilder(entity.getEntityType(), nonExistingIds, firstClassCitizenType,
+ entity.getFirstClassCitizenId(), entity.getVersion()).build());
+ }
}
- List<String> nonExistingIds = inputContainedEntityIds.stream()
- .filter(entityId -> !retrievedContainedEntityIds.contains(entityId))
- .collect(Collectors.toList());
-
- if (!nonExistingIds.isEmpty()) {
- if (nonExistingIds.size() == 1) {
- throw new CoreException(new VersionableSubEntityNotFoundErrorBuilder(
- containedEntityType,
- nonExistingIds.get(0),
- containingEntity.getEntityType(),
- containingEntity.getId(),
- containingEntity.getVersion()).build());
- }
- throw new CoreException(new VersionableSubEntityNotFoundErrorBuilder(
- containedEntityType,
- nonExistingIds,
- containingEntity.getEntityType(),
- containingEntity.getId(),
- containingEntity.getVersion()).build());
+ /**
+ * Validate contained entities existence.
+ *
+ * @param <T> the type parameter
+ * @param containedEntityType the contained entity type
+ * @param inputContainedEntityIds the input contained entity ids
+ * @param containingEntity the containing entity
+ * @param retrievedContainedEntityIds the retrieved contained entity ids
+ */
+ public static <T extends VersionableEntity> void validateContainedEntitiesExistence(String containedEntityType,
+ Set<String> inputContainedEntityIds, T containingEntity,
+ Set<String> retrievedContainedEntityIds) {
+ if (inputContainedEntityIds == null) {
+ return;
+ }
+ List<String> nonExistingIds = inputContainedEntityIds.stream().filter(entityId -> !retrievedContainedEntityIds.contains(entityId))
+ .collect(Collectors.toList());
+ if (!nonExistingIds.isEmpty()) {
+ if (nonExistingIds.size() == 1) {
+ throw new CoreException(
+ new VersionableSubEntityNotFoundErrorBuilder(containedEntityType, nonExistingIds.get(0), containingEntity.getEntityType(),
+ containingEntity.getId(), containingEntity.getVersion()).build());
+ }
+ throw new CoreException(
+ new VersionableSubEntityNotFoundErrorBuilder(containedEntityType, nonExistingIds, containingEntity.getEntityType(),
+ containingEntity.getId(), containingEntity.getVersion()).build());
+ }
}
- }
- /**
- * Resolve version version.
- *
- * @param requestedVersion the requested version
- * @param versionInfo the version info
- * @param finalOnly the final only
- * @return the version
- */
- public static Version resolveVersion(Version requestedVersion, VersionInfo versionInfo,
- boolean finalOnly) {
- if (requestedVersion == null) {
- if (finalOnly) {
- if (versionInfo.getLatestFinalVersion() == null) {
- throw new CoreException(new RequestedVersionInvalidErrorBuilder().build());
+ /**
+ * Resolve version version.
+ *
+ * @param requestedVersion the requested version
+ * @param versionInfo the version info
+ * @param finalOnly the final only
+ * @return the version
+ */
+ public static Version resolveVersion(Version requestedVersion, VersionInfo versionInfo, boolean finalOnly) {
+ if (requestedVersion == null) {
+ if (finalOnly) {
+ if (versionInfo.getLatestFinalVersion() == null) {
+ throw new CoreException(new RequestedVersionInvalidErrorBuilder().build());
+ }
+ requestedVersion = versionInfo.getLatestFinalVersion();
+ } else {
+ requestedVersion = versionInfo.getActiveVersion();
+ }
+ } else {
+ if ((finalOnly && !requestedVersion.isFinal()) || !versionInfo.getViewableVersions().contains(requestedVersion)) {
+ throw new CoreException(new RequestedVersionInvalidErrorBuilder().build());
+ }
}
- requestedVersion = versionInfo.getLatestFinalVersion();
- } else {
- requestedVersion = versionInfo.getActiveVersion();
- }
- } else {
- if ((finalOnly && !requestedVersion.isFinal())
- || !versionInfo.getViewableVersions().contains(requestedVersion)) {
- throw new CoreException(new RequestedVersionInvalidErrorBuilder().build());
- }
+ return requestedVersion;
}
- return requestedVersion;
- }
- /**
- * Resolve version.
- *
- * @param requestedVersion the requested version
- * @param versionInfo the version info
- * @return the version
- */
- public static Version resolveVersion(Version requestedVersion, VersionInfo versionInfo,
- String user) {
- if (requestedVersion == null) {
- requestedVersion = versionInfo.getActiveVersion();
- }
- if (versionInfo.getActiveVersion().equals(requestedVersion)
- && user.equals(versionInfo.getLockingUser())) {
- requestedVersion.setStatus(VersionStatus.Locked);
- }
- if (!versionInfo.getViewableVersions().contains(requestedVersion)) {
- throw new CoreException(new RequestedVersionInvalidErrorBuilder().build());
+ /**
+ * Resolve version.
+ *
+ * @param requestedVersion the requested version
+ * @param versionInfo the version info
+ * @return the version
+ */
+ public static Version resolveVersion(Version requestedVersion, VersionInfo versionInfo, String user) {
+ if (requestedVersion == null) {
+ requestedVersion = versionInfo.getActiveVersion();
+ }
+ if (versionInfo.getActiveVersion().equals(requestedVersion) && user.equals(versionInfo.getLockingUser())) {
+ requestedVersion.setStatus(VersionStatus.Locked);
+ }
+ if (!versionInfo.getViewableVersions().contains(requestedVersion)) {
+ throw new CoreException(new RequestedVersionInvalidErrorBuilder().build());
+ }
+ return requestedVersion;
}
- return requestedVersion;
- }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/ItemDao.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/ItemDao.java
index d1db91d670..17b047cdca 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/ItemDao.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/ItemDao.java
@@ -19,18 +19,18 @@
*/
package org.openecomp.sdc.versioning.dao;
-import org.openecomp.sdc.versioning.types.Item;
-
import java.util.Collection;
+import org.openecomp.sdc.versioning.types.Item;
public interface ItemDao {
- Collection<Item> list();
- Item get(Item item);
+ Collection<Item> list();
+
+ Item get(Item item);
- Item create(Item item);
+ Item create(Item item);
- void delete(Item item);
+ void delete(Item item);
- void update(Item item);
+ void update(Item item);
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/ItemDaoFactory.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/ItemDaoFactory.java
index 36edaa9aa9..69f6c03575 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/ItemDaoFactory.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/ItemDaoFactory.java
@@ -17,14 +17,14 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.dao;
import org.openecomp.core.factory.api.AbstractComponentFactory;
import org.openecomp.core.factory.api.AbstractFactory;
public abstract class ItemDaoFactory extends AbstractComponentFactory<ItemDao> {
- public static ItemDaoFactory getInstance() {
- return AbstractFactory.getInstance(ItemDaoFactory.class);
- }
+
+ public static ItemDaoFactory getInstance() {
+ return AbstractFactory.getInstance(ItemDaoFactory.class);
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionDao.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionDao.java
index cac4c4e939..46a6a36e59 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionDao.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionDao.java
@@ -25,25 +25,26 @@ import org.openecomp.sdc.versioning.dao.types.Revision;
import org.openecomp.sdc.versioning.dao.types.Version;
public interface VersionDao {
- List<Version> list(String itemId);
- void create(String itemId, Version version);
+ List<Version> list(String itemId);
- void update(String itemId, Version version);
+ void create(String itemId, Version version);
- Optional<Version> get(String itemId, Version version);
+ void update(String itemId, Version version);
- void delete(String itemId, Version version);
+ Optional<Version> get(String itemId, Version version);
- void publish(String itemId, Version version, String message);
+ void delete(String itemId, Version version);
- void sync(String itemId, Version version);
+ void publish(String itemId, Version version, String message);
- void forceSync(String itemId, Version version);
+ void sync(String itemId, Version version);
- void clean(String itemId, Version version);
+ void forceSync(String itemId, Version version);
- void revert(String itemId, Version version, String revisionId);
+ void clean(String itemId, Version version);
- List<Revision> listRevisions(String itemId, Version version);
+ void revert(String itemId, Version version, String revisionId);
+
+ List<Revision> listRevisions(String itemId, Version version);
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionDaoFactory.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionDaoFactory.java
index 845b248d7e..89e2c56813 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionDaoFactory.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionDaoFactory.java
@@ -17,14 +17,14 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.dao;
import org.openecomp.core.factory.api.AbstractComponentFactory;
import org.openecomp.core.factory.api.AbstractFactory;
public abstract class VersionDaoFactory extends AbstractComponentFactory<VersionDao> {
- public static VersionDaoFactory getInstance() {
- return AbstractFactory.getInstance(VersionDaoFactory.class);
- }
+
+ public static VersionDaoFactory getInstance() {
+ return AbstractFactory.getInstance(VersionDaoFactory.class);
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionInfoDao.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionInfoDao.java
index 260214eb07..2d33fc1eb4 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionInfoDao.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionInfoDao.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.dao;
import org.openecomp.core.dao.BaseDao;
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionInfoDaoFactory.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionInfoDaoFactory.java
index ebdb1a590b..2593cc5491 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionInfoDaoFactory.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionInfoDaoFactory.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,14 +17,14 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.dao;
import org.openecomp.core.factory.api.AbstractComponentFactory;
import org.openecomp.core.factory.api.AbstractFactory;
public abstract class VersionInfoDaoFactory extends AbstractComponentFactory<VersionInfoDao> {
- public static VersionInfoDaoFactory getInstance() {
- return AbstractFactory.getInstance(VersionInfoDaoFactory.class);
- }
+
+ public static VersionInfoDaoFactory getInstance() {
+ return AbstractFactory.getInstance(VersionInfoDaoFactory.class);
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionInfoDeletedDao.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionInfoDeletedDao.java
index ca09cdb532..3d52f6dc81 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionInfoDeletedDao.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionInfoDeletedDao.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.dao;
import org.openecomp.core.dao.BaseDao;
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionInfoDeletedDaoFactory.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionInfoDeletedDaoFactory.java
index d14cbfeb0b..bf0c23f5a7 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionInfoDeletedDaoFactory.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionInfoDeletedDaoFactory.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,16 +17,14 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.dao;
-
import org.openecomp.core.factory.api.AbstractComponentFactory;
import org.openecomp.core.factory.api.AbstractFactory;
-public abstract class VersionInfoDeletedDaoFactory
- extends AbstractComponentFactory<VersionInfoDeletedDao> {
- public static VersionInfoDeletedDaoFactory getInstance() {
- return AbstractFactory.getInstance(VersionInfoDeletedDaoFactory.class);
- }
+public abstract class VersionInfoDeletedDaoFactory extends AbstractComponentFactory<VersionInfoDeletedDao> {
+
+ public static VersionInfoDeletedDaoFactory getInstance() {
+ return AbstractFactory.getInstance(VersionInfoDeletedDaoFactory.class);
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionableDao.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionableDao.java
index 12cef62f44..3f1bdf2a81 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionableDao.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionableDao.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,9 +17,9 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.dao;
public interface VersionableDao {
- void registerVersioning(String versionableEntityType);
+
+ void registerVersioning(String versionableEntityType);
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionableEntityDao.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionableEntityDao.java
index 9ba042ba27..24d091a934 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionableEntityDao.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionableEntityDao.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.dao;
import org.openecomp.sdc.versioning.dao.types.Version;
@@ -25,12 +24,9 @@ import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
public interface VersionableEntityDao {
- void initVersion(VersionableEntityMetadata versionableTableMetadata, String entityId,
- Version baseVersion, Version newVersion);
+ void initVersion(VersionableEntityMetadata versionableTableMetadata, String entityId, Version baseVersion, Version newVersion);
- void deleteVersion(VersionableEntityMetadata versionableTableMetadata, String entityId,
- Version versionToDelete, Version backToVersion);
+ void deleteVersion(VersionableEntityMetadata versionableTableMetadata, String entityId, Version versionToDelete, Version backToVersion);
- void closeVersion(VersionableEntityMetadata versionableTableMetadata, String entityId,
- Version versionToClose);
+ void closeVersion(VersionableEntityMetadata versionableTableMetadata, String entityId, Version versionToClose);
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionableEntityDaoFactory.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionableEntityDaoFactory.java
index 870a7892ac..6b4d4de13f 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionableEntityDaoFactory.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/VersionableEntityDaoFactory.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,18 +17,17 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.dao;
import org.openecomp.core.factory.api.AbstractComponentFactory;
import org.openecomp.core.factory.api.AbstractFactory;
import org.openecomp.sdc.versioning.types.VersionableEntityStoreType;
-public abstract class VersionableEntityDaoFactory
- extends AbstractComponentFactory<VersionableEntityDao> {
- public static VersionableEntityDaoFactory getInstance() {
- return AbstractFactory.getInstance(VersionableEntityDaoFactory.class);
- }
+public abstract class VersionableEntityDaoFactory extends AbstractComponentFactory<VersionableEntityDao> {
+
+ public static VersionableEntityDaoFactory getInstance() {
+ return AbstractFactory.getInstance(VersionableEntityDaoFactory.class);
+ }
- public abstract VersionableEntityDao createInterface(VersionableEntityStoreType storeType);
+ public abstract VersionableEntityDao createInterface(VersionableEntityStoreType storeType);
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/Revision.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/Revision.java
index d0997cf16e..418ec4c741 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/Revision.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/Revision.java
@@ -19,15 +19,16 @@
*/
package org.openecomp.sdc.versioning.dao.types;
+import java.util.Date;
import lombok.Getter;
import lombok.Setter;
-import java.util.Date;
@Getter
@Setter
public class Revision {
- private String id;
- private String message;
- private Date time;
- private String user;
+
+ private String id;
+ private String message;
+ private Date time;
+ private String user;
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/SynchronizationState.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/SynchronizationState.java
index ed33a39b00..95b71dc514 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/SynchronizationState.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/SynchronizationState.java
@@ -20,17 +20,14 @@
package org.openecomp.sdc.versioning.dao.types;
public enum SynchronizationState {
- UpToDate("Up to date"),
- OutOfSync("Out of sync"),
- Merging("Merging");
+ UpToDate("Up to date"), OutOfSync("Out of sync"), Merging("Merging");
+ private String displayName;
- private String displayName;
+ SynchronizationState(String displayName) {
+ this.displayName = displayName;
+ }
- SynchronizationState(String displayName) {
- this.displayName = displayName;
- }
-
- public String toString() {
- return this.displayName;
- }
+ public String toString() {
+ return this.displayName;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/UserCandidateVersion.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/UserCandidateVersion.java
index 9dfab56b6d..8d863076e0 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/UserCandidateVersion.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/UserCandidateVersion.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.dao.types;
import com.datastax.driver.mapping.annotations.Frozen;
@@ -33,8 +32,8 @@ import lombok.Setter;
@AllArgsConstructor
@NoArgsConstructor
public class UserCandidateVersion {
- private String user;
- @Frozen
- private Version version;
-}
+ private String user;
+ @Frozen
+ private Version version;
+}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/Version.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/Version.java
index d0efcf93fe..b75967f711 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/Version.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/Version.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,141 +17,138 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.dao.types;
import com.datastax.driver.mapping.annotations.Transient;
import com.datastax.driver.mapping.annotations.UDT;
+import java.util.Date;
+import java.util.Map;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
-import java.util.Date;
-import java.util.Map;
-
@UDT(name = "version", keyspace = "dox")
@Getter
@Setter
@NoArgsConstructor
public class Version {
- public static final String VERSION_STRING_VIOLATION_MSG =
- "Version string must be in the format of: {integer}.{integer}";
-
- @Transient
- private String id;
- private int major; // TODO: 6/7/2017 remove!
- private int minor; // TODO: 6/7/2017 remove!
- @Transient
- private String name;
- @Transient
- private String description;
- @Transient
- private String baseId;
- @Transient
- private Date creationTime;
- @Transient
- private Date modificationTime;
- @Transient
- private VersionStatus status = VersionStatus.Draft;
- @Transient
- private VersionState state;
- @Transient
- private Map<String, Object> additionalInfo;
-
- public Version(String id) {
- this.id = id;
- }
- @Deprecated
- public Version(int major, int minor) {
- this.major = major;
- this.minor = minor;
- }
-
- /**
- * Value of version.
- *
- * @param versionString the version string
- * @return the version
- */
- public static Version valueOf(String versionString) {
- if (versionString == null) {
- return null;
- }
- String[] versionLevels = versionString.split("\\.");
- Version version;
- if (versionLevels.length != 2) {
- throw new IllegalArgumentException(VERSION_STRING_VIOLATION_MSG);
- }
- try {
- version = new Version(Integer.parseInt(versionLevels[0]), Integer.parseInt(versionLevels[1]));
- } catch (Exception ex) {
- throw new IllegalArgumentException(VERSION_STRING_VIOLATION_MSG);
+ public static final String VERSION_STRING_VIOLATION_MSG = "Version string must be in the format of: {integer}.{integer}";
+ @Transient
+ private String id;
+ private int major; // TODO: 6/7/2017 remove!
+
+ private int minor; // TODO: 6/7/2017 remove!
+ @Transient
+ private String name;
+ @Transient
+ private String description;
+ @Transient
+ private String baseId;
+ @Transient
+ private Date creationTime;
+ @Transient
+ private Date modificationTime;
+ @Transient
+ private VersionStatus status = VersionStatus.Draft;
+ @Transient
+ private VersionState state;
+ @Transient
+ private Map<String, Object> additionalInfo;
+
+ public Version(String id) {
+ this.id = id;
}
- return version;
- }
- public Version calculateNextCandidate() {
- return new Version(major, minor + 1);
- }
+ @Deprecated
+ public Version(int major, int minor) {
+ this.major = major;
+ this.minor = minor;
+ }
- public Version calculateNextFinal() {
- return new Version(major + 1, 0);
- }
+ /**
+ * Value of version.
+ *
+ * @param versionString the version string
+ * @return the version
+ */
+ public static Version valueOf(String versionString) {
+ if (versionString == null) {
+ return null;
+ }
+ String[] versionLevels = versionString.split("\\.");
+ Version version;
+ if (versionLevels.length != 2) {
+ throw new IllegalArgumentException(VERSION_STRING_VIOLATION_MSG);
+ }
+ try {
+ version = new Version(Integer.parseInt(versionLevels[0]), Integer.parseInt(versionLevels[1]));
+ } catch (Exception ex) {
+ throw new IllegalArgumentException(VERSION_STRING_VIOLATION_MSG);
+ }
+ return version;
+ }
- @Transient
- public boolean isFinal() {
- return major != 0 && minor == 0;
- }
+ public Version calculateNextCandidate() {
+ return new Version(major, minor + 1);
+ }
- @Override
- public int hashCode() {
- int result = major;
- result = 31 * result + minor;
- return result;
- }
+ public Version calculateNextFinal() {
+ return new Version(major + 1, 0);
+ }
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
+ @Transient
+ public boolean isFinal() {
+ return major != 0 && minor == 0;
}
- if (obj == null || getClass() != obj.getClass()) {
- return false;
+
+ @Override
+ public int hashCode() {
+ int result = major;
+ result = 31 * result + minor;
+ return result;
}
- Version version = (Version) obj;
- return major == version.major && minor == version.minor;
- }
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null || getClass() != obj.getClass()) {
+ return false;
+ }
+ Version version = (Version) obj;
+ return major == version.major && minor == version.minor;
+ }
- public int compareTo(Version other){
- if (this.major>other.major) {
- return 1;
- } else if(this.major<other.major){
- return -1;
- } else if(this.major == other.major){
- return Integer.compare(this.minor,other.minor);
+ public int compareTo(Version other) {
+ if (this.major > other.major) {
+ return 1;
+ } else if (this.major < other.major) {
+ return -1;
+ } else if (this.major == other.major) {
+ return Integer.compare(this.minor, other.minor);
+ }
+ return 0;
}
- return 0;
- }
- @Override
- public String toString() {
- return name != null ? name : major + "." + minor;
- }
+ @Override
+ public String toString() {
+ return name != null ? name : major + "." + minor;
+ }
- @Override
- public Version clone() {
- Version version = new Version();
- version.setStatus(this.getStatus());
- version.setCreationTime(this.getCreationTime());
- version.setName(this.getName());
- version.setBaseId(this.getBaseId());
- version.setMajor(this.major);
- version.setMinor(this.minor);
- version.setModificationTime(this.getModificationTime());
- version.setDescription(this.description);
- version.setId(this.getId());
- return version;
- }
-} \ No newline at end of file
+ @Override
+ public Version clone() {
+ Version version = new Version();
+ version.setStatus(this.getStatus());
+ version.setCreationTime(this.getCreationTime());
+ version.setName(this.getName());
+ version.setBaseId(this.getBaseId());
+ version.setMajor(this.major);
+ version.setMinor(this.minor);
+ version.setModificationTime(this.getModificationTime());
+ version.setDescription(this.description);
+ version.setId(this.getId());
+ return version;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionHistoryEntity.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionHistoryEntity.java
index b382ce5401..8b6e9e34fa 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionHistoryEntity.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionHistoryEntity.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.dao.types;
import com.datastax.driver.mapping.annotations.Column;
@@ -34,20 +33,18 @@ import lombok.Setter;
@NoArgsConstructor
public class VersionHistoryEntity {
- @PartitionKey
- @Column(name = "entity_id")
- @Frozen
- private VersionableEntityId entityId;
-
- @Column(name = "active_version")
- @Frozen
- private Version version;
-
- private String user;
- private String description;
- private VersionType type;
+ @PartitionKey
+ @Column(name = "entity_id")
+ @Frozen
+ private VersionableEntityId entityId;
+ @Column(name = "active_version")
+ @Frozen
+ private Version version;
+ private String user;
+ private String description;
+ private VersionType type;
- public VersionHistoryEntity(VersionableEntityId entityId) {
- this.entityId = entityId;
- }
+ public VersionHistoryEntity(VersionableEntityId entityId) {
+ this.entityId = entityId;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionInfoDeletedEntity.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionInfoDeletedEntity.java
index 12b82f7aed..06164f60f6 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionInfoDeletedEntity.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionInfoDeletedEntity.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.dao.types;
import com.datastax.driver.mapping.annotations.ClusteringColumn;
@@ -26,47 +25,39 @@ import com.datastax.driver.mapping.annotations.Frozen;
import com.datastax.driver.mapping.annotations.FrozenValue;
import com.datastax.driver.mapping.annotations.PartitionKey;
import com.datastax.driver.mapping.annotations.Table;
+import java.util.HashSet;
+import java.util.Set;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
-import java.util.HashSet;
-import java.util.Set;
-
@Table(keyspace = "dox", name = "version_info_deleted")
@Getter
@Setter
@NoArgsConstructor
public class VersionInfoDeletedEntity {
- @PartitionKey
- @Column(name = "entity_type")
- private String entityType;
-
- @ClusteringColumn
- @Column(name = "entity_id")
- private String entityId;
-
- @Column(name = "active_version")
- @Frozen
- private Version activeVersion;
-
- private VersionStatus status;
-
- @Frozen
- private UserCandidateVersion candidate;
-
- @Column(name = "viewable_versions")
- @FrozenValue
- private Set<Version> viewableVersions = new HashSet<>();
-
- @Column(name = "latest_final_version")
- @Frozen
- private Version latestFinalVersion;
-
- public VersionInfoDeletedEntity(String entityType, String entityId) {
- this.entityType = entityType;
- this.entityId = entityId;
- }
-
+ @PartitionKey
+ @Column(name = "entity_type")
+ private String entityType;
+ @ClusteringColumn
+ @Column(name = "entity_id")
+ private String entityId;
+ @Column(name = "active_version")
+ @Frozen
+ private Version activeVersion;
+ private VersionStatus status;
+ @Frozen
+ private UserCandidateVersion candidate;
+ @Column(name = "viewable_versions")
+ @FrozenValue
+ private Set<Version> viewableVersions = new HashSet<>();
+ @Column(name = "latest_final_version")
+ @Frozen
+ private Version latestFinalVersion;
+
+ public VersionInfoDeletedEntity(String entityType, String entityId) {
+ this.entityType = entityType;
+ this.entityId = entityId;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionInfoEntity.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionInfoEntity.java
index 84444a30c6..4f3811b25a 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionInfoEntity.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionInfoEntity.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.dao.types;
import com.datastax.driver.mapping.annotations.ClusteringColumn;
@@ -26,46 +25,39 @@ import com.datastax.driver.mapping.annotations.Frozen;
import com.datastax.driver.mapping.annotations.FrozenValue;
import com.datastax.driver.mapping.annotations.PartitionKey;
import com.datastax.driver.mapping.annotations.Table;
+import java.util.HashSet;
+import java.util.Set;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
-import java.util.HashSet;
-import java.util.Set;
-
@Table(keyspace = "dox", name = "version_info")
@Getter
@Setter
@NoArgsConstructor
public class VersionInfoEntity {
- @PartitionKey
- @Column(name = "entity_type")
- private String entityType;
-
- @ClusteringColumn
- @Column(name = "entity_id")
- private String entityId;
-
- @Column(name = "active_version")
- @Frozen
- private Version activeVersion;
-
- private VersionStatus status;
-
- @Frozen
- private UserCandidateVersion candidate;
-
- @Column(name = "viewable_versions")
- @FrozenValue
- private Set<Version> viewableVersions = new HashSet<>();
-
- @Column(name = "latest_final_version")
- @Frozen
- private Version latestFinalVersion;
-
- public VersionInfoEntity(String entityType, String entityId) {
- this.entityType = entityType;
- this.entityId = entityId;
- }
+ @PartitionKey
+ @Column(name = "entity_type")
+ private String entityType;
+ @ClusteringColumn
+ @Column(name = "entity_id")
+ private String entityId;
+ @Column(name = "active_version")
+ @Frozen
+ private Version activeVersion;
+ private VersionStatus status;
+ @Frozen
+ private UserCandidateVersion candidate;
+ @Column(name = "viewable_versions")
+ @FrozenValue
+ private Set<Version> viewableVersions = new HashSet<>();
+ @Column(name = "latest_final_version")
+ @Frozen
+ private Version latestFinalVersion;
+
+ public VersionInfoEntity(String entityType, String entityId) {
+ this.entityType = entityType;
+ this.entityId = entityId;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionState.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionState.java
index b4099e9409..f2abf695a1 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionState.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionState.java
@@ -25,6 +25,7 @@ import lombok.Setter;
@Getter
@Setter
public class VersionState {
- private SynchronizationState synchronizationState;
- private boolean dirty;
+
+ private SynchronizationState synchronizationState;
+ private boolean dirty;
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionStatus.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionStatus.java
index 6cf662c37a..86bbc5eb45 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionStatus.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionStatus.java
@@ -13,13 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.versioning.dao.types;
public enum VersionStatus {
- Draft,
- Locked, /* todo remove!!*/
- Certified,
- Deprecated,
- Deleted
+ Draft,
+ Locked, /* todo remove!!*/
+ Certified,
+ Deprecated,
+ Deleted
}
+
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionType.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionType.java
index befbae6631..b4a5a9b467 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionType.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionType.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,10 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.dao.types;
-public enum VersionType {
- Draft,
- Finalized;
-}
+public enum VersionType {Draft, Finalized;}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionableEntity.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionableEntity.java
index d909af86a3..c45cdce21a 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionableEntity.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionableEntity.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,27 +17,26 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.dao.types;
public interface VersionableEntity {
- String getEntityType();
+ String getEntityType();
- String getFirstClassCitizenId();
+ String getFirstClassCitizenId();
- String getId();
+ String getId();
- void setId(String id);
+ void setId(String id);
- Version getVersion();
+ Version getVersion();
- void setVersion(Version version);
+ void setVersion(Version version);
- default String getVersionUuId() {
- return "";
- }
+ default String getVersionUuId() {
+ return "";
+ }
- default void setVersionUuId(String uuId) {
- }
+ default void setVersionUuId(String uuId) {
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionableEntityId.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionableEntityId.java
index 690b7b3689..0a3f172d77 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionableEntityId.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/VersionableEntityId.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.dao.types;
import com.datastax.driver.mapping.annotations.UDT;
@@ -32,6 +31,7 @@ import lombok.Setter;
@NoArgsConstructor
@AllArgsConstructor
public class VersionableEntityId {
- private String type;
- private String id;
+
+ private String type;
+ private String id;
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/CheckinOnEntityLockedByOtherErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/CheckinOnEntityLockedByOtherErrorBuilder.java
index b46deeae87..8f5c1dc230 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/CheckinOnEntityLockedByOtherErrorBuilder.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/CheckinOnEntityLockedByOtherErrorBuilder.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.errors;
import org.openecomp.sdc.common.errors.BaseErrorBuilder;
@@ -28,22 +27,19 @@ import org.openecomp.sdc.common.errors.ErrorCategory;
*/
public class CheckinOnEntityLockedByOtherErrorBuilder extends BaseErrorBuilder {
- static final String CHECKIN_ON_ENTITY_LOCKED_BY_OTHER_USER_MSG =
- "Can not check in versionable entity %s with id %s since it is checked out by other "
- + "user: %s.";
+ static final String CHECKIN_ON_ENTITY_LOCKED_BY_OTHER_USER_MSG =
+ "Can not check in versionable entity %s with id %s since it is checked out by other " + "user: %s.";
- /**
- * Instantiates a new Checkin on entity locked by other error builder.
- *
- * @param entityType the entity type
- * @param entityId the entity id
- * @param lockingUser the locking user
- */
- public CheckinOnEntityLockedByOtherErrorBuilder(String entityType, String entityId,
- String lockingUser) {
- getErrorCodeBuilder().withId(VersioningErrorCodes.CHECKIN_ON_ENTITY_LOCKED_BY_OTHER_USER);
- getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
- getErrorCodeBuilder().withMessage(String
- .format(CHECKIN_ON_ENTITY_LOCKED_BY_OTHER_USER_MSG, entityType, entityId, lockingUser));
- }
+ /**
+ * Instantiates a new Checkin on entity locked by other error builder.
+ *
+ * @param entityType the entity type
+ * @param entityId the entity id
+ * @param lockingUser the locking user
+ */
+ public CheckinOnEntityLockedByOtherErrorBuilder(String entityType, String entityId, String lockingUser) {
+ getErrorCodeBuilder().withId(VersioningErrorCodes.CHECKIN_ON_ENTITY_LOCKED_BY_OTHER_USER);
+ getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
+ getErrorCodeBuilder().withMessage(String.format(CHECKIN_ON_ENTITY_LOCKED_BY_OTHER_USER_MSG, entityType, entityId, lockingUser));
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/CheckinOnUnlockedEntityErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/CheckinOnUnlockedEntityErrorBuilder.java
index 1ed8476534..e88a1ee5ef 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/CheckinOnUnlockedEntityErrorBuilder.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/CheckinOnUnlockedEntityErrorBuilder.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.errors;
import org.openecomp.sdc.common.errors.BaseErrorBuilder;
@@ -28,19 +27,17 @@ import org.openecomp.sdc.common.errors.ErrorCategory;
*/
public class CheckinOnUnlockedEntityErrorBuilder extends BaseErrorBuilder {
- static final String CHECKIN_ON_UNLOCKED_ENTITY_MSG =
- "Can not check in versionable entity %s with id %s since it is not checked out.";
+ static final String CHECKIN_ON_UNLOCKED_ENTITY_MSG = "Can not check in versionable entity %s with id %s since it is not checked out.";
- /**
- * Instantiates a new Checkin on unlocked entity error builder.
- *
- * @param entityType the entity type
- * @param entityId the entity id
- */
- public CheckinOnUnlockedEntityErrorBuilder(String entityType, String entityId) {
- getErrorCodeBuilder().withId(VersioningErrorCodes.CHECKIN_ON_UNLOCKED_ENTITY);
- getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
- getErrorCodeBuilder()
- .withMessage(String.format(CHECKIN_ON_UNLOCKED_ENTITY_MSG, entityType, entityId));
- }
+ /**
+ * Instantiates a new Checkin on unlocked entity error builder.
+ *
+ * @param entityType the entity type
+ * @param entityId the entity id
+ */
+ public CheckinOnUnlockedEntityErrorBuilder(String entityType, String entityId) {
+ getErrorCodeBuilder().withId(VersioningErrorCodes.CHECKIN_ON_UNLOCKED_ENTITY);
+ getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
+ getErrorCodeBuilder().withMessage(String.format(CHECKIN_ON_UNLOCKED_ENTITY_MSG, entityType, entityId));
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/CheckoutOnLockedEntityErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/CheckoutOnLockedEntityErrorBuilder.java
index c56b08f9f7..50682dae79 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/CheckoutOnLockedEntityErrorBuilder.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/CheckoutOnLockedEntityErrorBuilder.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.errors;
import org.openecomp.sdc.common.errors.BaseErrorBuilder;
@@ -28,24 +27,19 @@ import org.openecomp.sdc.common.errors.ErrorCategory;
*/
public class CheckoutOnLockedEntityErrorBuilder extends BaseErrorBuilder {
- static final String CHECKOT_ON_LOCKED_ENTITY_MSG =
- "Can not check out versionable entity %s with id %s since it is checked out by "
- + "other user: %s.";
-
- /**
- * Instantiates a new Checkout on locked entity error builder.
- *
- * @param entityType the entity type
- * @param entityId the entity id
- * @param lockingUser the locking user
- */
- public CheckoutOnLockedEntityErrorBuilder(String entityType, String entityId,
- String lockingUser) {
- getErrorCodeBuilder().withId(VersioningErrorCodes.CHECKOT_ON_LOCKED_ENTITY);
- getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
- getErrorCodeBuilder().withMessage(
- String.format(CHECKOT_ON_LOCKED_ENTITY_MSG, entityType, entityId, lockingUser));
- }
-
+ static final String CHECKOT_ON_LOCKED_ENTITY_MSG =
+ "Can not check out versionable entity %s with id %s since it is checked out by " + "other user: %s.";
+ /**
+ * Instantiates a new Checkout on locked entity error builder.
+ *
+ * @param entityType the entity type
+ * @param entityId the entity id
+ * @param lockingUser the locking user
+ */
+ public CheckoutOnLockedEntityErrorBuilder(String entityType, String entityId, String lockingUser) {
+ getErrorCodeBuilder().withId(VersioningErrorCodes.CHECKOT_ON_LOCKED_ENTITY);
+ getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
+ getErrorCodeBuilder().withMessage(String.format(CHECKOT_ON_LOCKED_ENTITY_MSG, entityType, entityId, lockingUser));
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/DeleteOnLockedEntityErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/DeleteOnLockedEntityErrorBuilder.java
index da181ceb77..0d3a7a1736 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/DeleteOnLockedEntityErrorBuilder.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/DeleteOnLockedEntityErrorBuilder.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.errors;
import org.openecomp.sdc.common.errors.BaseErrorBuilder;
@@ -28,22 +27,18 @@ import org.openecomp.sdc.common.errors.ErrorCategory;
*/
public class DeleteOnLockedEntityErrorBuilder extends BaseErrorBuilder {
- static final String DELETE_ON_LOCKED_ENTITY_MSG =
- "Can not delete versionable entity %s with id %s since it is checked out by other user: %s.";
-
- /**
- * Instantiates a new Delete on locked entity error builder.
- *
- * @param entityType the entity type
- * @param entityId the entity id
- * @param lockingUser the locking user
- */
- public DeleteOnLockedEntityErrorBuilder(String entityType, String entityId, String lockingUser) {
- getErrorCodeBuilder().withId(VersioningErrorCodes.DELETE_ON_LOCKED_ENTITY);
- getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
- getErrorCodeBuilder()
- .withMessage(String.format(DELETE_ON_LOCKED_ENTITY_MSG, entityType, entityId, lockingUser));
- }
-
+ static final String DELETE_ON_LOCKED_ENTITY_MSG = "Can not delete versionable entity %s with id %s since it is checked out by other user: %s.";
+ /**
+ * Instantiates a new Delete on locked entity error builder.
+ *
+ * @param entityType the entity type
+ * @param entityId the entity id
+ * @param lockingUser the locking user
+ */
+ public DeleteOnLockedEntityErrorBuilder(String entityType, String entityId, String lockingUser) {
+ getErrorCodeBuilder().withId(VersioningErrorCodes.DELETE_ON_LOCKED_ENTITY);
+ getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
+ getErrorCodeBuilder().withMessage(String.format(DELETE_ON_LOCKED_ENTITY_MSG, entityType, entityId, lockingUser));
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EditOnEntityLockedByOtherErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EditOnEntityLockedByOtherErrorBuilder.java
index bfebfd2c31..615cf1ee9d 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EditOnEntityLockedByOtherErrorBuilder.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EditOnEntityLockedByOtherErrorBuilder.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.errors;
import org.openecomp.sdc.common.errors.BaseErrorBuilder;
@@ -28,23 +27,18 @@ import org.openecomp.sdc.common.errors.ErrorCategory;
*/
public class EditOnEntityLockedByOtherErrorBuilder extends BaseErrorBuilder {
- static final String EDIT_ON_ENTITY_LOCKED_BY_OTHER_USER_MSG =
- "Versionable entity %s with id %s can not be edited since it is locked by other user %s.";
-
- /**
- * Instantiates a new Edit on entity locked by other error builder.
- *
- * @param entityType the entity type
- * @param entityId the entity id
- * @param lockingUser the locking user
- */
- public EditOnEntityLockedByOtherErrorBuilder(String entityType, String entityId,
- String lockingUser) {
- getErrorCodeBuilder().withId(VersioningErrorCodes.EDIT_ON_ENTITY_LOCKED_BY_OTHER_USER);
- getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
- getErrorCodeBuilder().withMessage(
- String.format(EDIT_ON_ENTITY_LOCKED_BY_OTHER_USER_MSG, entityType, entityId, lockingUser));
- }
-
+ static final String EDIT_ON_ENTITY_LOCKED_BY_OTHER_USER_MSG = "Versionable entity %s with id %s can not be edited since it is locked by other user %s.";
+ /**
+ * Instantiates a new Edit on entity locked by other error builder.
+ *
+ * @param entityType the entity type
+ * @param entityId the entity id
+ * @param lockingUser the locking user
+ */
+ public EditOnEntityLockedByOtherErrorBuilder(String entityType, String entityId, String lockingUser) {
+ getErrorCodeBuilder().withId(VersioningErrorCodes.EDIT_ON_ENTITY_LOCKED_BY_OTHER_USER);
+ getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
+ getErrorCodeBuilder().withMessage(String.format(EDIT_ON_ENTITY_LOCKED_BY_OTHER_USER_MSG, entityType, entityId, lockingUser));
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EditOnUnlockedEntityErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EditOnUnlockedEntityErrorBuilder.java
index c5ba6d84af..36d16af381 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EditOnUnlockedEntityErrorBuilder.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EditOnUnlockedEntityErrorBuilder.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,34 +17,29 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.errors;
+import static org.openecomp.sdc.versioning.errors.VersioningErrorCodes.EDIT_ON_UNLOCKED_ENTITY;
+
import org.openecomp.sdc.common.errors.BaseErrorBuilder;
import org.openecomp.sdc.common.errors.ErrorCategory;
-import static org.openecomp.sdc.versioning.errors.VersioningErrorCodes.EDIT_ON_UNLOCKED_ENTITY;
-
/**
* The type Edit on unlocked entity error builder.
*/
public class EditOnUnlockedEntityErrorBuilder extends BaseErrorBuilder {
- static final String EDIT_ON_UNLOCKED_ENTITY_MSG =
- "Can not edit versionable entity %s with id %s since it is not checked out.";
-
- /**
- * Instantiates a new Edit on unlocked entity error builder.
- *
- * @param entityType the entity type
- * @param entityId the entity id
- */
- public EditOnUnlockedEntityErrorBuilder(String entityType, String entityId) {
- getErrorCodeBuilder().withId(EDIT_ON_UNLOCKED_ENTITY);
- getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
- getErrorCodeBuilder()
- .withMessage(String.format(EDIT_ON_UNLOCKED_ENTITY_MSG, entityType, entityId));
- }
-
-
+ static final String EDIT_ON_UNLOCKED_ENTITY_MSG = "Can not edit versionable entity %s with id %s since it is not checked out.";
+
+ /**
+ * Instantiates a new Edit on unlocked entity error builder.
+ *
+ * @param entityType the entity type
+ * @param entityId the entity id
+ */
+ public EditOnUnlockedEntityErrorBuilder(String entityType, String entityId) {
+ getErrorCodeBuilder().withId(EDIT_ON_UNLOCKED_ENTITY);
+ getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
+ getErrorCodeBuilder().withMessage(String.format(EDIT_ON_UNLOCKED_ENTITY_MSG, entityType, entityId));
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EntityAlreadyExistErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EntityAlreadyExistErrorBuilder.java
index 0e591598f7..c6e080540c 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EntityAlreadyExistErrorBuilder.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EntityAlreadyExistErrorBuilder.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.errors;
import org.openecomp.sdc.common.errors.BaseErrorBuilder;
@@ -28,19 +27,17 @@ import org.openecomp.sdc.common.errors.ErrorCategory;
*/
public class EntityAlreadyExistErrorBuilder extends BaseErrorBuilder {
- static final String VERSIONABLE_ENTITY_ALREADY_EXIST_MSG =
- "Versionable entity %s with id %s already exist.";
+ static final String VERSIONABLE_ENTITY_ALREADY_EXIST_MSG = "Versionable entity %s with id %s already exist.";
- /**
- * Instantiates a new Entity already exist error builder.
- *
- * @param entityType the entity type
- * @param entityId the entity id
- */
- public EntityAlreadyExistErrorBuilder(String entityType, String entityId) {
- getErrorCodeBuilder().withId(VersioningErrorCodes.VERSIONABLE_ENTITY_ALREADY_EXIST);
- getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
- getErrorCodeBuilder()
- .withMessage(String.format(VERSIONABLE_ENTITY_ALREADY_EXIST_MSG, entityType, entityId));
- }
+ /**
+ * Instantiates a new Entity already exist error builder.
+ *
+ * @param entityType the entity type
+ * @param entityId the entity id
+ */
+ public EntityAlreadyExistErrorBuilder(String entityType, String entityId) {
+ getErrorCodeBuilder().withId(VersioningErrorCodes.VERSIONABLE_ENTITY_ALREADY_EXIST);
+ getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
+ getErrorCodeBuilder().withMessage(String.format(VERSIONABLE_ENTITY_ALREADY_EXIST_MSG, entityType, entityId));
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EntityAlreadyFinalizedErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EntityAlreadyFinalizedErrorBuilder.java
index 7cd97216eb..d4989c4dc7 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EntityAlreadyFinalizedErrorBuilder.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EntityAlreadyFinalizedErrorBuilder.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.errors;
import org.openecomp.sdc.common.errors.BaseErrorBuilder;
@@ -28,21 +27,17 @@ import org.openecomp.sdc.common.errors.ErrorCategory;
*/
public class EntityAlreadyFinalizedErrorBuilder extends BaseErrorBuilder {
- static final String SUBMIT_FINALIZED_ENTITY_NOT_ALLOWED_MSG =
- "Versionable entity %s with id %s can not be submitted since it is already final.";
-
- /**
- * Instantiates a new Entity already finalized error builder.
- *
- * @param entityType the entity type
- * @param entityId the entity id
- */
- public EntityAlreadyFinalizedErrorBuilder(String entityType, String entityId) {
- getErrorCodeBuilder().withId(VersioningErrorCodes.SUBMIT_FINALIZED_ENTITY_NOT_ALLOWED);
- getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
- getErrorCodeBuilder()
- .withMessage(String.format(SUBMIT_FINALIZED_ENTITY_NOT_ALLOWED_MSG, entityType, entityId));
- }
-
+ static final String SUBMIT_FINALIZED_ENTITY_NOT_ALLOWED_MSG = "Versionable entity %s with id %s can not be submitted since it is already final.";
+ /**
+ * Instantiates a new Entity already finalized error builder.
+ *
+ * @param entityType the entity type
+ * @param entityId the entity id
+ */
+ public EntityAlreadyFinalizedErrorBuilder(String entityType, String entityId) {
+ getErrorCodeBuilder().withId(VersioningErrorCodes.SUBMIT_FINALIZED_ENTITY_NOT_ALLOWED);
+ getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
+ getErrorCodeBuilder().withMessage(String.format(SUBMIT_FINALIZED_ENTITY_NOT_ALLOWED_MSG, entityType, entityId));
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EntityNotExistErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EntityNotExistErrorBuilder.java
index 2eab4b5dac..16c9949970 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EntityNotExistErrorBuilder.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EntityNotExistErrorBuilder.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.errors;
import org.openecomp.sdc.common.errors.BaseErrorBuilder;
@@ -28,19 +27,17 @@ import org.openecomp.sdc.common.errors.ErrorCategory;
*/
public class EntityNotExistErrorBuilder extends BaseErrorBuilder {
- static final String VERSIONABLE_ENTITY_NOT_EXIST_MSG =
- "Versionable entity %s with id %s does not exist.";
+ static final String VERSIONABLE_ENTITY_NOT_EXIST_MSG = "Versionable entity %s with id %s does not exist.";
- /**
- * Instantiates a new Entity not exist error builder.
- *
- * @param entityType the entity type
- * @param entityId the entity id
- */
- public EntityNotExistErrorBuilder(String entityType, String entityId) {
- getErrorCodeBuilder().withId(VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST);
- getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
- getErrorCodeBuilder()
- .withMessage(String.format(VERSIONABLE_ENTITY_NOT_EXIST_MSG, entityType, entityId));
- }
+ /**
+ * Instantiates a new Entity not exist error builder.
+ *
+ * @param entityType the entity type
+ * @param entityId the entity id
+ */
+ public EntityNotExistErrorBuilder(String entityType, String entityId) {
+ getErrorCodeBuilder().withId(VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST);
+ getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
+ getErrorCodeBuilder().withMessage(String.format(VERSIONABLE_ENTITY_NOT_EXIST_MSG, entityType, entityId));
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/RequestedVersionInvalidErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/RequestedVersionInvalidErrorBuilder.java
index aba3b8a17a..d49d0fb72b 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/RequestedVersionInvalidErrorBuilder.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/RequestedVersionInvalidErrorBuilder.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.errors;
import org.openecomp.sdc.common.errors.BaseErrorBuilder;
@@ -27,17 +26,17 @@ import org.openecomp.sdc.common.errors.ErrorCategory;
* The type Requested version invalid error builder.
*/
public class RequestedVersionInvalidErrorBuilder extends BaseErrorBuilder {
- static final String REQUESTED_VERSION_INVALID_MSG = "Invalid requested version.";
- /**
- * Instantiates a new Requested version invalid error builder.
- */
- public RequestedVersionInvalidErrorBuilder() {
- getErrorCodeBuilder().withId(VersioningErrorCodes.REQUESTED_VERSION_INVALID);
- getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
- getErrorCodeBuilder().withMessage(REQUESTED_VERSION_INVALID_MSG);
- }
+ static final String REQUESTED_VERSION_INVALID_MSG = "Invalid requested version.";
+ /**
+ * Instantiates a new Requested version invalid error builder.
+ */
+ public RequestedVersionInvalidErrorBuilder() {
+ getErrorCodeBuilder().withId(VersioningErrorCodes.REQUESTED_VERSION_INVALID);
+ getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
+ getErrorCodeBuilder().withMessage(REQUESTED_VERSION_INVALID_MSG);
+ }
/* private static List<String> toStringList(Set<Version> versions) {
List<String> versionStrings = new ArrayList<>(versions.size());
for (Version version : versions) {
@@ -45,4 +44,4 @@ public class RequestedVersionInvalidErrorBuilder extends BaseErrorBuilder {
}
return versionStrings;
}*/
-}
+}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/RevisionIdNotFoundErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/RevisionIdNotFoundErrorBuilder.java
index 4ec51297a6..7a41864dcd 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/RevisionIdNotFoundErrorBuilder.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/RevisionIdNotFoundErrorBuilder.java
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.errors;
import org.openecomp.sdc.common.errors.BaseErrorBuilder;
@@ -28,17 +27,14 @@ import org.openecomp.sdc.common.errors.ErrorCategory;
*/
public class RevisionIdNotFoundErrorBuilder extends BaseErrorBuilder {
- static final String REVISION_ID_NOT_FOUND_MSG =
- "Mandatory field revision id missing";
-
- /**
- * Instantiates a new Versionable sub entity not found error builder.
- */
- public RevisionIdNotFoundErrorBuilder() {
- getErrorCodeBuilder().withId(VersioningErrorCodes.MANDATORY_FIELD_REVISION_ID_MISSING);
- getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
- getErrorCodeBuilder().withMessage(REVISION_ID_NOT_FOUND_MSG);
- }
-
+ static final String REVISION_ID_NOT_FOUND_MSG = "Mandatory field revision id missing";
+ /**
+ * Instantiates a new Versionable sub entity not found error builder.
+ */
+ public RevisionIdNotFoundErrorBuilder() {
+ getErrorCodeBuilder().withId(VersioningErrorCodes.MANDATORY_FIELD_REVISION_ID_MISSING);
+ getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
+ getErrorCodeBuilder().withMessage(REVISION_ID_NOT_FOUND_MSG);
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/SubmitLockedEntityNotAllowedErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/SubmitLockedEntityNotAllowedErrorBuilder.java
index 0bd1cb91ee..b801134fb9 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/SubmitLockedEntityNotAllowedErrorBuilder.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/SubmitLockedEntityNotAllowedErrorBuilder.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.errors;
import org.openecomp.sdc.common.errors.BaseErrorBuilder;
@@ -28,22 +27,19 @@ import org.openecomp.sdc.common.errors.ErrorCategory;
*/
public class SubmitLockedEntityNotAllowedErrorBuilder extends BaseErrorBuilder {
- static final String SUBMIT_LOCKED_ENTITY_NOT_ALLOWED_MSG =
- "Versionable entity %s with id %s can not be submitted since it is currently"
- + " locked by user %s.";
+ static final String SUBMIT_LOCKED_ENTITY_NOT_ALLOWED_MSG =
+ "Versionable entity %s with id %s can not be submitted since it is currently" + " locked by user %s.";
- /**
- * Instantiates a new Submit locked entity not allowed error builder.
- *
- * @param entityType the entity type
- * @param entityId the entity id
- * @param lockingUser the locking user
- */
- public SubmitLockedEntityNotAllowedErrorBuilder(String entityType, String entityId,
- String lockingUser) {
- getErrorCodeBuilder().withId(VersioningErrorCodes.SUBMIT_LOCKED_ENTITY_NOT_ALLOWED);
- getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
- getErrorCodeBuilder().withMessage(
- String.format(SUBMIT_LOCKED_ENTITY_NOT_ALLOWED_MSG, entityType, entityId, lockingUser));
- }
+ /**
+ * Instantiates a new Submit locked entity not allowed error builder.
+ *
+ * @param entityType the entity type
+ * @param entityId the entity id
+ * @param lockingUser the locking user
+ */
+ public SubmitLockedEntityNotAllowedErrorBuilder(String entityType, String entityId, String lockingUser) {
+ getErrorCodeBuilder().withId(VersioningErrorCodes.SUBMIT_LOCKED_ENTITY_NOT_ALLOWED);
+ getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
+ getErrorCodeBuilder().withMessage(String.format(SUBMIT_LOCKED_ENTITY_NOT_ALLOWED_MSG, entityType, entityId, lockingUser));
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnEntityLockedByOtherErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnEntityLockedByOtherErrorBuilder.java
index 3ec4b6d40b..598425127e 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnEntityLockedByOtherErrorBuilder.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnEntityLockedByOtherErrorBuilder.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.errors;
import org.openecomp.sdc.common.errors.BaseErrorBuilder;
@@ -28,24 +27,19 @@ import org.openecomp.sdc.common.errors.ErrorCategory;
*/
public class UndoCheckoutOnEntityLockedByOtherErrorBuilder extends BaseErrorBuilder {
- static final String UNDO_CHECKOUT_ON_ENTITY_LOCKED_BY_OTHER_USER_MSG =
- "Can not undo checkout on versionable entity %s with id %s since it is checked "
- + "out by other user: %s.";
+ static final String UNDO_CHECKOUT_ON_ENTITY_LOCKED_BY_OTHER_USER_MSG =
+ "Can not undo checkout on versionable entity %s with id %s since it is checked " + "out by other user: %s.";
- /**
- * Instantiates a new Undo checkout on entity locked by other error builder.
- *
- * @param entityType the entity type
- * @param entityId the entity id
- * @param lockingUser the locking user
- */
- public UndoCheckoutOnEntityLockedByOtherErrorBuilder(String entityType, String entityId,
- String lockingUser) {
- getErrorCodeBuilder().withId(
- VersioningErrorCodes.UNDO_CHECKOUT_ON_ENTITY_LOCKED_BY_OTHER_USER);
- getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
- getErrorCodeBuilder().withMessage(String
- .format(UNDO_CHECKOUT_ON_ENTITY_LOCKED_BY_OTHER_USER_MSG, entityType, entityId,
- lockingUser));
- }
+ /**
+ * Instantiates a new Undo checkout on entity locked by other error builder.
+ *
+ * @param entityType the entity type
+ * @param entityId the entity id
+ * @param lockingUser the locking user
+ */
+ public UndoCheckoutOnEntityLockedByOtherErrorBuilder(String entityType, String entityId, String lockingUser) {
+ getErrorCodeBuilder().withId(VersioningErrorCodes.UNDO_CHECKOUT_ON_ENTITY_LOCKED_BY_OTHER_USER);
+ getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
+ getErrorCodeBuilder().withMessage(String.format(UNDO_CHECKOUT_ON_ENTITY_LOCKED_BY_OTHER_USER_MSG, entityType, entityId, lockingUser));
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnUnlockedEntityErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnUnlockedEntityErrorBuilder.java
index 12771efc85..3e6b9cf81e 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnUnlockedEntityErrorBuilder.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnUnlockedEntityErrorBuilder.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.errors;
import org.openecomp.sdc.common.errors.BaseErrorBuilder;
@@ -28,19 +27,17 @@ import org.openecomp.sdc.common.errors.ErrorCategory;
*/
public class UndoCheckoutOnUnlockedEntityErrorBuilder extends BaseErrorBuilder {
- static final String UNDO_CHECKOUT_ON_UNLOCKED_ENTITY_MSG =
- "Can not undo checkout on versionable entity %s with id %s since it is not checked out.";
+ static final String UNDO_CHECKOUT_ON_UNLOCKED_ENTITY_MSG = "Can not undo checkout on versionable entity %s with id %s since it is not checked out.";
- /**
- * Instantiates a new Undo checkout on unlocked entity error builder.
- *
- * @param entityType the entity type
- * @param entityId the entity id
- */
- public UndoCheckoutOnUnlockedEntityErrorBuilder(String entityType, String entityId) {
- getErrorCodeBuilder().withId(VersioningErrorCodes.UNDO_CHECKOUT_ON_UNLOCKED_ENTITY);
- getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
- getErrorCodeBuilder()
- .withMessage(String.format(UNDO_CHECKOUT_ON_UNLOCKED_ENTITY_MSG, entityType, entityId));
- }
+ /**
+ * Instantiates a new Undo checkout on unlocked entity error builder.
+ *
+ * @param entityType the entity type
+ * @param entityId the entity id
+ */
+ public UndoCheckoutOnUnlockedEntityErrorBuilder(String entityType, String entityId) {
+ getErrorCodeBuilder().withId(VersioningErrorCodes.UNDO_CHECKOUT_ON_UNLOCKED_ENTITY);
+ getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
+ getErrorCodeBuilder().withMessage(String.format(UNDO_CHECKOUT_ON_UNLOCKED_ENTITY_MSG, entityType, entityId));
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/VersionableSubEntityNotFoundErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/VersionableSubEntityNotFoundErrorBuilder.java
index 2fbb880cf8..d80c44e9d4 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/VersionableSubEntityNotFoundErrorBuilder.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/VersionableSubEntityNotFoundErrorBuilder.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,61 +17,54 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.errors;
+import java.util.List;
import org.openecomp.core.utilities.CommonMethods;
import org.openecomp.sdc.common.errors.BaseErrorBuilder;
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.versioning.dao.types.Version;
-import java.util.List;
-
/**
* The type Versionable sub entity not found error builder.
*/
public class VersionableSubEntityNotFoundErrorBuilder extends BaseErrorBuilder {
- static final String SUB_ENTITY_NOT_FOUND_MSG =
- "%s with Id %s does not exist for %s with id %s and version %s";
- static final String SUB_ENTITIES_NOT_FOUND_MSG =
- "%ss with Ids %s do not exist for %s with id %s and version %s";
+ static final String SUB_ENTITY_NOT_FOUND_MSG = "%s with Id %s does not exist for %s with id %s and version %s";
+ static final String SUB_ENTITIES_NOT_FOUND_MSG = "%ss with Ids %s do not exist for %s with id %s and version %s";
- /**
- * Instantiates a new Versionable sub entity not found error builder.
- *
- * @param entityType the entity type
- * @param entityId the entity id
- * @param containingEntityType the containing entity type
- * @param containingEntityId the containing entity id
- * @param version the version
- */
- public VersionableSubEntityNotFoundErrorBuilder(String entityType, String entityId,
- String containingEntityType,
- String containingEntityId, Version version) {
- getErrorCodeBuilder().withId(VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND);
- getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
- getErrorCodeBuilder().withMessage(String
- .format(SUB_ENTITY_NOT_FOUND_MSG, entityType, entityId, containingEntityType,
- containingEntityId, version.getId()));
- }
+ /**
+ * Instantiates a new Versionable sub entity not found error builder.
+ *
+ * @param entityType the entity type
+ * @param entityId the entity id
+ * @param containingEntityType the containing entity type
+ * @param containingEntityId the containing entity id
+ * @param version the version
+ */
+ public VersionableSubEntityNotFoundErrorBuilder(String entityType, String entityId, String containingEntityType, String containingEntityId,
+ Version version) {
+ getErrorCodeBuilder().withId(VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND);
+ getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
+ getErrorCodeBuilder()
+ .withMessage(String.format(SUB_ENTITY_NOT_FOUND_MSG, entityType, entityId, containingEntityType, containingEntityId, version.getId()));
+ }
- /**
- * Instantiates a new Versionable sub entity not found error builder.
- *
- * @param entityType the entity type
- * @param entityIds the entity ids
- * @param containingEntityType the containing entity type
- * @param containingEntityId the containing entity id
- * @param version the version
- */
- public VersionableSubEntityNotFoundErrorBuilder(String entityType, List<String> entityIds,
- String containingEntityType,
- String containingEntityId, Version version) {
- getErrorCodeBuilder().withId(VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND);
- getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
- getErrorCodeBuilder().withMessage(String.format(SUB_ENTITIES_NOT_FOUND_MSG, entityType,
- CommonMethods.listToSeparatedString(entityIds, ','), containingEntityType,
- containingEntityId, version.toString()));
- }
+ /**
+ * Instantiates a new Versionable sub entity not found error builder.
+ *
+ * @param entityType the entity type
+ * @param entityIds the entity ids
+ * @param containingEntityType the containing entity type
+ * @param containingEntityId the containing entity id
+ * @param version the version
+ */
+ public VersionableSubEntityNotFoundErrorBuilder(String entityType, List<String> entityIds, String containingEntityType, String containingEntityId,
+ Version version) {
+ getErrorCodeBuilder().withId(VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND);
+ getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
+ getErrorCodeBuilder().withMessage(String
+ .format(SUB_ENTITIES_NOT_FOUND_MSG, entityType, CommonMethods.listToSeparatedString(entityIds, ','), containingEntityType,
+ containingEntityId, version.toString()));
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/VersioningErrorCodes.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/VersioningErrorCodes.java
index 3dd87d5a3f..984c3bfd2c 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/VersioningErrorCodes.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/VersioningErrorCodes.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,33 +17,23 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.errors;
public class VersioningErrorCodes {
- public static final String REQUESTED_VERSION_INVALID = "REQUESTED_VERSION_INVALID";
- public static final String CHECKIN_ON_ENTITY_LOCKED_BY_OTHER_USER =
- "CHECKIN_ON_ENTITY_LOCKED_BY_OTHER_USER";
- public static final String CHECKIN_ON_UNLOCKED_ENTITY = "CHECKIN_ON_UNLOCKED_ENTITY";
- public static final String CHECKOT_ON_LOCKED_ENTITY = "CHECKOT_ON_LOCKED_ENTITY";
- public static final String DELETE_ON_LOCKED_ENTITY = "DELETE_ON_LOCKED_ENTITY";
- public static final String EDIT_ON_ENTITY_LOCKED_BY_OTHER_USER =
- "EDIT_ON_ENTITY_LOCKED_BY_OTHER_USER";
- public static final String EDIT_ON_UNLOCKED_ENTITY = "EDIT_ON_UNLOCKED_ENTITY";
- public static final String VERSIONABLE_ENTITY_ALREADY_EXIST = "VERSIONABLE_ENTITY_ALREADY_EXIST";
- public static final String SUBMIT_FINALIZED_ENTITY_NOT_ALLOWED =
- "SUBMIT_FINALIZED_ENTITY_NOT_ALLOWED";
- public static final String VERSIONABLE_ENTITY_NOT_EXIST = "VERSIONABLE_ENTITY_NOT_EXIST";
- public static final String VERSIONABLE_SUB_ENTITY_NOT_FOUND = "VERSIONABLE_SUB_ENTITY_NOT_FOUND";
- public static final String SUBMIT_LOCKED_ENTITY_NOT_ALLOWED = "SUBMIT_LOCKED_ENTITY_NOT_ALLOWED";
- public static final String UNDO_CHECKOUT_ON_ENTITY_LOCKED_BY_OTHER_USER =
- "UNDO_CHECKOUT_ON_ENTITY_LOCKED_BY_OTHER_USER";
- public static final String UNDO_CHECKOUT_ON_UNLOCKED_ENTITY = "UNDO_CHECKOUT_ON_UNLOCKED_ENTITY";
- public static final String MANDATORY_FIELD_REVISION_ID_MISSING =
- "MANDATORY_FIELD_REVISION_ID_MISSING";
-
-
-
-
+ public static final String REQUESTED_VERSION_INVALID = "REQUESTED_VERSION_INVALID";
+ public static final String CHECKIN_ON_ENTITY_LOCKED_BY_OTHER_USER = "CHECKIN_ON_ENTITY_LOCKED_BY_OTHER_USER";
+ public static final String CHECKIN_ON_UNLOCKED_ENTITY = "CHECKIN_ON_UNLOCKED_ENTITY";
+ public static final String CHECKOT_ON_LOCKED_ENTITY = "CHECKOT_ON_LOCKED_ENTITY";
+ public static final String DELETE_ON_LOCKED_ENTITY = "DELETE_ON_LOCKED_ENTITY";
+ public static final String EDIT_ON_ENTITY_LOCKED_BY_OTHER_USER = "EDIT_ON_ENTITY_LOCKED_BY_OTHER_USER";
+ public static final String EDIT_ON_UNLOCKED_ENTITY = "EDIT_ON_UNLOCKED_ENTITY";
+ public static final String VERSIONABLE_ENTITY_ALREADY_EXIST = "VERSIONABLE_ENTITY_ALREADY_EXIST";
+ public static final String SUBMIT_FINALIZED_ENTITY_NOT_ALLOWED = "SUBMIT_FINALIZED_ENTITY_NOT_ALLOWED";
+ public static final String VERSIONABLE_ENTITY_NOT_EXIST = "VERSIONABLE_ENTITY_NOT_EXIST";
+ public static final String VERSIONABLE_SUB_ENTITY_NOT_FOUND = "VERSIONABLE_SUB_ENTITY_NOT_FOUND";
+ public static final String SUBMIT_LOCKED_ENTITY_NOT_ALLOWED = "SUBMIT_LOCKED_ENTITY_NOT_ALLOWED";
+ public static final String UNDO_CHECKOUT_ON_ENTITY_LOCKED_BY_OTHER_USER = "UNDO_CHECKOUT_ON_ENTITY_LOCKED_BY_OTHER_USER";
+ public static final String UNDO_CHECKOUT_ON_UNLOCKED_ENTITY = "UNDO_CHECKOUT_ON_UNLOCKED_ENTITY";
+ public static final String MANDATORY_FIELD_REVISION_ID_MISSING = "MANDATORY_FIELD_REVISION_ID_MISSING";
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/Item.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/Item.java
index 154bc40dad..62d21676f2 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/Item.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/Item.java
@@ -17,47 +17,46 @@
*/
package org.openecomp.sdc.versioning.types;
-import lombok.Getter;
-import lombok.Setter;
-import org.openecomp.sdc.versioning.dao.types.VersionStatus;
-
import java.util.Date;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.Map;
+import lombok.Getter;
+import lombok.Setter;
+import org.openecomp.sdc.versioning.dao.types.VersionStatus;
@Getter
@Setter
public class Item {
- private String id;
- private String type;
- private String name;
- private String owner;
- private ItemStatus status;
- private String description;
- private Map<String, Object> properties = new HashMap<>();
- private Map<VersionStatus, Integer> versionStatusCounters = new EnumMap<>(VersionStatus.class);
- private Date creationTime;
- private Date modificationTime;
- public void addProperty(String key, Object value) {
- properties.put(key, value);
- }
+ private String id;
+ private String type;
+ private String name;
+ private String owner;
+ private ItemStatus status;
+ private String description;
+ private Map<String, Object> properties = new HashMap<>();
+ private Map<VersionStatus, Integer> versionStatusCounters = new EnumMap<>(VersionStatus.class);
+ private Date creationTime;
+ private Date modificationTime;
- public void addVersionStatus(VersionStatus versionStatus) {
- Integer counter = versionStatusCounters.get(versionStatus);
- versionStatusCounters
- .put(versionStatus, counter == null ? 1 : counter + 1);
- }
+ public void addProperty(String key, Object value) {
+ properties.put(key, value);
+ }
+
+ public void addVersionStatus(VersionStatus versionStatus) {
+ Integer counter = versionStatusCounters.get(versionStatus);
+ versionStatusCounters.put(versionStatus, counter == null ? 1 : counter + 1);
+ }
- public void removeVersionStatus(VersionStatus versionStatus) {
- Integer counter = versionStatusCounters.get(versionStatus);
- if (counter != null) {
- if (counter == 1) {
- versionStatusCounters.remove(versionStatus);
- } else {
- versionStatusCounters.put(versionStatus, counter - 1);
- }
+ public void removeVersionStatus(VersionStatus versionStatus) {
+ Integer counter = versionStatusCounters.get(versionStatus);
+ if (counter != null) {
+ if (counter == 1) {
+ versionStatusCounters.remove(versionStatus);
+ } else {
+ versionStatusCounters.put(versionStatus, counter - 1);
+ }
+ }
}
- }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/ItemStatus.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/ItemStatus.java
index 4322aee856..775eef69af 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/ItemStatus.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/ItemStatus.java
@@ -19,7 +19,4 @@
*/
package org.openecomp.sdc.versioning.types;
-public enum ItemStatus {
- ACTIVE,
- ARCHIVED
-}
+public enum ItemStatus {ACTIVE, ARCHIVED}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/NotificationEventTypes.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/NotificationEventTypes.java
index 3e443e6533..9d6a45ba36 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/NotificationEventTypes.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/NotificationEventTypes.java
@@ -29,11 +29,6 @@ import lombok.Getter;
@Getter
@AllArgsConstructor
public enum NotificationEventTypes {
- SUBMIT("submit"),
- DELETE("delete"),
- ARCHIVE("archive"),
- RESTORE("restore"),
- COMMIT("commit");
-
+ SUBMIT("submit"), DELETE("delete"), ARCHIVE("archive"), RESTORE("restore"), COMMIT("commit");
private final String eventName;
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/UniqueValueMetadata.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/UniqueValueMetadata.java
index e12a42e2c4..ab4465fb61 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/UniqueValueMetadata.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/UniqueValueMetadata.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,18 +17,18 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.types;
+import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
-import java.util.List;
@Getter
@Setter
@AllArgsConstructor
public class UniqueValueMetadata {
- private String type;
- private List<String> uniqueConstraintIdentifiers;
+
+ private String type;
+ private List<String> uniqueConstraintIdentifiers;
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionCreationMethod.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionCreationMethod.java
index 1d1af6c306..66947316ee 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionCreationMethod.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionCreationMethod.java
@@ -20,8 +20,8 @@
package org.openecomp.sdc.versioning.types;
public enum VersionCreationMethod {
- /*parent_level,
- same_level,
- sub_level*/
- major,minor
+ /*parent_level,
+ same_level,
+ sub_level*/
+ major, minor
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionInfo.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionInfo.java
index a56c73d356..ad05688987 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionInfo.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionInfo.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,37 +17,36 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.types;
+import java.util.ArrayList;
+import java.util.List;
import lombok.Getter;
import lombok.Setter;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.dao.types.VersionStatus;
-import java.util.ArrayList;
-import java.util.List;
-
@Getter
@Setter
public class VersionInfo {
- private Version activeVersion;
- private Version latestFinalVersion;
- private List<Version> viewableVersions = new ArrayList<>();
- private List<Version> finalVersions = new ArrayList<>();
- private VersionStatus status;
- private String lockingUser;
- @Override
- public String toString() {
- final StringBuilder sb = new StringBuilder("VersionInfo{");
- sb.append("activeVersion=").append(activeVersion);
- sb.append(", latestFinalVersion=").append(latestFinalVersion);
- sb.append(", viewableVersions=").append(viewableVersions);
- sb.append(", finalVersions=").append(finalVersions);
- sb.append(", status=").append(status);
- sb.append(", lockingUser='").append(lockingUser).append('\'');
- sb.append('}');
- return sb.toString();
- }
+ private Version activeVersion;
+ private Version latestFinalVersion;
+ private List<Version> viewableVersions = new ArrayList<>();
+ private List<Version> finalVersions = new ArrayList<>();
+ private VersionStatus status;
+ private String lockingUser;
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder("VersionInfo{");
+ sb.append("activeVersion=").append(activeVersion);
+ sb.append(", latestFinalVersion=").append(latestFinalVersion);
+ sb.append(", viewableVersions=").append(viewableVersions);
+ sb.append(", finalVersions=").append(finalVersions);
+ sb.append(", status=").append(status);
+ sb.append(", lockingUser='").append(lockingUser).append('\'');
+ sb.append('}');
+ return sb.toString();
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionableEntityAction.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionableEntityAction.java
index ef9fef2bda..45bce35174 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionableEntityAction.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionableEntityAction.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,10 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.types;
-public enum VersionableEntityAction {
- Read,
- Write;
-}
+public enum VersionableEntityAction {Read, Write;}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionableEntityMetadata.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionableEntityMetadata.java
index fcc02afd52..84495f6c35 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionableEntityMetadata.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionableEntityMetadata.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,35 +17,31 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.types;
-import lombok.Getter;
-import lombok.Setter;
import java.util.ArrayList;
import java.util.List;
+import lombok.Getter;
+import lombok.Setter;
@Getter
@Setter
public class VersionableEntityMetadata {
- private VersionableEntityStoreType storeType;
- private String name;
- private String identifierName;
- private String versionIdentifierName;
- private List<UniqueValueMetadata> uniqueValuesMetadata = new ArrayList<>();
-
- public VersionableEntityMetadata(String name, String identifierName,
- String versionIdentifierName) {
- this(VersionableEntityStoreType.Cassandra, name, identifierName, versionIdentifierName);
- }
+ private VersionableEntityStoreType storeType;
+ private String name;
+ private String identifierName;
+ private String versionIdentifierName;
+ private List<UniqueValueMetadata> uniqueValuesMetadata = new ArrayList<>();
- public VersionableEntityMetadata(VersionableEntityStoreType storeType, String name,
- String identifierName, String versionIdentifierName) {
- this.storeType = storeType;
- this.name = name;
- this.identifierName = identifierName;
- this.versionIdentifierName = versionIdentifierName;
- }
+ public VersionableEntityMetadata(String name, String identifierName, String versionIdentifierName) {
+ this(VersionableEntityStoreType.Cassandra, name, identifierName, versionIdentifierName);
+ }
+ public VersionableEntityMetadata(VersionableEntityStoreType storeType, String name, String identifierName, String versionIdentifierName) {
+ this.storeType = storeType;
+ this.name = name;
+ this.identifierName = identifierName;
+ this.versionIdentifierName = versionIdentifierName;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionableEntityStoreType.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionableEntityStoreType.java
index 6d420100cc..4dfba514e2 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionableEntityStoreType.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionableEntityStoreType.java
@@ -19,7 +19,4 @@
*/
package org.openecomp.sdc.versioning.types;
-public enum VersionableEntityStoreType {
- Cassandra,
- Zusammen
-}
+public enum VersionableEntityStoreType {Cassandra, Zusammen}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/VersionCalculator.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/VersionCalculator.java
index 2d64355d48..445632af3f 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/VersionCalculator.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/VersionCalculator.java
@@ -19,13 +19,13 @@
*/
package org.openecomp.sdc.versioning;
+import java.util.Set;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.types.VersionCreationMethod;
-import java.util.Set;
-
public interface VersionCalculator {
- String calculate(String baseVersion, VersionCreationMethod creationMethod);
- void injectAdditionalInfo(Version version, Set<String> existingVersions);
+ String calculate(String baseVersion, VersionCreationMethod creationMethod);
+
+ void injectAdditionalInfo(Version version, Set<String> existingVersions);
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/VersionCalculatorFactory.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/VersionCalculatorFactory.java
index 85f02cd267..0e6558564e 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/VersionCalculatorFactory.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/VersionCalculatorFactory.java
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning;
import org.openecomp.core.factory.api.AbstractComponentFactory;
@@ -25,7 +24,7 @@ import org.openecomp.core.factory.api.AbstractFactory;
public abstract class VersionCalculatorFactory extends AbstractComponentFactory<VersionCalculator> {
- public static VersionCalculatorFactory getInstance() {
- return AbstractFactory.getInstance(VersionCalculatorFactory.class);
- }
+ public static VersionCalculatorFactory getInstance() {
+ return AbstractFactory.getInstance(VersionCalculatorFactory.class);
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/ItemDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/ItemDaoFactoryImpl.java
index 0f9c9065d4..d75cc35050 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/ItemDaoFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/ItemDaoFactoryImpl.java
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.dao.impl;
import org.openecomp.core.zusammen.api.ZusammenAdaptorFactory;
@@ -26,11 +25,11 @@ import org.openecomp.sdc.versioning.dao.ItemDaoFactory;
import org.openecomp.sdc.versioning.dao.impl.zusammen.ItemZusammenDaoImpl;
public class ItemDaoFactoryImpl extends ItemDaoFactory {
- private static ItemDao INSTANCE =
- new ItemZusammenDaoImpl(ZusammenAdaptorFactory.getInstance().createInterface());
- @Override
- public ItemDao createInterface() {
- return INSTANCE;
- }
+ private static ItemDao INSTANCE = new ItemZusammenDaoImpl(ZusammenAdaptorFactory.getInstance().createInterface());
+
+ @Override
+ public ItemDao 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/VersionDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionDaoFactoryImpl.java
index f8b0d71eb7..80a385fd4b 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionDaoFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionDaoFactoryImpl.java
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.dao.impl;
import org.openecomp.core.zusammen.api.ZusammenAdaptorFactory;
@@ -26,11 +25,11 @@ import org.openecomp.sdc.versioning.dao.VersionDaoFactory;
import org.openecomp.sdc.versioning.dao.impl.zusammen.VersionZusammenDaoImpl;
public class VersionDaoFactoryImpl extends VersionDaoFactory {
- private static VersionDao INSTANCE =
- new VersionZusammenDaoImpl(ZusammenAdaptorFactory.getInstance().createInterface());
- @Override
- public VersionDao createInterface() {
- return INSTANCE;
- }
+ private static VersionDao INSTANCE = new VersionZusammenDaoImpl(ZusammenAdaptorFactory.getInstance().createInterface());
+
+ @Override
+ public VersionDao 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/VersionInfoDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionInfoDaoFactoryImpl.java
index f26164a9d3..5e63a97a92 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionInfoDaoFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionInfoDaoFactoryImpl.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.versioning.dao.impl;
import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
@@ -21,10 +20,11 @@ import org.openecomp.sdc.versioning.dao.VersionInfoDao;
import org.openecomp.sdc.versioning.dao.VersionInfoDaoFactory;
public class VersionInfoDaoFactoryImpl extends VersionInfoDaoFactory {
- private static VersionInfoDao INSTANCE = new VersionInfoDaoImpl(NoSqlDbFactory.getInstance().createInterface());
- @Override
- public VersionInfoDao createInterface() {
- return INSTANCE;
- }
+ private static VersionInfoDao INSTANCE = new VersionInfoDaoImpl(NoSqlDbFactory.getInstance().createInterface());
+
+ @Override
+ public VersionInfoDao 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/VersionInfoDaoImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionInfoDaoImpl.java
index 4df67735be..e9bb17efd2 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionInfoDaoImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionInfoDaoImpl.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.versioning.dao.impl;
import com.datastax.driver.extras.codecs.enums.EnumNameCodec;
@@ -21,50 +20,46 @@ import com.datastax.driver.mapping.Mapper;
import com.datastax.driver.mapping.Result;
import com.datastax.driver.mapping.annotations.Accessor;
import com.datastax.driver.mapping.annotations.Query;
-
import java.util.Collection;
-
import org.openecomp.core.dao.impl.CassandraBaseDao;
import org.openecomp.core.nosqldb.api.NoSqlDb;
import org.openecomp.sdc.versioning.dao.VersionInfoDao;
import org.openecomp.sdc.versioning.dao.types.VersionInfoEntity;
import org.openecomp.sdc.versioning.dao.types.VersionStatus;
-public class VersionInfoDaoImpl extends CassandraBaseDao<VersionInfoEntity>
- implements VersionInfoDao {
+public class VersionInfoDaoImpl extends CassandraBaseDao<VersionInfoEntity> implements VersionInfoDao {
+ private final NoSqlDb noSqlDb;
+ private final Mapper<VersionInfoEntity> mapper;
+ private final VersionInfoAccessor accessor;
- private final NoSqlDb noSqlDb;
- private final Mapper<VersionInfoEntity> mapper;
- private final VersionInfoAccessor accessor;
-
-
- public VersionInfoDaoImpl(NoSqlDb noSqlDb) {
- this.noSqlDb = noSqlDb;
- this.mapper = this.noSqlDb.getMappingManager().mapper(VersionInfoEntity.class);
- this.accessor = this.noSqlDb.getMappingManager().createAccessor(VersionInfoAccessor.class);
- this.noSqlDb.getMappingManager().getSession().getCluster().getConfiguration().getCodecRegistry()
+ public VersionInfoDaoImpl(NoSqlDb noSqlDb) {
+ this.noSqlDb = noSqlDb;
+ this.mapper = this.noSqlDb.getMappingManager().mapper(VersionInfoEntity.class);
+ this.accessor = this.noSqlDb.getMappingManager().createAccessor(VersionInfoAccessor.class);
+ this.noSqlDb.getMappingManager().getSession().getCluster().getConfiguration().getCodecRegistry()
.register(new EnumNameCodec<>(VersionStatus.class));
- }
+ }
+
+ @Override
+ protected Mapper<VersionInfoEntity> getMapper() {
+ return mapper;
+ }
- @Override
- protected Mapper<VersionInfoEntity> getMapper() {
- return mapper;
- }
+ @Override
+ protected Object[] getKeys(VersionInfoEntity entity) {
+ return new Object[]{entity.getEntityType(), entity.getEntityId()};
+ }
- @Override
- protected Object[] getKeys(VersionInfoEntity entity) {
- return new Object[]{entity.getEntityType(), entity.getEntityId()};
- }
+ @Override
+ public Collection<VersionInfoEntity> list(VersionInfoEntity entity) {
+ return accessor.getAll(entity.getEntityType()).all();
+ }
- @Override
- public Collection<VersionInfoEntity> list(VersionInfoEntity entity) {
- return accessor.getAll(entity.getEntityType()).all();
- }
+ @Accessor
+ interface VersionInfoAccessor {
- @Accessor
- interface VersionInfoAccessor {
- @Query("select * from version_info where entity_type=?")
- Result<VersionInfoEntity> getAll(String entityType);
- }
+ @Query("select * from version_info where entity_type=?")
+ Result<VersionInfoEntity> getAll(String entityType);
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionInfoDeletedDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionInfoDeletedDaoFactoryImpl.java
index 9163018a85..fb7c8131e4 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionInfoDeletedDaoFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionInfoDeletedDaoFactoryImpl.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,18 +17,17 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.dao.impl;
-
import org.openecomp.sdc.versioning.dao.VersionInfoDeletedDao;
import org.openecomp.sdc.versioning.dao.VersionInfoDeletedDaoFactory;
public class VersionInfoDeletedDaoFactoryImpl extends VersionInfoDeletedDaoFactory {
- private static VersionInfoDeletedDao INSTANCE = new VersionInfoDeletedDaoImpl();
- @Override
- public VersionInfoDeletedDao createInterface() {
- return INSTANCE;
- }
+ private static VersionInfoDeletedDao INSTANCE = new VersionInfoDeletedDaoImpl();
+
+ @Override
+ public VersionInfoDeletedDao 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/VersionInfoDeletedDaoImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionInfoDeletedDaoImpl.java
index af6b20252e..02945be400 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionInfoDeletedDaoImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionInfoDeletedDaoImpl.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,50 +17,44 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.dao.impl;
-
import com.datastax.driver.mapping.Mapper;
import com.datastax.driver.mapping.Result;
import com.datastax.driver.mapping.annotations.Accessor;
import com.datastax.driver.mapping.annotations.Query;
+import java.util.Collection;
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.VersionInfoDeletedDao;
import org.openecomp.sdc.versioning.dao.types.VersionInfoDeletedEntity;
-import java.util.Collection;
-
-public class VersionInfoDeletedDaoImpl extends CassandraBaseDao<VersionInfoDeletedEntity>
- implements VersionInfoDeletedDao {
+public class VersionInfoDeletedDaoImpl extends CassandraBaseDao<VersionInfoDeletedEntity> implements VersionInfoDeletedDao {
- private static NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static Mapper<VersionInfoDeletedEntity> mapper =
- noSqlDb.getMappingManager().mapper(VersionInfoDeletedEntity.class);
- private static VersionInfoAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(VersionInfoAccessor.class);
+ private static NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
+ private static Mapper<VersionInfoDeletedEntity> mapper = noSqlDb.getMappingManager().mapper(VersionInfoDeletedEntity.class);
+ private static VersionInfoAccessor accessor = noSqlDb.getMappingManager().createAccessor(VersionInfoAccessor.class);
+ @Override
+ protected Mapper<VersionInfoDeletedEntity> getMapper() {
+ return mapper;
+ }
- @Override
- protected Mapper<VersionInfoDeletedEntity> getMapper() {
- return mapper;
- }
+ @Override
+ protected Object[] getKeys(VersionInfoDeletedEntity entity) {
+ return new Object[]{entity.getEntityType(), entity.getEntityId()};
+ }
- @Override
- protected Object[] getKeys(VersionInfoDeletedEntity entity) {
- return new Object[]{entity.getEntityType(), entity.getEntityId()};
- }
+ @Override
+ public Collection<VersionInfoDeletedEntity> list(VersionInfoDeletedEntity entity) {
+ return accessor.getAll(entity.getEntityType()).all();
+ }
- @Override
- public Collection<VersionInfoDeletedEntity> list(VersionInfoDeletedEntity entity) {
- return accessor.getAll(entity.getEntityType()).all();
- }
+ @Accessor
+ interface VersionInfoAccessor {
- @Accessor
- interface VersionInfoAccessor {
- @Query("select * from version_info_deleted where entity_type=?")
- Result<VersionInfoDeletedEntity> getAll(String entityType);
- }
+ @Query("select * from version_info_deleted where entity_type=?")
+ Result<VersionInfoDeletedEntity> getAll(String entityType);
+ }
}
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 19c62ab43c..fcbbaf77aa 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
@@ -7,9 +7,9 @@
* 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.
@@ -17,12 +17,17 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
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 java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Function;
+import java.util.stream.Collectors;
import org.openecomp.core.dao.UniqueValueDao;
import org.openecomp.core.nosqldb.api.NoSqlDb;
import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
@@ -35,135 +40,103 @@ import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.types.UniqueValueMetadata;
import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-
class VersionableEntityDaoCassandraImpl implements VersionableEntityDao {
- private final UniqueValueUtil uniqueValueUtil;
- private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static Logger Logger =
- (Logger) LoggerFactory.getLogger(VersionableEntityDaoCassandraImpl.class);
-
- public VersionableEntityDaoCassandraImpl(
- UniqueValueDao uniqueValueDao) {
- this.uniqueValueUtil = new UniqueValueUtil(uniqueValueDao);
- }
+ private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
+ private static Logger Logger = (Logger) LoggerFactory.getLogger(VersionableEntityDaoCassandraImpl.class);
+ private final UniqueValueUtil uniqueValueUtil;
- private static String commaSeparatedQuestionMarks(int size) {
- StringBuilder sb = new StringBuilder(size * 2 - 1);
- for (int i = 0; i < size; i++) {
- if (i > 0) {
- sb.append(',');
- }
- sb.append('?');
+ public VersionableEntityDaoCassandraImpl(UniqueValueDao uniqueValueDao) {
+ this.uniqueValueUtil = new UniqueValueUtil(uniqueValueDao);
}
- return sb.toString();
- }
+ private static String commaSeparatedQuestionMarks(int size) {
+ StringBuilder sb = new StringBuilder(size * 2 - 1);
+ for (int i = 0; i < size; i++) {
+ if (i > 0) {
+ sb.append(',');
+ }
+ sb.append('?');
+ }
+ return sb.toString();
+ }
- @Override
- public void initVersion(VersionableEntityMetadata metadata, String entityId, Version baseVersion,
- Version newVersion) {
- ResultSet rows = loadVersionRows(metadata, entityId, baseVersion);
- List<String> columnNames =
- rows.getColumnDefinitions().asList().stream().map(ColumnDefinitions.Definition::getName)
+ @Override
+ public void initVersion(VersionableEntityMetadata metadata, String entityId, Version baseVersion, Version newVersion) {
+ ResultSet rows = loadVersionRows(metadata, entityId, baseVersion);
+ List<String> columnNames = rows.getColumnDefinitions().asList().stream().map(ColumnDefinitions.Definition::getName)
.collect(Collectors.toList());
-
- String insertCql = String.format("insert into %s (%s) values (%s)", metadata.getName(),
- CommonMethods.listToSeparatedString(columnNames, ','),
- commaSeparatedQuestionMarks(columnNames.size()));
- Logger.debug("insertCql", insertCql);
-
- for (Row row : rows) {
- List<Object> columnValues = new ArrayList<>();
- Map<String, Object> columnNameToValue = new HashMap<>();
-
- for (String columnName : columnNames) {
- if (metadata.getVersionIdentifierName().equals(columnName)) {
- columnValues.add(newVersion);
- columnNameToValue.put(columnName, newVersion.toString());
- } else {
- Object value = row.getObject(columnName);
- columnValues.add(value);
- columnNameToValue.put(columnName, value);
+ String insertCql = String.format("insert into %s (%s) values (%s)", metadata.getName(), CommonMethods.listToSeparatedString(columnNames, ','),
+ commaSeparatedQuestionMarks(columnNames.size()));
+ Logger.debug("insertCql", insertCql);
+ for (Row row : rows) {
+ List<Object> columnValues = new ArrayList<>();
+ Map<String, Object> columnNameToValue = new HashMap<>();
+ for (String columnName : columnNames) {
+ if (metadata.getVersionIdentifierName().equals(columnName)) {
+ columnValues.add(newVersion);
+ columnNameToValue.put(columnName, newVersion.toString());
+ } else {
+ Object value = row.getObject(columnName);
+ columnValues.add(value);
+ columnNameToValue.put(columnName, value);
+ }
+ }
+ initRowUniqueValues(metadata.getUniqueValuesMetadata(), columnNameToValue);
+ noSqlDb.execute(insertCql, columnValues.toArray());
}
- }
-
- initRowUniqueValues(metadata.getUniqueValuesMetadata(), columnNameToValue);
-
- noSqlDb.execute(insertCql, columnValues.toArray());
}
- }
-
- @Override
- public void deleteVersion(VersionableEntityMetadata metadata, String entityId,
- Version versionToDelete, Version backToVersion) {
- deleteRowsUniqueValues(metadata, entityId, versionToDelete);
-
- String deleteCql = String.format("delete from %s where %s=? and %s=?", metadata.getName(),
- metadata.getIdentifierName(), metadata.getVersionIdentifierName());
- noSqlDb.execute(deleteCql, entityId, versionToDelete);
- }
-
- @Override
- public void closeVersion(VersionableEntityMetadata versionableTableMetadata, String entityId,
- Version versionToClose) {
- // redundant in cassandra impl.
- }
- private ResultSet loadVersionRows(VersionableEntityMetadata metadata, String entityId,
- Version version) {
- String selectCql = String.format("select * from %s where %s=? and %s=?", metadata.getName(),
- metadata.getIdentifierName(), metadata.getVersionIdentifierName());
- Logger.debug("selectCql", selectCql);
- Logger.debug("entityId", entityId);
- Logger.debug("version", version);
+ @Override
+ public void deleteVersion(VersionableEntityMetadata metadata, String entityId, Version versionToDelete, Version backToVersion) {
+ deleteRowsUniqueValues(metadata, entityId, versionToDelete);
+ String deleteCql = String
+ .format("delete from %s where %s=? and %s=?", metadata.getName(), metadata.getIdentifierName(), metadata.getVersionIdentifierName());
+ noSqlDb.execute(deleteCql, entityId, versionToDelete);
+ }
- return noSqlDb.execute(selectCql, entityId, version);
- }
+ @Override
+ public void closeVersion(VersionableEntityMetadata versionableTableMetadata, String entityId, Version versionToClose) {
+ // redundant in cassandra impl.
+ }
- private void initRowUniqueValues(List<UniqueValueMetadata> metadata,
- Map<String, Object> columnNameToValue) {
- for (UniqueValueMetadata uniqueMetadata : metadata) {
- List<String> uniqueValueCombination = uniqueMetadata.getUniqueConstraintIdentifiers().stream()
- .map(colName -> (String) columnNameToValue.get(colName)).collect(Collectors.toList());
- uniqueValueUtil.createUniqueValue(uniqueMetadata.getType(),
- uniqueValueCombination.toArray(new String[uniqueValueCombination.size()]));
+ private ResultSet loadVersionRows(VersionableEntityMetadata metadata, String entityId, Version version) {
+ String selectCql = String
+ .format("select * from %s where %s=? and %s=?", metadata.getName(), metadata.getIdentifierName(), metadata.getVersionIdentifierName());
+ Logger.debug("selectCql", selectCql);
+ Logger.debug("entityId", entityId);
+ Logger.debug("version", version);
+ return noSqlDb.execute(selectCql, entityId, version);
}
- }
- private void deleteRowUniqueValues(List<UniqueValueMetadata> metadata,
- Map<String, Object> columnNameToValue) {
- for (UniqueValueMetadata uniqueMetadata : metadata) {
- List<String> uniqueValueCombination = uniqueMetadata.getUniqueConstraintIdentifiers().stream()
- .map(colName -> (String) columnNameToValue.get(colName)).collect(Collectors.toList());
- uniqueValueUtil.deleteUniqueValue(uniqueMetadata.getType(),
- uniqueValueCombination.toArray(new String[uniqueValueCombination.size()]));
+ private void initRowUniqueValues(List<UniqueValueMetadata> metadata, Map<String, Object> columnNameToValue) {
+ for (UniqueValueMetadata uniqueMetadata : metadata) {
+ List<String> uniqueValueCombination = uniqueMetadata.getUniqueConstraintIdentifiers().stream()
+ .map(colName -> (String) columnNameToValue.get(colName)).collect(Collectors.toList());
+ uniqueValueUtil.createUniqueValue(uniqueMetadata.getType(), uniqueValueCombination.toArray(new String[uniqueValueCombination.size()]));
+ }
}
- }
- private void deleteRowsUniqueValues(VersionableEntityMetadata metadata, String entityId,
- Version version) {
- if (metadata.getUniqueValuesMetadata().isEmpty()) {
- return;
+ private void deleteRowUniqueValues(List<UniqueValueMetadata> metadata, Map<String, Object> columnNameToValue) {
+ for (UniqueValueMetadata uniqueMetadata : metadata) {
+ List<String> uniqueValueCombination = uniqueMetadata.getUniqueConstraintIdentifiers().stream()
+ .map(colName -> (String) columnNameToValue.get(colName)).collect(Collectors.toList());
+ uniqueValueUtil.deleteUniqueValue(uniqueMetadata.getType(), uniqueValueCombination.toArray(new String[uniqueValueCombination.size()]));
+ }
}
- ResultSet rows = loadVersionRows(metadata, entityId, version);
- List<String> columnNames =
- rows.getColumnDefinitions().asList().stream().map(ColumnDefinitions.Definition::getName)
- .collect(Collectors.toList());
- for (Row row : rows) {
- Map<String, Object> columnNameToValue =
- columnNames.stream().filter(name -> row.getObject(name) != null).collect(Collectors
- .toMap(Function.identity(),
- columnName -> metadata.getVersionIdentifierName().equals(columnName) ? version
- .toString() : row.getObject(columnName)));
- deleteRowUniqueValues(metadata.getUniqueValuesMetadata(), columnNameToValue);
+ private void deleteRowsUniqueValues(VersionableEntityMetadata metadata, String entityId, Version version) {
+ if (metadata.getUniqueValuesMetadata().isEmpty()) {
+ return;
+ }
+ ResultSet rows = loadVersionRows(metadata, entityId, version);
+ List<String> columnNames = rows.getColumnDefinitions().asList().stream().map(ColumnDefinitions.Definition::getName)
+ .collect(Collectors.toList());
+ for (Row row : rows) {
+ Map<String, Object> columnNameToValue = columnNames.stream().filter(name -> row.getObject(name) != null).collect(Collectors
+ .toMap(Function.identity(),
+ columnName -> metadata.getVersionIdentifierName().equals(columnName) ? version.toString() : row.getObject(columnName)));
+ deleteRowUniqueValues(metadata.getUniqueValuesMetadata(), columnNameToValue);
+ }
}
- }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoFactoryImpl.java
index d9300a007b..806d77ecd2 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoFactoryImpl.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.dao.impl;
import org.openecomp.core.dao.UniqueValueDaoFactory;
@@ -27,26 +26,26 @@ import org.openecomp.sdc.versioning.dao.VersionableEntityDaoFactory;
import org.openecomp.sdc.versioning.types.VersionableEntityStoreType;
public class VersionableEntityDaoFactoryImpl extends VersionableEntityDaoFactory {
- private static VersionableEntityDao CASSANDRA_INSTANCE = new VersionableEntityDaoCassandraImpl(
- UniqueValueDaoFactory.getInstance().createInterface());
- private static VersionableEntityDao ZUSAMMEN_INSTANCE =
- new VersionableEntityDaoZusammenImpl(ZusammenAdaptorFactory.getInstance().createInterface());
- @Override
- public VersionableEntityDao createInterface() {
- throw new UnsupportedOperationException
- ("Please use createInterface api with VersionableEntityStoreType argument.");
- }
+ private static VersionableEntityDao CASSANDRA_INSTANCE = new VersionableEntityDaoCassandraImpl(
+ UniqueValueDaoFactory.getInstance().createInterface());
+ private static VersionableEntityDao ZUSAMMEN_INSTANCE = new VersionableEntityDaoZusammenImpl(
+ ZusammenAdaptorFactory.getInstance().createInterface());
+
+ @Override
+ public VersionableEntityDao createInterface() {
+ throw new UnsupportedOperationException("Please use createInterface api with VersionableEntityStoreType argument.");
+ }
- @Override
- public VersionableEntityDao createInterface(VersionableEntityStoreType storeType) {
- switch (storeType) {
- case Cassandra:
- return CASSANDRA_INSTANCE;
- case Zusammen:
- return ZUSAMMEN_INSTANCE;
- default:
- throw new IllegalArgumentException("Unssported state store");
+ @Override
+ public VersionableEntityDao createInterface(VersionableEntityStoreType storeType) {
+ switch (storeType) {
+ case Cassandra:
+ return CASSANDRA_INSTANCE;
+ case Zusammen:
+ return ZUSAMMEN_INSTANCE;
+ default:
+ throw new IllegalArgumentException("Unssported state store");
+ }
}
- }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoZusammenImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoZusammenImpl.java
index f90ef79290..f8c479eb5b 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoZusammenImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionableEntityDaoZusammenImpl.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.versioning.dao.impl;
import com.amdocs.zusammen.datatypes.Id;
@@ -32,53 +31,47 @@ import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
public class VersionableEntityDaoZusammenImpl implements VersionableEntityDao {
- private ZusammenAdaptor zusammenAdaptor;
+ private ZusammenAdaptor zusammenAdaptor;
- public VersionableEntityDaoZusammenImpl(ZusammenAdaptor zusammenAdaptor) {
- this.zusammenAdaptor = zusammenAdaptor;
- }
+ public VersionableEntityDaoZusammenImpl(ZusammenAdaptor zusammenAdaptor) {
+ this.zusammenAdaptor = zusammenAdaptor;
+ }
- @Override
- public void initVersion(VersionableEntityMetadata versionableTableMetadata, String entityId,
- Version baseVersion, Version newVersion) {
- // redundant in zusammen impl.
- }
+ private static Comparator<ItemVersion> getVersionModificationTimeDescComparator() {
+ return (o1, o2) -> Integer.compare(o2.getId().getValue().length(), o1.getId().getValue().length());
+ }
- @Override
- public void deleteVersion(VersionableEntityMetadata versionableTableMetadata, String entityId,
- Version versionToDelete, Version backToVersion) {
- SessionContext context = ZusammenUtil.createSessionContext();
- Id itemId = new Id(entityId);
- Id versionId = getItemVersionId(itemId, context);
- zusammenAdaptor.resetVersionHistory(context, itemId, versionId, backToVersion.toString());
- }
+ @Override
+ public void initVersion(VersionableEntityMetadata versionableTableMetadata, String entityId, Version baseVersion, Version newVersion) {
+ // redundant in zusammen impl.
+ }
- @Override
- public void closeVersion(VersionableEntityMetadata versionableTableMetadata, String entityId,
- Version versionToClose) {
- SessionContext context = ZusammenUtil.createSessionContext();
- Id itemId = new Id(entityId);
- Id versionId = getItemVersionId(itemId, context);
- zusammenAdaptor
- .tagVersion(context, itemId, versionId, new Tag(versionToClose.toString(), null));
- }
+ @Override
+ public void deleteVersion(VersionableEntityMetadata versionableTableMetadata, String entityId, Version versionToDelete, Version backToVersion) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(entityId);
+ Id versionId = getItemVersionId(itemId, context);
+ zusammenAdaptor.resetVersionHistory(context, itemId, versionId, backToVersion.toString());
+ }
- // TODO: 3/19/2017 move to a common util
- private Id getItemVersionId(Id itemId, SessionContext context) {
- Optional<ItemVersion> itemVersionOptional = getFirstVersion(context, itemId);
- ItemVersion itemVersion = itemVersionOptional.orElseThrow(() ->
- new RuntimeException(String.format("No version was found for item %s.", itemId)));
- return itemVersion.getId();
- }
+ @Override
+ public void closeVersion(VersionableEntityMetadata versionableTableMetadata, String entityId, Version versionToClose) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(entityId);
+ Id versionId = getItemVersionId(itemId, context);
+ zusammenAdaptor.tagVersion(context, itemId, versionId, new Tag(versionToClose.toString(), null));
+ }
- private Optional<ItemVersion> getFirstVersion(SessionContext context, Id itemId) {
- Collection<ItemVersion> versions = zusammenAdaptor.listPublicVersions(context, itemId);
- return CollectionUtils.isEmpty(versions)
- ? Optional.empty()
- : versions.stream().min(getVersionModificationTimeDescComparator());
- }
+ // TODO: 3/19/2017 move to a common util
+ private Id getItemVersionId(Id itemId, SessionContext context) {
+ Optional<ItemVersion> itemVersionOptional = getFirstVersion(context, itemId);
+ ItemVersion itemVersion = itemVersionOptional
+ .orElseThrow(() -> new RuntimeException(String.format("No version was found for item %s.", itemId)));
+ return itemVersion.getId();
+ }
- private static Comparator<ItemVersion> getVersionModificationTimeDescComparator() {
- return (o1, o2) -> Integer.compare(o2.getId().getValue().length(), o1.getId().getValue().length());
- }
+ private Optional<ItemVersion> getFirstVersion(SessionContext context, Id itemId) {
+ Collection<ItemVersion> versions = zusammenAdaptor.listPublicVersions(context, itemId);
+ return CollectionUtils.isEmpty(versions) ? Optional.empty() : versions.stream().min(getVersionModificationTimeDescComparator());
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/zusammen/ItemZusammenDaoImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/zusammen/ItemZusammenDaoImpl.java
index b631663813..6ac18d9ff9 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/zusammen/ItemZusammenDaoImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/zusammen/ItemZusammenDaoImpl.java
@@ -21,6 +21,9 @@ package org.openecomp.sdc.versioning.dao.impl.zusammen;
import com.amdocs.zusammen.datatypes.Id;
import com.amdocs.zusammen.datatypes.item.Info;
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
import org.openecomp.core.zusammen.api.ZusammenAdaptor;
import org.openecomp.core.zusammen.api.ZusammenUtil;
import org.openecomp.sdc.versioning.dao.ItemDao;
@@ -28,120 +31,103 @@ import org.openecomp.sdc.versioning.dao.types.VersionStatus;
import org.openecomp.sdc.versioning.types.Item;
import org.openecomp.sdc.versioning.types.ItemStatus;
-import java.util.Collection;
-import java.util.Map;
-import java.util.stream.Collectors;
-
public class ItemZusammenDaoImpl implements ItemDao {
- private ZusammenAdaptor zusammenAdaptor;
-
- public ItemZusammenDaoImpl(ZusammenAdaptor zusammenAdaptor) {
- this.zusammenAdaptor = zusammenAdaptor;
- }
-
- @Override
- public Collection<Item> list() {
- return zusammenAdaptor.listItems(ZusammenUtil.createSessionContext())
- .stream().map(this::mapFromZusammenItem)
- .collect(Collectors.toList());
- }
-
- @Override
- public Item get(Item item) {
- return mapFromZusammenItem(
- zusammenAdaptor.getItem(ZusammenUtil.createSessionContext(), new Id(item.getId())));
- }
-
- @Override
- public Item create(Item item) {
- Id itemId = zusammenAdaptor
- .createItem(ZusammenUtil.createSessionContext(), mapToZusammenItemInfo(item));
- item.setId(itemId.getValue());
- return item;
- }
+ private ZusammenAdaptor zusammenAdaptor;
- @Override
- public void delete(Item item){
- zusammenAdaptor.deleteItem(ZusammenUtil.createSessionContext(),new Id(item.getId()));
- }
+ public ItemZusammenDaoImpl(ZusammenAdaptor zusammenAdaptor) {
+ this.zusammenAdaptor = zusammenAdaptor;
+ }
- @Override
- public void update(Item item) {
- zusammenAdaptor
- .updateItem(ZusammenUtil.createSessionContext(), new Id(item.getId()),
- mapToZusammenItemInfo(item));
- }
+ @Override
+ public Collection<Item> list() {
+ return zusammenAdaptor.listItems(ZusammenUtil.createSessionContext()).stream().map(this::mapFromZusammenItem).collect(Collectors.toList());
+ }
- private Item mapFromZusammenItem(com.amdocs.zusammen.datatypes.item.Item zusammenItem) {
- if (zusammenItem == null) {
- return null;
+ @Override
+ public Item get(Item item) {
+ return mapFromZusammenItem(zusammenAdaptor.getItem(ZusammenUtil.createSessionContext(), new Id(item.getId())));
}
- Item item = new Item();
- item.setId(zusammenItem.getId().getValue());
- item.setName(zusammenItem.getInfo().getName());
- item.setDescription(zusammenItem.getInfo().getDescription());
- zusammenItem.getInfo().getProperties().entrySet()
- .forEach(property -> addPropertyToItem(property.getKey(), property.getValue(), item));
+ @Override
+ public Item create(Item item) {
+ Id itemId = zusammenAdaptor.createItem(ZusammenUtil.createSessionContext(), mapToZusammenItemInfo(item));
+ item.setId(itemId.getValue());
+ return item;
+ }
- item.setCreationTime(zusammenItem.getCreationTime());
- item.setModificationTime(zusammenItem.getModificationTime());
+ @Override
+ public void delete(Item item) {
+ zusammenAdaptor.deleteItem(ZusammenUtil.createSessionContext(), new Id(item.getId()));
+ }
- if(item.getStatus() == null){
- item.setStatus(ItemStatus.ACTIVE);
- update(item);
+ @Override
+ public void update(Item item) {
+ zusammenAdaptor.updateItem(ZusammenUtil.createSessionContext(), new Id(item.getId()), mapToZusammenItemInfo(item));
}
- return item;
- }
+ private Item mapFromZusammenItem(com.amdocs.zusammen.datatypes.item.Item zusammenItem) {
+ if (zusammenItem == null) {
+ return null;
+ }
+ Item item = new Item();
+ item.setId(zusammenItem.getId().getValue());
+ item.setName(zusammenItem.getInfo().getName());
+ item.setDescription(zusammenItem.getInfo().getDescription());
+ zusammenItem.getInfo().getProperties().entrySet().forEach(property -> addPropertyToItem(property.getKey(), property.getValue(), item));
+ item.setCreationTime(zusammenItem.getCreationTime());
+ item.setModificationTime(zusammenItem.getModificationTime());
+ if (item.getStatus() == null) {
+ item.setStatus(ItemStatus.ACTIVE);
+ update(item);
+ }
+ return item;
+ }
- private void addPropertyToItem(String propertyKey, Object propertyValue, Item item) {
- switch (propertyKey) {
- case InfoPropertyName.ITEM_TYPE:
- item.setType((String) propertyValue);
- break;
- case InfoPropertyName.ITEM_OWNER:
- item.setOwner((String) propertyValue);
- break;
- case InfoPropertyName.ITEM_STATUS:
- item.setStatus(ItemStatus.valueOf((String)propertyValue));
- break;
- case InfoPropertyName.ITEM_VERSIONS_STATUSES:
- for (Map.Entry<String, Number> statusCounter :
- ((Map<String, Number>) propertyValue).entrySet()) {
- item.getVersionStatusCounters().put(VersionStatus.valueOf(statusCounter.getKey()),
- statusCounter.getValue().intValue());
+ private void addPropertyToItem(String propertyKey, Object propertyValue, Item item) {
+ switch (propertyKey) {
+ case InfoPropertyName.ITEM_TYPE:
+ item.setType((String) propertyValue);
+ break;
+ case InfoPropertyName.ITEM_OWNER:
+ item.setOwner((String) propertyValue);
+ break;
+ case InfoPropertyName.ITEM_STATUS:
+ item.setStatus(ItemStatus.valueOf((String) propertyValue));
+ break;
+ case InfoPropertyName.ITEM_VERSIONS_STATUSES:
+ for (Map.Entry<String, Number> statusCounter : ((Map<String, Number>) propertyValue).entrySet()) {
+ item.getVersionStatusCounters().put(VersionStatus.valueOf(statusCounter.getKey()), statusCounter.getValue().intValue());
+ }
+ break;
+ default:
+ item.addProperty(propertyKey, propertyValue);
}
- break;
- default:
- item.addProperty(propertyKey, propertyValue);
}
- }
- private Info mapToZusammenItemInfo(Item item) {
- Info info = new Info();
- info.setName(item.getName());
- info.setDescription(item.getDescription());
- info.addProperty(InfoPropertyName.ITEM_TYPE, item.getType());
- info.addProperty(InfoPropertyName.ITEM_OWNER,item.getOwner());
- if (item.getStatus() != null) {
- info.addProperty(InfoPropertyName.ITEM_STATUS, item.getStatus());
+ private Info mapToZusammenItemInfo(Item item) {
+ Info info = new Info();
+ info.setName(item.getName());
+ info.setDescription(item.getDescription());
+ info.addProperty(InfoPropertyName.ITEM_TYPE, item.getType());
+ info.addProperty(InfoPropertyName.ITEM_OWNER, item.getOwner());
+ if (item.getStatus() != null) {
+ info.addProperty(InfoPropertyName.ITEM_STATUS, item.getStatus());
+ }
+ info.addProperty(InfoPropertyName.ITEM_VERSIONS_STATUSES, item.getVersionStatusCounters());
+ item.getProperties().entrySet().forEach(property -> info.addProperty(property.getKey(), property.getValue()));
+ return info;
}
- info.addProperty(InfoPropertyName.ITEM_VERSIONS_STATUSES, item.getVersionStatusCounters());
- item.getProperties().entrySet()
- .forEach(property -> info.addProperty(property.getKey(), property.getValue()));
- return info;
- }
- private static final class InfoPropertyName {
- private static final String ITEM_TYPE = "item_type";
- private static final String ITEM_VERSIONS_STATUSES = "item_versions_statuses";
- private static final String ITEM_OWNER = "Owner";
- private static final String ITEM_STATUS = "status";
+ private static final class InfoPropertyName {
- private InfoPropertyName() {
- throw new IllegalStateException("Constants class");
+ private static final String ITEM_TYPE = "item_type";
+ private static final String ITEM_VERSIONS_STATUSES = "item_versions_statuses";
+ private static final String ITEM_OWNER = "Owner";
+ private static final String ITEM_STATUS = "status";
+
+ private InfoPropertyName() {
+ throw new IllegalStateException("Constants class");
+ }
}
- }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/zusammen/VersionZusammenDaoImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/zusammen/VersionZusammenDaoImpl.java
index dfefc7273d..044359a165 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/zusammen/VersionZusammenDaoImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/zusammen/VersionZusammenDaoImpl.java
@@ -23,7 +23,11 @@ import static org.openecomp.core.zusammen.api.ZusammenUtil.createSessionContext;
import com.amdocs.zusammen.datatypes.Id;
import com.amdocs.zusammen.datatypes.SessionContext;
-import com.amdocs.zusammen.datatypes.item.*;
+import com.amdocs.zusammen.datatypes.item.Info;
+import com.amdocs.zusammen.datatypes.item.ItemVersion;
+import com.amdocs.zusammen.datatypes.item.ItemVersionData;
+import com.amdocs.zusammen.datatypes.item.ItemVersionStatus;
+import com.amdocs.zusammen.datatypes.item.SynchronizationStatus;
import com.amdocs.zusammen.datatypes.itemversion.ItemVersionRevisions;
import java.util.ArrayList;
import java.util.List;
@@ -42,168 +46,148 @@ import org.openecomp.sdc.versioning.dao.types.VersionState;
public class VersionZusammenDaoImpl implements VersionDao {
- public static final class ZusammenProperty {
- public static final String LABEL = "label";
- public static final String STATUS = "status";
-
- private ZusammenProperty() {
- throw new IllegalStateException("Constants class");
- }
- }
-
- private ZusammenAdaptor zusammenAdaptor;
-
- public VersionZusammenDaoImpl(ZusammenAdaptor zusammenAdaptor) {
- this.zusammenAdaptor = zusammenAdaptor;
- }
-
- @Override
- public List<Version> list(String itemId) {
- ItemVersionToVersionConvertor convertor = new ItemVersionToVersionConvertor();
- return zusammenAdaptor.listPublicVersions(createSessionContext(), new Id(itemId)).stream()
- .map(convertor::convert)
- .collect(Collectors.toList());
- }
-
- @Override
- public void create(String itemId, Version version) {
- Id versionId =
- zusammenAdaptor.createVersion(createSessionContext(), new Id(itemId),
- version.getBaseId() == null ? null : new Id(version.getBaseId()),
- mapToZusammenVersion(version));
-
- version.setId(versionId.getValue());
- }
-
- @Override
- public void update(String itemId, Version version) {
- zusammenAdaptor.updateVersion(createSessionContext(), new Id(itemId), new Id(version.getId()),
- mapToZusammenVersion(version));
- }
-
- @Override
- public Optional<Version> get(String itemId, Version version) {
- SessionContext context = createSessionContext();
- Id itemIdObj = new Id(itemId);
- Id versionId = new Id(version.getId());
- ItemVersion itemVersion = zusammenAdaptor.getVersion(context, itemIdObj, versionId);
-
- if (itemVersion == null) {
- return Optional.empty();
- }
-
- VersionState versionState =
- convertState(zusammenAdaptor.getVersionStatus(context, itemIdObj, versionId));
- updateVersionStatus(context, itemIdObj, versionId, versionState, itemVersion);
-
- Version result = new ItemVersionToVersionConvertor().convert(itemVersion);
- result.setState(versionState);
- return Optional.of(result);
- }
-
- @Override
- public void delete(String itemId, Version version) {
- throw new UnsupportedOperationException("Delete version operation is not yet supported.");
- }
-
- @Override
- public void publish(String itemId, Version version, String message) {
- zusammenAdaptor
- .publishVersion(createSessionContext(), new Id(itemId), new Id(version.getId()), message);
- }
-
- @Override
- public void sync(String itemId, Version version) {
- zusammenAdaptor
- .syncVersion(createSessionContext(), new Id(itemId), new Id(version.getId()));
- }
-
- @Override
- public void forceSync(String itemId, Version version) {
- zusammenAdaptor
- .forceSyncVersion(createSessionContext(), new Id(itemId), new Id(version.getId()));
- }
-
- @Override
- public void clean(String itemId, Version version) {
- zusammenAdaptor.cleanVersion(createSessionContext(), new Id(itemId), new Id(version.getId()));
- }
-
- @Override
- public void revert(String itemId, Version version, String revisionId) {
- zusammenAdaptor.revert(createSessionContext(), new Id(itemId), new Id(version.getId()),
- new Id(revisionId));
- }
-
- @Override
- public List<Revision> listRevisions(String itemId, Version version) {
- ItemVersionRevisions itemVersionRevisions = zusammenAdaptor
- .listRevisions(createSessionContext(), new Id(itemId), new Id(version.getId()));
-
- return itemVersionRevisions == null || itemVersionRevisions.getItemVersionRevisions() == null ||
- itemVersionRevisions.getItemVersionRevisions().isEmpty()
- ? new ArrayList<>()
- : itemVersionRevisions.getItemVersionRevisions().stream()
- .map(this::convertRevision)
- .sorted(this::compareRevisionsTime)
+ private ZusammenAdaptor zusammenAdaptor;
+
+ public VersionZusammenDaoImpl(ZusammenAdaptor zusammenAdaptor) {
+ this.zusammenAdaptor = zusammenAdaptor;
+ }
+
+ @Override
+ public List<Version> list(String itemId) {
+ ItemVersionToVersionConvertor convertor = new ItemVersionToVersionConvertor();
+ return zusammenAdaptor.listPublicVersions(createSessionContext(), new Id(itemId)).stream().map(convertor::convert)
.collect(Collectors.toList());
- }
-
- private void updateVersionStatus(SessionContext context, Id itemId, Id versionId,
- VersionState versionState, ItemVersion itemVersion) {
- if (versionState.getSynchronizationState() != SynchronizationState.UpToDate) {
- String versionStatus = zusammenAdaptor.getPublicVersion(context, itemId, versionId)
- .getData().getInfo().getProperty(ZusammenProperty.STATUS);
- itemVersion.getData().getInfo().addProperty(ZusammenProperty.STATUS, versionStatus);
- }
- }
-
- private ItemVersionData mapToZusammenVersion(Version version) {
- Info info = new Info();
- info.addProperty(ZusammenProperty.LABEL, version.toString());
- info.addProperty(ZusammenProperty.STATUS, version.getStatus().name());
- info.setName(version.getName());
- info.setDescription(version.getDescription());
-
- ItemVersionData itemVersionData = new ItemVersionData();
- itemVersionData.setInfo(info);
- return itemVersionData;
- }
-
- private VersionState convertState(ItemVersionStatus versionStatus) {
- VersionState state = new VersionState();
- state.setSynchronizationState(getSyncState(versionStatus.getSynchronizationStatus()));
- state.setDirty(versionStatus.isDirty());
- return state;
- }
-
- private SynchronizationState getSyncState(SynchronizationStatus synchronizationStatus) {
- switch (synchronizationStatus) {
- case UP_TO_DATE:
- return SynchronizationState.UpToDate;
- case OUT_OF_SYNC:
- return SynchronizationState.OutOfSync;
- case MERGING:
- return SynchronizationState.Merging;
- default:
- throw new CoreException(new ErrorCode.ErrorCodeBuilder()
- .withCategory(ErrorCategory.APPLICATION)
- .withId("UNKNOWN_VERSION_STATE")
- .withMessage("Version state is unknown").build());
- }
- }
-
- private Revision convertRevision(
- com.amdocs.zusammen.datatypes.itemversion.Revision zusammenRevision) {
- Revision revision = new Revision();
- revision.setId(zusammenRevision.getRevisionId().getValue());
- revision.setTime(zusammenRevision.getTime());
- revision.setUser(zusammenRevision.getUser());
- revision.setMessage(zusammenRevision.getMessage());
- return revision;
- }
-
- private int compareRevisionsTime(Revision revision1, Revision revision2) {
- return revision1.getTime().before(revision2.getTime()) ? 1 : -1;
- }
+ }
+
+ @Override
+ public void create(String itemId, Version version) {
+ Id versionId = zusammenAdaptor
+ .createVersion(createSessionContext(), new Id(itemId), version.getBaseId() == null ? null : new Id(version.getBaseId()),
+ mapToZusammenVersion(version));
+ version.setId(versionId.getValue());
+ }
+
+ @Override
+ public void update(String itemId, Version version) {
+ zusammenAdaptor.updateVersion(createSessionContext(), new Id(itemId), new Id(version.getId()), mapToZusammenVersion(version));
+ }
+
+ @Override
+ public Optional<Version> get(String itemId, Version version) {
+ SessionContext context = createSessionContext();
+ Id itemIdObj = new Id(itemId);
+ Id versionId = new Id(version.getId());
+ ItemVersion itemVersion = zusammenAdaptor.getVersion(context, itemIdObj, versionId);
+ if (itemVersion == null) {
+ return Optional.empty();
+ }
+ VersionState versionState = convertState(zusammenAdaptor.getVersionStatus(context, itemIdObj, versionId));
+ updateVersionStatus(context, itemIdObj, versionId, versionState, itemVersion);
+ Version result = new ItemVersionToVersionConvertor().convert(itemVersion);
+ result.setState(versionState);
+ return Optional.of(result);
+ }
+
+ @Override
+ public void delete(String itemId, Version version) {
+ throw new UnsupportedOperationException("Delete version operation is not yet supported.");
+ }
+
+ @Override
+ public void publish(String itemId, Version version, String message) {
+ zusammenAdaptor.publishVersion(createSessionContext(), new Id(itemId), new Id(version.getId()), message);
+ }
+
+ @Override
+ public void sync(String itemId, Version version) {
+ zusammenAdaptor.syncVersion(createSessionContext(), new Id(itemId), new Id(version.getId()));
+ }
+
+ @Override
+ public void forceSync(String itemId, Version version) {
+ zusammenAdaptor.forceSyncVersion(createSessionContext(), new Id(itemId), new Id(version.getId()));
+ }
+
+ @Override
+ public void clean(String itemId, Version version) {
+ zusammenAdaptor.cleanVersion(createSessionContext(), new Id(itemId), new Id(version.getId()));
+ }
+
+ @Override
+ public void revert(String itemId, Version version, String revisionId) {
+ zusammenAdaptor.revert(createSessionContext(), new Id(itemId), new Id(version.getId()), new Id(revisionId));
+ }
+
+ @Override
+ public List<Revision> listRevisions(String itemId, Version version) {
+ ItemVersionRevisions itemVersionRevisions = zusammenAdaptor.listRevisions(createSessionContext(), new Id(itemId), new Id(version.getId()));
+ return
+ itemVersionRevisions == null || itemVersionRevisions.getItemVersionRevisions() == null || itemVersionRevisions.getItemVersionRevisions()
+ .isEmpty() ? new ArrayList<>()
+ : itemVersionRevisions.getItemVersionRevisions().stream().map(this::convertRevision).sorted(this::compareRevisionsTime)
+ .collect(Collectors.toList());
+ }
+
+ private void updateVersionStatus(SessionContext context, Id itemId, Id versionId, VersionState versionState, ItemVersion itemVersion) {
+ if (versionState.getSynchronizationState() != SynchronizationState.UpToDate) {
+ String versionStatus = zusammenAdaptor.getPublicVersion(context, itemId, versionId).getData().getInfo()
+ .getProperty(ZusammenProperty.STATUS);
+ itemVersion.getData().getInfo().addProperty(ZusammenProperty.STATUS, versionStatus);
+ }
+ }
+
+ private ItemVersionData mapToZusammenVersion(Version version) {
+ Info info = new Info();
+ info.addProperty(ZusammenProperty.LABEL, version.toString());
+ info.addProperty(ZusammenProperty.STATUS, version.getStatus().name());
+ info.setName(version.getName());
+ info.setDescription(version.getDescription());
+ ItemVersionData itemVersionData = new ItemVersionData();
+ itemVersionData.setInfo(info);
+ return itemVersionData;
+ }
+
+ private VersionState convertState(ItemVersionStatus versionStatus) {
+ VersionState state = new VersionState();
+ state.setSynchronizationState(getSyncState(versionStatus.getSynchronizationStatus()));
+ state.setDirty(versionStatus.isDirty());
+ return state;
+ }
+
+ private SynchronizationState getSyncState(SynchronizationStatus synchronizationStatus) {
+ switch (synchronizationStatus) {
+ case UP_TO_DATE:
+ return SynchronizationState.UpToDate;
+ case OUT_OF_SYNC:
+ return SynchronizationState.OutOfSync;
+ case MERGING:
+ return SynchronizationState.Merging;
+ default:
+ throw new CoreException(new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION).withId("UNKNOWN_VERSION_STATE")
+ .withMessage("Version state is unknown").build());
+ }
+ }
+
+ private Revision convertRevision(com.amdocs.zusammen.datatypes.itemversion.Revision zusammenRevision) {
+ Revision revision = new Revision();
+ revision.setId(zusammenRevision.getRevisionId().getValue());
+ revision.setTime(zusammenRevision.getTime());
+ revision.setUser(zusammenRevision.getUser());
+ revision.setMessage(zusammenRevision.getMessage());
+ return revision;
+ }
+
+ private int compareRevisionsTime(Revision revision1, Revision revision2) {
+ return revision1.getTime().before(revision2.getTime()) ? 1 : -1;
+ }
+
+ public static final class ZusammenProperty {
+
+ public static final String LABEL = "label";
+ public static final String STATUS = "status";
+
+ private ZusammenProperty() {
+ throw new IllegalStateException("Constants class");
+ }
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/zusammen/convertor/ItemVersionToVersionConvertor.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/zusammen/convertor/ItemVersionToVersionConvertor.java
index 2ebb95b33b..361b1bcbec 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/zusammen/convertor/ItemVersionToVersionConvertor.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/zusammen/convertor/ItemVersionToVersionConvertor.java
@@ -29,40 +29,37 @@ import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.dao.types.VersionStatus;
public class ItemVersionToVersionConvertor extends ElementConvertor {
- @Override
- public Object convert(Element element) {
- return null;
- }
- @Override
- public Object convert(Item item) {
- return null;
- }
-
- @Override
- public Object convert(ElementInfo elementInfo) {
- return null;
- }
+ @Override
+ public Object convert(Element element) {
+ return null;
+ }
- @Override
- public Version convert(ItemVersion itemVersion) {
- if (itemVersion == null) {
- return null;
+ @Override
+ public Object convert(Item item) {
+ return null;
}
- Version version = Version.valueOf(
- itemVersion.getData().getInfo().getProperty(VersionZusammenDaoImpl.ZusammenProperty.LABEL));
- version.setStatus(VersionStatus.valueOf(itemVersion.getData().getInfo()
- .getProperty(VersionZusammenDaoImpl.ZusammenProperty.STATUS)));
- version.setName(itemVersion.getData().getInfo().getName());
- version.setDescription(itemVersion.getData().getInfo().getDescription());
- version.setId(itemVersion.getId().getValue());
- if (itemVersion.getBaseId() != null) {
- version.setBaseId(itemVersion.getBaseId().getValue());
+ @Override
+ public Object convert(ElementInfo elementInfo) {
+ return null;
}
- version.setCreationTime(itemVersion.getCreationTime());
- version.setModificationTime(itemVersion.getModificationTime());
- return version;
- }
+ @Override
+ public Version convert(ItemVersion itemVersion) {
+ if (itemVersion == null) {
+ return null;
+ }
+ Version version = Version.valueOf(itemVersion.getData().getInfo().getProperty(VersionZusammenDaoImpl.ZusammenProperty.LABEL));
+ version.setStatus(VersionStatus.valueOf(itemVersion.getData().getInfo().getProperty(VersionZusammenDaoImpl.ZusammenProperty.STATUS)));
+ version.setName(itemVersion.getData().getInfo().getName());
+ version.setDescription(itemVersion.getData().getInfo().getDescription());
+ version.setId(itemVersion.getId().getValue());
+ if (itemVersion.getBaseId() != null) {
+ version.setBaseId(itemVersion.getBaseId().getValue());
+ }
+ version.setCreationTime(itemVersion.getCreationTime());
+ version.setModificationTime(itemVersion.getModificationTime());
+ return version;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ActionVersioningManagerFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ActionVersioningManagerFactoryImpl.java
index 054a569958..0de4af3ab8 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ActionVersioningManagerFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ActionVersioningManagerFactoryImpl.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.versioning.impl;
import org.openecomp.sdc.versioning.ActionVersioningManager;
@@ -26,14 +25,10 @@ import org.openecomp.sdc.versioning.dao.VersionInfoDeletedDaoFactory;
public class ActionVersioningManagerFactoryImpl extends ActionVersioningManagerFactory {
-
- @Override
- public ActionVersioningManager createInterface() {
- return new ActionVersioningManagerImpl(
- VersionInfoDaoFactory.getInstance().createInterface(),
- VersionInfoDeletedDaoFactory.getInstance().createInterface(),
- VersionDaoFactory.getInstance().createInterface(),
- VersionCalculatorFactory.getInstance().createInterface(),
- AsdcItemManagerFactory.getInstance().createInterface());
- }
+ @Override
+ public ActionVersioningManager createInterface() {
+ return new ActionVersioningManagerImpl(VersionInfoDaoFactory.getInstance().createInterface(),
+ VersionInfoDeletedDaoFactory.getInstance().createInterface(), VersionDaoFactory.getInstance().createInterface(),
+ VersionCalculatorFactory.getInstance().createInterface(), AsdcItemManagerFactory.getInstance().createInterface());
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ActionVersioningManagerImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ActionVersioningManagerImpl.java
index ef33beadab..a69e862582 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ActionVersioningManagerImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ActionVersioningManagerImpl.java
@@ -13,9 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.versioning.impl;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
@@ -28,585 +34,494 @@ import org.openecomp.sdc.versioning.dao.VersionDao;
import org.openecomp.sdc.versioning.dao.VersionInfoDao;
import org.openecomp.sdc.versioning.dao.VersionInfoDeletedDao;
import org.openecomp.sdc.versioning.dao.VersionableEntityDaoFactory;
-import org.openecomp.sdc.versioning.dao.types.*;
-import org.openecomp.sdc.versioning.errors.*;
+import org.openecomp.sdc.versioning.dao.types.Revision;
+import org.openecomp.sdc.versioning.dao.types.SynchronizationState;
+import org.openecomp.sdc.versioning.dao.types.UserCandidateVersion;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.dao.types.VersionInfoDeletedEntity;
+import org.openecomp.sdc.versioning.dao.types.VersionInfoEntity;
+import org.openecomp.sdc.versioning.dao.types.VersionStatus;
+import org.openecomp.sdc.versioning.errors.CheckinOnEntityLockedByOtherErrorBuilder;
+import org.openecomp.sdc.versioning.errors.CheckinOnUnlockedEntityErrorBuilder;
+import org.openecomp.sdc.versioning.errors.CheckoutOnLockedEntityErrorBuilder;
+import org.openecomp.sdc.versioning.errors.DeleteOnLockedEntityErrorBuilder;
+import org.openecomp.sdc.versioning.errors.EditOnEntityLockedByOtherErrorBuilder;
+import org.openecomp.sdc.versioning.errors.EditOnUnlockedEntityErrorBuilder;
+import org.openecomp.sdc.versioning.errors.EntityAlreadyExistErrorBuilder;
+import org.openecomp.sdc.versioning.errors.EntityAlreadyFinalizedErrorBuilder;
+import org.openecomp.sdc.versioning.errors.EntityNotExistErrorBuilder;
+import org.openecomp.sdc.versioning.errors.SubmitLockedEntityNotAllowedErrorBuilder;
+import org.openecomp.sdc.versioning.errors.UndoCheckoutOnEntityLockedByOtherErrorBuilder;
+import org.openecomp.sdc.versioning.errors.UndoCheckoutOnUnlockedEntityErrorBuilder;
import org.openecomp.sdc.versioning.types.VersionCreationMethod;
import org.openecomp.sdc.versioning.types.VersionInfo;
import org.openecomp.sdc.versioning.types.VersionableEntityAction;
import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
-import java.util.stream.Collectors;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
public class ActionVersioningManagerImpl implements ActionVersioningManager {
- private static final Logger LOGGER = LoggerFactory.getLogger(ActionVersioningManagerImpl.class);
- private static final Version INITIAL_ACTIVE_VERSION = new Version(0, 0);
- private static final Map<String, Set<VersionableEntityMetadata>> VERSIONABLE_ENTITIES =
- new HashMap<>();
-
- private final VersionInfoDao versionInfoDao;
- private final VersionInfoDeletedDao versionInfoDeletedDao;
- private VersionDao versionDao;
- private VersionCalculator versionCalculator;
- private AsdcItemManager asdcItemManager;
-
- public ActionVersioningManagerImpl(VersionInfoDao versionInfoDao,
- VersionInfoDeletedDao versionInfoDeletedDao,
- VersionDao versionDao,
- VersionCalculator versionCalculator,
- AsdcItemManager asdcItemManager) {
- this.versionInfoDao = versionInfoDao;
- this.versionInfoDeletedDao = versionInfoDeletedDao;
- this.versionDao = versionDao;
- this.versionCalculator = versionCalculator;
- this.asdcItemManager = asdcItemManager;
- }
-
- private static VersionInfo getVersionInfo(VersionInfoEntity versionInfoEntity, String user,
- VersionableEntityAction action) {
- return getVersionInfo(versionInfoEntity.getEntityId(),
- versionInfoEntity.getEntityType(),
- versionInfoEntity.getActiveVersion(),
- versionInfoEntity.getCandidate(),
- versionInfoEntity.getStatus(),
- versionInfoEntity.getLatestFinalVersion(),
- versionInfoEntity.getViewableVersions(),
- action,
- user);
- }
-
- private static VersionInfo getVersionInfo(VersionInfoDeletedEntity versionInfoEntity, String user,
- VersionableEntityAction action) {
- return getVersionInfo(versionInfoEntity.getEntityId(),
- versionInfoEntity.getEntityType(),
- versionInfoEntity.getActiveVersion(),
- versionInfoEntity.getCandidate(),
- versionInfoEntity.getStatus(),
- versionInfoEntity.getLatestFinalVersion(),
- versionInfoEntity.getViewableVersions(),
- action,
- user);
- }
-
- private static VersionInfo getVersionInfo(String entityId, String entityType, Version activeVer,
- UserCandidateVersion candidate, VersionStatus status,
- Version latestFinalVersion,
- Set<Version> viewableVersions,
- VersionableEntityAction action, String user) {
- Version activeVersion;
-
- if (action == VersionableEntityAction.Write) {
- if (candidate != null) {
- if (user.equals(candidate.getUser())) {
- activeVersion = candidate.getVersion();
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(ActionVersioningManagerImpl.class);
+ private static final Version INITIAL_ACTIVE_VERSION = new Version(0, 0);
+ private static final Map<String, Set<VersionableEntityMetadata>> VERSIONABLE_ENTITIES = new HashMap<>();
+ private final VersionInfoDao versionInfoDao;
+ private final VersionInfoDeletedDao versionInfoDeletedDao;
+ private VersionDao versionDao;
+ private VersionCalculator versionCalculator;
+ private AsdcItemManager asdcItemManager;
+
+ public ActionVersioningManagerImpl(VersionInfoDao versionInfoDao, VersionInfoDeletedDao versionInfoDeletedDao, VersionDao versionDao,
+ VersionCalculator versionCalculator, AsdcItemManager asdcItemManager) {
+ this.versionInfoDao = versionInfoDao;
+ this.versionInfoDeletedDao = versionInfoDeletedDao;
+ this.versionDao = versionDao;
+ this.versionCalculator = versionCalculator;
+ this.asdcItemManager = asdcItemManager;
+ }
+
+ private static VersionInfo getVersionInfo(VersionInfoEntity versionInfoEntity, String user, VersionableEntityAction action) {
+ return getVersionInfo(versionInfoEntity.getEntityId(), versionInfoEntity.getEntityType(), versionInfoEntity.getActiveVersion(),
+ versionInfoEntity.getCandidate(), versionInfoEntity.getStatus(), versionInfoEntity.getLatestFinalVersion(),
+ versionInfoEntity.getViewableVersions(), action, user);
+ }
+
+ private static VersionInfo getVersionInfo(VersionInfoDeletedEntity versionInfoEntity, String user, VersionableEntityAction action) {
+ return getVersionInfo(versionInfoEntity.getEntityId(), versionInfoEntity.getEntityType(), versionInfoEntity.getActiveVersion(),
+ versionInfoEntity.getCandidate(), versionInfoEntity.getStatus(), versionInfoEntity.getLatestFinalVersion(),
+ versionInfoEntity.getViewableVersions(), action, user);
+ }
+
+ private static VersionInfo getVersionInfo(String entityId, String entityType, Version activeVer, UserCandidateVersion candidate,
+ VersionStatus status, Version latestFinalVersion, Set<Version> viewableVersions,
+ VersionableEntityAction action, String user) {
+ Version activeVersion;
+ if (action == VersionableEntityAction.Write) {
+ if (candidate != null) {
+ if (user.equals(candidate.getUser())) {
+ activeVersion = candidate.getVersion();
+ } else {
+ throw new CoreException(new EditOnEntityLockedByOtherErrorBuilder(entityType, entityId, candidate.getUser()).build());
+ }
+ } else {
+ throw new CoreException(new EditOnUnlockedEntityErrorBuilder(entityType, entityId).build());
+ }
} else {
- throw new CoreException(
- new EditOnEntityLockedByOtherErrorBuilder(entityType, entityId, candidate.getUser())
- .build());
+ if (candidate != null && user.equals(candidate.getUser())) {
+ activeVersion = candidate.getVersion();
+ } else {
+ activeVersion = activeVer;
+ }
}
- } else {
- throw new CoreException(new EditOnUnlockedEntityErrorBuilder(entityType, entityId).build());
- }
- } else {
- if (candidate != null && user.equals(candidate.getUser())) {
- activeVersion = candidate.getVersion();
- } else {
- activeVersion = activeVer;
- }
- }
-
- VersionInfo versionInfo = new VersionInfo();
- versionInfo.setStatus(status);
- activeVersion.setStatus(status);
- if (latestFinalVersion != null) {
- latestFinalVersion.setStatus(status);
- }
- if (viewableVersions != null) {
- viewableVersions.forEach(version -> version.setStatus(status));
- versionInfo.setViewableVersions(toSortedList(viewableVersions));
- versionInfo.setFinalVersions(getFinalVersions(viewableVersions));
- }
- versionInfo.setActiveVersion(activeVersion);
- versionInfo.setLatestFinalVersion(latestFinalVersion);
- if (candidate != null) {
- candidate.getVersion().setStatus(status);
- versionInfo.setLockingUser(candidate.getUser());
- if (user.equals(candidate.getUser())) {
- versionInfo.getViewableVersions().add(candidate.getVersion());
- }
- }
- return versionInfo;
- }
-
- private static List<Version> toSortedList(
- Set<Version> versions) { // changing the Set to List in DB will require migration...
- return versions.stream().sorted((o1, o2) -> o1.getMajor() > o2.getMajor() ? 1
- : o1.getMajor() == o2.getMajor() ? (o1.getMinor() > o2.getMinor() ? 1
- : o1.getMinor() == o2.getMinor() ? 0 : -1) : -1).collect(Collectors.toList());
- }
-
- private static List<Version> getFinalVersions(Set<Version> versions) {
- return versions.stream().filter(Version::isFinal).collect(Collectors.toList());
- }
-
- @Override
- public void register(String entityType, VersionableEntityMetadata entityMetadata) {
- Set<VersionableEntityMetadata> entitiesMetadata =
- VERSIONABLE_ENTITIES.computeIfAbsent(entityType, k -> new HashSet<>());
- entitiesMetadata.add(entityMetadata);
- }
-
- @Override
- public Version create(String entityType, String entityId, String user) {
- VersionInfoEntity
- versionInfoEntity = versionInfoDao.get(new VersionInfoEntity(entityType, entityId));
- if (versionInfoEntity != null) {
- throw new CoreException(new EntityAlreadyExistErrorBuilder(entityType, entityId).build());
- }
-
- versionInfoEntity = new VersionInfoEntity(entityType, entityId);
- versionInfoEntity.setActiveVersion(INITIAL_ACTIVE_VERSION);
- markAsCheckedOut(versionInfoEntity, user);
- versionInfoDao.create(versionInfoEntity);
-
- return versionInfoEntity.getCandidate().getVersion();
- }
-
- @Override
- public void delete(String entityType, String entityId, String user) {
- VersionInfoEntity versionInfoEntity =
- versionInfoDao.get(new VersionInfoEntity(entityType, entityId));
- if (versionInfoEntity == null) {
- throw new CoreException(new EntityNotExistErrorBuilder(entityType, entityId).build());
- }
-
- switch (versionInfoEntity.getStatus()) {
- case Locked:
- throw new CoreException(new DeleteOnLockedEntityErrorBuilder(entityType, entityId,
- versionInfoEntity.getCandidate().getUser()).build());
- default:
- //do nothing
- break;
- }
-
- doDelete(versionInfoEntity);
- }
-
- @Override
- public void undoDelete(String entityType, String entityId, String user) {
- VersionInfoDeletedEntity versionInfoDeletedEntity =
- versionInfoDeletedDao.get(new VersionInfoDeletedEntity(entityType, entityId));
- if (versionInfoDeletedEntity == null) {
- throw new CoreException(new EntityNotExistErrorBuilder(entityType, entityId).build());
- }
-
- doUndoDelete(versionInfoDeletedEntity);
-}
+ VersionInfo versionInfo = new VersionInfo();
+ versionInfo.setStatus(status);
+ activeVersion.setStatus(status);
+ if (latestFinalVersion != null) {
+ latestFinalVersion.setStatus(status);
+ }
+ if (viewableVersions != null) {
+ viewableVersions.forEach(version -> version.setStatus(status));
+ versionInfo.setViewableVersions(toSortedList(viewableVersions));
+ versionInfo.setFinalVersions(getFinalVersions(viewableVersions));
+ }
+ versionInfo.setActiveVersion(activeVersion);
+ versionInfo.setLatestFinalVersion(latestFinalVersion);
+ if (candidate != null) {
+ candidate.getVersion().setStatus(status);
+ versionInfo.setLockingUser(candidate.getUser());
+ if (user.equals(candidate.getUser())) {
+ versionInfo.getViewableVersions().add(candidate.getVersion());
+ }
+ }
+ return versionInfo;
+ }
- @Override
- public Version checkout(String entityType, String entityId, String user) {
- VersionInfoEntity versionInfoEntity =
- versionInfoDao.get(new VersionInfoEntity(entityType, entityId));
- if (versionInfoEntity == null) {
- throw new CoreException(new EntityNotExistErrorBuilder(entityType, entityId).build());
- }
-
- Version checkoutVersion = null;
- switch (versionInfoEntity.getStatus()) {
- case Locked:
- throw new CoreException(new CheckoutOnLockedEntityErrorBuilder(entityType, entityId,
- versionInfoEntity.getCandidate().getUser()).build());
- case Certified:
- case Draft:
- checkoutVersion = doCheckout(versionInfoEntity, user);
- break;
- default:
- //do nothing
- break;
- }
-
- return checkoutVersion;
- }
-
- @Override
- public Version undoCheckout(String entityType, String entityId, String user) {
- VersionInfoEntity versionInfoEntity =
- versionInfoDao.get(new VersionInfoEntity(entityType, entityId));
- if (versionInfoEntity == null) {
- throw new CoreException(new EntityNotExistErrorBuilder(entityType, entityId).build());
- }
-
- Version activeVersion = null;
- switch (versionInfoEntity.getStatus()) {
- case Locked:
- if (!user.equals(versionInfoEntity.getCandidate().getUser())) {
- throw new CoreException(
- new UndoCheckoutOnEntityLockedByOtherErrorBuilder(entityType, entityId,
- versionInfoEntity.getCandidate().getUser()).build());
+ private static List<Version> toSortedList(
+ Set<Version> versions) { // changing the Set to List in DB will require migration...
+ return versions.stream().sorted((o1, o2) -> o1.getMajor() > o2.getMajor() ? 1
+ : o1.getMajor() == o2.getMajor() ? (o1.getMinor() > o2.getMinor() ? 1 : o1.getMinor() == o2.getMinor() ? 0 : -1) : -1)
+ .collect(Collectors.toList());
+ }
+
+ private static List<Version> getFinalVersions(Set<Version> versions) {
+ return versions.stream().filter(Version::isFinal).collect(Collectors.toList());
+ }
+
+ @Override
+ public void register(String entityType, VersionableEntityMetadata entityMetadata) {
+ Set<VersionableEntityMetadata> entitiesMetadata = VERSIONABLE_ENTITIES.computeIfAbsent(entityType, k -> new HashSet<>());
+ entitiesMetadata.add(entityMetadata);
+ }
+
+ @Override
+ public Version create(String entityType, String entityId, String user) {
+ VersionInfoEntity versionInfoEntity = versionInfoDao.get(new VersionInfoEntity(entityType, entityId));
+ if (versionInfoEntity != null) {
+ throw new CoreException(new EntityAlreadyExistErrorBuilder(entityType, entityId).build());
+ }
+ versionInfoEntity = new VersionInfoEntity(entityType, entityId);
+ versionInfoEntity.setActiveVersion(INITIAL_ACTIVE_VERSION);
+ markAsCheckedOut(versionInfoEntity, user);
+ versionInfoDao.create(versionInfoEntity);
+ return versionInfoEntity.getCandidate().getVersion();
+ }
+
+ @Override
+ public void delete(String entityType, String entityId, String user) {
+ VersionInfoEntity versionInfoEntity = versionInfoDao.get(new VersionInfoEntity(entityType, entityId));
+ if (versionInfoEntity == null) {
+ throw new CoreException(new EntityNotExistErrorBuilder(entityType, entityId).build());
+ }
+ switch (versionInfoEntity.getStatus()) {
+ case Locked:
+ throw new CoreException(
+ new DeleteOnLockedEntityErrorBuilder(entityType, entityId, versionInfoEntity.getCandidate().getUser()).build());
+ default:
+ //do nothing
+ break;
+ }
+ doDelete(versionInfoEntity);
+ }
+
+ @Override
+ public void undoDelete(String entityType, String entityId, String user) {
+ VersionInfoDeletedEntity versionInfoDeletedEntity = versionInfoDeletedDao.get(new VersionInfoDeletedEntity(entityType, entityId));
+ if (versionInfoDeletedEntity == null) {
+ throw new CoreException(new EntityNotExistErrorBuilder(entityType, entityId).build());
+ }
+ doUndoDelete(versionInfoDeletedEntity);
+ }
+
+ @Override
+ public Version checkout(String entityType, String entityId, String user) {
+ VersionInfoEntity versionInfoEntity = versionInfoDao.get(new VersionInfoEntity(entityType, entityId));
+ if (versionInfoEntity == null) {
+ throw new CoreException(new EntityNotExistErrorBuilder(entityType, entityId).build());
+ }
+ Version checkoutVersion = null;
+ switch (versionInfoEntity.getStatus()) {
+ case Locked:
+ throw new CoreException(
+ new CheckoutOnLockedEntityErrorBuilder(entityType, entityId, versionInfoEntity.getCandidate().getUser()).build());
+ case Certified:
+ case Draft:
+ checkoutVersion = doCheckout(versionInfoEntity, user);
+ break;
+ default:
+ //do nothing
+ break;
+ }
+ return checkoutVersion;
+ }
+
+ @Override
+ public Version undoCheckout(String entityType, String entityId, String user) {
+ VersionInfoEntity versionInfoEntity = versionInfoDao.get(new VersionInfoEntity(entityType, entityId));
+ if (versionInfoEntity == null) {
+ throw new CoreException(new EntityNotExistErrorBuilder(entityType, entityId).build());
+ }
+ Version activeVersion = null;
+ switch (versionInfoEntity.getStatus()) {
+ case Locked:
+ if (!user.equals(versionInfoEntity.getCandidate().getUser())) {
+ throw new CoreException(
+ new UndoCheckoutOnEntityLockedByOtherErrorBuilder(entityType, entityId, versionInfoEntity.getCandidate().getUser()).build());
+ }
+ activeVersion = undoCheckout(versionInfoEntity);
+ break;
+ case Certified:
+ case Draft:
+ throw new CoreException(new UndoCheckoutOnUnlockedEntityErrorBuilder(entityType, entityId).build());
+ default:
+ //do nothing
+ break;
+ }
+ return activeVersion;
+ }
+
+ private Version undoCheckout(VersionInfoEntity versionInfoEntity) {
+ deleteVersionFromEntity(versionInfoEntity.getEntityType(), versionInfoEntity.getEntityId(), versionInfoEntity.getCandidate().getVersion(),
+ versionInfoEntity.getActiveVersion());
+ versionInfoEntity.setStatus(versionInfoEntity.getActiveVersion().isFinal() ? VersionStatus.Certified : VersionStatus.Draft);
+ versionInfoEntity.setCandidate(null);
+ versionInfoDao.update(versionInfoEntity);
+ return versionInfoEntity.getActiveVersion();
+ }
+
+ @Override
+ public Version checkin(String entityType, String entityId, String user, String checkinDescription) {
+ VersionInfoEntity versionInfoEntity = versionInfoDao.get(new VersionInfoEntity(entityType, entityId));
+ if (versionInfoEntity == null) {
+ throw new CoreException(new EntityNotExistErrorBuilder(entityType, entityId).build());
}
- activeVersion = undoCheckout(versionInfoEntity);
- break;
- case Certified:
- case Draft:
- throw new CoreException(
- new UndoCheckoutOnUnlockedEntityErrorBuilder(entityType, entityId).build());
- default:
- //do nothing
- break;
- }
-
- return activeVersion;
- }
-
- private Version undoCheckout(VersionInfoEntity versionInfoEntity) {
- deleteVersionFromEntity(versionInfoEntity.getEntityType(), versionInfoEntity.getEntityId(),
- versionInfoEntity.getCandidate().getVersion(), versionInfoEntity.getActiveVersion());
-
- versionInfoEntity
- .setStatus(versionInfoEntity.getActiveVersion().isFinal() ? VersionStatus.Certified
- : VersionStatus.Draft);
- versionInfoEntity.setCandidate(null);
- versionInfoDao.update(versionInfoEntity);
- return versionInfoEntity.getActiveVersion();
- }
-
- @Override
- public Version checkin(String entityType, String entityId, String user,
- String checkinDescription) {
- VersionInfoEntity versionInfoEntity =
- versionInfoDao.get(new VersionInfoEntity(entityType, entityId));
- if (versionInfoEntity == null) {
- throw new CoreException(new EntityNotExistErrorBuilder(entityType, entityId).build());
- }
-
- Version checkedInVersion = null;
- switch (versionInfoEntity.getStatus()) {
- case Draft:
- case Certified:
- throw new CoreException(
- new CheckinOnUnlockedEntityErrorBuilder(entityType, entityId).build());
- case Locked:
- if (!user.equals(versionInfoEntity.getCandidate().getUser())) {
- throw new CoreException(new CheckinOnEntityLockedByOtherErrorBuilder(entityType, entityId,
- versionInfoEntity.getCandidate().getUser()).build());
+ Version checkedInVersion = null;
+ switch (versionInfoEntity.getStatus()) {
+ case Draft:
+ case Certified:
+ throw new CoreException(new CheckinOnUnlockedEntityErrorBuilder(entityType, entityId).build());
+ case Locked:
+ if (!user.equals(versionInfoEntity.getCandidate().getUser())) {
+ throw new CoreException(
+ new CheckinOnEntityLockedByOtherErrorBuilder(entityType, entityId, versionInfoEntity.getCandidate().getUser()).build());
+ }
+ checkedInVersion = doCheckin(versionInfoEntity, checkinDescription);
+ break;
+ default:
+ //do nothing
+ break;
+ }
+ return checkedInVersion;
+ }
+
+ @Override
+ public Version submit(String entityType, String entityId, String user, String submitDescription) {
+ VersionInfoEntity versionInfoEntity = versionInfoDao.get(new VersionInfoEntity(entityType, entityId));
+ if (versionInfoEntity == null) {
+ throw new CoreException(new EntityNotExistErrorBuilder(entityType, entityId).build());
+ }
+ Version submitVersion = null;
+ switch (versionInfoEntity.getStatus()) {
+ case Certified:
+ throw new CoreException(new EntityAlreadyFinalizedErrorBuilder(entityType, entityId).build());
+ case Locked:
+ throw new CoreException(
+ new SubmitLockedEntityNotAllowedErrorBuilder(entityType, entityId, versionInfoEntity.getCandidate().getUser()).build());
+ case Draft:
+ submitVersion = doSubmit(versionInfoEntity, user, submitDescription);
+ break;
+ default:
+ //do nothing
+ break;
+ }
+ return submitVersion;
+ }
+
+ @Override
+ public VersionInfo getEntityVersionInfo(String entityType, String entityId, String user, VersionableEntityAction action) {
+ VersionInfoEntity versionInfoEntity = versionInfoDao.get(new VersionInfoEntity(entityType, entityId));
+ if (versionInfoEntity == null) {
+ throw new CoreException(new EntityNotExistErrorBuilder(entityType, entityId).build());
}
- checkedInVersion = doCheckin(versionInfoEntity, checkinDescription);
- break;
- default:
- //do nothing
- break;
- }
-
- return checkedInVersion;
- }
-
- @Override
- public Version submit(String entityType, String entityId, String user, String submitDescription) {
- VersionInfoEntity versionInfoEntity =
- versionInfoDao.get(new VersionInfoEntity(entityType, entityId));
- if (versionInfoEntity == null) {
- throw new CoreException(new EntityNotExistErrorBuilder(entityType, entityId).build());
- }
-
- Version submitVersion = null;
- switch (versionInfoEntity.getStatus()) {
- case Certified:
- throw new CoreException(
- new EntityAlreadyFinalizedErrorBuilder(entityType, entityId).build());
- case Locked:
- throw new CoreException(new SubmitLockedEntityNotAllowedErrorBuilder(entityType, entityId,
- versionInfoEntity.getCandidate().getUser()).build());
- case Draft:
- submitVersion = doSubmit(versionInfoEntity, user, submitDescription);
- break;
- default:
- //do nothing
- break;
- }
-
- return submitVersion;
- }
-
- @Override
- public VersionInfo getEntityVersionInfo(String entityType, String entityId, String user,
- VersionableEntityAction action) {
- VersionInfoEntity versionInfoEntity =
- versionInfoDao.get(new VersionInfoEntity(entityType, entityId));
- if (versionInfoEntity == null) {
- throw new CoreException(new EntityNotExistErrorBuilder(entityType, entityId).build());
- }
- return getVersionInfo(versionInfoEntity, user, action);
- }
-
- @Override
- public Map<String, VersionInfo> listEntitiesVersionInfo(String entityType, String user,
- VersionableEntityAction action) {
- Collection<VersionInfoEntity> versionInfoEntities =
- versionInfoDao.list(new VersionInfoEntity(entityType, null));
- Map<String, VersionInfo> activeVersions = new HashMap<>();
- for (VersionInfoEntity versionInfoEntity : versionInfoEntities) {
- activeVersions
- .put(versionInfoEntity.getEntityId(), getVersionInfo(versionInfoEntity, user, action));
- }
- return activeVersions;
- }
-
- @Override
- public Map<String, VersionInfo> listDeletedEntitiesVersionInfo(String entityType, String user,
- VersionableEntityAction action) {
- Collection<VersionInfoDeletedEntity> versionInfoDeletedEntities =
- versionInfoDeletedDao.list(new VersionInfoDeletedEntity(entityType, null));
- Map<String, VersionInfo> activeVersions = new HashMap<>();
-
-
- for (VersionInfoDeletedEntity versionInfoDeletedEntity : versionInfoDeletedEntities) {
- activeVersions.put(versionInfoDeletedEntity.getEntityId(),
- getVersionInfo(versionInfoDeletedEntity, user, action));
- }
- return activeVersions;
- }
-
- @Override
- public List<Version> list(String itemId) {
-
- List<Version> versions = versionDao.list(itemId);
- Set<String> versionsNames = versions.stream().map(Version::getName).collect(Collectors.toSet());
- versions.forEach(version -> {
- version.setAdditionalInfo(new HashMap<>());
- versionCalculator.injectAdditionalInfo(version, versionsNames);
- });
- return versions;
- }
-
- @Override
- public Version get(String itemId, Version version) {
- return versionDao.get(itemId, version)
- .map(retrievedVersion -> getUpdateRetrievedVersion(itemId, retrievedVersion))
- .orElseGet(() -> getSyncedVersion(itemId, version));
- }
-
- private Version getUpdateRetrievedVersion(String itemId, Version version) {
- if (version.getStatus() == VersionStatus.Certified &&
- (version.getState().getSynchronizationState() == SynchronizationState.OutOfSync ||
- version.getState().isDirty())) {
- forceSync(itemId, version);
- LOGGER.info("Item Id {}, version Id {}: Force sync is done", itemId, version.getId());
- version = versionDao.get(itemId, version)
- .orElseThrow(() -> new IllegalStateException(
- "Get version after a successful force sync must return the version"));
- }
- return version;
- }
-
- private Version getSyncedVersion(String itemId, Version version) {
- sync(itemId, version);
- LOGGER.info("Item Id {}, version Id {}: First time sync is done", itemId, version.getId());
- return versionDao.get(itemId, version)
- .orElseThrow(() -> new IllegalStateException(
- "Get version after a successful sync must return the version"));
- }
-
- @Override
- public Version create(String itemId, Version version, VersionCreationMethod creationMethod) {
- String baseVersionName = null;
- if (version.getBaseId() == null) {
- version.setDescription("Initial version");
- } else {
- baseVersionName = get(itemId, new Version(version.getBaseId())).getName();
- }
- String versionName = versionCalculator.calculate(baseVersionName, creationMethod);
- validateVersionName(itemId, versionName);
- version.setName(versionName);
-
- versionDao.create(itemId, version);
- asdcItemManager.updateVersionStatus(itemId, VersionStatus.Draft, null);
-
- publish(itemId, version, String.format("Create version: %s", version.getName()));
- return version;
- }
-
- private void validateVersionName(String itemId, String versionName) {
- if (versionDao.list(itemId).stream()
- .anyMatch(version -> versionName.equals(version.getName()))) {
- String errorDescription = String
- .format("Item %s: create version failed, a version with the name %s already exist",
- itemId, versionName);
- throw new CoreException(new ErrorCode.ErrorCodeBuilder()
- .withCategory(ErrorCategory.APPLICATION)
- .withId("VERSION_NAME_ALREADY_EXIST")
- .withMessage(errorDescription)
- .build());
- }
- }
-
- @Override
- public void submit(String itemId, Version version, String submitDescription) {
- version = get(itemId, version);
-
- validateSubmit(itemId, version);
-
- version.setStatus(VersionStatus.Certified);
- versionDao.update(itemId, version);
-
- publish(itemId, version, submitDescription);
-
- asdcItemManager.updateVersionStatus(itemId, VersionStatus.Certified, VersionStatus.Draft);
- }
-
- private void validateSubmit(String itemId, Version version) {
- if (version.getStatus() == VersionStatus.Certified) {
- String errorDescription = String
- .format("Item %s: submit version failed, version %s is already Certified", itemId,
- version.getId());
- throw new CoreException(new ErrorCode.ErrorCodeBuilder()
- .withCategory(ErrorCategory.APPLICATION)
- .withId("VERSION_ALREADY_CERTIFIED")
- .withMessage(errorDescription)
- .build());
- }
- }
-
- @Override
- public void publish(String itemId, Version version, String message) {
- versionDao.publish(itemId, version, message);
- }
-
-
- @Override
- public void sync(String itemId, Version version) {
- versionDao.sync(itemId, version);
- }
-
- @Override
- public void forceSync(String itemId, Version version) {
- versionDao.forceSync(itemId, version);
- }
-
- @Override
- public void revert(String itemId, Version version, String revisionId) {
- versionDao.revert(itemId, version, revisionId);
- }
-
- @Override
- public List<Revision> listRevisions(String itemId, Version version) {
- return versionDao.listRevisions(itemId, version);
- }
-
- private void markAsCheckedOut(VersionInfoEntity versionInfoEntity, String checkingOutUser) {
- versionInfoEntity.setStatus(VersionStatus.Locked);
- versionInfoEntity.setCandidate(new UserCandidateVersion(checkingOutUser,
- versionInfoEntity.getActiveVersion().calculateNextCandidate()));
- }
-
- private Version doCheckout(VersionInfoEntity versionInfoEntity, String user) {
- markAsCheckedOut(versionInfoEntity, user);
- versionInfoDao.update(versionInfoEntity);
-
- initVersionOnEntity(versionInfoEntity.getEntityType(), versionInfoEntity.getEntityId(),
- versionInfoEntity.getActiveVersion(), versionInfoEntity.getCandidate().getVersion());
-
- return versionInfoEntity.getCandidate().getVersion();
- }
-
- private void doDelete(VersionInfoEntity versionInfoEntity) {
- VersionInfoDeletedEntity versionInfoDeletedEntity = new VersionInfoDeletedEntity();
- versionInfoDeletedEntity.setStatus(versionInfoEntity.getStatus());
- versionInfoDeletedEntity.setViewableVersions(versionInfoEntity.getViewableVersions());
- versionInfoDeletedEntity.setActiveVersion(versionInfoEntity.getActiveVersion());
- versionInfoDeletedEntity.setCandidate(versionInfoEntity.getCandidate());
- versionInfoDeletedEntity.setEntityId(versionInfoEntity.getEntityId());
- versionInfoDeletedEntity.setEntityType(versionInfoEntity.getEntityType());
- versionInfoDeletedEntity.setLatestFinalVersion(versionInfoEntity.getLatestFinalVersion());
- versionInfoDeletedDao.create(versionInfoDeletedEntity);
- versionInfoDao.delete(versionInfoEntity);
- }
-
- private void doUndoDelete(VersionInfoDeletedEntity versionInfoDeletedEntity) {
- VersionInfoEntity versionInfoEntity = new VersionInfoEntity();
- versionInfoEntity.setStatus(versionInfoDeletedEntity.getStatus());
- versionInfoEntity.setViewableVersions(versionInfoDeletedEntity.getViewableVersions());
- versionInfoEntity.setActiveVersion(versionInfoDeletedEntity.getActiveVersion());
- versionInfoEntity.setCandidate(versionInfoDeletedEntity.getCandidate());
- versionInfoEntity.setEntityId(versionInfoDeletedEntity.getEntityId());
- versionInfoEntity.setEntityType(versionInfoDeletedEntity.getEntityType());
- versionInfoEntity.setLatestFinalVersion(versionInfoDeletedEntity.getLatestFinalVersion());
- versionInfoDao.create(versionInfoEntity);
- versionInfoDeletedDao.delete(versionInfoDeletedEntity);
- }
-
- private Version doCheckin(VersionInfoEntity versionInfoEntity, String checkinDescription) {
- UserCandidateVersion userCandidateVersion = versionInfoEntity.getCandidate();
- versionInfoEntity.setCandidate(null);
- versionInfoEntity.setActiveVersion(userCandidateVersion.getVersion());
- versionInfoEntity.getViewableVersions().add(versionInfoEntity.getActiveVersion());
- versionInfoEntity.setStatus(VersionStatus.Draft);
-
- closeVersionOnEntity(versionInfoEntity.getEntityType(), versionInfoEntity.getEntityId(),
- versionInfoEntity.getActiveVersion());
-
- versionInfoDao.update(versionInfoEntity);
-
- return versionInfoEntity.getActiveVersion();
- }
-
- private Version doSubmit(VersionInfoEntity versionInfoEntity, String submittingUser,
- String submitDescription) {
- Version finalVersion = versionInfoEntity.getActiveVersion().calculateNextFinal();
- initVersionOnEntity(versionInfoEntity.getEntityType(), versionInfoEntity.getEntityId(),
- versionInfoEntity.getActiveVersion(), finalVersion);
- closeVersionOnEntity(versionInfoEntity.getEntityType(), versionInfoEntity.getEntityId(),
- finalVersion);
-
- Set<Version> viewableVersions = new HashSet<>();
- for (Version version : versionInfoEntity.getViewableVersions()) {
- if (version.isFinal()) {
- viewableVersions.add(version);
- }
- }
- viewableVersions.add(finalVersion);
- versionInfoEntity.setViewableVersions(viewableVersions);
- versionInfoEntity.setActiveVersion(finalVersion);
- versionInfoEntity.setLatestFinalVersion(finalVersion);
- versionInfoEntity.setStatus(VersionStatus.Certified);
- versionInfoDao.update(versionInfoEntity);
-
- return finalVersion;
- }
-
- private void initVersionOnEntity(String entityType, String entityId, Version baseVersion,
- Version newVersion) {
- Set<VersionableEntityMetadata> entityMetadatas = VERSIONABLE_ENTITIES.get(entityType);
- if (entityMetadatas != null) {
- for (VersionableEntityMetadata entityMetadata : entityMetadatas) {
- VersionableEntityDaoFactory.getInstance().createInterface(entityMetadata.getStoreType())
- .initVersion(entityMetadata, entityId, baseVersion, newVersion);
- }
- }
- }
-
- private void deleteVersionFromEntity(String entityType, String entityId,
- Version versionToDelete, Version backToVersion) {
- Set<VersionableEntityMetadata> entityMetadatas = VERSIONABLE_ENTITIES.get(entityType);
- if (entityMetadatas != null) {
- for (VersionableEntityMetadata entityMetadata : entityMetadatas) {
- VersionableEntityDaoFactory.getInstance().createInterface(entityMetadata.getStoreType())
- .deleteVersion(entityMetadata, entityId, versionToDelete, backToVersion);
- }
- }
- }
-
- private void closeVersionOnEntity(String entityType, String entityId, Version versionToClose) {
- Set<VersionableEntityMetadata> entityMetadatas = VERSIONABLE_ENTITIES.get(entityType);
- if (entityMetadatas != null) {
- for (VersionableEntityMetadata entityMetadata : entityMetadatas) {
- VersionableEntityDaoFactory.getInstance().createInterface(entityMetadata.getStoreType())
- .closeVersion(entityMetadata, entityId, versionToClose);
- }
- }
- }
+ return getVersionInfo(versionInfoEntity, user, action);
+ }
+
+ @Override
+ public Map<String, VersionInfo> listEntitiesVersionInfo(String entityType, String user, VersionableEntityAction action) {
+ Collection<VersionInfoEntity> versionInfoEntities = versionInfoDao.list(new VersionInfoEntity(entityType, null));
+ Map<String, VersionInfo> activeVersions = new HashMap<>();
+ for (VersionInfoEntity versionInfoEntity : versionInfoEntities) {
+ activeVersions.put(versionInfoEntity.getEntityId(), getVersionInfo(versionInfoEntity, user, action));
+ }
+ return activeVersions;
+ }
+
+ @Override
+ public Map<String, VersionInfo> listDeletedEntitiesVersionInfo(String entityType, String user, VersionableEntityAction action) {
+ Collection<VersionInfoDeletedEntity> versionInfoDeletedEntities = versionInfoDeletedDao.list(new VersionInfoDeletedEntity(entityType, null));
+ Map<String, VersionInfo> activeVersions = new HashMap<>();
+ for (VersionInfoDeletedEntity versionInfoDeletedEntity : versionInfoDeletedEntities) {
+ activeVersions.put(versionInfoDeletedEntity.getEntityId(), getVersionInfo(versionInfoDeletedEntity, user, action));
+ }
+ return activeVersions;
+ }
+
+ @Override
+ public List<Version> list(String itemId) {
+ List<Version> versions = versionDao.list(itemId);
+ Set<String> versionsNames = versions.stream().map(Version::getName).collect(Collectors.toSet());
+ versions.forEach(version -> {
+ version.setAdditionalInfo(new HashMap<>());
+ versionCalculator.injectAdditionalInfo(version, versionsNames);
+ });
+ return versions;
+ }
+
+ @Override
+ public Version get(String itemId, Version version) {
+ return versionDao.get(itemId, version).map(retrievedVersion -> getUpdateRetrievedVersion(itemId, retrievedVersion))
+ .orElseGet(() -> getSyncedVersion(itemId, version));
+ }
+
+ private Version getUpdateRetrievedVersion(String itemId, Version version) {
+ if (version.getStatus() == VersionStatus.Certified && (version.getState().getSynchronizationState() == SynchronizationState.OutOfSync
+ || version.getState().isDirty())) {
+ forceSync(itemId, version);
+ LOGGER.info("Item Id {}, version Id {}: Force sync is done", itemId, version.getId());
+ version = versionDao.get(itemId, version)
+ .orElseThrow(() -> new IllegalStateException("Get version after a successful force sync must return the version"));
+ }
+ return version;
+ }
+
+ private Version getSyncedVersion(String itemId, Version version) {
+ sync(itemId, version);
+ LOGGER.info("Item Id {}, version Id {}: First time sync is done", itemId, version.getId());
+ return versionDao.get(itemId, version)
+ .orElseThrow(() -> new IllegalStateException("Get version after a successful sync must return the version"));
+ }
+
+ @Override
+ public Version create(String itemId, Version version, VersionCreationMethod creationMethod) {
+ String baseVersionName = null;
+ if (version.getBaseId() == null) {
+ version.setDescription("Initial version");
+ } else {
+ baseVersionName = get(itemId, new Version(version.getBaseId())).getName();
+ }
+ String versionName = versionCalculator.calculate(baseVersionName, creationMethod);
+ validateVersionName(itemId, versionName);
+ version.setName(versionName);
+ versionDao.create(itemId, version);
+ asdcItemManager.updateVersionStatus(itemId, VersionStatus.Draft, null);
+ publish(itemId, version, String.format("Create version: %s", version.getName()));
+ return version;
+ }
+
+ private void validateVersionName(String itemId, String versionName) {
+ if (versionDao.list(itemId).stream().anyMatch(version -> versionName.equals(version.getName()))) {
+ String errorDescription = String.format("Item %s: create version failed, a version with the name %s already exist", itemId, versionName);
+ throw new CoreException(new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION).withId("VERSION_NAME_ALREADY_EXIST")
+ .withMessage(errorDescription).build());
+ }
+ }
+
+ @Override
+ public void submit(String itemId, Version version, String submitDescription) {
+ version = get(itemId, version);
+ validateSubmit(itemId, version);
+ version.setStatus(VersionStatus.Certified);
+ versionDao.update(itemId, version);
+ publish(itemId, version, submitDescription);
+ asdcItemManager.updateVersionStatus(itemId, VersionStatus.Certified, VersionStatus.Draft);
+ }
+
+ private void validateSubmit(String itemId, Version version) {
+ if (version.getStatus() == VersionStatus.Certified) {
+ String errorDescription = String.format("Item %s: submit version failed, version %s is already Certified", itemId, version.getId());
+ throw new CoreException(new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION).withId("VERSION_ALREADY_CERTIFIED")
+ .withMessage(errorDescription).build());
+ }
+ }
+
+ @Override
+ public void publish(String itemId, Version version, String message) {
+ versionDao.publish(itemId, version, message);
+ }
+
+ @Override
+ public void sync(String itemId, Version version) {
+ versionDao.sync(itemId, version);
+ }
+
+ @Override
+ public void forceSync(String itemId, Version version) {
+ versionDao.forceSync(itemId, version);
+ }
+
+ @Override
+ public void revert(String itemId, Version version, String revisionId) {
+ versionDao.revert(itemId, version, revisionId);
+ }
+
+ @Override
+ public List<Revision> listRevisions(String itemId, Version version) {
+ return versionDao.listRevisions(itemId, version);
+ }
+
+ private void markAsCheckedOut(VersionInfoEntity versionInfoEntity, String checkingOutUser) {
+ versionInfoEntity.setStatus(VersionStatus.Locked);
+ versionInfoEntity.setCandidate(new UserCandidateVersion(checkingOutUser, versionInfoEntity.getActiveVersion().calculateNextCandidate()));
+ }
+
+ private Version doCheckout(VersionInfoEntity versionInfoEntity, String user) {
+ markAsCheckedOut(versionInfoEntity, user);
+ versionInfoDao.update(versionInfoEntity);
+ initVersionOnEntity(versionInfoEntity.getEntityType(), versionInfoEntity.getEntityId(), versionInfoEntity.getActiveVersion(),
+ versionInfoEntity.getCandidate().getVersion());
+ return versionInfoEntity.getCandidate().getVersion();
+ }
+
+ private void doDelete(VersionInfoEntity versionInfoEntity) {
+ VersionInfoDeletedEntity versionInfoDeletedEntity = new VersionInfoDeletedEntity();
+ versionInfoDeletedEntity.setStatus(versionInfoEntity.getStatus());
+ versionInfoDeletedEntity.setViewableVersions(versionInfoEntity.getViewableVersions());
+ versionInfoDeletedEntity.setActiveVersion(versionInfoEntity.getActiveVersion());
+ versionInfoDeletedEntity.setCandidate(versionInfoEntity.getCandidate());
+ versionInfoDeletedEntity.setEntityId(versionInfoEntity.getEntityId());
+ versionInfoDeletedEntity.setEntityType(versionInfoEntity.getEntityType());
+ versionInfoDeletedEntity.setLatestFinalVersion(versionInfoEntity.getLatestFinalVersion());
+ versionInfoDeletedDao.create(versionInfoDeletedEntity);
+ versionInfoDao.delete(versionInfoEntity);
+ }
+
+ private void doUndoDelete(VersionInfoDeletedEntity versionInfoDeletedEntity) {
+ VersionInfoEntity versionInfoEntity = new VersionInfoEntity();
+ versionInfoEntity.setStatus(versionInfoDeletedEntity.getStatus());
+ versionInfoEntity.setViewableVersions(versionInfoDeletedEntity.getViewableVersions());
+ versionInfoEntity.setActiveVersion(versionInfoDeletedEntity.getActiveVersion());
+ versionInfoEntity.setCandidate(versionInfoDeletedEntity.getCandidate());
+ versionInfoEntity.setEntityId(versionInfoDeletedEntity.getEntityId());
+ versionInfoEntity.setEntityType(versionInfoDeletedEntity.getEntityType());
+ versionInfoEntity.setLatestFinalVersion(versionInfoDeletedEntity.getLatestFinalVersion());
+ versionInfoDao.create(versionInfoEntity);
+ versionInfoDeletedDao.delete(versionInfoDeletedEntity);
+ }
+
+ private Version doCheckin(VersionInfoEntity versionInfoEntity, String checkinDescription) {
+ UserCandidateVersion userCandidateVersion = versionInfoEntity.getCandidate();
+ versionInfoEntity.setCandidate(null);
+ versionInfoEntity.setActiveVersion(userCandidateVersion.getVersion());
+ versionInfoEntity.getViewableVersions().add(versionInfoEntity.getActiveVersion());
+ versionInfoEntity.setStatus(VersionStatus.Draft);
+ closeVersionOnEntity(versionInfoEntity.getEntityType(), versionInfoEntity.getEntityId(), versionInfoEntity.getActiveVersion());
+ versionInfoDao.update(versionInfoEntity);
+ return versionInfoEntity.getActiveVersion();
+ }
+
+ private Version doSubmit(VersionInfoEntity versionInfoEntity, String submittingUser, String submitDescription) {
+ Version finalVersion = versionInfoEntity.getActiveVersion().calculateNextFinal();
+ initVersionOnEntity(versionInfoEntity.getEntityType(), versionInfoEntity.getEntityId(), versionInfoEntity.getActiveVersion(), finalVersion);
+ closeVersionOnEntity(versionInfoEntity.getEntityType(), versionInfoEntity.getEntityId(), finalVersion);
+ Set<Version> viewableVersions = new HashSet<>();
+ for (Version version : versionInfoEntity.getViewableVersions()) {
+ if (version.isFinal()) {
+ viewableVersions.add(version);
+ }
+ }
+ viewableVersions.add(finalVersion);
+ versionInfoEntity.setViewableVersions(viewableVersions);
+ versionInfoEntity.setActiveVersion(finalVersion);
+ versionInfoEntity.setLatestFinalVersion(finalVersion);
+ versionInfoEntity.setStatus(VersionStatus.Certified);
+ versionInfoDao.update(versionInfoEntity);
+ return finalVersion;
+ }
+
+ private void initVersionOnEntity(String entityType, String entityId, Version baseVersion, Version newVersion) {
+ Set<VersionableEntityMetadata> entityMetadatas = VERSIONABLE_ENTITIES.get(entityType);
+ if (entityMetadatas != null) {
+ for (VersionableEntityMetadata entityMetadata : entityMetadatas) {
+ VersionableEntityDaoFactory.getInstance().createInterface(entityMetadata.getStoreType())
+ .initVersion(entityMetadata, entityId, baseVersion, newVersion);
+ }
+ }
+ }
+
+ private void deleteVersionFromEntity(String entityType, String entityId, Version versionToDelete, Version backToVersion) {
+ Set<VersionableEntityMetadata> entityMetadatas = VERSIONABLE_ENTITIES.get(entityType);
+ if (entityMetadatas != null) {
+ for (VersionableEntityMetadata entityMetadata : entityMetadatas) {
+ VersionableEntityDaoFactory.getInstance().createInterface(entityMetadata.getStoreType())
+ .deleteVersion(entityMetadata, entityId, versionToDelete, backToVersion);
+ }
+ }
+ }
+
+ private void closeVersionOnEntity(String entityType, String entityId, Version versionToClose) {
+ Set<VersionableEntityMetadata> entityMetadatas = VERSIONABLE_ENTITIES.get(entityType);
+ if (entityMetadatas != null) {
+ for (VersionableEntityMetadata entityMetadata : entityMetadatas) {
+ VersionableEntityDaoFactory.getInstance().createInterface(entityMetadata.getStoreType())
+ .closeVersion(entityMetadata, entityId, versionToClose);
+ }
+ }
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/AsdcItemManagerFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/AsdcItemManagerFactoryImpl.java
index 090f042027..f071d5e500 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/AsdcItemManagerFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/AsdcItemManagerFactoryImpl.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.versioning.impl;
import org.openecomp.sdc.itempermissions.PermissionsServicesFactory;
@@ -23,13 +22,12 @@ import org.openecomp.sdc.versioning.AsdcItemManagerFactory;
import org.openecomp.sdc.versioning.dao.ItemDaoFactory;
public class AsdcItemManagerFactoryImpl extends AsdcItemManagerFactory {
- private static final AsdcItemManager INSTANCE =
- new AsdcItemManagerImpl(ItemDaoFactory.getInstance().createInterface(),
- PermissionsServicesFactory.getInstance().createInterface(),
- SubscriptionServiceFactory.getInstance().createInterface());
- @Override
- public AsdcItemManager createInterface() {
- return INSTANCE;
- }
+ private static final AsdcItemManager INSTANCE = new AsdcItemManagerImpl(ItemDaoFactory.getInstance().createInterface(),
+ PermissionsServicesFactory.getInstance().createInterface(), SubscriptionServiceFactory.getInstance().createInterface());
+
+ @Override
+ public AsdcItemManager createInterface() {
+ return INSTANCE;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/AsdcItemManagerImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/AsdcItemManagerImpl.java
index 82d3ae5a61..a4741f57e3 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/AsdcItemManagerImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/AsdcItemManagerImpl.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.versioning.impl;
import org.openecomp.sdc.common.session.SessionContextProviderFactory;
@@ -24,47 +23,39 @@ import org.openecomp.sdc.versioning.dao.ItemDao;
import org.openecomp.sdc.versioning.types.Item;
public class AsdcItemManagerImpl extends ItemManagerImpl implements AsdcItemManager {
- private static final String CREATE_ITEM = "Create_Item";
-
- private PermissionsServices permissionsServices;
- private SubscriptionService subscriptionService;
-
- public AsdcItemManagerImpl(ItemDao itemDao, PermissionsServices permissionsServices,
- SubscriptionService subscriptionService) {
- super(itemDao);
-
- this.permissionsServices = permissionsServices;
- this.subscriptionService = subscriptionService;
- }
-
- @Override
- public Item create(Item item) {
- Item createdItem = super.create(item);
- String userId = SessionContextProviderFactory.getInstance()
- .createInterface().get().getUser().getUserId();
- String itemId = createdItem.getId();
- permissionsServices.execute(itemId, userId, CREATE_ITEM);
- subscriptionService.subscribe(userId, itemId);
+ private static final String CREATE_ITEM = "Create_Item";
+ private PermissionsServices permissionsServices;
+ private SubscriptionService subscriptionService;
- return createdItem;
- }
-
-
- @Override
- public void updateOwner(String itemId, String owner) {
- Item item = get(itemId);
- if (item == null) {
- return;
+ public AsdcItemManagerImpl(ItemDao itemDao, PermissionsServices permissionsServices, SubscriptionService subscriptionService) {
+ super(itemDao);
+ this.permissionsServices = permissionsServices;
+ this.subscriptionService = subscriptionService;
}
- item.setOwner(owner);
- super.update(item);
- }
- @Override
- public void delete(Item item) {
- super.delete(item);
- }
+ @Override
+ public Item create(Item item) {
+ Item createdItem = super.create(item);
+ String userId = SessionContextProviderFactory.getInstance().createInterface().get().getUser().getUserId();
+ String itemId = createdItem.getId();
+ permissionsServices.execute(itemId, userId, CREATE_ITEM);
+ subscriptionService.subscribe(userId, itemId);
+ return createdItem;
+ }
+ @Override
+ public void updateOwner(String itemId, String owner) {
+ Item item = get(itemId);
+ if (item == null) {
+ return;
+ }
+ item.setOwner(owner);
+ super.update(item);
+ }
+ @Override
+ public void delete(Item item) {
+ super.delete(item);
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ItemManagerFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ItemManagerFactoryImpl.java
index fbbc32e58e..77f4ef90c7 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ItemManagerFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ItemManagerFactoryImpl.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.versioning.impl;
import org.openecomp.sdc.versioning.ItemManager;
@@ -21,11 +20,11 @@ import org.openecomp.sdc.versioning.ItemManagerFactory;
import org.openecomp.sdc.versioning.dao.ItemDaoFactory;
public class ItemManagerFactoryImpl extends ItemManagerFactory {
- private static final ItemManager instance =
- new ItemManagerImpl(ItemDaoFactory.getInstance().createInterface());
- @Override
- public ItemManager createInterface() {
- return instance;
- }
+ private static final ItemManager instance = new ItemManagerImpl(ItemDaoFactory.getInstance().createInterface());
+
+ @Override
+ public ItemManager createInterface() {
+ return instance;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ItemManagerImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ItemManagerImpl.java
index 368eadad2c..8ef1fd2e04 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ItemManagerImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ItemManagerImpl.java
@@ -13,9 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.versioning.impl;
+import java.util.Collection;
+import java.util.function.Predicate;
+import java.util.stream.Collectors;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
@@ -25,98 +27,81 @@ import org.openecomp.sdc.versioning.dao.types.VersionStatus;
import org.openecomp.sdc.versioning.types.Item;
import org.openecomp.sdc.versioning.types.ItemStatus;
-import java.util.Collection;
-import java.util.function.Predicate;
-import java.util.stream.Collectors;
-
public class ItemManagerImpl implements ItemManager {
- private ItemDao itemDao;
-
-
- public ItemManagerImpl(ItemDao itemDao) {
- this.itemDao = itemDao;
-
- }
+ private ItemDao itemDao;
- @Override
- public Collection<Item> list(Predicate<Item> predicate) {
- return itemDao.list().stream().filter(predicate).collect(Collectors.toList());
- }
-
- @Override
- public Item get(String itemId) {
- Item item = new Item();
- item.setId(itemId);
- return itemDao.get(item);
- }
-
- @Override
- public Item create(Item item) {
- return itemDao.create(item);
- }
-
- @Override
- public void updateVersionStatus(String itemId, VersionStatus addedVersionStatus,
- VersionStatus removedVersionStatus) {
- Item item = get(itemId);
- if (item == null) {
- return;
+ public ItemManagerImpl(ItemDao itemDao) {
+ this.itemDao = itemDao;
}
- item.addVersionStatus(addedVersionStatus);
- if (removedVersionStatus != null) {
- item.removeVersionStatus(removedVersionStatus);
+ @Override
+ public Collection<Item> list(Predicate<Item> predicate) {
+ return itemDao.list().stream().filter(predicate).collect(Collectors.toList());
}
- itemDao.update(item);
- }
- @Override
- public void delete(Item item) {
- itemDao.delete(item);
- }
-
- @Override
- public void updateName(String itemId, String name) {
- Item item = get(itemId);
- if (item == null) {
- return;
+ @Override
+ public Item get(String itemId) {
+ Item item = new Item();
+ item.setId(itemId);
+ return itemDao.get(item);
}
- item.setName(name);
- itemDao.update(item);
- }
-
- @Override
- public void archive(Item item) {
+ @Override
+ public Item create(Item item) {
+ return itemDao.create(item);
+ }
- if (item.getStatus() == ItemStatus.ARCHIVED) {
- throw new CoreException(new ErrorCode.ErrorCodeBuilder()
- .withCategory(ErrorCategory.APPLICATION)
- .withMessage(String.format("Archive item failed, item %s is already Archived", item.getId()))
- .build());
+ @Override
+ public void updateVersionStatus(String itemId, VersionStatus addedVersionStatus, VersionStatus removedVersionStatus) {
+ Item item = get(itemId);
+ if (item == null) {
+ return;
+ }
+ item.addVersionStatus(addedVersionStatus);
+ if (removedVersionStatus != null) {
+ item.removeVersionStatus(removedVersionStatus);
+ }
+ itemDao.update(item);
}
- item.setStatus(ItemStatus.ARCHIVED);
- itemDao.update(item);
- }
+ @Override
+ public void delete(Item item) {
+ itemDao.delete(item);
+ }
- @Override
- public void restore(Item item) {
+ @Override
+ public void updateName(String itemId, String name) {
+ Item item = get(itemId);
+ if (item == null) {
+ return;
+ }
+ item.setName(name);
+ itemDao.update(item);
+ }
- if (item.getStatus() == ItemStatus.ACTIVE) {
- throw new CoreException(new ErrorCode.ErrorCodeBuilder()
- .withCategory(ErrorCategory.APPLICATION)
- .withMessage(String.format("Restore item failed, item %s is already Active", item.getId()))
- .build());
- }
+ @Override
+ public void archive(Item item) {
+ if (item.getStatus() == ItemStatus.ARCHIVED) {
+ throw new CoreException(new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION)
+ .withMessage(String.format("Archive item failed, item %s is already Archived", item.getId())).build());
+ }
+ item.setStatus(ItemStatus.ARCHIVED);
+ itemDao.update(item);
+ }
- item.setStatus(ItemStatus.ACTIVE);
- itemDao.update(item);
+ @Override
+ public void restore(Item item) {
+ if (item.getStatus() == ItemStatus.ACTIVE) {
+ throw new CoreException(new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION)
+ .withMessage(String.format("Restore item failed, item %s is already Active", item.getId())).build());
+ }
+ item.setStatus(ItemStatus.ACTIVE);
+ itemDao.update(item);
}
- @Override
- public void update(Item item) {
- itemDao.update(item);
- }
+ @Override
+ public void update(Item item) {
+ itemDao.update(item);
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/MajorVersionCalculatorFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/MajorVersionCalculatorFactoryImpl.java
index 8cb524c27c..ef3ca5059f 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/MajorVersionCalculatorFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/MajorVersionCalculatorFactoryImpl.java
@@ -23,11 +23,11 @@ import org.openecomp.sdc.versioning.VersionCalculator;
import org.openecomp.sdc.versioning.VersionCalculatorFactory;
public class MajorVersionCalculatorFactoryImpl extends VersionCalculatorFactory {
- private static final VersionCalculator INSTANCE =
- new MajorVersionCalculatorImpl();
- @Override
- public VersionCalculator createInterface() {
- return INSTANCE;
- }
+ private static final VersionCalculator INSTANCE = new MajorVersionCalculatorImpl();
+
+ @Override
+ public VersionCalculator createInterface() {
+ return INSTANCE;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/MajorVersionCalculatorImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/MajorVersionCalculatorImpl.java
index 008d96713f..c5e69ce647 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/MajorVersionCalculatorImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/MajorVersionCalculatorImpl.java
@@ -19,54 +19,49 @@
*/
package org.openecomp.sdc.versioning.impl;
+import java.util.HashSet;
+import java.util.Set;
import org.openecomp.core.utilities.CommonMethods;
import org.openecomp.sdc.versioning.VersionCalculator;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.dao.types.VersionStatus;
import org.openecomp.sdc.versioning.types.VersionCreationMethod;
-import java.util.HashSet;
-import java.util.Set;
-
public class MajorVersionCalculatorImpl implements VersionCalculator {
- private static final String INITIAL_VERSION = "1.0";
- private static final String VERSION_STRING_VIOLATION_MSG =
- "Version string must be in the format of: {integer}.{integer}";
- @Override
- public String calculate(String baseVersion, VersionCreationMethod creationMethod) {
+ private static final String INITIAL_VERSION = "1.0";
+ private static final String VERSION_STRING_VIOLATION_MSG = "Version string must be in the format of: {integer}.{integer}";
- if (baseVersion == null) {
- return INITIAL_VERSION;
- }
-
- String[] versionLevels = baseVersion.split("\\.");
- if (versionLevels.length != 2) {
- throw new IllegalArgumentException(VERSION_STRING_VIOLATION_MSG);
+ @Override
+ public String calculate(String baseVersion, VersionCreationMethod creationMethod) {
+ if (baseVersion == null) {
+ return INITIAL_VERSION;
+ }
+ String[] versionLevels = baseVersion.split("\\.");
+ if (versionLevels.length != 2) {
+ throw new IllegalArgumentException(VERSION_STRING_VIOLATION_MSG);
+ }
+ int index = Integer.parseInt(versionLevels[0]);
+ index++;
+ versionLevels[0] = Integer.toString(index);
+ versionLevels[1] = "0";
+ return CommonMethods.arrayToSeparatedString(versionLevels, '.');
}
- int index = Integer.parseInt(versionLevels[0]);
- index++;
- versionLevels[0] = Integer.toString(index);
- versionLevels[1] = "0";
-
- return CommonMethods.arrayToSeparatedString(versionLevels, '.');
- }
-
- @Override
- public void injectAdditionalInfo(Version version, Set<String> existingVersions) {
- String optionalVersion;
- Set<VersionCreationMethod> optionalCreationMethods = new HashSet<>();
- if(version.getStatus().equals(VersionStatus.Certified)) {
- try {
- optionalVersion = calculate(version.getName(), VersionCreationMethod.major);
- if (!existingVersions.contains(optionalVersion)) {
- optionalCreationMethods.add(VersionCreationMethod.major);
+ @Override
+ public void injectAdditionalInfo(Version version, Set<String> existingVersions) {
+ String optionalVersion;
+ Set<VersionCreationMethod> optionalCreationMethods = new HashSet<>();
+ if (version.getStatus().equals(VersionStatus.Certified)) {
+ try {
+ optionalVersion = calculate(version.getName(), VersionCreationMethod.major);
+ if (!existingVersions.contains(optionalVersion)) {
+ optionalCreationMethods.add(VersionCreationMethod.major);
+ }
+ } catch (IllegalArgumentException iae) {
+ //not a valid creation method.
+ }
}
- } catch (IllegalArgumentException iae) {
- //not a valid creation method.
- }
+ version.getAdditionalInfo().put("OptionalCreationMethods", optionalCreationMethods);
}
- version.getAdditionalInfo().put("OptionalCreationMethods", optionalCreationMethods);
- }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersionCalculatorFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersionCalculatorFactoryImpl.java
index 155aa9c5e6..9f2b9fbe58 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersionCalculatorFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersionCalculatorFactoryImpl.java
@@ -17,18 +17,17 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.versioning.impl;
import org.openecomp.sdc.versioning.VersionCalculator;
import org.openecomp.sdc.versioning.VersionCalculatorFactory;
public class VersionCalculatorFactoryImpl extends VersionCalculatorFactory {
- private static final VersionCalculator INSTANCE =
- new VersionCalculatorImpl();
- @Override
- public VersionCalculator createInterface() {
- return INSTANCE;
- }
+ private static final VersionCalculator INSTANCE = new VersionCalculatorImpl();
+
+ @Override
+ public VersionCalculator createInterface() {
+ return INSTANCE;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersionCalculatorImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersionCalculatorImpl.java
index 5fe48ff7ca..4e9f460f04 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersionCalculatorImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersionCalculatorImpl.java
@@ -19,6 +19,8 @@
*/
package org.openecomp.sdc.versioning.impl;
+import java.util.HashSet;
+import java.util.Set;
import org.openecomp.core.utilities.CommonMethods;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
@@ -27,62 +29,55 @@ import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.dao.types.VersionStatus;
import org.openecomp.sdc.versioning.types.VersionCreationMethod;
-import java.util.HashSet;
-import java.util.Set;
-
public class VersionCalculatorImpl implements VersionCalculator {
- private static final Logger LOGGER = LoggerFactory.getLogger(VersionCalculatorImpl.class);
-
- private static final String INITIAL_VERSION = "1.0";
- private static final String VERSION_STRING_VIOLATION_MSG =
- "Version string must be in the format of: {integer}.{integer}";
- private static final String INVALID_CREATION_METHOD_MSG = "Invalid creation method";
- @Override
- public String calculate(String baseVersion, VersionCreationMethod creationMethod) {
+ private static final Logger LOGGER = LoggerFactory.getLogger(VersionCalculatorImpl.class);
+ private static final String INITIAL_VERSION = "1.0";
+ private static final String VERSION_STRING_VIOLATION_MSG = "Version string must be in the format of: {integer}.{integer}";
+ private static final String INVALID_CREATION_METHOD_MSG = "Invalid creation method";
- if (baseVersion == null) {
- return INITIAL_VERSION;
- }
-
- String[] versionLevels = baseVersion.split("\\.");
- if (versionLevels.length != 2) {
- throw new IllegalArgumentException(VERSION_STRING_VIOLATION_MSG);
- }
-
- int index;
- switch (creationMethod) {
- case major:
- index = Integer.parseInt(versionLevels[0]);
- index++;
- versionLevels[0] = Integer.toString(index);
- versionLevels[1] = "0";
- break;
- case minor:
- index = Integer.parseInt(versionLevels[1]);
- index++;
- versionLevels[1] = Integer.toString(index);
- break;
+ @Override
+ public String calculate(String baseVersion, VersionCreationMethod creationMethod) {
+ if (baseVersion == null) {
+ return INITIAL_VERSION;
+ }
+ String[] versionLevels = baseVersion.split("\\.");
+ if (versionLevels.length != 2) {
+ throw new IllegalArgumentException(VERSION_STRING_VIOLATION_MSG);
+ }
+ int index;
+ switch (creationMethod) {
+ case major:
+ index = Integer.parseInt(versionLevels[0]);
+ index++;
+ versionLevels[0] = Integer.toString(index);
+ versionLevels[1] = "0";
+ break;
+ case minor:
+ index = Integer.parseInt(versionLevels[1]);
+ index++;
+ versionLevels[1] = Integer.toString(index);
+ break;
+ }
+ return CommonMethods.arrayToSeparatedString(versionLevels, '.');
}
- return CommonMethods.arrayToSeparatedString(versionLevels, '.');
- }
- @Override
- public void injectAdditionalInfo(Version version, Set<String> existingVersions) {
- String optionalVersion;
- Set<VersionCreationMethod> optionalCreationMethods = new HashSet<>();
- if(version.getStatus().equals(VersionStatus.Certified)) {
- for (VersionCreationMethod versionCreationMethod : VersionCreationMethod.values()) {
- try {
- optionalVersion = calculate(version.getName(), versionCreationMethod);
- if (!existingVersions.contains(optionalVersion)) {
- optionalCreationMethods.add(versionCreationMethod);
- }
- } catch (IllegalArgumentException iae) {
- LOGGER.error("{}:{}", INVALID_CREATION_METHOD_MSG, versionCreationMethod.name(), iae);
+ @Override
+ public void injectAdditionalInfo(Version version, Set<String> existingVersions) {
+ String optionalVersion;
+ Set<VersionCreationMethod> optionalCreationMethods = new HashSet<>();
+ if (version.getStatus().equals(VersionStatus.Certified)) {
+ for (VersionCreationMethod versionCreationMethod : VersionCreationMethod.values()) {
+ try {
+ optionalVersion = calculate(version.getName(), versionCreationMethod);
+ if (!existingVersions.contains(optionalVersion)) {
+ optionalCreationMethods.add(versionCreationMethod);
+ }
+ } catch (IllegalArgumentException iae) {
+ LOGGER.error("{}:{}", INVALID_CREATION_METHOD_MSG, versionCreationMethod.name(), iae);
+ }
+ }
}
- }
+ version.getAdditionalInfo().put("OptionalCreationMethods", optionalCreationMethods);
}
- version.getAdditionalInfo().put("OptionalCreationMethods", optionalCreationMethods);
- }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersioningManagerFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersioningManagerFactoryImpl.java
index 83f3d77ae3..a8aad15677 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersioningManagerFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersioningManagerFactoryImpl.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.versioning.impl;
import org.openecomp.sdc.versioning.ItemManagerFactory;
@@ -24,12 +23,9 @@ import org.openecomp.sdc.versioning.dao.VersionDaoFactory;
public class VersioningManagerFactoryImpl extends VersioningManagerFactory {
-
- @Override
- public VersioningManager createInterface() {
- return new VersioningManagerImpl(
- VersionDaoFactory.getInstance().createInterface(),
- VersionCalculatorFactory.getInstance().createInterface(),
- ItemManagerFactory.getInstance().createInterface());
- }
+ @Override
+ public VersioningManager createInterface() {
+ return new VersioningManagerImpl(VersionDaoFactory.getInstance().createInterface(), VersionCalculatorFactory.getInstance().createInterface(),
+ ItemManagerFactory.getInstance().createInterface());
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersioningManagerImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersioningManagerImpl.java
index 95779c232c..6f1a7c4e13 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersioningManagerImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersioningManagerImpl.java
@@ -13,9 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.versioning.impl;
+import static org.openecomp.sdc.versioning.dao.types.VersionStatus.Certified;
+import static org.openecomp.sdc.versioning.dao.types.VersionStatus.Draft;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
@@ -30,163 +36,128 @@ import org.openecomp.sdc.versioning.dao.types.SynchronizationState;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.types.VersionCreationMethod;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
+public class VersioningManagerImpl implements VersioningManager {
-import static org.openecomp.sdc.versioning.dao.types.VersionStatus.Certified;
-import static org.openecomp.sdc.versioning.dao.types.VersionStatus.Draft;
+ private static final Logger LOGGER = LoggerFactory.getLogger(VersioningManagerImpl.class);
+ private VersionDao versionDao;
+ private VersionCalculator versionCalculator;
+ private ItemManager itemManager;
-public class VersioningManagerImpl implements VersioningManager {
- private static final Logger LOGGER = LoggerFactory.getLogger(VersioningManagerImpl.class);
-
- private VersionDao versionDao;
- private VersionCalculator versionCalculator;
- private ItemManager itemManager;
-
- public VersioningManagerImpl(VersionDao versionDao,
- VersionCalculator versionCalculator,
- ItemManager itemManager) {
- this.versionDao = versionDao;
- this.versionCalculator = versionCalculator;
- this.itemManager = itemManager;
- }
-
-
- @Override
- public List<Version> list(String itemId) {
-
- List<Version> versions = versionDao.list(itemId);
- Set<String> versionsNames = versions.stream().map(Version::getName).collect(Collectors.toSet());
- versions.forEach(version -> {
- version.setAdditionalInfo(new HashMap<>());
- versionCalculator.injectAdditionalInfo(version, versionsNames);
- });
- return versions;
- }
-
- @Override
- public Version get(String itemId, Version version) {
- return versionDao.get(itemId, version)
- .map(retrievedVersion -> getUpdateRetrievedVersion(itemId, retrievedVersion))
- .orElseGet(() -> getSyncedVersion(itemId, version));
- }
-
- private Version getUpdateRetrievedVersion(String itemId, Version version) {
- if (version.getStatus() == Certified &&
- (version.getState().getSynchronizationState() == SynchronizationState.OutOfSync ||
- version.getState().isDirty())) {
- forceSync(itemId, version);
- LOGGER.info("Item Id {}, version Id {}: Force sync is done", itemId, version.getId());
- version = versionDao.get(itemId, version)
- .orElseThrow(() -> new IllegalStateException(
- "Get version after a successful force sync must return the version"));
- }
- return version;
- }
-
- private Version getSyncedVersion(String itemId, Version version) {
- sync(itemId, version);
- LOGGER.info("Item Id {}, version Id {}: First time sync is done", itemId, version.getId());
- return versionDao.get(itemId, version)
- .orElseThrow(() -> new IllegalStateException(
- "Get version after a successful sync must return the version"));
- }
-
- @Override
- public Version create(String itemId, Version version, VersionCreationMethod creationMethod) {
- String baseVersionName = null;
- if (version.getBaseId() == null) {
- version.setDescription("Initial version");
- } else {
- baseVersionName = get(itemId, new Version(version.getBaseId())).getName();
- }
- String versionName = versionCalculator.calculate(baseVersionName, creationMethod);
- validateVersionName(itemId, versionName);
- version.setName(versionName);
-
- versionDao.create(itemId, version);
- itemManager.updateVersionStatus(itemId, Draft, null);
-
- publish(itemId, version, String.format("Create version: %s", version.getName()));
- return version;
- }
-
- private void validateVersionName(String itemId, String versionName) {
- if (versionDao.list(itemId).stream()
- .anyMatch(version -> versionName.equals(version.getName()))) {
- String errorDescription = String
- .format("Item %s: create version failed, a version with the name %s already exist",
- itemId, versionName);
-
- throw new CoreException(new ErrorCode.ErrorCodeBuilder()
- .withMessage(errorDescription)
- .build());
- }
- }
-
- @Override
- public void submit(String itemId, Version version, String submitDescription) {
- version = get(itemId, version);
-
- validateSubmit(itemId, version);
-
- version.setStatus(Certified);
- versionDao.update(itemId, version);
-
- publish(itemId, version, submitDescription);
-
- itemManager.updateVersionStatus(itemId, Certified, Draft);
- }
-
- private void validateSubmit(String itemId, Version version) {
- if (version.getStatus() == Certified) {
- String errorDescription = String
- .format("Item %s: submit version failed, version %s is already Certified", itemId,
- version.getId());
- throw new CoreException(new ErrorCode.ErrorCodeBuilder()
- .withCategory(ErrorCategory.APPLICATION)
- .withId("VERSION_ALREADY_CERTIFIED")
- .withMessage(errorDescription)
- .build());
- }
- }
-
- @Override
- public void publish(String itemId, Version version, String message) {
- versionDao.publish(itemId, version, message);
- }
-
-
- @Override
- public void sync(String itemId, Version version) {
- versionDao.sync(itemId, version);
- }
-
- @Override
- public void forceSync(String itemId, Version version) {
- versionDao.forceSync(itemId, version);
- }
-
- @Override
- public void revert(String itemId, Version version, String revisionId) {
- versionDao.revert(itemId, version, revisionId);
- }
-
- @Override
- public List<Revision> listRevisions(String itemId, Version version) {
- return versionDao.listRevisions(itemId, version);
- }
-
- @Override
- public void updateVersion(String itemId, Version version) {
- versionDao.update(itemId, version);
- }
-
- @Override
- public void clean(String itemId, Version version) {
- versionDao.clean(itemId, version);
- }
+ public VersioningManagerImpl(VersionDao versionDao, VersionCalculator versionCalculator, ItemManager itemManager) {
+ this.versionDao = versionDao;
+ this.versionCalculator = versionCalculator;
+ this.itemManager = itemManager;
+ }
+
+ @Override
+ public List<Version> list(String itemId) {
+ List<Version> versions = versionDao.list(itemId);
+ Set<String> versionsNames = versions.stream().map(Version::getName).collect(Collectors.toSet());
+ versions.forEach(version -> {
+ version.setAdditionalInfo(new HashMap<>());
+ versionCalculator.injectAdditionalInfo(version, versionsNames);
+ });
+ return versions;
+ }
+
+ @Override
+ public Version get(String itemId, Version version) {
+ return versionDao.get(itemId, version).map(retrievedVersion -> getUpdateRetrievedVersion(itemId, retrievedVersion))
+ .orElseGet(() -> getSyncedVersion(itemId, version));
+ }
+
+ private Version getUpdateRetrievedVersion(String itemId, Version version) {
+ if (version.getStatus() == Certified && (version.getState().getSynchronizationState() == SynchronizationState.OutOfSync || version.getState()
+ .isDirty())) {
+ forceSync(itemId, version);
+ LOGGER.info("Item Id {}, version Id {}: Force sync is done", itemId, version.getId());
+ version = versionDao.get(itemId, version)
+ .orElseThrow(() -> new IllegalStateException("Get version after a successful force sync must return the version"));
+ }
+ return version;
+ }
+ private Version getSyncedVersion(String itemId, Version version) {
+ sync(itemId, version);
+ LOGGER.info("Item Id {}, version Id {}: First time sync is done", itemId, version.getId());
+ return versionDao.get(itemId, version)
+ .orElseThrow(() -> new IllegalStateException("Get version after a successful sync must return the version"));
+ }
+
+ @Override
+ public Version create(String itemId, Version version, VersionCreationMethod creationMethod) {
+ String baseVersionName = null;
+ if (version.getBaseId() == null) {
+ version.setDescription("Initial version");
+ } else {
+ baseVersionName = get(itemId, new Version(version.getBaseId())).getName();
+ }
+ String versionName = versionCalculator.calculate(baseVersionName, creationMethod);
+ validateVersionName(itemId, versionName);
+ version.setName(versionName);
+ versionDao.create(itemId, version);
+ itemManager.updateVersionStatus(itemId, Draft, null);
+ publish(itemId, version, String.format("Create version: %s", version.getName()));
+ return version;
+ }
+
+ private void validateVersionName(String itemId, String versionName) {
+ if (versionDao.list(itemId).stream().anyMatch(version -> versionName.equals(version.getName()))) {
+ String errorDescription = String.format("Item %s: create version failed, a version with the name %s already exist", itemId, versionName);
+ throw new CoreException(new ErrorCode.ErrorCodeBuilder().withMessage(errorDescription).build());
+ }
+ }
+
+ @Override
+ public void submit(String itemId, Version version, String submitDescription) {
+ version = get(itemId, version);
+ validateSubmit(itemId, version);
+ version.setStatus(Certified);
+ versionDao.update(itemId, version);
+ publish(itemId, version, submitDescription);
+ itemManager.updateVersionStatus(itemId, Certified, Draft);
+ }
+
+ private void validateSubmit(String itemId, Version version) {
+ if (version.getStatus() == Certified) {
+ String errorDescription = String.format("Item %s: submit version failed, version %s is already Certified", itemId, version.getId());
+ throw new CoreException(new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION).withId("VERSION_ALREADY_CERTIFIED")
+ .withMessage(errorDescription).build());
+ }
+ }
+
+ @Override
+ public void publish(String itemId, Version version, String message) {
+ versionDao.publish(itemId, version, message);
+ }
+
+ @Override
+ public void sync(String itemId, Version version) {
+ versionDao.sync(itemId, version);
+ }
+
+ @Override
+ public void forceSync(String itemId, Version version) {
+ versionDao.forceSync(itemId, version);
+ }
+
+ @Override
+ public void revert(String itemId, Version version, String revisionId) {
+ versionDao.revert(itemId, version, revisionId);
+ }
+
+ @Override
+ public List<Revision> listRevisions(String itemId, Version version) {
+ return versionDao.listRevisions(itemId, version);
+ }
+
+ @Override
+ public void updateVersion(String itemId, Version version) {
+ versionDao.update(itemId, version);
+ }
+
+ @Override
+ public void clean(String itemId, Version version) {
+ versionDao.clean(itemId, version);
+ }
}