Implementation overview

This example creates a sample text creation handler to update the name of the text module in the pre-process step:
  1. Create a TextCreateHandler class implementing the ActionHandler interface in CorrespondenceManagementSolutionTemplate/Services project. This interface contains the preProcess() and postProcess() methods which are called before and after the create method respectively:
    package com.adobe.icc; 
     
    import java.util.Map; 
    import com.adobe.icc.dbforms.obj.TextModule; 
    import com.adobe.livecycle.content.repository.action.ActionHandler; 
    import com.adobe.livecycle.content.repository.action.ActionType; 
     
    /** 
     * TextCreateHandler is the handler associated with the Create operation of the Form. The preProcess() and postProcess() methods of 
     * this class are invoked just before and after the Create operation. 
     */ 
    public class TextCreateHandler implements ActionHandler { 
     
            private static final String PREFIX = "PREFIX"; 
        /** 
         * This method is invoked just prior to the Create operation of TextModule. The first parameter of this API is the form object that 
         * is being Created. 
         */ 
        public void preProcess(String nodeType, ActionType actionType, Object obj, Map<String, Object> arg1) 
        { 
            TextModule text = (TextModule) obj; 
                    text.setName(PREFIX + text.getName()); 
        } 
         
        /** 
         * This method is invoked just after to the Create operation of Text. The first parameter is the form object that has been 
         * Created. 
         */ 
        public void postProcess(String nodeType, ActionType actionType, Object arg0, Map<String, Object> arg1) { 
            // Do nothing 
        } 
    }
  2. Configuring the Handler by adding the following entry to the <bp:blueprint> section of CorrespondenceManagementSolutionTemplate\Services\resources\META-INF\spring\osgi-context.xml file:
    <bp:reference interface="com.adobe.livecycle.content.repository.RepositoryService" />
  3. Update the AssetDefinitionDeployer class to add a private variable repositoryService of class com.adobe.livecycle.content.repository.RepositoryService:
    @Autowired 
    private RepositoryService repositoryService;
  4. and add the following code to the afterPropertiesSet() method:
    List<ActionHandler> handlers = new ArrayList<ActionHandler>(); 
    handlers = new ArrayList<ActionHandler>(); 
    handlers.add(new TextCreateHandler()); 
    repositoryService.addActionHandlers(ActionHandlerService.APP_ROOT_GLOBAL, TextModule.class.getName(), ActionType.CREATE, handlers);
  5. Rebuild and redeploy the Solution template to view the changes. For information on rebuilding and redeploying, see Building and deploying the Solution Template

// Ethnio survey code removed