use of org.adempiere.exceptions.DBMoreThenOneRecordsFoundException in project metasfresh-webui-api by metasfresh.
the class SqlDocumentsRepository method retrieveDocument.
@Override
public Document retrieveDocument(final DocumentQuery query, final IDocumentChangesCollector changesCollector) {
final int limit = 2;
final OrderedDocumentsList documents = retriveDocuments(query, limit, changesCollector);
if (documents.isEmpty()) {
return null;
} else if (documents.size() > 1) {
throw new DBMoreThenOneRecordsFoundException("More than one record found for " + query + " on " + this + "\n First " + limit + " records: " + Joiner.on("\n").join(documents.toList()));
} else {
return documents.get(0);
}
}
Aggregations