share.setDescription(description);
share.setShare(json);
// Save the document to the share collection
DbManager.getSocial().getShare().update(query, share.toDb());
rp.setData(share, new SharePojoApiMap(null));
rp.setResponse(new ResponseObject("Share", true, "Share updated successfully."));
}
// Create new share
else
{
// Create a new SharePojo object
share = new SharePojo();
share.set_id(new ObjectId(shareIdStr));
share.setCreated(new Date());
share.setModified(new Date());
share.setType(type);
share.setTitle(title);
share.setDescription(description);
share.setShare(json);
HashSet<ObjectId> endorsedSet = new HashSet<ObjectId>();
share.setEndorsed(endorsedSet); // (you're always endorsed within your own community)
endorsedSet.add(new ObjectId(ownerIdStr));
// Get ShareOwnerPojo object and personal community
PersonPojo owner = getPerson(new ObjectId(ownerIdStr));
share.setOwner(getOwner(owner));
share.setCommunities(getPersonalCommunity(owner));
// Serialize the ID and Dates in the object to MongoDB format
// Save the document to the share collection
DbManager.getSocial().getShare().save(share.toDb());
rp.setData(share, new SharePojoApiMap(null));
rp.setResponse(new ResponseObject("Share", true, "New share added successfully."));
}
}
catch (Exception e)
{