Search in sources :

Example 1 with IdentifierGenerator

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;
    }
}
Also used : DataAccessForm(org.obiba.mica.micaConfig.domain.DataAccessForm) IdentifierGenerator(org.obiba.mica.core.support.IdentifierGenerator)

Aggregations

IdentifierGenerator (org.obiba.mica.core.support.IdentifierGenerator)1 DataAccessForm (org.obiba.mica.micaConfig.domain.DataAccessForm)1