Previous     Contents     Index     DocHome     Next     
iPlanet Application Server Enterprise Connector for PeopleSoft Developer's Guide



Chapter 3   Programming for the PeopleSoft Connector


To program for PeopleSoft Enterprise connector, you must know how to acquire Unified Integration Framework (UIF) objects and execute functions by using function objects. You also need to know how to use servlets with the iPlanet Application Server Enterprise Connector for PeopleSoft to access functions on a PeopleSoft EIS. This chapter includes the following information:



About Data Objects

Data objects contain data and metadata, which you can access through the data object interface. The UIF data object interface features:

  • Present a unified representation of backend data types

  • Represent complex data

  • Support most common primitive data types

Data objects are built from primitive types like integer or string. Arrays and structures are complex data objects.

The types of data objects are:

UIF data objects represent data in a hierarchal fashion. Circular references are not allowed because the iPlanet Application Server for PeopleSoft prevents a data object from being used as an attribute of itself. Indirect circular references are not checked by iPlanet Application Server for PeopleSoft and can cause unpredictable results at runtime.


Primitive Objects

A primitive data type object contains a single value of one of the following types:

Figure 3-1    Primitive Object



Integers, floats, and doubles

Integer, float, and double data type objects hold values whose types corresponds to the same Java data type.

When a primitive data object is assigned to a list, array, or structure, the data object is unwrapped and its value is copied. The data object itself is not used. When a primitive value is obtained by using an untyped get method, such as getField(), getElem(), getAttr(), or getCurrent(), the returned value is wrapped with a primitive data object. In this case, the value is copied, thus, modifying the returned primitive data object.


Fixed length strings and variable length strings

Strings correspond to the Java string data type. A fixed length string has a maximum length, whereas a variable length string has no restrictions on its length.


Fixed size byte arrays and variable size byte arrays

A fixed size byte array has a maximum size, whereas a variable size byte array has no restriction on its size.

When a new value replaces an old value, the old value is released. Thus, when a new value is assigned to a variable-length string or a variable size byte array, the old value is released. When a new value is assigned to a fixed length string or a fixed size byte array, the new value is copied over the old one. In the case of a fixed length string, the copied string is truncated to fit, if necessary. In the case of a fixed size byte array, a shorted array is zero filled on the right and a longer array is truncated to fit.

The maximum length of a fixed length string and the maximum size of a fixed size byte array are set when the string's initial value is specified; for example, it is four characters in the following example:

list.addElemFString("abcd")

If you use a five character value, the value is truncated to four characters.


Structure Objects

Structure objects contain other data objects or primitive values as fields. Each object within the structure object is referred to by a string that represents the field name. Field names have a maximum length of 64 characters. A structure's fields are heterogeneous.

Figure 3-2    Structure Object



Array Objects

An array object contains data objects or primitive values as elements in the object. Array objects inherit from list objects. The difference between an array object and a list object is that the array's elements must be homogeneous. Each element within the array object is referred to by an integer that specifies its position in the array object.

Figure 3-3    Array Object



Type Information Objects

Type information objects are structured objects that contain the type information of a data object. For instance, a type information object might define the fields in a structure and their corresponding data types. Instances of data objects can be created of type information objects. Each of these instances contain a reference to a type of information object. Numerous data types can share the same type information object.

Table 3-1 Type Information Objects

DataObjectInfo Type

Target Object

IBSPDataObjectPrimitiveInfo describes the type number, size of value (if type is string or binary), and the default value.  

IBSPDataObjectPrimitive  

IBSPDataObjectStructureInfo describes the type info of all fields of the target structure. The type info of each field is in tern described by a type info object.  

IBSPDataObjectStructure  

IBSPDataObjectListInfo describes the initial capacity and maximal element count of the target list.  

IBSPDataObjectList  

IBSPDataObjectArrayInfo describes the initial capacity, maximal element count and the type info of elements of the target array.  

IBSPDataObjectArray  


UIF Naming Conventions

Methods in the Unified Integration Framework API conform to a naming convention that specifies:

For instance, in the following example:

getElemString()

  • get is the operation

  • Elem is the target

  • String is the type


Operation

There are many types of operations but the two most commonly used are:


Target

The targets are:

  • None (primitive)

  • Attr (complex DataObject such as a list, array, or structure), which uses a path to address the attribute.

  • Elem (list/array), which uses index to address element

  • Field (structure), which uses name to address field

  • Current (itr), which addresses object iterator is currently on


Type

The types of operations are:

  • Int

  • Float

  • Double

  • String

  • FString

  • Binary

  • VBinary

  • DataObject

  • None


Attributes and Paths

In the API, methods of the IBSPDataObject interface do not distinguish between an element in an array and a field in a structure. In this case, the element or field is referred to as an attribute.

The path to an element is its element number, beginning from zero. The path to a field is its field name.You may combine element numbers and field names to create paths to attributes in complex data objects, such as a field of a structure that contains a list of elements. In this case, you specify the path as the individual attributes separated by periods (.); i.e. use "field1.[01]" to identify the first element of a list at field1 in the structure.


Changing Data Types

If an attribute's type is primitive, it cannot change. For example, the following code causes an error because it tries to change the type of a primitive from an integer to a float:

list.addElemInt (100) ; // assume 100 is added to element 1

list.setElemFloat (1, 3.14) ; // fails because the type of element is int

You can change the data type of non-primitive, as in the following example:

list.addElemDataObject(aStruct) ; // add a structure is to element 1

list.setElemDataObject (1, array) ; // change to array succeeds



Working with Servlet Samples



The following procedures are required to execute a PeopleSoft transaction from a servlet:


Acquiring the UIF Runtime Object and Mapping it to the Connector

The runtime object is the entry point into UIF. It is both the object factory and the point for creating other objects. Following is an example of how to acquire a runtime object. Code Example 3-1 Acquiring the UIF Runtime Object

private IBSPRuntime getRuntime()

{

   com.kivasoft.IContext _ctx =

   ((com.netscape.server.servlet.platformhttp.PlatformServletContext)

      getServletContext()).getContext();

   IBSPRuntime ibspruntime = access_cBSPRuntime.getcBSPRuntime
         (_ctx, null, null);

   return ibspruntime;   

}



Creating the Service Provider Object

The service provider is the logical representation of a connection to a backend system. Typically, the service provider is not bound to a physical connection until it is absolutely necessary. A service provider must be enabled before you can use it.

A service-provider type represents a connection to a backend PeopleSoft system. It contains configuration information such as the kinds of data required to create a connection, like, host, port, username, and password. A service provider type may also specify additional information it requires to manage a connection. The following diagram shows the fields of a service provider template

.

Figure 3-4    Service Provider Types

Following is a code sample that illustrates how to create a service provider object.

Code Example 3-2 Creating the Service Provider Object

private IBSPServiceProvider getServiceProvider(IBSPRuntime runtime)

{

   deb.println("Before createServiceProvider()");

   if (runtime != null)

      

   else

      deb.println("runtime is null");

   return null;

}


Note that in the following code line from the example,

return runtime.createServiceProvider("PSFT", "connection");

the first parameter, PSFT, is the data source name and the second parameter, connection, is the service provider name.


Creating a Function Object

A function object is a group of related operations that share a common state. In the PeopleSoft connector, a function object must be set up and associated with a service provider before you can use the function object.

A function item type represents the logical business functions that are available on a data source like, a stored procedure, a prepared query for a relational database data source, or a transaction in a PeopleSoft system. A function object type defines one or more operations on a transaction. Each operation represents an action you can execute on the backend system. The function object type specifies the service provider type it requires for execution.

The following diagram shows the parts of a function object type.



Figure 3-5    Function Object Type

The following is a code example of how to create a function object. Code Example 3-3 Creating a Function Object

IBSPFunctionObject fn = null;

...

if(   runtime != null )

{

   deb.println("Before getServiceProvider()");

   sp = getServiceProvider(runtime);

   deb.println("After getServiceProvider()");

   if( sp != null )

   {

      deb.println("Before createFunctionObject()");

      fn = runtime.createFunctionObject("PSFT", "UpdateEmployeeDetails.DisplayEmployeeDetails.SearchDialog"));

   }

}


Note that in the following code line from the example,

fn = runtime.createFunctionObject("PSFT", "UpdateEmployeeDetails.DisplayEmployeeDetails.SearchDialog")

the first parameter, PSFT, is the data source name and the parameter, "UpdateEmployeeDetails.DisplayEmployeeDetails.SearchDialog", is the service provider name.


Running a Function Object

You must perform the following steps to use a function object:

  • Specify and enable the service provider.

  • Initialize the function object by creating the property set and input parameters.

  • Execute the function object.

  • Retrieve the output parameters.

  • Disable the service provider.

The following code sample illustrates these steps.     Code Example 3-4 Setting Up and Running a Function Object

public void execute () throws Exception , BspException

   {

      IBSPFunctionObject fn = null;

      IBSPDataObject data = null, prop = null;

IBSPServiceProvider sp =null;

    int hr = 1;

try

{

      IBSPRuntime runtime = getRuntime();

      if(   runtime != null )

      {

         sp = getServiceProvider(runtime);

         if( sp != null )

         {

            fn = runtime.createFunctionObject("PSFT", "UpdateEmployeeDetails.DisplayEmployeeDetails.SearchDialog");

            hr = sp.enable();

            if(hr!=0)

               return;

            if( fn != null )

            {

               hr = fn.useServiceProvider(sp);

               if(hr!=0)

                  return;

               hr = fn.prepare("Execute");

               if(hr!=0)

                  return;

               data = fn.getDataBlock();

               if( data != null )

                  setInputData(data);

               prop = fn.getProperties();

               if( prop != null )

                  setInputProperties(prop);

               hr = fn.execute();

               if( hr == 0 )

               {

                  data = fn.getDataBlock();

                  if(data != null )

                     getOutputData(data);

                  prop = fn.getProperties();

                  if(prop != null)

                     getOutputProperties(prop);

               } // if(hr == 0)

               else

                   deb.println("Execute Failed");

            } // if(fn != null)

            else

               deb.println("Create function object Failed");

         } // if( sp != null )

         else

            deb.println("Create service provider Failed");

         hr = sp.disable();

      }

      else

         deb.println("Create runtime Failed");

}

catch(BspException BspError)

{

if(sp!=null)

{

hr = sp.disable();

}

throw (BspError);

}

catch(Exception ex)

{

if(sp!=null)

{

hr = sp.disable();

}

throw (ex);

}

      return;

   }

   public void setInputData(IBSPDataObject data) throws BspException

   {

      data.setAttrFString("INPUT.EMPLID",EMPLID);

      data.setAttrFString("INPUT.NAME",NAME);

      data.setAttrFString("INPUT.LAST_NAME_SRCH",LAST_NAME_SRCH);

      data.setAttrFString("INPUT.SETID_DEPT",SETID_DEPT);

      data.setAttrFString("INPUT.DEPTID",DEPTID);

      data.setAttrFString("INPUT.NAME_AC",NAME_AC);

   }

   public void getOutputData(IBSPDataObject data) throws BspException

   {

IBSPDataObjectArray outputArray=(IBSPDataObjectArray )(data.getAttrDataObject("OUTPUT.PERSON_SRCH"));

int PERSON_SRCH_length=outputArray.getAttrCount();

PERSON_SRCH=new cPERSON_SRCH [PERSON_SRCH_length];

for(int i=0;i<PERSON_SRCH_length;i++)

       {

deb.println("before get element"+i);

PERSON_SRCH[i].EMPLID = data.getAttrFString("OUTPUT.PERSON_SRCH.["+i+"].EMPLID");

      PERSON_SRCH[i].EMPL_RCD = data.getAttrInt("OUTPUT.PERSON_SRCH.["+i+"].EMPL_RCD");

      PERSON_SRCH[i].NAME = data.getAttrFString("OUTPUT.PERSON_SRCH.["+i+"].NAME");

      PERSON_SRCH[i].LAST_NAME_SRCH = data.getAttrFString("OUTPUT.PERSON_SRCH.["+i+"].LAST_NAME_SRCH");

      PERSON_SRCH[i].SETID_DEPT = data.getAttrFString("OUTPUT.PERSON_SRCH.["+i+"].SETID_DEPT");

      PERSON_SRCH[i].DEPTID = data.getAttrFString("OUTPUT.PERSON_SRCH.["+i+"].DEPTID");

      PERSON_SRCH[i].NAME_AC = data.getAttrFString("OUTPUT.PERSON_SRCH.["+i+"].NAME_AC");

deb.println("after get element"+i);

       }

   }

   public void setInputProperties(IBSPDataObject prop) throws BspException

   {

   prop.setAttrFString("ProcessingMessages.ACTIVITY",ACTIVITY);

   prop.setAttrFString("ProcessingMessages.MsgDefinition",MsgDefinition);

   prop.setAttrInt("ProcessingMessages.MAXRECORDS",MAXRECORDS);

   prop.setAttrInt("ProcessingMessages.OperationType",OperationType);

   }

   public void getOutputProperties(IBSPDataObject prop) throws BspException

   {

      ACTIVITY = prop.getAttrFString("ProcessingMessages.ACTIVITY");

      MsgDefinition = prop.getAttrFString("ProcessingMessages.MsgDefinition");

      MAXRECORDS = prop.getAttrInt("ProcessingMessages.MAXRECORDS");

      OperationType = prop.getAttrInt("ProcessingMessages.OperationType");

   }




Employee Details Sample



The Employee Details Sample consists of PeopleSoft programs that access Oracle databases. You can run this sample on the Windows NT or Sun Solaris platforms. However, before you run the samples that come with the PeopleSoft Enterprise Connector, you must build the message definition, described in Building Message Definitions.


To run the Employee Details Sample on NT

  • From the Start menu, select Programs > iPlanet Application Server 6.0 > PEOPLESOFT Connector -Start Worker Process.


To run the Employee Details Sample on Solaris

  1. From <iPlanet Install directory>/ias/APPS/bin, type:

    startpsftworker.sh start

  2. Press Enter.

    The PSFT Employee Details Samples appears, showing links to the ProcessMsg and SearchDialog samples.

  3. Click on: To Start The ProcessMsg Demo link

    The Employee Details samples opening screen appears.


The ProcessMsg Demo

  1. To start the demo click on the link: To Start The ProcessMsg Demo.

  2. Type in the information in the text fields and click on Execute.

  3. After the data finishes processing the ProcessMsg End Form appears.


To Start the SearchDialog Demo

Click on the To Start The SearchDialog Demo link.

The SearchDialog Demo form appears. .



Code Samples

Following are the code listings for the Process Message and Search Dialog samples.

Code Example 3-5 Process Message Code Listing


package ProcessMsg;

import java.io.*;

import java.util.*;

import javax.naming.*;

import netscape.bsp.*;

import netscape.bsp.runtime.*;

import netscape.bsp.dataobject.*;

public class Execute

{

   private TestDebug deb = new TestDebug("Execute");

   public com.kivasoft.IContext _ctx=null;

   //SELECTED OPERATION

   public String DataSourceName="";

   public String FunctionName="";

   public String ServiceProviderName="";

   public String OperationName="";

public String PropertiesPath="";

   //DATA

   public class cINPUT

   {

      public String EmplId = null;

      public String OperClass = null;

   }

   public cINPUT INPUT=new cINPUT();

   public class cOUTPUT

   {

      public Integer EmplRcd = null;

      public String NationalIdType = null;

      public String AccessCode = null;

      public String Name = null;

      public String LastName = null;

      public String ACName = null;

      public String DepartmentSetid = null;

      public String Department = null;

      public String NidType = null;

      public String NidShortDescription = null;

      public String NationalId = null;

   }

   public cOUTPUT OUTPUT=new cOUTPUT();

   public class cPropertySet

   {

      public class cProcessingMessages

      {

         public String ACTIVITY = null;

         public String MsgDefinition = null;

         public Integer MAXRECORDS = null;

         public Integer OperationType = null;

         public String RecordName = null;

      }

      public cProcessingMessages ProcessingMessages=new cProcessingMessages();

   }

   public cPropertySet PropertySet=new cPropertySet();

   public Execute(String path) throws Exception,BspException

   {

      //read properties file

PropertiesPath=path;

      FileInputStream propertiesFile=new FileInputStream(PropertiesPath+"//ProcessMsg//Execute.properties");

      Properties properties=new Properties();

      properties.load(propertiesFile);

      FunctionName= properties.getProperty("FunctionName");

      deb.println("FunctionName="+FunctionName);

      OperationName= properties.getProperty("OperationName");

      deb.println("OperationName="+OperationName);

      String LocalServiceProviderName= properties.getProperty("LocalServiceProviderName");

      deb.println("LocalServiceProviderName="+LocalServiceProviderName);

      FileInputStream sp_propertiesFile=new FileInputStream(PropertiesPath+"//"+LocalServiceProviderName+".properties");

      Properties sp_properties=new Properties();

      sp_properties.load(sp_propertiesFile);

      DataSourceName= sp_properties.getProperty("DataSourceName");

      deb.println("DataSourceName="+DataSourceName);

      ServiceProviderName= sp_properties.getProperty("ServiceProviderName");

      deb.println("ServiceProviderName="+ServiceProviderName);

   }

   private IBSPRuntime getRuntime() throws BspException

   {

      deb.println(" before access_cBSPRuntime.getcBSPRuntime ");

      IBSPRuntime ibspruntime = access_cBSPRuntime.getcBSPRuntime(_ctx, null, null);

      deb.println(" after access_cBSPRuntime.getcBSPRuntime ");

      return ibspruntime;

   }

   private IBSPServiceProvider getServiceProvider(IBSPRuntime runtime) throws BspException

   {

      deb.println("Before createServiceProvider()");

      if (runtime != null)

         return runtime.createServiceProvider(DataSourceName, ServiceProviderName);

      else

         deb.println("runtime is null");

      return null;

   }

   public void execute () throws Exception, BspException

   {

      IBSPFunctionObject fn = null;

      IBSPDataObject data = null, prop = null;

IBSPServiceProvider sp =null;

    int hr = 1;

try

{

      deb.println("Before sendRequest ");

      deb.println(" Before getRuntime()");

      IBSPRuntime runtime = getRuntime();

      deb.println("After getRuntime()");

      if(   runtime != null )

      {

         deb.println("Before getServiceProvider()");

         sp = getServiceProvider(runtime);

         deb.println("After getServiceProvider()");

         if( sp != null )

         {

            deb.println("Before createFunctionObject()");

            fn = runtime.createFunctionObject(DataSourceName, FunctionName);

            deb.println("After createFunctionObject()");

            hr = sp.enable();

            deb.println("After enable(), hr = "+hr);

            if(hr!=0)

               return;

            deb.println("After enable(), hr = "+hr);

            if( fn != null )

            {

               hr = fn.useServiceProvider(sp);

               deb.println("After useServiceProvider(), hr = "+hr);

               if(hr!=0)

                  return;

               hr = fn.prepare(OperationName);

               deb.println("After prepare(), hr = "+hr);

               if(hr!=0)

                  return;

               data = fn.getDataBlock();

               deb.println("After getDataBlock()");

               if( data != null )

                  setInputData(data);

               prop = fn.getProperties();

               deb.println("After getProperties()");

               if( prop != null )

                  setInputProperties(prop);

               deb.println("Before execute()");

               hr = fn.execute();

               deb.println("After execute(), hr = "+hr);

               if( hr == 0 )

               {

                  data = fn.getDataBlock();

                  deb.println("After getDataBlock()");

                  if(data != null )

                     getOutputData(data);

                  prop = fn.getProperties();

                  deb.println("After getProperties()");

                  if(prop != null)

                     getOutputProperties(prop);

               } // if(hr == 0)

               else

                   deb.println("Execute Failed");

            } // if(fn != null)

            else

               deb.println("Create function object Failed");

         } // if( sp != null )

         else

            deb.println("Create service provider Failed");

         hr = sp.disable();

         deb.println("After disable(), hr = "+hr);

      }

      else

         deb.println("Create runtime Failed");

      deb.println("after sendRequest ");

}

catch(BspException BspError)

{

if(sp!=null)

{

hr = sp.disable();

          deb.println("After disable(), hr = "+hr);

}

throw (BspError);

}

catch(Exception ex)

{

if(sp!=null)

{

hr = sp.disable();

          deb.println("After disable(), hr = "+hr);

}

throw (ex);

}

      return;

   }

   public void setInputData(IBSPDataObject data) throws BspException

   {

      if(INPUT.EmplId != null)

         data.setAttrFString("INPUT.EmplId",INPUT.EmplId);

      if(INPUT.OperClass != null)

         data.setAttrFString("INPUT.OperClass",INPUT.OperClass);

   }

   public void getOutputData(IBSPDataObject data) throws BspException

   {

      OUTPUT.EmplRcd = new Integer(data.getAttrInt("OUTPUT.EmplRcd"));

      OUTPUT.NationalIdType = data.getAttrFString("OUTPUT.NationalIdType");

      OUTPUT.AccessCode = data.getAttrFString("OUTPUT.AccessCode");

      OUTPUT.Name = data.getAttrFString("OUTPUT.Name");

      OUTPUT.LastName = data.getAttrFString("OUTPUT.LastName");

      OUTPUT.ACName = data.getAttrFString("OUTPUT.ACName");

      OUTPUT.DepartmentSetid = data.getAttrFString("OUTPUT.DepartmentSetid");

      OUTPUT.Department = data.getAttrFString("OUTPUT.Department");

      OUTPUT.NidType = data.getAttrFString("OUTPUT.NidType");

      OUTPUT.NidShortDescription = data.getAttrFString("OUTPUT.NidShortDescription");

      OUTPUT.NationalId = data.getAttrFString("OUTPUT.NationalId");

   }

   public void setInputProperties(IBSPDataObject prop) throws BspException

   {

      if(PropertySet.ProcessingMessages.ACTIVITY != null)

          prop.setAttrFString("ProcessingMessages.ACTIVITY",PropertySet.ProcessingMessag es.ACTIVITY);

      if(PropertySet.ProcessingMessages.MsgDefinition != null)

          prop.setAttrFString("ProcessingMessages.MsgDefinition",PropertySet.ProcessingM essages.MsgDefinition);

      if(PropertySet.ProcessingMessages.MAXRECORDS != null)

          prop.setAttrInt("ProcessingMessages.MAXRECORDS",PropertySet.ProcessingMessages .MAXRECORDS.intValue());

      if(PropertySet.ProcessingMessages.OperationType != null)

          prop.setAttrInt("ProcessingMessages.OperationType",PropertySet.ProcessingMessa ges.OperationType.intValue());

      if(PropertySet.ProcessingMessages.RecordName != null)

          prop.setAttrFString("ProcessingMessages.RecordName",PropertySet.ProcessingMess ages.RecordName);

   }

   public void getOutputProperties(IBSPDataObject prop) throws BspException

   {

      PropertySet.ProcessingMessages.ACTIVITY = prop.getAttrFString("ProcessingMessages.ACTIVITY");

      PropertySet.ProcessingMessages.MsgDefinition = prop.getAttrFString("ProcessingMessages.MsgDefinition");

      PropertySet.ProcessingMessages.MAXRECORDS = new Integer(prop.getAttrInt("ProcessingMessages.MAXRECORDS"));

      PropertySet.ProcessingMessages.OperationType = new Integer(prop.getAttrInt("ProcessingMessages.OperationType"));

      PropertySet.ProcessingMessages.RecordName = prop.getAttrFString("ProcessingMessages.RecordName");

   }

}


Code Example 3-6 Process Message Main.Java



package ProcessMsg;

import java.util.*;

import javax.servlet.http.*;

import java.io.*;

import javax.servlet.*;

import javax.naming.*;

import netscape.bsp.*;

public class main extends HttpServlet

{

   private TestDebug deb = new TestDebug("ProcessMsg");

   protected String getInputString(HttpServletRequest   request, String parameterName)

   {

      // This method is useful since getValString returns null on

      // some platforms and an empty string on other platforms for

      // missing input parameters.   It also removes any whitespace

      // characters that the user my have inadvertantly entered.

      String parameter = request.getParameter(parameterName);

      if (parameter != null)

      {

         parameter = parameter.trim();

      }

      else

         deb.println("parameter "+ parameterName+" is null");

      return parameter;

   }

   public void doGet (

    HttpServletRequest   request,

    HttpServletResponse   response ) throws ServletException, IOException

   {

RequestDispatcher dispatcher=null;

      try{

       String value;

//read properties path

com.kivasoft.IContext _ctx=((com.netscape.server.servlet.platformhttp.PlatformServletContext)getServ letContext()).getContext();

String PropertiesPath=com.kivasoft.util.GX.GDSGetKeyValueString(com.kivasoft.util.GX. GDSRoot(_ctx),

null, "AppPath", null);

deb.println("PropertiesPath="+PropertiesPath);

       Execute obj_Execute=new Execute(PropertiesPath);

       deb.println("after create obj_Execute");

       obj_Execute.INPUT.EmplId = new String(getInputString(request,"INPUT.EmplId"));

       obj_Execute.INPUT.OperClass = new String(getInputString(request,"INPUT.OperClass"));

       deb.println("after set obj_Execute input");

       FileInputStream propertiesFile=new FileInputStream(PropertiesPath+"//ProcessMsg//Execute_properties.properties");

       Properties properties=new Properties();

       properties.load(propertiesFile);

       value= properties.getProperty("PropertySet.ProcessingMessages.ACTIVITY").trim();

       if(value!=null && value.length()>0)

       obj_Execute.PropertySet.ProcessingMessages.ACTIVITY=value;

       value= properties.getProperty("PropertySet.ProcessingMessages.MsgDefinition").trim();

       if(value!=null && value.length()>0)

       obj_Execute.PropertySet.ProcessingMessages.MsgDefinition=value;

       value= properties.getProperty("PropertySet.ProcessingMessages.MAXRECORDS").trim();

       if(value!=null && value.length()>0)

       obj_Execute.PropertySet.ProcessingMessages.MAXRECORDS=new Integer(value);

       value= properties.getProperty("PropertySet.ProcessingMessages.OperationType").trim();

       if(value!=null && value.length()>0)

       obj_Execute.PropertySet.ProcessingMessages.OperationType=new Integer(value);

       value= properties.getProperty("PropertySet.ProcessingMessages.RecordName").trim();

       if(value!=null && value.length()>0)

       obj_Execute.PropertySet.ProcessingMessages.RecordName=value;

       deb.println("after set obj_Execute properties");

       obj_Execute._ctx=_ctx;

       deb.println("Before sendRequest ");

       obj_Execute.execute();

       deb.println("After sendRequest ");

response.setContentType("text/html");

       dispatcher = getServletContext().getRequestDispatcher("/jsp/endForm.jsp");

       request.setAttribute("OUTPUT.EmplRcd",obj_Execute.OUTPUT.EmplRcd);

       request.setAttribute("OUTPUT.NationalIdType",obj_Execute.OUTPUT.NationalIdType );

       request.setAttribute("OUTPUT.AccessCode",obj_Execute.OUTPUT.AccessCode);

       request.setAttribute("OUTPUT.Name",obj_Execute.OUTPUT.Name);

       request.setAttribute("OUTPUT.LastName",obj_Execute.OUTPUT.LastName);

       request.setAttribute("OUTPUT.ACName",obj_Execute.OUTPUT.ACName);

       request.setAttribute("OUTPUT.DepartmentSetid",obj_Execute.OUTPUT.DepartmentSet id);

       request.setAttribute("OUTPUT.Department",obj_Execute.OUTPUT.Department);

       request.setAttribute("OUTPUT.NidType",obj_Execute.OUTPUT.NidType);

       request.setAttribute("OUTPUT.NidShortDescription",obj_Execute.OUTPUT.NidShortD escription);

       request.setAttribute("OUTPUT.NationalId",obj_Execute.OUTPUT.NationalId);

       deb.println("after get obj_Execute output");

      }//try.

       catch(BspException BspError)

    {

    deb.println("BspException:"+BspError.getMessage());

response.setContentType("text/html");

    dispatcher = getServletContext().getRequestDispatcher("/jsp/ExceptionForm.jsp");

    request.setAttribute("BspException",BspError.getMessage());

    }

catch(Exception exception)

    {

    deb.println("Exception:"+exception.toString());

response.setContentType("text/html");

    dispatcher = getServletContext().getRequestDispatcher("/jsp/ExceptionForm.jsp");

    request.setAttribute("Exception",exception.toString());

    }

    dispatcher.include(request, response);

deb.println("8. before return ");

return;

   }//doGet.

}//main




Code Example 3-7 SearchDialog Execute.Java



package SearchDialog;

import java.io.*;

import java.util.*;

import javax.naming.*;

import netscape.bsp.*;

import netscape.bsp.runtime.*;

import netscape.bsp.dataobject.*;

public class Execute

{

   private TestDebug deb = new TestDebug("Execute");

   public com.kivasoft.IContext _ctx=null;

   //SELECTED OPERATION

   public String DataSourceName="";

   public String FunctionName="";

   public String ServiceProviderName="";

   public String OperationName="";

public String PropertiesPath="";

   //DATA

   public class cINPUT

   {

      public String EMPLID = null;

      public String NAME = null;

      public String LAST_NAME_SRCH = null;

      public String SETID_DEPT = null;

      public String DEPTID = null;

      public String NAME_AC = null;

   }

   public cINPUT INPUT=new cINPUT();

   public class cOUTPUT

   {

      public class cPERSON_SRCH

      {

         public String EMPLID = null;

         public Integer EMPL_RCD = null;

         public String NAME = null;

         public String LAST_NAME_SRCH = null;

         public String SETID_DEPT = null;

         public String DEPTID = null;

         public String NAME_AC = null;

      }

      public cPERSON_SRCH[] PERSON_SRCH=null;

public void add_PERSON_SRCH_elements(int attrCount)

{

PERSON_SRCH=new cPERSON_SRCH[attrCount];

for(int i=0;i<attrCount;i++)

PERSON_SRCH[i]=new cPERSON_SRCH();

}

   }

   public cOUTPUT OUTPUT=new cOUTPUT();

   public class cPropertySet

   {

      public class cProcessingMessages

      {

         public String ACTIVITY = null;

         public String MsgDefinition = null;

         public Integer MAXRECORDS = null;

         public Integer OperationType = null;

         public String RecordName = null;

      }

      public cProcessingMessages ProcessingMessages=new cProcessingMessages();

   }

   public cPropertySet PropertySet=new cPropertySet();

   public Execute(String path) throws Exception , BspException

   {

      //read properties file

PropertiesPath=path;

      FileInputStream propertiesFile=new FileInputStream(PropertiesPath+"//SearchDialog//Execute.properties");

      Properties properties=new Properties();

      properties.load(propertiesFile);

      FunctionName= properties.getProperty("FunctionName");

      deb.println("FunctionName="+FunctionName);

      OperationName= properties.getProperty("OperationName");

      deb.println("OperationName="+OperationName);

      String LocalServiceProviderName= properties.getProperty("LocalServiceProviderName");

      deb.println("LocalServiceProviderName="+LocalServiceProviderName);

      FileInputStream sp_propertiesFile=new FileInputStream(PropertiesPath+"//"+LocalServiceProviderName+".properties");

      Properties sp_properties=new Properties();

      sp_properties.load(sp_propertiesFile);

      DataSourceName= sp_properties.getProperty("DataSourceName");

      deb.println("DataSourceName="+DataSourceName);

      ServiceProviderName= sp_properties.getProperty("ServiceProviderName");

      deb.println("ServiceProviderName="+ServiceProviderName);

   }

   private IBSPRuntime getRuntime() throws BspException

   {

      deb.println(" before access_cBSPRuntime.getcBSPRuntime ");

      IBSPRuntime ibspruntime = access_cBSPRuntime.getcBSPRuntime(_ctx, null, null);

      deb.println(" after access_cBSPRuntime.getcBSPRuntime ");

      return ibspruntime;

   }

   private IBSPServiceProvider getServiceProvider(IBSPRuntime runtime) throws BspException

   {

      deb.println("Before createServiceProvider()");

      if (runtime != null)

         return runtime.createServiceProvider(DataSourceName, ServiceProviderName);

      else

         deb.println("runtime is null");

      return null;

   }

   public void execute () throws Exception , BspException

   {

      IBSPFunctionObject fn = null;

      IBSPDataObject data = null, prop = null;

IBSPServiceProvider sp =null;

    int hr = 1;

try

{

      deb.println("Before sendRequest ");

      deb.println(" Before getRuntime()");

      IBSPRuntime runtime = getRuntime();

      deb.println("After getRuntime()");

      if(   runtime != null )

      {

         deb.println("Before getServiceProvider()");

         sp = getServiceProvider(runtime);

         deb.println("After getServiceProvider()");

         if( sp != null )

         {

            deb.println("Before createFunctionObject()");

            fn = runtime.createFunctionObject(DataSourceName, FunctionName);

            deb.println("After createFunctionObject()");

            hr = sp.enable();

            deb.println("After enable(), hr = "+hr);

            if(hr!=0)

               return;

            deb.println("After enable(), hr = "+hr);

            if( fn != null )

            {

               hr = fn.useServiceProvider(sp);

               deb.println("After useServiceProvider(), hr = "+hr);

               if(hr!=0)

                  return;

               hr = fn.prepare(OperationName);

               deb.println("After prepare(), hr = "+hr);

               if(hr!=0)

                  return;

               data = fn.getDataBlock();

               deb.println("After getDataBlock()");

               if( data != null )

                  setInputData(data);

               prop = fn.getProperties();

               deb.println("After getProperties()");

               if( prop != null )

                  setInputProperties(prop);

               deb.println("Before execute()");

               hr = fn.execute();

               deb.println("After execute(), hr = "+hr);

               if( hr == 0 )

               {

                  data = fn.getDataBlock();

                  deb.println("After getDataBlock()");

                  if(data != null )

                     getOutputData(data);

                  prop = fn.getProperties();

                  deb.println("After getProperties()");

                  if(prop != null)

                     getOutputProperties(prop);

               } // if(hr == 0)

               else

                   deb.println("Execute Failed");

            } // if(fn != null)

            else

               deb.println("Create function object Failed");

         } // if( sp != null )

         else

            deb.println("Create service provider Failed");

         hr = sp.disable();

         deb.println("After disable(), hr = "+hr);

      }

      else

         deb.println("Create runtime Failed");

      deb.println("after sendRequest ");

}

catch(BspException BspError)

{

if(sp!=null)

{

hr = sp.disable();

          deb.println("After disable(), hr = "+hr);

}

throw (BspError);

}

catch(Exception ex)

{

if(sp!=null)

{

hr = sp.disable();

          deb.println("After disable(), hr = "+hr);

}

throw (ex);

}

      return;

   }

   public void setInputData(IBSPDataObject data) throws BspException

   {

      if(INPUT.EMPLID != null)

         data.setAttrFString("INPUT.EMPLID",INPUT.EMPLID);

      if(INPUT.NAME != null)

         data.setAttrFString("INPUT.NAME",INPUT.NAME);

      if(INPUT.LAST_NAME_SRCH != null)

         data.setAttrFString("INPUT.LAST_NAME_SRCH",INPUT.LAST_NAME_SRCH);

      if(INPUT.SETID_DEPT != null)

         data.setAttrFString("INPUT.SETID_DEPT",INPUT.SETID_DEPT);

      if(INPUT.DEPTID != null)

         data.setAttrFString("INPUT.DEPTID",INPUT.DEPTID);

      if(INPUT.NAME_AC != null)

         data.setAttrFString("INPUT.NAME_AC",INPUT.NAME_AC);

   }

   public void getOutputData(IBSPDataObject data) throws BspException

   {

IBSPDataObjectArray outputArray=(IBSPDataObjectArray )(data.getAttrDataObject("OUTPUT.PERSON_SRCH"));

int attrCount=outputArray.getAttrCount();

OUTPUT.add_PERSON_SRCH_elements(attrCount);

       for(int i=0;i<attrCount;i++)

       {

deb.println("before get element"+i);

OUTPUT.PERSON_SRCH[i].EMPLID = data.getAttrFString("OUTPUT.PERSON_SRCH.["+i+"].EMPLID");

      OUTPUT.PERSON_SRCH[i].EMPL_RCD = new Integer(data.getAttrInt("OUTPUT.PERSON_SRCH.["+i+"].EMPL_RCD"));

      OUTPUT.PERSON_SRCH[i].NAME = data.getAttrFString("OUTPUT.PERSON_SRCH.["+i+"].NAME");

      OUTPUT.PERSON_SRCH[i].LAST_NAME_SRCH = data.getAttrFString("OUTPUT.PERSON_SRCH.["+i+"].LAST_NAME_SRCH");

      OUTPUT.PERSON_SRCH[i].SETID_DEPT = data.getAttrFString("OUTPUT.PERSON_SRCH.["+i+"].SETID_DEPT");

      OUTPUT.PERSON_SRCH[i].DEPTID = data.getAttrFString("OUTPUT.PERSON_SRCH.["+i+"].DEPTID");

      OUTPUT.PERSON_SRCH[i].NAME_AC = data.getAttrFString("OUTPUT.PERSON_SRCH.["+i+"].NAME_AC");

deb.println("after get element"+i);

       }

   }

   public void setInputProperties(IBSPDataObject prop) throws BspException

   {

      if(PropertySet.ProcessingMessages.ACTIVITY != null)

          prop.setAttrFString("ProcessingMessages.ACTIVITY",PropertySet.ProcessingMessag es.ACTIVITY);

      if(PropertySet.ProcessingMessages.MsgDefinition != null)

          prop.setAttrFString("ProcessingMessages.MsgDefinition",PropertySet.ProcessingM essages.MsgDefinition);

      if(PropertySet.ProcessingMessages.MAXRECORDS != null)

          prop.setAttrInt("ProcessingMessages.MAXRECORDS",PropertySet.ProcessingMessages .MAXRECORDS.intValue());

      if(PropertySet.ProcessingMessages.OperationType != null)

          prop.setAttrInt("ProcessingMessages.OperationType",PropertySet.ProcessingMessa ges.OperationType.intValue());

      if(PropertySet.ProcessingMessages.RecordName != null)

          prop.setAttrFString("ProcessingMessages.RecordName",PropertySet.ProcessingMess ages.RecordName);

   }

   public void getOutputProperties(IBSPDataObject prop) throws BspException

   {

      PropertySet.ProcessingMessages.ACTIVITY = prop.getAttrFString("ProcessingMessages.ACTIVITY");

      PropertySet.ProcessingMessages.MsgDefinition = prop.getAttrFString("ProcessingMessages.MsgDefinition");

      PropertySet.ProcessingMessages.MAXRECORDS = new Integer(prop.getAttrInt("ProcessingMessages.MAXRECORDS"));

      PropertySet.ProcessingMessages.OperationType = new Integer(prop.getAttrInt("ProcessingMessages.OperationType"));

      PropertySet.ProcessingMessages.RecordName = prop.getAttrFString("ProcessingMessages.RecordName");

   }

}





Search Dialog Demo Code Examples"> Code Example 3-7 SearchDialog Execute.Java


package SearchDialog;

import java.io.*;

import java.util.*;

import javax.naming.*;

import netscape.bsp.*;

import netscape.bsp.runtime.*;

import netscape.bsp.dataobject.*;

public class Execute

{

   private TestDebug deb = new TestDebug("Execute");

   public com.kivasoft.IContext _ctx=null;

   //SELECTED OPERATION

   public String DataSourceName="";

   public String FunctionName="";

   public String ServiceProviderName="";

   public String OperationName="";

public String PropertiesPath="";

   //DATA

   public class cINPUT

   {

      public String EMPLID = null;

      public String NAME = null;

      public String LAST_NAME_SRCH = null;

      public String SETID_DEPT = null;

      public String DEPTID = null;

      public String NAME_AC = null;

   }

   public cINPUT INPUT=new cINPUT();

   public class cOUTPUT

   {

      public class cPERSON_SRCH

      {

         public String EMPLID = null;

         public Integer EMPL_RCD = null;

         public String NAME = null;

         public String LAST_NAME_SRCH = null;

         public String SETID_DEPT = null;

         public String DEPTID = null;

         public String NAME_AC = null;

      }

      public cPERSON_SRCH[] PERSON_SRCH=null;

public void add_PERSON_SRCH_elements(int attrCount)

{

PERSON_SRCH=new cPERSON_SRCH[attrCount];

for(int i=0;i<attrCount;i++)

PERSON_SRCH[i]=new cPERSON_SRCH();

}

   }

   public cOUTPUT OUTPUT=new cOUTPUT();

   public class cPropertySet

   {

      public class cProcessingMessages

      {

         public String ACTIVITY = null;

         public String MsgDefinition = null;

         public Integer MAXRECORDS = null;

         public Integer OperationType = null;

         public String RecordName = null;

      }

      public cProcessingMessages ProcessingMessages=new cProcessingMessages();

   }

   public cPropertySet PropertySet=new cPropertySet();

   public Execute(String path) throws Exception , BspException

   {

      //read properties file

PropertiesPath=path;

      FileInputStream propertiesFile=new FileInputStream(PropertiesPath+"//SearchDialog//Execute.properties");

      Properties properties=new Properties();

      properties.load(propertiesFile);

      FunctionName= properties.getProperty("FunctionName");

      deb.println("FunctionName="+FunctionName);

      OperationName= properties.getProperty("OperationName");

      deb.println("OperationName="+OperationName);

      String LocalServiceProviderName= properties.getProperty("LocalServiceProviderName");

      deb.println("LocalServiceProviderName="+LocalServiceProviderName);

      FileInputStream sp_propertiesFile=new FileInputStream(PropertiesPath+"//"+LocalServiceProviderName+".properties");

      Properties sp_properties=new Properties();

      sp_properties.load(sp_propertiesFile);

      DataSourceName= sp_properties.getProperty("DataSourceName");

      deb.println("DataSourceName="+DataSourceName);

      ServiceProviderName= sp_properties.getProperty("ServiceProviderName");

      deb.println("ServiceProviderName="+ServiceProviderName);

   }

   private IBSPRuntime getRuntime() throws BspException

   {

      deb.println(" before access_cBSPRuntime.getcBSPRuntime ");

      IBSPRuntime ibspruntime = access_cBSPRuntime.getcBSPRuntime(_ctx, null, null);

      deb.println(" after access_cBSPRuntime.getcBSPRuntime ");

      return ibspruntime;

   }

   private IBSPServiceProvider getServiceProvider(IBSPRuntime runtime) throws BspException

   {

      deb.println("Before createServiceProvider()");

      if (runtime != null)

         return runtime.createServiceProvider(DataSourceName, ServiceProviderName);

      else

         deb.println("runtime is null");

      return null;

   }

   public void execute () throws Exception , BspException

   {

      IBSPFunctionObject fn = null;

      IBSPDataObject data = null, prop = null;

IBSPServiceProvider sp =null;

    int hr = 1;

try

{

      deb.println("Before sendRequest ");

      deb.println(" Before getRuntime()");

      IBSPRuntime runtime = getRuntime();

      deb.println("After getRuntime()");

      if(   runtime != null )

      {

         deb.println("Before getServiceProvider()");

         sp = getServiceProvider(runtime);

         deb.println("After getServiceProvider()");

         if( sp != null )

         {

            deb.println("Before createFunctionObject()");

            fn = runtime.createFunctionObject(DataSourceName, FunctionName);

            deb.println("After createFunctionObject()");

            hr = sp.enable();

            deb.println("After enable(), hr = "+hr);

            if(hr!=0)

               return;

            deb.println("After enable(), hr = "+hr);

            if( fn != null )

            {

               hr = fn.useServiceProvider(sp);

               deb.println("After useServiceProvider(), hr = "+hr);

               if(hr!=0)

                  return;

               hr = fn.prepare(OperationName);

               deb.println("After prepare(), hr = "+hr);

               if(hr!=0)

                  return;

               data = fn.getDataBlock();

               deb.println("After getDataBlock()");

               if( data != null )

                  setInputData(data);

               prop = fn.getProperties();

               deb.println("After getProperties()");

               if( prop != null )

                  setInputProperties(prop);

               deb.println("Before execute()");

               hr = fn.execute();

               deb.println("After execute(), hr = "+hr);

               if( hr == 0 )

               {

                  data = fn.getDataBlock();

                  deb.println("After getDataBlock()");

                  if(data != null )

                     getOutputData(data);

                  prop = fn.getProperties();

                  deb.println("After getProperties()");

                  if(prop != null)

                     getOutputProperties(prop);

               } // if(hr == 0)

               else

                   deb.println("Execute Failed");

            } // if(fn != null)

            else

               deb.println("Create function object Failed");

         } // if( sp != null )

         else

            deb.println("Create service provider Failed");

         hr = sp.disable();

         deb.println("After disable(), hr = "+hr);

      }

      else

         deb.println("Create runtime Failed");

      deb.println("after sendRequest ");

}

catch(BspException BspError)

{

if(sp!=null)

{

hr = sp.disable();

          deb.println("After disable(), hr = "+hr);

}

throw (BspError);

}

catch(Exception ex)

{

if(sp!=null)

{

hr = sp.disable();

          deb.println("After disable(), hr = "+hr);

}

throw (ex);

}

      return;

   }

   public void setInputData(IBSPDataObject data) throws BspException

   {

      if(INPUT.EMPLID != null)

         data.setAttrFString("INPUT.EMPLID",INPUT.EMPLID);

      if(INPUT.NAME != null)

         data.setAttrFString("INPUT.NAME",INPUT.NAME);

      if(INPUT.LAST_NAME_SRCH != null)

         data.setAttrFString("INPUT.LAST_NAME_SRCH",INPUT.LAST_NAME_SRCH);

      if(INPUT.SETID_DEPT != null)

         data.setAttrFString("INPUT.SETID_DEPT",INPUT.SETID_DEPT);

      if(INPUT.DEPTID != null)

         data.setAttrFString("INPUT.DEPTID",INPUT.DEPTID);

      if(INPUT.NAME_AC != null)

         data.setAttrFString("INPUT.NAME_AC",INPUT.NAME_AC);

   }

   public void getOutputData(IBSPDataObject data) throws BspException

   {

IBSPDataObjectArray outputArray=(IBSPDataObjectArray )(data.getAttrDataObject("OUTPUT.PERSON_SRCH"));

int attrCount=outputArray.getAttrCount();

OUTPUT.add_PERSON_SRCH_elements(attrCount);

       for(int i=0;i<attrCount;i++)

       {

deb.println("before get element"+i);

OUTPUT.PERSON_SRCH[i].EMPLID = data.getAttrFString("OUTPUT.PERSON_SRCH.["+i+"].EMPLID");

      OUTPUT.PERSON_SRCH[i].EMPL_RCD = new Integer(data.getAttrInt("OUTPUT.PERSON_SRCH.["+i+"].EMPL_RCD"));

      OUTPUT.PERSON_SRCH[i].NAME = data.getAttrFString("OUTPUT.PERSON_SRCH.["+i+"].NAME");

      OUTPUT.PERSON_SRCH[i].LAST_NAME_SRCH = data.getAttrFString("OUTPUT.PERSON_SRCH.["+i+"].LAST_NAME_SRCH");

      OUTPUT.PERSON_SRCH[i].SETID_DEPT = data.getAttrFString("OUTPUT.PERSON_SRCH.["+i+"].SETID_DEPT");

      OUTPUT.PERSON_SRCH[i].DEPTID = data.getAttrFString("OUTPUT.PERSON_SRCH.["+i+"].DEPTID");

      OUTPUT.PERSON_SRCH[i].NAME_AC = data.getAttrFString("OUTPUT.PERSON_SRCH.["+i+"].NAME_AC");

deb.println("after get element"+i);

       }

   }

   public void setInputProperties(IBSPDataObject prop) throws BspException

   {

      if(PropertySet.ProcessingMessages.ACTIVITY != null)

          prop.setAttrFString("ProcessingMessages.ACTIVITY",PropertySet.ProcessingMessag es.ACTIVITY);

      if(PropertySet.ProcessingMessages.MsgDefinition != null)

          prop.setAttrFString("ProcessingMessages.MsgDefinition",PropertySet.ProcessingM essages.MsgDefinition);

      if(PropertySet.ProcessingMessages.MAXRECORDS != null)

          prop.setAttrInt("ProcessingMessages.MAXRECORDS",PropertySet.ProcessingMessages .MAXRECORDS.intValue());

      if(PropertySet.ProcessingMessages.OperationType != null)

          prop.setAttrInt("ProcessingMessages.OperationType",PropertySet.ProcessingMessa ges.OperationType.intValue());

      if(PropertySet.ProcessingMessages.RecordName != null)

          prop.setAttrFString("ProcessingMessages.RecordName",PropertySet.ProcessingMess ages.RecordName);

   }

   public void getOutputProperties(IBSPDataObject prop) throws BspException

   {

      PropertySet.ProcessingMessages.ACTIVITY = prop.getAttrFString("ProcessingMessages.ACTIVITY");

      PropertySet.ProcessingMessages.MsgDefinition = prop.getAttrFString("ProcessingMessages.MsgDefinition");

      PropertySet.ProcessingMessages.MAXRECORDS = new Integer(prop.getAttrInt("ProcessingMessages.MAXRECORDS"));

      PropertySet.ProcessingMessages.OperationType = new Integer(prop.getAttrInt("ProcessingMessages.OperationType"));

      PropertySet.ProcessingMessages.RecordName = prop.getAttrFString("ProcessingMessages.RecordName");

   }

}





Search Dialog Demo Code Examples


Code Example 3-8 SearchDialog Main.Java



package SearchDialog;

import java.util.*;

import javax.servlet.http.*;

import java.io.*;

import javax.servlet.*;

import javax.naming.*;

import netscape.bsp.*;

public class main extends HttpServlet

{

   private TestDebug deb = new TestDebug("SearchDialog");

   protected String getInputString(HttpServletRequest   request, String parameterName)

   {

      // This method is useful since getValString returns null on

      // some platforms and an empty string on other platforms for

      // missing input parameters.   It also removes any whitespace

      // characters that the user my have inadvertantly entered.

      String parameter = request.getParameter(parameterName);

      if (parameter != null)

      {

         parameter = parameter.trim();

      }

      else

         deb.println("parameter "+ parameterName+" is null");

      return parameter;

   }

   public void doGet (

    HttpServletRequest   request,

    HttpServletResponse   response ) throws ServletException, IOException

   {

RequestDispatcher dispatcher=null;

      try{

       String value;

//read properties path

com.kivasoft.IContext _ctx=((com.netscape.server.servlet.platformhttp.PlatformServletContext)getServ letContext()).getContext();

String PropertiesPath=com.kivasoft.util.GX.GDSGetKeyValueString(com.kivasoft.util.GX. GDSRoot(_ctx),

null, "AppPath", null);

deb.println("PropertiesPath="+PropertiesPath);

//create Execute object

       Execute obj_Execute=new Execute(PropertiesPath);

       deb.println("after create obj_Execute");

       obj_Execute.INPUT.EMPLID = new String(getInputString(request,"INPUT.EMPLID"));

       obj_Execute.INPUT.NAME = new String(getInputString(request,"INPUT.NAME"));

       obj_Execute.INPUT.LAST_NAME_SRCH = new String(getInputString(request,"INPUT.LAST_NAME_SRCH"));

       obj_Execute.INPUT.SETID_DEPT = new String(getInputString(request,"INPUT.SETID_DEPT"));

       obj_Execute.INPUT.DEPTID = new String(getInputString(request,"INPUT.DEPTID"));

       obj_Execute.INPUT.NAME_AC = new String(getInputString(request,"INPUT.NAME_AC"));

       deb.println("after set obj_Execute input");

       FileInputStream propertiesFile=new FileInputStream(PropertiesPath+"//SearchDialog//Execute_properties.properties" );

       Properties properties=new Properties();

       properties.load(propertiesFile);

       value= properties.getProperty("PropertySet.ProcessingMessages.ACTIVITY").trim();

       if(value!=null && value.length()>0)

       obj_Execute.PropertySet.ProcessingMessages.ACTIVITY=value;

       value= properties.getProperty("PropertySet.ProcessingMessages.MsgDefinition").trim();

       if(value!=null && value.length()>0)

       obj_Execute.PropertySet.ProcessingMessages.MsgDefinition=value;

       value= properties.getProperty("PropertySet.ProcessingMessages.MAXRECORDS").trim();

       if(value!=null && value.length()>0)

       obj_Execute.PropertySet.ProcessingMessages.MAXRECORDS=new Integer(value);

       value= properties.getProperty("PropertySet.ProcessingMessages.OperationType").trim();

       if(value!=null && value.length()>0)

       obj_Execute.PropertySet.ProcessingMessages.OperationType=new Integer(value);

       value= properties.getProperty("PropertySet.ProcessingMessages.RecordName").trim();

       if(value!=null && value.length()>0)

       obj_Execute.PropertySet.ProcessingMessages.RecordName=value;

       deb.println("after set obj_Execute properties");

       obj_Execute._ctx=_ctx;

       deb.println("Before sendRequest ");

       obj_Execute.execute();

       deb.println("After sendRequest ");

response.setContentType("text/html");

       dispatcher = getServletContext().getRequestDispatcher("/jsp/endForm.jsp");

request.setAttribute("OUTPUT.PERSON_SRCH",obj_Execute.OUTPUT.PERSON_SRCH);

       deb.println("after get obj_Execute output");

      }//try.

      catch(BspException BspError)

    {

    deb.println("BspException:"+BspError.getMessage());

response.setContentType("text/html");

    dispatcher = getServletContext().getRequestDispatcher("/jsp/ExceptionForm.jsp");

    request.setAttribute("BspException",BspError.getMessage());

    }

    catch(Exception exception)

    {

    deb.println("Exception:"+exception.toString());

response.setContentType("text/html");

    dispatcher = getServletContext().getRequestDispatcher("/jsp/ExceptionForm.jsp");

    request.setAttribute("Exception",exception.toString());

    }

    dispatcher.include(request, response);

deb.println("8. before return ");

return;

   }//doGet.

}//main






Building Message Definitions



Message Definitions are the metadata, which describe the format of data associated with a particular PeopleSoft panel. This section includes procedures for building your own message definitions. Follow these to create the message definition that you must use to run the sample that is provided with the Peoplesoft Enterprise Connector.

For more information on PeopleSoft application development, go to the PeopleSoft web site at:

http://www.peoplesoft.com/en/tools_technology/index.html

You build message definitions by using the following procedures:


To create a project

  1. Select Start > Programs > PeopleSoft 7.5 > Application Designer.

    The PeopleSoft Signon screen appears.

  2. Type in your Operator ID and Password and click on the OK button.

    The PeopleSoft Application Designer window appears.

  3. Select File > New.

  4. From the New dialog, select Project and click OK.


To select project options

  1. Select Tool > Options.

    The Options dialog box appears. .

  2. Select When Object is modified and saved from the Insert Object into Project radio button group.

  3. Select Do not insert related objects with current object radio button from the Related Objects Options radio button group.

  4. Click the OK button to save these options.


To define a new employee record field

You must include the new field, EMPL_RCD, to run the samples.

  1. Select File > Open > Field.

  2. Click the OK button.

    The New Field drop-down list box appears.

    .

  3. Select Number from the drop-down list and click OK.

  4. Type:

    • Employee Record in the Long Name field.

    • EmplRcd in the Short Name field.

  5. Dismiss the dialog box.

  6. Select File > Save As and type EMPL_RCD in the Save Name As field of the dialog box. .

  7. Click OK to save the new field.

  8. Select File > Save Project As.

  9. Type DEMO_PROJECT in the Save Name As text box and then click OK.


To add existing fields to your project

  1. Select File > Open > Field.

  2. Type EMPLID into the Name text field.

  3. Click on Select.

    A list of all fields that start with that prefix appear. If there is only one field with the prefix, the field definition dialog box opens.

  4. Double-click a field to open the field definition dialog box.

  5. Press <F7> to insert the currently selected object into the project.

  6. Select each of the following fields to insert into the project.

    • EMPLID

    • EMPL_RCD

    • OPRCLASS

    • ACCESS_CD

    • NAME

    • LAST_NAME_SEARCH

    • SETID_DEPT

    • DEPTID

    • NAME_AC

    • NID_COUNTRY

    • NATIONAL_ID_TYPE

    • NID_DESCRSHORT

    • NATIONAL_ID

    Your screen should look like this when you finish inserting all the necessary fields.


To define the record

  1. Select File > New > Record.

  2. Click OK.

  3. Drag the fields to the new record.

    When you are finished your record should look like this.

  4. Select File > Save As.

  5. Type in the new record name and click the OK button.

  6. Select View > Use Display to see the new record.

  7. Select the EMPLID field, click the right mouse button, and select Record Field Properties from the drop-down menu.

  8. Mark the following checkboxes:

    • Key

    • Search Key

    • List Box Item

  9. Click the OK button.

  10. Check the appropriate boxes for each field, according to the following table.


Table 3-2 Message Definition Options

Field

Key

Search

List

System

EMPLID

 

Key  

Yes  

Yes  

No  

EMPL_RCD

 

 

No  

Yes  

No  

OPRCLASS

 

Key  

No  

No  

No  

ACCESS_CD

 

 

No  

No  

No  

NAME

 

Alt  

No  

Yes  

No  

LAST_NAME_SEARCH

 

Alt  

No  

Yes  

No  

SETID_DEPT

 

Alt  

No  

Yes  

No  

DEPTID

 

Alt  

No  

Yes  

No  

NAME_AC

 

Alt  

No  

Yes  

No  

NID_COUNTRY

 

 

No  

No  

No  

NATIONAL_ID_TYPE

 

 

No  

No  

No  

NID_DESCRSHORT

 

 

No  

No  

No  

NATIONAL_ID

 

 

No  

No  

No  

 

 

 

 

 



Note Alt - check the Alternate Search Key check box



  1. Select File > Save.


To set table space

  1. Select Tools > DataAdministration > Set_TableSpace.

  2. Click on Set_TableSpace to display the Select Tools data administrator.

  3. Click on Set_TableSpace to display the Change Space dialog box.

  4. Select HRAPP and click OK.


To build the project

  1. Select    a record.

  2. Select Build > Current Object to display the Build dialog box.

  3. Select:

    • Create Tables checkbox

    • Execute-and-build-script radio button.

  4. To build the new record, click the Build button.


To build a panel

  1. Select File > New > Panel and click OK.

  2. Drag the fields from the record onto the panel.

  3. Select File > Save As.

  4. In the Save As dialog box, type in the Panel name and then click OK..


To define a panel group for this panel

  1. Select New > File > Panel Group and then click OK.

  2. Drag the panels you want to include in the panel group, to the Panel Group window.

  3. Select the Property icon and click on the Use tab.

  4. From the Search record drop-down menu, select the Record you defined in the previous step.

  5. Select the checkboxes for the Actions you want to use.

  6. Select File > Save As..

  7. In the Save As dialog box, type the Panel Group name, select the Market type from the drop-down list., and click on OK.


To define your menu

  1. Select File > New > Menu and click OK.

  2. In the New Menu dialog box, select the Standard radio button, and click OK.

  3. Double-click on the menu bar that appears, to open the Menu Item Properties dialog box.

  4. Type Use in the Name and Label text boxes and then click OK.

  5. Drag the panel group to the menu item.

  6. Select File > Save As.

  7. In the Save As dialog, type in the Menu name, and click OK..


To define a new business process

  1. Select File > New > Business Process and click OK.

    The Business Process workspace and toolbar appears.

  2. Drag an activity to the workspace.

  3. When the Activity is at the location you want, click the left mouse button to display the Activity Choice dialog box.

  4. Select the Create New Activity radio button and click OK.

    An Activity tool appears on the worksheet.

  5. Select the Activity tool and then click the right mouse button.

    The Activity Definition dialog box appears.

  6. Type in the activity definition and then click OK.

  7. Select File > Save.

    Type the name of the business process into the text box of the Save As dialog box

    .

  8. Click the OK button to create a business process.

  9. Double-click the activity.

    A business process toolbar appears.

  10. Drag the Message Definition icon onto the worksheet.

  11. Click the right mouse button and type the Message Definition name.

  12. Type in the Message Definition name.

  13. Press the Attribute button and select the fields from the Message Attribute dialog box drop-down lists.

  14. Press the Level Mapping button and select the appropriate radio buttons and checkbox.

  15. Click the OK button.

  16. Click on the Field Mapping button.

    For each field you must select the Record, the Field name, and either Input or Output.

  17. Type in the Field name and then click OK.

  18. The following table is the end result of the complete process.



Note EmplId and OperClass must be selected from the Search Record.




To give authorization to the panel

  1. Select Go > PeopleTools > Security Administration

    .

  2. Select File > Open.

  3. Select ALLPANLS and click OK.

  4. Select the Menu Items icon and an item from the Insert Menu Name dialog box.

  5. Click the OK button

    The Select Menu Items dialog box appears..

  6. Click the Select All button and click OK.

    Your file is saved.


Previous     Contents     Index     DocHome     Next     
Copyright © 2000 Sun Microsystems, Inc. Some preexisting portions Copyright © 2000 Netscape Communications Corp. All rights reserved.

Last Updated June 13, 2000