Sunday 22 July 2012

How to create Custom Filter Component for AutoNumberPrefix for standard Checkin Document In UCM 11g

  1. Open Component Wizard : <domain _home>/ucm/cs/bin/ComponentWizard

2. click on Add
    a. Name the component "AutoNumberPrefix-ContentID-Filter"
    b. Click on OK.

3. Now open Jdevloper/eclipse Create java class Name "CustomFilter"

package project1;

import intradoc.common.ExecutionContext;
import intradoc.common.ServiceException;
import intradoc.common.SystemUtils;
import intradoc.data.DataBinder;
import intradoc.data.DataException;
import intradoc.data.Workspace;
import intradoc.shared.FilterImplementor;

public class CustomFilter implements FilterImplementor {

    public int doFilter(Workspace ws, DataBinder binder, ExecutionContext ctx) throws
DataException, ServiceException {
        // obtain the dDocType
        String type = binder.getLocal("dDocType");
        String dDocName = binder.getLocal("dDocName");
        SystemUtils.info("dDocName:" + dDocName);
       // if it exists (which it always should) set the autonumber prefix to that value
        SystemUtils.info("type:" + type);
        if (type != null) {
            SystemUtils.info("inside if");
            binder.putLocal("AutoNumberPrefix", type + "_");
            SystemUtils.info("AutoNumberPrefix:" +
                             binder.getLocal("AutoNumberPrefix"));
        }
        // filter executed correctly, return CONTINUE
        return FilterImplementor.CONTINUE;

    }
}

4. Create folder structure inside your custom component location & put Java , class files to appropriate locations :
<domain_home>/ucm/cs/custom/AutoNumberPrefix-Content-ID-Filter/src/project1/CustomFilter.java
 <domain_home>/ucm/cs/custom/AutoNumberPrefix-Content-ID-Filter/classes/project1/CustomFilter.class
 

5. Now open your AutoNumberPrefix-ContentID-Filter.hda and make following entries

6. open component wizard select your custom component select open , in JavaCode you will see details for filter

 7. Open Component Wizard enable your component and restart content server


8. Now check in new document without giving content ID , you can see the Content ID is auto generated  based on document type.
 


2 comments:

  1. Replies
    1. Thanks Wriju for your comment.
      For more details you should refer these expert blog:
      http://bexhuff.com/topic/technology/oracle-stellent
      and for detail on auto number prefix please refer
      http://bexhuff.com/2011/03/howto-component-samples-for-oracle-ucm-11g

      Delete