Note that there are some explanatory texts on larger screens.

plurals
  1. POAlfresco form filters
    primarykey
    data
    text
    <p>I'm trying to create a form filter, that would do some post-processing of a form.</p> <p>What I'm trying to achieve: Everytime a node has been created OR modified the filter should be applied after the node is persisted.</p> <p>It runs just fine when i edit/modify an existing, but it does not run after a new node is created.</p> <p>Here is my code:</p> <pre><code> public class CaseFormFilter extends AbstractFilter&lt;Object, NodeRef&gt; { protected ServiceRegistry registry; protected NodeService nodeService; protected SearchService searchService; protected SiteService siteService; protected NamespaceService namespaceService; public void setServiceRegistry (ServiceRegistry registry) { this.registry = registry; this.nodeService = this.registry.getNodeService(); this.searchService = this.registry.getSearchService(); this.siteService = this.registry.getSiteService(); this.namespaceService = this.registry.getNamespaceService(); } @Override public void afterPersist(Object item, FormData data, NodeRef persistedObject) { System.out.println("Persisting!"); } @Override public void afterGenerate(Object item, List fields, List forcedFields, Form form, Map context) { System.out.println("Calling afterGenerate!!"); } @Override public void beforeGenerate(Object item, List fields, List forcedFields, Form form, Map context) { System.out.println("Calling beforeGenerate!!"); } @Override public void beforePersist(Object item, FormData data) { System.out.println("Calling beforePersist!!"); } } </code></pre> <p>I can see that <code>beforeGenerate</code> and <code>afterGenerate</code> is always called, even when viewing, which makes sense. However, <code>afterPersist</code> is only run when I edit a node, but not when creating a new node.</p> <p>Am I doing something wrong or missing something? The wiki/documentation is rather useless on this point, reading <a href="http://wiki.alfresco.com/wiki/Forms_Developer_Guide#Form_Filter" rel="nofollow">http://wiki.alfresco.com/wiki/Forms_Developer_Guide#Form_Filter</a> just tells me to look in the DOD5015 module, which does provide an example, but does not really provide any answers.</p> <p>I'm using Alfresco 4.0.b Community edition.</p> <p>EDIT: A bit more clarification</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload