Search in sources :

Example 1 with AcsJRangeLockedEx

use of alma.ArchiveIdentifierError.wrappers.AcsJRangeLockedEx in project ACS by ACS-Community.

the class Range method setUniqueEntityId.

private void setUniqueEntityId(EntityT entity, boolean allowReplacing) throws AcsJUidAlreadyExistsEx, AcsJRangeLockedEx, AcsJRangeExhaustedEx {
    if (entity == null) {
        throw new NullPointerException("argument 'entity' must not be null.");
    }
    if (!isLocked) {
        if (entity.getEntityId() != null && entity.getEntityId().length() > 0 && !allowReplacing) {
            AcsJUidAlreadyExistsEx ex = new AcsJUidAlreadyExistsEx();
            ex.setObjectDesc("Entity " + entity.getEntityTypeName());
            ex.setUid(entity.getEntityId());
            throw ex;
        }
        String uid = getNextID();
        entity.setEntityId(uid);
        entity.setEntityIdEncrypted("-- id encryption not yet implemented --");
    } else {
        AcsJRangeLockedEx ex = new AcsJRangeLockedEx();
        ex.setRange(rangeIdString());
        throw ex;
    }
}
Also used : AcsJUidAlreadyExistsEx(alma.ArchiveIdentifierError.wrappers.AcsJUidAlreadyExistsEx) AcsJRangeLockedEx(alma.ArchiveIdentifierError.wrappers.AcsJRangeLockedEx)

Aggregations

AcsJRangeLockedEx (alma.ArchiveIdentifierError.wrappers.AcsJRangeLockedEx)1 AcsJUidAlreadyExistsEx (alma.ArchiveIdentifierError.wrappers.AcsJUidAlreadyExistsEx)1