diff options
author | AviZi <avi.ziv@amdocs.com> | 2017-06-09 02:39:56 +0300 |
---|---|---|
committer | AviZi <avi.ziv@amdocs.com> | 2017-06-09 02:39:56 +0300 |
commit | 280f8015d06af1f41a3ef12e8300801c7a5e0d54 (patch) | |
tree | 9c1d3978c04cd28068f02073038c936bb49ca9e0 /openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main | |
parent | fd3821dad11780d33c5373d74c957c442489945e (diff) |
[SDC-29] Amdocs OnBoard 1707 initial commit.
Change-Id: Ie4d12a3f574008b792899b368a0902a8b46b5370
Signed-off-by: AviZi <avi.ziv@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main')
19 files changed, 102 insertions, 58 deletions
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 d51f8c0a2b..c4479d7105 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 @@ -23,6 +23,7 @@ package org.openecomp.sdc.versioning; import org.openecomp.core.dao.BaseDao; import org.openecomp.sdc.common.errors.CoreException; import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.sdc.versioning.dao.types.VersionStatus; import org.openecomp.sdc.versioning.dao.types.VersionableEntity; import org.openecomp.sdc.versioning.errors.RequestedVersionInvalidErrorBuilder; import org.openecomp.sdc.versioning.errors.VersionableSubEntityNotFoundErrorBuilder; @@ -47,9 +48,13 @@ public class VersioningUtil { * @param firstClassCitizenType the first class citizen type */ public static <T extends VersionableEntity> void validateEntityExistence(Object retrievedEntity, - T inputEntity, - String firstClassCitizenType) { + T inputEntity, + String firstClassCitizenType) { if (retrievedEntity == null) { + //MdcDataErrorMessage.createErrorMessageAndUpdateMDC(LoggerServiceName + // .getServiceName(LoggerServiceName.Submit_Entity), + // LoggerConstants.TARGET_ENTITY_DB, LoggerTragetServiceName.SUBMIT_ENTITY, + // ErrorLevel.ERROR.name(), null, LoggerErrorDescription.SUBMIT_ENTITY); throw new CoreException(new VersionableSubEntityNotFoundErrorBuilder( inputEntity.getEntityType(), inputEntity.getId(), @@ -84,6 +89,10 @@ public class VersioningUtil { } if (nonExistingIds.size() > 0) { + //MdcDataErrorMessage.createErrorMessageAndUpdateMDC + // (LoggerServiceName.getServiceName(LoggerServiceName.Submit_Entity), + // LoggerConstants.TARGET_ENTITY_DB, LoggerTragetServiceName.SUBMIT_ENTITY, + // ErrorLevel.ERROR.name(), null, LoggerErrorDescription.SUBMIT_ENTITY); if (nonExistingIds.size() == 1) { throw new CoreException(new VersionableSubEntityNotFoundErrorBuilder( entity.getEntityType(), @@ -123,6 +132,10 @@ public class VersioningUtil { if (nonExistingIds.size() > 0) { if (nonExistingIds.size() == 1) { + //MdcDataErrorMessage.createErrorMessageAndUpdateMDC(LoggerServiceName + // .getServiceName(LoggerServiceName.Submit_Entity), LoggerConstants.TARGET_ENTITY_DB, + // LoggerTragetServiceName.ENTIT, ErrorLevel.ERROR.name(), + // null, LoggerErrorDescription.SUBMIT_ENTITY); throw new CoreException(new VersionableSubEntityNotFoundErrorBuilder( containedEntityType, nonExistingIds.get(0), @@ -130,6 +143,10 @@ public class VersioningUtil { containingEntity.getId(), containingEntity.getVersion()).build()); } + //MdcDataErrorMessage.createErrorMessageAndUpdateMDC(LoggerServiceName + // .getServiceName(LoggerServiceName.Submit_Entity), + // LoggerConstants.TARGET_ENTITY_DB, LoggerTragetServiceName.SUBMIT_ENTITY, + // ErrorLevel.ERROR.name(), null, LoggerErrorDescription.SUBMIT_ENTITY); throw new CoreException(new VersionableSubEntityNotFoundErrorBuilder( containedEntityType, nonExistingIds, @@ -168,19 +185,23 @@ public class VersioningUtil { } /** - * Resolve version version. + * Resolve version. * * @param requestedVersion the requested version * @param versionInfo the version info * @return the version */ - public static Version resolveVersion(Version requestedVersion, VersionInfo versionInfo) { + public static Version resolveVersion(Version requestedVersion, VersionInfo versionInfo, + String user) { if (requestedVersion == null) { requestedVersion = versionInfo.getActiveVersion(); - } else { - if (!versionInfo.getViewableVersions().contains(requestedVersion)) { - throw new CoreException(new RequestedVersionInvalidErrorBuilder().build()); - } + } + 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; } 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 cb6c050520..ca09cdb532 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 @@ -20,7 +20,6 @@ package org.openecomp.sdc.versioning.dao; - import org.openecomp.core.dao.BaseDao; import org.openecomp.sdc.versioning.dao.types.VersionInfoDeletedEntity; 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 8709a983a3..9ba042ba27 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 @@ -29,6 +29,8 @@ public interface VersionableEntityDao { Version baseVersion, Version newVersion); void deleteVersion(VersionableEntityMetadata versionableTableMetadata, String entityId, - Version versionToDelete); + Version versionToDelete, Version backToVersion); + 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 be3c635be2..870a7892ac 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 @@ -22,10 +22,13 @@ 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 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/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 e6ac799fd4..f0f67cf064 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 @@ -20,16 +20,18 @@ package org.openecomp.sdc.versioning.dao.types; +import com.datastax.driver.mapping.annotations.Transient; import com.datastax.driver.mapping.annotations.UDT; @UDT(name = "version", keyspace = "dox") public class Version { - public static final String VERSION_REGEX = "^\\d+\\.\\d+$"; public static final String VERSION_STRING_VIOLATION_MSG = "Version string must be in the format of: {integer}.{integer}"; private int major; private int minor; + @Transient + private VersionStatus status = VersionStatus.Available; public Version() { } @@ -56,7 +58,7 @@ public class Version { } try { version = new Version(Integer.parseInt(versionLevels[0]), Integer.parseInt(versionLevels[1])); - } catch (Exception exception) { + } catch (Exception ex) { throw new IllegalArgumentException(VERSION_STRING_VIOLATION_MSG); } @@ -79,6 +81,14 @@ public class Version { this.minor = minor; } + public VersionStatus getStatus() { + return status; + } + + public void setStatus(VersionStatus status) { + this.status = status; + } + public Version calculateNextCandidate() { return new Version(major, minor + 1); } @@ -92,6 +102,13 @@ public class Version { } @Override + public int hashCode() { + int result = major; + result = 31 * result + minor; + return result; + } + + @Override public boolean equals(Object obj) { if (this == obj) { return true; @@ -101,18 +118,10 @@ public class Version { } Version version = (Version) obj; - return major == version.major && minor == version.minor; } @Override - public int hashCode() { - int result = major; - result = 31 * result + minor; - return result; - } - - @Override public String toString() { return major + "." + minor; } 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 1fb68540d6..cf980d6b51 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 @@ -24,5 +24,4 @@ public enum VersionStatus { Available, Locked, Final - } 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 5a395c6172..befbae6631 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 @@ -22,5 +22,5 @@ package org.openecomp.sdc.versioning.dao.types; public enum VersionType { Draft, - Finalized + Finalized; } 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 829ce2691b..f0d80513f6 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 @@ -20,9 +20,6 @@ package org.openecomp.sdc.versioning.errors; -import static org.openecomp.sdc.versioning.errors.VersioningErrorCodes - .CHECKIN_ON_ENTITY_LOCKED_BY_OTHER_USER; - import org.openecomp.sdc.common.errors.BaseErrorBuilder; import org.openecomp.sdc.common.errors.ErrorCategory; @@ -32,8 +29,8 @@ import org.openecomp.sdc.common.errors.ErrorCategory; public class CheckinOnEntityLockedByOtherErrorBuilder extends BaseErrorBuilder { private 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."; + "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. @@ -44,7 +41,7 @@ public class CheckinOnEntityLockedByOtherErrorBuilder extends BaseErrorBuilder { */ public CheckinOnEntityLockedByOtherErrorBuilder(String entityType, String entityId, String lockingUser) { - getErrorCodeBuilder().withId(CHECKIN_ON_ENTITY_LOCKED_BY_OTHER_USER); + 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/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 60c02474ad..9784782c70 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 @@ -29,8 +29,8 @@ import org.openecomp.sdc.common.errors.ErrorCategory; public class CheckoutOnLockedEntityErrorBuilder extends BaseErrorBuilder { private 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."; + "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. 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 fb61cce1f0..4de5618e75 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 @@ -20,6 +20,8 @@ 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; @@ -38,7 +40,7 @@ public class EditOnUnlockedEntityErrorBuilder extends BaseErrorBuilder { * @param entityId the entity id */ public EditOnUnlockedEntityErrorBuilder(String entityType, String entityId) { - getErrorCodeBuilder().withId(VersioningErrorCodes.EDIT_ON_UNLOCKED_ENTITY); + 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/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 22643ddc26..bff3e82f87 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 @@ -20,9 +20,6 @@ package org.openecomp.sdc.versioning.errors; -import static org.openecomp.sdc.versioning.errors.VersioningErrorCodes - .SUBMIT_FINALIZED_ENTITY_NOT_ALLOWED; - import org.openecomp.sdc.common.errors.BaseErrorBuilder; import org.openecomp.sdc.common.errors.ErrorCategory; @@ -41,7 +38,7 @@ public class EntityAlreadyFinalizedErrorBuilder extends BaseErrorBuilder { * @param entityId the entity id */ public EntityAlreadyFinalizedErrorBuilder(String entityType, String entityId) { - getErrorCodeBuilder().withId(SUBMIT_FINALIZED_ENTITY_NOT_ALLOWED); + 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/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 7d3afcb94a..d44b2c488b 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 @@ -37,4 +37,12 @@ public class RequestedVersionInvalidErrorBuilder extends BaseErrorBuilder { 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) { + versionStrings.add(version.toString()); + } + return versionStrings; + }*/ } 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 3f4fc81b76..959c277005 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 @@ -29,8 +29,8 @@ import org.openecomp.sdc.common.errors.ErrorCategory; public class SubmitLockedEntityNotAllowedErrorBuilder extends BaseErrorBuilder { private 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."; + "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. 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 5e2be13d61..2b90338ae2 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 @@ -20,9 +20,6 @@ package org.openecomp.sdc.versioning.errors; -import static org.openecomp.sdc.versioning.errors.VersioningErrorCodes - .UNDO_CHECKOUT_ON_ENTITY_LOCKED_BY_OTHER_USER; - import org.openecomp.sdc.common.errors.BaseErrorBuilder; import org.openecomp.sdc.common.errors.ErrorCategory; @@ -32,8 +29,8 @@ import org.openecomp.sdc.common.errors.ErrorCategory; public class UndoCheckoutOnEntityLockedByOtherErrorBuilder extends BaseErrorBuilder { private 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."; + "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. @@ -44,7 +41,8 @@ public class UndoCheckoutOnEntityLockedByOtherErrorBuilder extends BaseErrorBuil */ public UndoCheckoutOnEntityLockedByOtherErrorBuilder(String entityType, String entityId, String lockingUser) { - getErrorCodeBuilder().withId(UNDO_CHECKOUT_ON_ENTITY_LOCKED_BY_OTHER_USER); + 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, 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 36ca5b5c41..d56473f297 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 @@ -20,13 +20,9 @@ package org.openecomp.sdc.versioning.errors; -import static org.openecomp.sdc.versioning.errors.VersioningErrorCodes - .UNDO_CHECKOUT_ON_UNLOCKED_ENTITY; - import org.openecomp.sdc.common.errors.BaseErrorBuilder; import org.openecomp.sdc.common.errors.ErrorCategory; - /** * The type Undo checkout on unlocked entity error builder. */ @@ -42,7 +38,7 @@ public class UndoCheckoutOnUnlockedEntityErrorBuilder extends BaseErrorBuilder { * @param entityId the entity id */ public UndoCheckoutOnUnlockedEntityErrorBuilder(String entityType, String entityId) { - getErrorCodeBuilder().withId(UNDO_CHECKOUT_ON_UNLOCKED_ENTITY); + 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/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 c7413858e5..ef9fef2bda 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 @@ -22,5 +22,5 @@ package org.openecomp.sdc.versioning.types; public enum VersionableEntityAction { Read, - Write + 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 161221abe3..8ec54c9980 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 @@ -25,25 +25,33 @@ import java.util.List; public class VersionableEntityMetadata { + private VersionableEntityStoreType storeType; private String name; private String identifierName; private String versionIdentifierName; private List<UniqueValueMetadata> uniqueValuesMetadata = new ArrayList<>(); - /** - * Instantiates a new Versionable entity metadata. - * - * @param name the name - * @param identifierName the identifier name - * @param versionIdentifierName the version identifier name - */ 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; } + public VersionableEntityStoreType getStoreType() { + return storeType; + } + + public void setStoreType(VersionableEntityStoreType storeType) { + this.storeType = storeType; + } + public String getName() { return name; } 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 new file mode 100644 index 0000000000..72c5ecdba1 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/VersionableEntityStoreType.java @@ -0,0 +1,6 @@ +package org.openecomp.sdc.versioning.types; + +public enum VersionableEntityStoreType { + Cassandra, + Zusammen +} diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/resources/factoryConfiguration.json b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/resources/factoryConfiguration.json index f36c2d5a43..e38ad1a8b4 100644 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/resources/factoryConfiguration.json +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/resources/factoryConfiguration.json @@ -1,7 +1,6 @@ { "org.openecomp.sdc.versioning.VersioningManagerFactory": "org.openecomp.sdc.versioning.impl.VersioningManagerFactoryImpl", - "org.openecomp.sdc.versioning.dao.VersionableEntityDaoFactory" : "org.openecomp.sdc.versioning.dao.impl.VersionableEntityDaoFactoryImpl", + "org.openecomp.sdc.versioning.dao.VersionableEntityDaoFactory": "org.openecomp.sdc.versioning.dao.impl.VersionableEntityDaoFactoryImpl", "org.openecomp.sdc.versioning.dao.VersionInfoDaoFactory": "org.openecomp.sdc.versioning.dao.impl.VersionInfoDaoFactoryImpl", "org.openecomp.sdc.versioning.dao.VersionInfoDeletedDaoFactory": "org.openecomp.sdc.versioning.dao.impl.VersionInfoDeletedDaoFactoryImpl" - }
\ No newline at end of file |