List<SourcePojo> sources = SourcePojo.listFromDb(DbManager.getIngest().getSource().find(deleteQuery2, deleteFields2), SourcePojo.listType());
List<SourcePojo> failedSources = new ArrayList<SourcePojo>();
for (SourcePojo source: sources)
{
ResponsePojo rp1 = null;
SourceHandler tmpHandler = new SourceHandler();
if (1 == source.getCommunityIds().size()) { // delete this source
rp1 = tmpHandler.deleteSource(source.getId().toString(), communityIdStr, personIdStr, false);
// (deletes all docs and removes from the share)
}
else { // Still need to delete docs from this share from this community
rp1 = tmpHandler.deleteSource(source.getId().toString(), communityIdStr, personIdStr, true);
}
if ( rp1 != null && !rp1.getResponse().isSuccess() )
{
failedSources.add(source);
}