bvc.addFilterId(liveDeployment.getBundleVersion().getId());
bvc.fetchBundle(true); // will eagerly fetch the bundle type
PageList<BundleVersion> bvs = bundleManager.findBundleVersionsByCriteria(subject, bvc);
liveDeployment.setBundleVersion(bvs.get(0)); // wire up the full bundle version back into the live deployment
// the bundle type doesn't eagerly load the resource type - the remote plugin container needs that too
ResourceTypeCriteria rtc = new ResourceTypeCriteria();
rtc.addFilterIgnored(null); // we are purging, so we don't care if this returns ignored types or not, just purge anyway
rtc.addFilterBundleTypeId(liveDeployment.getBundleVersion().getBundle().getBundleType().getId());
PageList<ResourceType> rts = resourceTypeManager.findResourceTypesByCriteria(subject, rtc);
liveDeployment.getBundleVersion().getBundle().getBundleType().setResourceType(rts.get(0));
// we need to obtain the resources for all resource deployments - our first criteria can't fetch this deep, we have to do another query.
List<Integer> resourceDeployIds = new ArrayList<Integer>();