public static BusinessList getBusinessListFromKeys(FindBusiness body, FindQualifiers findQualifiers, EntityManager em, List<?> keysFound,
Date modifiedAfter, Date modifiedBefore, Holder<Integer> subscriptionStartIndex, Integer subscriptionMaxRows)
throws DispositionReportFaultMessage {
BusinessList result = new BusinessList();
ListDescription listDesc = new ListDescription();
result.setListDescription(listDesc);
// Sort and retrieve the final results taking paging into account
List<?> queryResults = FetchBusinessEntitiesQuery.select(em, findQualifiers, keysFound, body.getMaxRows(), body.getListHead(), listDesc);
if (queryResults != null && queryResults.size() > 0)
result.setBusinessInfos(new org.uddi.api_v3.BusinessInfos());
// Set the currentIndex to 0 or the value of the subscriptionStartIndex
int currentIndex = 0;
if (subscriptionStartIndex != null && subscriptionStartIndex.value != null)
currentIndex = subscriptionStartIndex.value;
int returnedRowCount = 0;
while (currentIndex < queryResults.size()) {
Object item = queryResults.get(currentIndex);
org.apache.juddi.model.BusinessEntity modelBusinessEntity = (org.apache.juddi.model.BusinessEntity)item;
org.uddi.api_v3.BusinessInfo apiBusinessInfo = new org.uddi.api_v3.BusinessInfo();
if (modifiedAfter != null && modifiedAfter.after(modelBusinessEntity.getModifiedIncludingChildren())){
currentIndex++;
continue;
}
if (modifiedBefore != null && modifiedBefore.before(modelBusinessEntity.getModifiedIncludingChildren())) {
currentIndex++;
continue;
}
MappingModelToApi.mapBusinessInfo(modelBusinessEntity, apiBusinessInfo);
result.getBusinessInfos().getBusinessInfo().add(apiBusinessInfo);
returnedRowCount++;
// If the returned rows equals the max allowed, we can end the loop (applies to subscription calls only)
if (subscriptionMaxRows != null) {
if (returnedRowCount == subscriptionMaxRows)