}
public static ServiceList getServiceListFromKeys(FindService body, FindQualifiers findQualifiers, EntityManager em, List<?> keysFound,
Date modifiedAfter, Date modifiedBefore, Holder<Integer> subscriptionStartIndex, Integer subscriptionMaxRows)
throws DispositionReportFaultMessage {
ServiceList result = new ServiceList();
ListDescription listDesc = new ListDescription();
result.setListDescription(listDesc);
// Sort and retrieve the final results taking paging into account
List<?> queryResults = FetchBusinessServicesQuery.select(em, findQualifiers, keysFound, body.getMaxRows(), body.getListHead(), listDesc);
if (queryResults != null && queryResults.size() > 0)
result.setServiceInfos(new org.uddi.api_v3.ServiceInfos());
// 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;
if (logger.isDebugEnabled()) logger.debug("Period = " + modifiedAfter + " ---- " + modifiedBefore);
while (currentIndex < queryResults.size()) {
Object item = queryResults.get(currentIndex);
org.apache.juddi.model.BusinessService modelBusinessService = (org.apache.juddi.model.BusinessService)item;
org.uddi.api_v3.ServiceInfo apiServiceInfo = new org.uddi.api_v3.ServiceInfo();
logger.info(modelBusinessService.getEntityKey() + " is modified " + modelBusinessService.getModifiedIncludingChildren() + " " + modelBusinessService.getModifiedIncludingChildren().getTime() );
if (modifiedAfter != null && modifiedAfter.after(modelBusinessService.getModifiedIncludingChildren())) {
currentIndex++;
continue;
}
if (modifiedBefore != null && modifiedBefore.before(modelBusinessService.getModifiedIncludingChildren())) {
currentIndex++;
continue;
}
MappingModelToApi.mapServiceInfo(modelBusinessService, apiServiceInfo);
result.getServiceInfos().getServiceInfo().add(apiServiceInfo);
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)