public class AddFileListener implements NodeServicePolicies.OnCreateNodePolicy {
private Logger logger = Logger.getLogger(AddFileListener.class);
private Behaviour onCreateNode;
private PolicyComponent policyComponent;
protected NodeService nodeService;
protected ContentService contentService;
public void setContentService(ContentService contentService) {
this.contentService = contentService;
}
public void setPolicyComponent(PolicyComponent policyComponent) {
this.policyComponent = policyComponent;
}
public void setNodeService(NodeService nodeService) {
this.nodeService = nodeService;
}
void init() {
// Create behaviours
this.onCreateNode = new JavaBehaviour(this, "onCreateNode",
NotificationFrequency.EVERY_EVENT);
// Register interest in the onCreateNode policy - for content
policyComponent.bindClassBehaviour(QName.createQName(
NamespaceService.ALFRESCO_URI, "onCreateNode"),
ContentModel.TYPE_CONTENT, onCreateNode);
}
@Override
public void onCreateNode(ChildAssociationRef childAssRef) {
System.out.println("node value is ::" + childAssRef.getQName());
}
@Override
public void onCreateNode(ChildAssociationRef childAssRef) {
System.out.println("node value is ::" + childAssRef.getQName());
NodeRef nodeRefFile = childAssRef.getChildRef();
ContentReader reader = contentService.getReader(nodeRefFile,ContentModel.PROP_CONTENT);
}
Content from pre 2016 and from language groups that have been closed.
Content is read-only.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.