Showing posts with label PE API. Show all posts
Showing posts with label PE API. Show all posts

Saturday, March 13, 2021

FileNet - Setting user Preferences using Process Engine API

 

Setting User Preference


package com.fnp8api.userPreferences;

import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import javax.security.auth.Subject;
import com.filenet.api.core.Connection;
import com.filenet.api.core.Domain;
import com.filenet.api.core.Factory;
import com.filenet.api.util.UserContext;
import filenet.vw.api.VWSecurityList;
import filenet.vw.api.VWSession;
import filenet.vw.api.VWUserInfo;


public class SettingUserPreferences{

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

Connection con= // get the Connecton code from here

Domain domain=Factory.Domain.fetchInstance(con, null, null);

// Connect to ProcessEngine and get vwSession object 
 VWSession vwSession = new VWSession();

 vwSession.setBootstrapCEURI("your content engine url");
  
 vwSession.logon( "UserName", "password", "Connection Point Name");

 VWSecurityList userList = vwSession.fetchUsers(1000,false);

 while(list.hasNext())
 {
    
	VWUserInfo userInfo = vwSession.fetchUserInfo(userList.next().toString());
    
	userInfo.setEMailAddress(userInfo +"@"+"email domain suffix");
    
 	int notification = VWUserInfo.NOTIFICATION_STEP_EXPIRED_DEADLINE |
 	VWUserInfo.NOTIFICATION_STEP_REMINDERS |
	VWUserInfo.NOTIFICATION_TRACKER_EXPIRED_DEADLINE |
 	VWUserInfo.NOTIFICATION_TRACKER_NEW_ASSIGNMENT |
 	VWUserInfo.NOTIFICATION_STEP_NEW_ASSIGNMENT |
 	VWUserInfo.NOTIFICATION_TRACKER_WORKFLOW_EXCEPTION;

 	userInfo.setNotificationFlags(notification);

 	userInfo.save();
 
 }

}
    
catch(Exception e)
{
    e.printStackTrace();

}
}
}

Monday, February 15, 2021

IBM FileNet custom logger -Configuring Fnlog4j.properties

IBM FileNet : Configuring fnlog4j.properties for logger


Copy the sample fnlog4j.properties.sample file form \IBM\FileNet\ContentEngine\tools\PE\samples

And Place the bellow code in the fnlog4j.properties file



log4j.appender.MYAPPLICATION=org.apache.log4j.DailyRollingFileAppender

log4j.appender.MYAPPLICATION.layout=org.apache.log4j.PatternLayout

log4j.appender.MYAPPLICATION.layout.ConversionPattern=%d{dd/MM/yyyy HH:mm:ss,SSS} %5p %c: %L - %m%n

log4j.appender.MYAPPLICATION.File=mydrive/IBM/WebSphere/AppServer/profiles/AppServer/myserverabc/ComponentLogs/javacomplog.txt

log4j.appender.MYAPPLICATION.Append=true


log4j.logger.myapplogger=ALL, MYAPPLICATION


Copy the fnlog4j.properties file to :    - \IBM\WebSphere\AppServer\java\jre\lib

And use the bellow code in java project 


import filenet.vw.base.logging.Logger;

this.logger=Logger.getLogger("myapplogger");

Wednesday, February 3, 2021

FileNet- PE API - Java code to Connect Process Engine(Creating vw session object )


FileNet Process Engine API


 \\Connecting to Process Engine using PE API

public VWSession getVWSession(){

  try{

         vwSession=new VWSession(); \\Creating VWSession Object

vwSession.setBootstrapCEURI("<your content engine url>");

  vwSession.logon("userName", "password", connectionPointObject);

  return vwSession;

  }

  catch(Exception e){

                        e.printStackTrace();

}

  return null;

  }