09-28-2011 10:13 AM
09-28-2011 10:24 AM
Hello,
You've got a getComments(DocumentModel) method exposed by the CommentManager service. I hope it will help you.
09-28-2011 10:24 AM
Hello,
You've got a getComments(DocumentModel) method exposed by the CommentManager service. I hope it will help you.
09-28-2011 10:56 AM
Yes, thank you but I want to get the comment from the event to send it in the email notification
07-02-2012 04:31 AM
/** * */
package org.nuxeo.yourcompany.automation;
import java.util.List;
import org.nuxeo.ecm.automation.core.Constants; import org.nuxeo.ecm.automation.core.annotations.Context; import org.nuxeo.ecm.automation.core.annotations.Operation; import org.nuxeo.ecm.automation.core.annotations.OperationMethod; import org.nuxeo.ecm.automation.core.collectors.DocumentModelListCollector; import org.nuxeo.ecm.core.api.CoreSession; import org.nuxeo.ecm.core.api.DocumentModel; import org.nuxeo.ecm.core.api.DocumentModelList; import org.nuxeo.ecm.core.api.impl.DocumentModelListImpl; import org.nuxeo.ecm.platform.comment.api.CommentManager; import org.nuxeo.runtime.api.Framework;
/**
@author pjenicot */ @Operation(id=GetComments.ID, category=Constants.CAT_DOCUMENT, label="GetComments", description="Renvoie les commentaires d'un document") public class GetComments {
public static final String ID = "Document.GetComments";
@Context protected CoreSession session;
protected CommentManager commentManager;
private static CommentManager getCommentManager() { try { return ((CommentManager)Framework.getService(CommentManager.class)); } catch (Exception e) {}
return null;
}
@OperationMethod(collector=DocumentModelListCollector.class) public DocumentModelList run(DocumentModel doc) throws Exception {
DocumentModelListImpl docs = new DocumentModelListImpl();
CommentManager commentManager = getCommentManager();
List<DocumentModel> comments = commentManager.getComments(doc);
if (!comments.isEmpty())
{
for(DocumentModel comment : comments)
docs.add(comment);
}
return docs;
}
}
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.