else
result.setBusinessDetail(businessDetail);
}
if (subscriptionFilter.getGetServiceDetail() != null) {
GetServiceDetail getDetail = subscriptionFilter.getGetServiceDetail();
// Running through the key list here to determine the deleted keys and store the existing entities.
KeyBag missingKeyBag = new KeyBag();
missingKeyBag.setDeleted(true);
List<org.apache.juddi.model.BusinessService> existingList = new ArrayList<org.apache.juddi.model.BusinessService>(0);
for (String key : getDetail.getServiceKey()) {
org.apache.juddi.model.BusinessService modelBusinessService = em.find(org.apache.juddi.model.BusinessService.class, key);
if (modelBusinessService != null)
existingList.add(modelBusinessService);
else
missingKeyBag.getBusinessKey().add(key);
}
// Store deleted keys in the results
if (missingKeyBag.getServiceKey() != null && missingKeyBag.getServiceKey().size() > 0)
result.getKeyBag().add(missingKeyBag);
KeyBag resultsKeyBag = new KeyBag();
ServiceDetail serviceDetail = new ServiceDetail();
// Set the currentIndex to 0 or the value of the chunkData
int currentIndex = 0;
if (chunkData != null)
currentIndex = chunkData;
int returnedRowCount = 0;
while(currentIndex < existingList.size()) {
org.apache.juddi.model.BusinessService modelBusinessService = existingList.get(currentIndex);
if (startPointDate.after(modelBusinessService.getModifiedIncludingChildren())) {
currentIndex++;
continue;
}
if (endPointDate.before(modelBusinessService.getModifiedIncludingChildren())) {
currentIndex++;
continue;
}
if (modelSubscription.isBrief()) {
resultsKeyBag.getServiceKey().add(modelBusinessService.getEntityKey());
}
else {
org.uddi.api_v3.BusinessService apiBusinessService = new org.uddi.api_v3.BusinessService();
MappingModelToApi.mapBusinessService(modelBusinessService, apiBusinessService);
serviceDetail.getBusinessService().add(apiBusinessService);
returnedRowCount++;
}
// If the returned rows equals the max allowed, we can end the loop.
if (modelSubscription.getMaxEntities() != null) {
if (returnedRowCount == modelSubscription.getMaxEntities())
break;
}
currentIndex++;
}
// If the loop was broken prematurely (max row count hit) we set the chunk data to the next index to start with.
// A non-null value of chunk data will cause a chunk token to be generated.
if (currentIndex < (existingList.size() - 1))
chunkData = currentIndex + 1;
else
chunkData = null;
if (modelSubscription.isBrief())
result.getKeyBag().add(resultsKeyBag);
else
result.setServiceDetail(serviceDetail);
}
if (subscriptionFilter.getGetTModelDetail() != null) {
GetTModelDetail getDetail = subscriptionFilter.getGetTModelDetail();
// Running through the key list here to determine the deleted keys and store the existing entities.
KeyBag missingKeyBag = new KeyBag();
missingKeyBag.setDeleted(true);
List<org.apache.juddi.model.Tmodel> existingList = new ArrayList<org.apache.juddi.model.Tmodel>(0);
for (String key : getDetail.getTModelKey()) {
org.apache.juddi.model.Tmodel modelTModel = em.find(org.apache.juddi.model.Tmodel.class, key);
if (modelTModel != null)
existingList.add(modelTModel);
else
missingKeyBag.getTModelKey().add(key);