IBM ECM Application Center

No Comments

Below link has  sample code and tech notes from IBM.

https://www.ibm.com/developerworks/mydeveloperworks/groups/service/forum/topicThread?topicUuid=070bead5-37d3-4ffb-b650-9e0a1f64fa14#fullpageWidgetId=Wf2c4e43b120c_4ac7_80ae_2695b8e6d46d

 

Eform Java API standalone update code

1 Comment

eform when used in FileNet P8 stores the form data in CE as content XML.

When associated with workflow step, updating eform content requires form policy and form template configuration.

It becomes really tricky to update  eform content (document object) using external standalone utility when it is associated with workflow.

Here are few things that you should know how eform stores data in CE

1.  All eform data is stored as document object of  ’Form Data’ or it subclass.

2. ‘ITX Form Template’ and ‘Form Policy’ are OVP property that are associated with the template and policy definition.

3.  If you check-out  and check-in eform document object using Workplace action, the above property is set to null and eform will not open.

4. FormPolicyLaunchedWorkflowNumber stores the wob number of the workflow object aooscited with eform.

5. FormPolicyStepDescriptor stores the step info of the workflow step.

6. FormPolicyStepDescriptor  and FormPolicyLaunchedWorkflowNumber  are visible in EM not in Workplace GetInfo.

Following code get the XML data of the eform.

public class TestEform {
public static void main(String[] args) {
try
{

// Initial Configuration

// This file contains the P8 configuration
Configuration.initialize(“<Path of the  folder  that contains file ‘eforms-integration.xml’ >);
Hashtable context = Context.initialize();

// This is 3.5 Session used in Workplace. Not tested with 4.5 Session.
context.put(“session”, conutil.getCESession());
context.put(“locale”, Locale.US);
context.put(“timeZone”, TimeZone.getDefault());

System.out.println(“Initialization done”);

// Create Template String

// GUID of eform Template
String templateUri = “p8:” +
URLEncoder.encode(conutil.getObjectStore().getId()) + “.” +
URLEncoder.encode(“{3E99B5A4-671C-4F3F-AC89-F7AD87540800}”);

System.out.println(“templateUri” + templateUri);

// Create Form URI

// GUID of eform Content.
String formDataUri = “p8:” +
URLEncoder.encode(conutil.getObjectStore().getId()) + “.” +
URLEncoder.encode(“{40315028-485B-42E8-BEA5-A7568C43499F}”);
System.out.println(“formDataUri”+formDataUri);

// creating form object
Template t = new Template(templateUri);
Form f = new Form(t);
String itxData=f.getDataXml();
System.out.println(“form data xml” +itxData);

// Form Instance data
Data data = new Data(formDataUri);
String dataXML=data.getXml();
System.out.println(“data xml” +dataXML);
}
catch(Throwable t)
{
t.printStackTrace();
System.out.println(“error”);

}
}

}

Once you get the XML you can use eform Java AP Ito update cell or retrieve value.

// create version first and then update properties

InputStream inputStream1 = new ByteArrayInputStream(WcmXMLUtil.saveToString(XMLDoc).getBytes());
TransportInputStream tis = new TransportInputStream(inputStream1);
tis.setFilename(strFileName);
tis.setMimeType(strMimeType);
tis.setContentElement(1);
inputStream.setContentElement(1);
doc = doc.checkout();
doc.setContent(tis, false, false);
doc.checkin(false, false);

You can then use that content xml to create new version.

// Below code retrieves the document object

// Note form template and form policy is also retrieved as after checkin it is set to null by default

 

Document formData = executeFormDataSearch(P8SessionHelper.getCE35Session(), “OS1″, objectid);
Document formTemplate = (Document) doc.getPropertyValue(P8FormUtil.ITX_FORM_TEMPLATE);
Document formPolicy = (Document) doc.getPropertyValue(P8FormUtil.FORM_POLICY);

Property propFormPolicy = ObjectFactory.getProperty(“FormPolicy”);
propFormPolicy.setValue(formPolicy);
loProperties.add(propFormPolicy);

// Update the properties before check-in

Properties loProperties = ObjectFactory.getProperties();

Property propFormTemplate = ObjectFactory.getProperty(“ITXFormTemplate”);
propFormTemplate.setValue(formTemplate);
loProperties.add(propFormTemplate);

formData.setProperties(loProperties);

 

Content Engine Ping Page

No Comments

http://server:port/FileNet/Engine

 

 

PE Session Using EJB Layer

No Comments

public static VWSession getPESession() throws Exception
{
System.setProperty(“java.security.auth.login.config”,”jaas_config”);
System.setProperty(“java.naming.factory.initial”,”weblogic.jndi.WLInitialContextFactory”);
VWSession moVWSession=new VWSession();

// t3 is for Weblogic EJB protocol.
moVWSession.setBootstrapCEURI(“t3://server:port/FileNet/Engine”);
moVWSession.logon(PE_USER_NAME, PE_PASSWORD, “Connection Point”);
return moVWSession;
}

CE Oracle SQL

1 Comment

Ideally you should use CE Enterprise Manager to run any query.

This is some of the query if you really want to run the query behind the scene. Custom property column names are generated unique for each environment.

– doc version size in millions

select count(*)/1000/1000  from schema.DOCVERSION;

– Find out number of documents in Object Store

select count(*) from schema.DOCVERSION, schema.CLASSDEFINITION where schema.DOCVERSION.OBJECT_CLASS_ID = schema.CLASSDEFINITION.OBJECT_ID and symbolic_Name in (‘DocClassSymName’, ‘DocClassSymName’);

List down document class tree (as seen in EM)

select lpad(‘__’,5*(level-1)) || symbolic_name   from schema.classdefinition  start with symbolic_name = ‘Document’

connect by prior object_id = superclass_id;

Document created by user ‘user1′ max 10

select schema.DOCVERSION.OBJECT_ID, schema.DOCVERSION.XXX_DOCUMENTTITLE from schema.DOCVERSION where rownum < 10 and schema.DOCVERSION.CREATOR = ‘user1′;

 Folder query inside Parent folder

select * from schema.container where schema.container.name = ‘XXX’ and parent_container_id = (select object_id
from schema.container where schema.container.name = ‘ParentFolder’);

RCR Query

select schema.RR.head_id “GUID”, cn.XXX_customprop “SymbolicName”
from schema.relationship RR ,schema.container CN, schema.classdefinition CD
where cd.object_id = cn.object_class_id
and cd.symbolic_name = ‘FolderSymName’
and rr.tail_id = cn.object_id;

 

Multi Select Document Action Code Sample (WAT)

2 Comments

If you  are using Workplace or Workplace XT as your main web application and want to code new action for search result see the details below

Note:  Workplace and Workplace XT is still available in 5.1 Version.  Although in coming months new UI ‘Nexus’ will slowly replace Workplace/Workplace XT.

Step 1

Add the new action in Action.xml file. This is section to add new action definition. You can also add the action in ‘topLevelActions’ for single rigth click select.

<array key=”multiSelectActions”>

<value>newAction</value>

 Also define the new key section

<object key=”actionDefinition”>
<setting key=”id”>newAction</setting>

<setting key=”url”>Workplace/operations/MyNewAction.jsp?id={OBJECT_ID}&amp;label={OBJECT_LABEL}&amp;objectType={OBJECT_TYPE}&amp;objectStoreName={OBJECT_STORE_NAME}&amp;returnUrl={RETURN_URL}&amp;op=UsePageParams</setting>

……

</object>

Refecr existing example of OOTB action to create a new action  in this configuration file.

Step 2

Define new ‘MyNewAction.jsp’ event and UI JSP.

Event JSP  (webapp location)

<jsp:useBean id=”newAction”

       class=”com.test.NewAction”
       scope=”request”>
    <jsp:setProperty name=”newAction” property=”name” value=”newAction” />
</jsp:useBean>

 

UI JSP location UI-INF\jsp\ui\…

<html>
<head>
   <%
       Locale locale = WcmStringResources.getClientLocale(request);
</head>
<body>
    <% WcmUi.render(request, “newAction”, out); %>
</body>
</html>

Step 3

Add WAT Code in this file

com.test.NewAction

You can refer existing FileNet WAT code.

PE LDAP Cache Entry Timeout

No Comments

If you add/remove users from LDAP you will notice that it is not refreshed immediately. By default the sync process  is set to 4 Hour.

It typically can take more on enterprise network where LDAP itself need to sync up all servers.

http://publib.boulder.ibm.com/infocenter/p8docs/v5r0m0/index.jsp?topic=%2Fcom.ibm.p8.pe.admin.doc%2Fbpfad027.htm

 

 

 

 

WAT Hello World

1 Comment

“Hello World” uses the following components:

  • Event JSP Page
  • UI JSP Page
  • UI Module

In a typical WAT app, both event and UI JSP pages have the same name. But, they are deployed in separate locations

Event JSP Page

  •  Initializing the controller and Module components
  •  Registering Modules and Passing the Control to the Controller

Following are the steps performed in an Event JSP page

  • Step 1: Initialize the UI Component
  • Step 2: Initialize the Controller Component
  • Step 3: Register Modules with the Controller
  • Step 4: Route Events to the Controller to invoke callbacks

Event JSP Location

<Web-Project-Folder>/HelloWorld.jsp

 

HelloWorld.jsp (Event JSP Page)

 

  <%@ page errorPage=”/WcmError.jsp” autoFlush=”false” %>

 

<%– Instantiate the UI Module –%>

 

  <jsp:useBean

     id=”helloWorld”

     scope=”request”>

 

  <jsp:setProperty name=”helloWorld” property=”name” value=”helloWorld” />

</jsp:useBean>

 

<%– Instantiate the controller object –%>

<jsp:useBean id=”controller”

    scope=”request”>

</jsp:useBean>

 

<%–  initializes the controller and  register Modules–%>

  <%

 

    controller.configurePage(application, request);

    controller.registerModule(helloWorld);

    controller.setLoginEnabled(false);

  %>

 

<%– routes the events

The handleEvent method includes a Boolean parameter. When the parameter is set to true, the method redirects the request to a corresponding UI JSP page, which initiates rendering of the HTML output.  –%>

 

 <%

   controller.handleEvent(application, request, response, true);

 %>

 

UI JSP Page

 

UI JSP Location

<Web-Project-Folder>/UI-INF/jsp/ui/HelloWorld.jsp

 

HelloWorld.jsp

 

<%@ include file=”/WEB-INF/jsp/WcmHeader.jsp” %>

<html>

 

<head>

   <title>Hello World Sample</title>

   <link rel=”stylesheet” href=”css/Wcm.css” type=”text/css”>

</head>

 

<body>

 

 

<%– Using the predefined JSP variables request and out, the following call passes the HttpServletRequest and PrintWriter objects to WcmUi.render method. It also passes the helloWorld variable, which identifies the HelloWorld object instantiated in the event JSP page. The WcmUI.render method will route rendering to HelloWorldModuleJSP.jsp, as set in the UI module, HelloWorld. –%>

 

<%System.out.println(“Before calling render()….”);%>

 

           <% WcmUi.render(request, “helloWorld”, out); %>

 

<%System.out.println(“After calling render()….”);%>

 

</body>

 

</html>

 

 

UI Module

 

This is java UI module that is loaded by controller

HelloWorld.java

package com.filenet.samples.general;

import com.filenet.wcm.toolkit.server.base.*;

import java.io.Writer;

import javax.servlet.http.*;

 

/* Like all UI modules, WcmHello inherits from WcmUiModule */

public class HelloWorld extends WcmUiModule

{

               /* This variable holds the “Hello World” string displayed on the HTML page. */

               public String message = “Hello World!”;

 

               /* The controller calls the initialize method on all registered modules. */

               public void initialize() throws java.lang.Exception

    {

                               /* This inherited method sets the UI module JSP that will retrieve and render the message value. */

        //setJSP(“apps/HelloWorldModuleJSP.jsp”);

System.out.println(“Inside Initialize…”);

 

    }

//onStartPage() of parent is called, since I have not overridden

    public void render(Writer w) throws Exception

   {

 

     System.out.println(“Inside Render…”);

w.write(“<b>Hello World!</b>”);

 

   }

 

}

 

CE JDBC Code Sample

2 Comments

IBM FileNet provides a JDBC driver that can connect to the CE database – com.filenet.api.jdbc.Driver
The driver establishes a connection to a CE database and can provide metadata information on object stores and can execute queries against those object stores. The database referenced is a logical view, reflecting the Content Engine data model as a merged scope; it is not a direct connection to the CE database.

Instance of this class can connect to a Content Engine database server using

• Enterprise Java Beans (EJB) Listener
• Web Services Listener

Connecting with Java Requirements
• URLExample: jdbc:filenetp8:http://server:7001/wsi/FNCEWS40DIME/?objectstores=testOS&mergemode=intersectio
n
• Userid
• Password
• Jars needed:
o Jace.jar
o Log4j.jar

Commands
javac -classpath c:\p8\jace.jar;c:\p8\log4j-1.2.14.jar; TestCEJDBC.java
java -classpath c:\p8\jace.jar;c:\p8\log4j-1.2.14.jar; TestCEJDBC

Sample Code

import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.Statement;
import com.filenet.api.jdbc.Driver;
public class TestCEJDBC {

public static void main(String args[]) {

try {

String url = “<url>”;
Driver driver = new Driver();
java.util.Properties props = new java.util.Properties();
System.out.println(“TestCEJDBC – Trying to get connection”);
props.put(Driver.USER_PROPERTY_KEY, “<userid>”);
props.put(Driver.PASSWORD_PROPERTY_KEY, “<password>”);
java.sql.Connection connection = driver.connect(url, props);
Statement b = connection.createStatement();
System.out.println(“TestCEJDBC – Connection obtained”);
// Transaction
ResultSet resultSet = b.executeQuery(“select DocumentTitle from Document”);
ResultSetMetaData c = resultSet.getMetaData();
System.out.println(” “);
while (resultSet.next()) {
System.out.print(resultSet.getString(1) );
}
resultSet.close();
connection.close();
} catch (Exception e) {
System.out.println(“Some Exception”);
}
}

Finding Work Queue Physical database table

No Comments

Following blog  details the steps

http://ecmcorner.wordpress.com/2010/09/06/associate-work-queue-name-with-physical-table-in-pe-database/

vwtool config command provides the details of the matching physical database table name with the corresponding queue name in PE.

Older Entries