com.netscape.pm.model
Class PMRequestFactory

java.lang.Object
  |
  +--com.netscape.pm.model.PMRequestFactory

public class PMRequestFactory
extends java.lang.Object

Creates a request object, used for passing client request information to Process Manager engine components. The IPMRequest objects this factory creates serve as thin-layer wrappers around ServletRequest objects, but allow the engine to remain loosely coupled to whatever request transport mechanism is currently being employed.

Here is an example of how the IPMRequest object may be used by the fields defined in the application's data dictionary.

 public void doGet( HttpServletRequest req, HttpServletResponse res ) 
     throws ServletException, IOException
 {
     res.setContentType( "text/html; charset=ISO-8859-4" );

     javax.naming.Context cxt = new javax.naming.InitialContext();
     String jndiName = "java:comp/env/" + IPMApplication.DEFAULT_JNDI_ROOT
                     + "/" + localName;
     IPMApplicationHome home = (IPMApplicationHome) cxt.lookup( jndiName );
     IPMApplication app = home.create();

     IProcessDefinition pd = app.getProcessDefinition();
     INodeElement epn = pd.getProcessMap()
                          .getNodeElement( "EntryPoint1" );
     IFormElement epf = pd.getFormDictionary()
                          .getFormElement( "EntryPointForm" );

     IWorkItem wi = app.initiateProcessInstance( epn );
     IProcessInstance pi = wi.getProcessInstance();

     IPMRequest request = PMRequestFactory.create( req );
     for( Enumeration fs = epf.editables(); fs.hasMoreElements(); )
     {
         IPresentationElement ipe = (IPresentationElement) fs.nextElement();
         ipe.update( pi, request );
     }

     app.execute( wi );
     wi.release( true );

     res.getWriter().flush();
     res.getWriter().close();
 }
 

See Also:
IPMRequest

Constructor Summary
PMRequestFactory()
           
 
Method Summary
static IPMRequest create(javax.servlet.http.HttpServletRequest request)
          Creates an instance of a request object from an HttpServletRequest object.
static IPMRequest create(com.sun.processmgr.serviceapi.types.IWFDataList req)
          Creates an instance of a request object from an IWFDataList object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PMRequestFactory

public PMRequestFactory()
Method Detail

create

public static IPMRequest create(javax.servlet.http.HttpServletRequest request)
Creates an instance of a request object from an HttpServletRequest object.
Parameters:
request - a servlet request object
Returns:
an instance of an IPMRequest object
Since:
PM 6.0
See Also:
IPMRequest

create

public static IPMRequest create(com.sun.processmgr.serviceapi.types.IWFDataList req)
Creates an instance of a request object from an IWFDataList object. EVALUATE IF THIS IS THE CORRECT APPROACH POST 6.5 bcox this causes a reverse dependancy i.e old Java API on the new Service API...should be only one way i.e. Service API -> Java API . added to support the Service API that gets data via the IWFData interface (created by a serializer) as opposed to a HTTPServletRequest .
Parameters:
request - an IWFDataList object (
Returns:
an instance of an IPMRequest object
Since:
PM 6.5
See Also:
IPMRequest