com.netscape.pm.model
Class WorkItemPKFactory

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

public class WorkItemPKFactory
extends java.lang.Object

Creates a work item key object, used for obtaining a handle to an IWorkItem object. The method findWorkItem off the IPMApplication interface is the only means of obtaining an IWorkItem object using an IWorkItemPK object.

 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();

     long instanceId = Long.parseLong( req.getParameter(
                                             IUIParameters.INSTANCE_ID ) );
     String forkId = req.getParameter( IUIParameters.FORK_ID );
     String nodeName = req.getParameter( IUIParameters.NODE_NAME );

     IWorkItemPK pk = WorkItemPKFactory.create( instanceId,
                                                forkId,
                                                nodeName );
     pk.setEditable( true );
     
     IWorkItem wi = app.findWorkItem( pk );
     IProcessInstance pi = wi.getProcessInstance();

     pi.setData( "name", req.getParameter( "name" ) );
     wi.save();
     wi.release( true );

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

See Also:
IWorkItemPK, IPMApplication

Constructor Summary
WorkItemPKFactory()
           
 
Method Summary
static IWorkItemPK create(long instanceId, java.lang.String forkId, java.lang.String nodeName)
          Creates an instance of a work item key from an instance id, fork id and node name.
static IWorkItemPK create(long instanceId, java.lang.String forkId, java.lang.String nodeName, java.lang.String appName)
          Creates an instance of a work item key from an instance id, fork id, node name and an application name.
static IWorkItemPK create(long instanceId, java.lang.String forkId, java.lang.String nodeName, java.lang.String appName, java.lang.String clusterName)
          Creates an instance of a work item key from an instance id, fork id, node name and an application name.
protected static IWorkItemPK create(java.lang.String swapURL)
          Creates an instance of a work item key from a swap URL string.
protected static IWorkItemPK create(java.lang.String swapURL, java.lang.String clusterName)
          Creates an instance of a work item key from a swap URL string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WorkItemPKFactory

public WorkItemPKFactory()
Method Detail

create

public static IWorkItemPK create(long instanceId,
                                 java.lang.String forkId,
                                 java.lang.String nodeName)
Creates an instance of a work item key from an instance id, fork id and node name.

Keys created via this method only differ from those created via the create( long, String, String, String ) method by the value of the application name member (this method will not set the application name). When accessing parent work items, the engine requires the name of the parent application. Users will not require the use of the create( long, String, String, String ) factory method and should concentrate on this method instead.

Parameters:
instanceId - the instance id of the work item
forkId - the fork id of the work item
nodeName - the node name of the work item
Returns:
an instance of a work item key containing the given key parameters.
Since:
PM 6.0
See Also:
create( long, String, String, String ), IWorkItemPK

create

public static IWorkItemPK create(long instanceId,
                                 java.lang.String forkId,
                                 java.lang.String nodeName,
                                 java.lang.String appName)
Creates an instance of a work item key from an instance id, fork id, node name and an application name.

Keys created via this method only differ from those created via the create( long, String, String ) method by the value of the application name member. When accessing parent work items, the engine requires the name of the parent application. Users will not require the use of this factory method and should use the create( long, String, String ) version of this method instead.

Parameters:
instanceId - the instance id of the work item
forkId - the fork id of the work item
nodeName - the node name of the work item
appName - the name of the application the work item belongs to
Returns:
an instance of a work item key containing the given key parameters.
Since:
PM 6.0
See Also:
create( long, String, String ), IWorkItemPK

create

public static IWorkItemPK create(long instanceId,
                                 java.lang.String forkId,
                                 java.lang.String nodeName,
                                 java.lang.String appName,
                                 java.lang.String clusterName)
Creates an instance of a work item key from an instance id, fork id, node name and an application name.

Keys created via this method only differ from those created via the create( long, String, String ) method by the value of the application name member. When accessing parent work items, the engine requires the name of the parent application. Users will not require the use of this factory method and should use the create( long, String, String ) version of this method instead.

Parameters:
instanceId - the instance id of the work item
forkId - the fork id of the work item
nodeName - the node name of the work item
appName - the name of the application the work item belongs to
clusterName - name of the cluster this application belongs to
Returns:
an instance of a work item key containing the given key parameters.
Since:
PM 6.0
See Also:
create( long, String, String ), IWorkItemPK

create

protected static IWorkItemPK create(java.lang.String swapURL)
                             throws PMException
Creates an instance of a work item key from a swap URL string. This method is used internally by the engine to create a parent work item key from a serialized string version. Users will not require the use of this factory method and should use the create( long, String, String ) version of this method instead.
Parameters:
swapURL - the value of the work item key in an internal format
Returns:
an instance of a work item key.
Throws:
PMException - if the value of swapURL does not match the expected format.
Since:
PM 6.0
See Also:
IWorkItemPK

create

protected static IWorkItemPK create(java.lang.String swapURL,
                                    java.lang.String clusterName)
                             throws PMException
Creates an instance of a work item key from a swap URL string. This method is used internally by the engine to create a parent work item key from a serialized string version. Users will not require the use of this factory method and should use the create( long, String, String ) version of this method instead.
Parameters:
swapURL - the value of the work item key in an internal format
clusterName - name of the cluster
Returns:
an instance of a work item key.
Throws:
PMException - if the value of swapURL does not match the expected format.
Since:
PM 6.0
See Also:
IWorkItemPK