Revision c781c97b
Added by Katja Luther over 6 years ago
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/IdentifiableServiceBase.java | ||
---|---|---|
601 | 601 |
if (includeEntity){ |
602 | 602 |
result.add(new IdentifiedEntityDTO<S>((DefinedTerm)daoObj[0], (String)daoObj[1], (S)daoObj[2])); |
603 | 603 |
}else{ |
604 |
result.add(new IdentifiedEntityDTO<S>((DefinedTerm)daoObj[0], (String)daoObj[1], (UUID)daoObj[2], (String)daoObj[3])); |
|
604 |
result.add(new IdentifiedEntityDTO<S>((DefinedTerm)daoObj[0], (String)daoObj[1], (UUID)daoObj[2], (String)daoObj[3], null));
|
|
605 | 605 |
} |
606 | 606 |
} |
607 | 607 |
return new DefaultPagerImpl<IdentifiedEntityDTO<S>>(pageNumber, numberOfResults, pageSize, result); |
608 | 608 |
} |
609 | 609 |
|
610 |
@Override |
|
611 |
@Transactional(readOnly = true) |
|
612 |
public <S extends T> List<IdentifiedEntityDTO<S>> listByIdentifier( |
|
613 |
Class<S> clazz, String identifier, DefinedTerm identifierType, MatchMode matchmode, |
|
614 |
boolean includeEntity, List<String> propertyPaths, Integer limit) { |
|
615 |
|
|
616 |
Integer numberOfResults = dao.countByIdentifier(clazz, identifier, identifierType, matchmode); |
|
617 |
List<Object[]> daoResults = new ArrayList<Object[]>(); |
|
618 |
if(numberOfResults > 0) { // no point checking again |
|
619 |
daoResults = dao.findByIdentifier(clazz, identifier, identifierType, |
|
620 |
matchmode, includeEntity, limit, 0, propertyPaths); |
|
621 |
} |
|
622 |
|
|
623 |
List<IdentifiedEntityDTO<S>> result = new ArrayList<IdentifiedEntityDTO<S>>(); |
|
624 |
for (Object[] daoObj : daoResults){ |
|
625 |
if (includeEntity){ |
|
626 |
result.add(new IdentifiedEntityDTO<S>((DefinedTerm)daoObj[0], (String)daoObj[1], (S)daoObj[2])); |
|
627 |
}else{ |
|
628 |
result.add(new IdentifiedEntityDTO<S>((DefinedTerm)daoObj[0], (String)daoObj[1], (UUID)daoObj[2], (String)daoObj[3], null)); |
|
629 |
} |
|
630 |
} |
|
631 |
return result; |
|
632 |
} |
|
633 |
|
|
634 |
|
|
610 | 635 |
@Override |
611 | 636 |
@Transactional(readOnly = true) |
612 | 637 |
public <S extends T> Pager<MarkedEntityDTO<S>> findByMarker( |
Also available in: Unified diff
implement possibility to get cdmEntities by identifiers in dialogs