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;
}
}
Aggregations