diff options
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning')
58 files changed, 816 insertions, 998 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} |