use of org.obiba.mica.core.support.IdentifierGenerator in project mica2 by obiba.
the class DataAccessRequestService method generateId.
private String generateId() {
DataAccessForm dataAccessForm = dataAccessFormService.find().get();
IdentifierGenerator idGenerator = IdentifierGenerator.newBuilder().prefix(dataAccessForm.getIdPrefix()).size(dataAccessForm.getIdLength()).zeros().build();
while (true) {
String id = idGenerator.generateIdentifier();
if (dataAccessRequestRepository.findOne(id) == null)
return id;
}
}
Aggregations