import eu.etaxonomy.cdm.persistence.dao.common.ICdmGenericDao;
import eu.etaxonomy.cdm.persistence.dao.common.IReferencedEntityDao;
import eu.etaxonomy.cdm.persistence.dao.common.ISourcedEntityDao;
+import eu.etaxonomy.cdm.persistence.dao.common.Restriction;
+import eu.etaxonomy.cdm.persistence.dao.initializer.IBeanInitializer;
import eu.etaxonomy.cdm.persistence.dao.name.IHomotypicalGroupDao;
import eu.etaxonomy.cdm.persistence.dao.name.INomenclaturalStatusDao;
import eu.etaxonomy.cdm.persistence.dao.name.ITaxonNameDao;
private ICdmGenericDao genericDao;
@Autowired
private ILuceneIndexToolProvider luceneIndexToolProvider;
+ @Autowired
+ // @Qualifier("defaultBeanInitializer")
+ protected IBeanInitializer defaultBeanInitializer;
/**
* Constructor
return nomStatusDao.list(limit, start);
}
+ @Override
+ public NomenclaturalStatus loadNomenclaturalStatus(UUID uuid, List<String> propertyPaths){
+ return nomStatusDao.load(uuid, propertyPaths);
+ }
+
/**
* TODO candidate for harmonization
* new name getTypeDesignations
if(AbstractPagerImpl.hasResultsInRange(numberOfResults, pageNumber, pageSize)) {
results = dao.getTypeDesignations(name, null, status, pageSize, pageNumber, propertyPaths);
}
-
return new DefaultPagerImpl<>(pageNumber, numberOfResults, pageSize, results);
}
+ @Override
+ public List<TypeDesignationBase> getTypeDesignationsInHomotypicalGroup(UUID nameUuid, Integer pageSize,
+ Integer pageNumber, List<String> propertyPaths){
+ TaxonName name = load(nameUuid, Arrays.asList("nomenclaturalReference.authorship"));
+ Set<TypeDesignationBase<?>> typeDesignations = name.getHomotypicalGroup().getTypeDesignations();
+ List<TypeDesignationBase> result = defaultBeanInitializer.initializeAll(new ArrayList(typeDesignations), propertyPaths);
+ return result;
+ }
+
/**
* FIXME Candidate for harmonization
* rename search
return filterMap.values();
}
+ @Override
+ public <S extends TaxonName> Pager<S> page(Class<S> clazz, List<Restriction<?>> restrictions, Integer pageSize,
+ Integer pageIndex, List<OrderHint> orderHints, List<String> propertyPaths) {
+ return page(clazz, restrictions, pageSize, pageIndex, orderHints, propertyPaths, INCLUDE_UNPUBLISHED);
+ }
+
+ @Override
+ public <S extends TaxonName> Pager<S> page(Class<S> clazz, List<Restriction<?>> restrictions, Integer pageSize,
+ Integer pageIndex, List<OrderHint> orderHints, List<String> propertyPaths, boolean includeUnpublished) {
+
+ List<S> records;
+ long resultSize = dao.count(clazz, restrictions);
+ if(AbstractPagerImpl.hasResultsInRange(resultSize, pageIndex, pageSize)){
+ records = dao.list(clazz, restrictions, pageSize, pageIndex, orderHints, propertyPaths, includeUnpublished);
+ } else {
+ records = new ArrayList<>();
+ }
+ Pager<S> pager = new DefaultPagerImpl<>(pageIndex, resultSize, pageSize, records);
+ return pager;
+ }
+
+
}