use of org.alfresco.repo.favourites.PersonFavourite.PersonFavouriteKey in project alfresco-repository by Alfresco.
the class FavouritesServiceImpl method removeFavouriteNode.
private boolean removeFavouriteNode(String userName, Type type, NodeRef nodeRef) {
boolean exists = false;
Map<PersonFavouriteKey, PersonFavourite> personFavourites = getFavouriteNodes(userName, type);
PersonFavouriteKey personFavouriteKey = new PersonFavouriteKey(userName, null, type, nodeRef);
PersonFavourite personFavourite = personFavourites.remove(personFavouriteKey);
exists = personFavourite != null;
updateFavouriteNodes(userName, type, personFavourites);
QName nodeClass = nodeService.getType(nodeRef);
final String finalRef = nodeRef.getId();
final QName nodeType = nodeClass;
eventPublisher.publishEvent(new EventPreparator() {
@Override
public Event prepareEvent(String user, String networkId, String transactionId) {
return new ActivityEvent("favorite.removed", transactionId, networkId, user, finalRef, null, nodeType == null ? null : nodeType.toString(), Client.asType(ClientType.script), null, null, null, 0l, null);
}
});
OnRemoveFavouritePolicy policy = onRemoveFavouriteDelegate.get(nodeRef, nodeClass);
policy.onRemoveFavourite(userName, nodeRef);
return exists;
}
Aggregations