Wednesday 1 August 2012

How to create Custom Service Component in Oracle UCM 11g

1. Open Component Wizard from {domain_home}/ucm/cs/bin/ComponentWizard
2. Click on Add button will show up new popup window.
     a. Name the component "HelloWorld"
     b.Click Ok.
3. Click on Add on Resource Window
     a. Select Service & Click Next.
4. Give the service name "Hello_World".
     Class name - Give class path
     Template- MSG_PAGE

5. Click on ADD button
6. Click Ok.

7. Click On Finish.
8. Open Jdeveloper/ Eclipse framework Create Java class name "Custom Service"
package project1;
import intradoc.common.ServiceException;
import intradoc.common.SystemUtils;
import intradoc.data.DataException;
import intradoc.server.Service;
public class CustomService extends Service {


public void helloworld_sayHello()throws DataException,ServiceException{
SystemUtils.info("inside Method");
m_binder.putLocal("StatusMessage", "Hello World Sample ");
String statusmessage=m_binder.getLocal("StatusMessage");
SystemUtils.info("statusmessage:"+statusmessage);
}


}
 

a. Create folder structure at your custom component location & put java and Class file to appropriate location:
/ucm/cs/custom/HelloWorld/src/project1/CustomService.java
/ucm/cs/custom/HelloWorld/classes/project1/CustomService.class

9. Add class Path to {Custom_Component_Home}/HelloWorld.hda
 10. Open Component Wizard Click on "Enable" by selectin "HelloWorld" component.
 11. Restart the content server.
       Now hit the URL:http://localhost:16200/cs/idcplg?IdcService=HELLO_WORLD



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.