Primavera Integration API 7.0

com.primavera.integration.client
Class Session

java.lang.Object
  extended by com.primavera.integration.client.Session
Direct Known Subclasses:
DistributedSession, LocalSession

public abstract class Session
extends java.lang.Object

Session is the main class used for communicating with the server. A static login method is used to establish a valid session, that can then be used to access other main objects, such as the EnterpriseLoadManager and the JobManager. Logging in requires a valid database instance to be specified if multiple instances were defined, but a list of available database instances can be retrieved by calling getDatabaseInstances(), even without first logging in.

Note that the only differences in client code between Local Mode and Remote Mode is the calls to getDatabaseInstances() and login(). For Remote Mode, the URL of the RMI server needs to be specified. The RMIURL helper class can be used to create the URL.

Session is not a singleton, meaning you can establish multiple simultaneous sessions communicating with different servers and/or database instances. This can be useful for integrating with multiple Primavera databases.

When you are done working with the API, you should call logout() to release the session.


Field Summary
static int DEFAULT_BIND_PARAM_LIMIT_ON_LOAD
          The default where clause bind parameter limit
static int DEFAULT_LOCAL_BATCH_SIZE
          The default batch size for loading business objects in Local Mode.
static int MAX_BIND_PARAM_LIMIT_ON_LOAD
          The maximum where clause bind parameter limit
static int MAX_BUSINESS_OBJECT_BATCH_SIZE
          The maximum batch size for loading the business objects.
static int MIN_BIND_PARAM_LIMIT_ON_LOAD
          The minimum where clause bind parameter limit
static int MIN_BUSINESS_OBJECT_BATCH_SIZE
          The minimum batch size for loading the business objects.
 
Method Summary
 boolean getBatchFailOnFirstFlag()
          Gets the flag that indicates whether batch creates and updates should be aborted when the first exception occurs (the default behavior), or whether the entire batch should be processed and then all business rule exceptions reported in a single BatchException.
 int getBindParameterLimitOnLoad()
          Retrieves the current limit on bind parameters
 int getBusinessObjectBatchSize()
          Retrieves the current batch size for loading business objects.
 java.lang.String getDatabaseEncoding()
          Retrieves the database encoding this session is logged into
 java.lang.String getDatabaseInstanceId()
          Retrieves the database instance ID used to login and establish this session.
static DatabaseInstance[] getDatabaseInstances(java.lang.String sUrl)
          Retrieves all database instances supported by the server.
 java.lang.String getDatabaseName()
          Retrieves the name of the database this session is logged into.
 int getDatabaseType()
          Retrieves the database type this session is logged into.
 java.lang.String getDatabaseUrl()
          Retrieves the URL of the database this session is logged into.
abstract  DocumentManager getDocumentManager()
          Deprecated. As of release 6.2, this method is no longer supported in the API.
 EnterpriseLoadManager getEnterpriseLoadManager()
          Gets the EnterpriseLoadManager for this session.
 GlobalObjectManager getGlobalObjectManager()
          Gets the GlobalObjectManager for this session.
abstract  com.primavera.integration.collab.initiation.InitiationManager getInitiationManager()
          Deprecated. As of release 6.2, this method is no longer supported in the API.
 JobManager getJobManager()
          Gets the JobManager for this session.
 java.lang.String getUserName()
          Retrieves the name of the User who is logged in using this Session instance.
abstract  ObjectId getUserObjectId()
          Retrieves the ObjectId of the User who is logged in using this Session instance.
abstract  ObjectId getUSessionId()
          Returns and ObjectId representation of the usession id
 XMLExporter getXMLExporter()
          Deprecated. As of release 6.2, the flat XML exporter XMLExporter should be used instead of the hierarchical exporter.
 XMLImporter getXMLImporter()
          Deprecated. As of release 6.2, the flat XML importer XMLImporter should be used instead of the hierarchical importer.
static boolean isLocalModeAvailable()
          Indicates whether Local Mode is available.
static boolean isRemoteModeAvailable()
          Indicates whether Remote Mode is available.
abstract  boolean isValid()
          Verifies if the session is valid.
abstract  java.sql.Timestamp loadSafetyDate()
          Loads the safety date from the database.
static Session login(java.lang.String sUrl, java.lang.String sDbId, java.lang.String sUserName, java.lang.String sPassword)
          Logs in and obtains a Session object.
abstract  void logout()
          Notifies the server that this session is no longer needed and releases any resources allocated for this session.
 void setBatchFailOnFirstFlag(boolean fail)
          Sets the flag that indicates whether batch creates and updates should be aborted when the first exception occurs (the default behavior), or whether the entire batch should be processed and then all business rule exceptions reported in a single BatchException.
 void setBindParameterLimitOnLoad(int iBindParameterLimit)
          Set the new bind parameter limit for loading business objects.
 void setBusinessObjectBatchSize(int iBatchSize)
          Set the new batch size for loading business objects.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_LOCAL_BATCH_SIZE

public static final int DEFAULT_LOCAL_BATCH_SIZE
The default batch size for loading business objects in Local Mode.

See Also:
Constant Field Values

MAX_BUSINESS_OBJECT_BATCH_SIZE

public static final int MAX_BUSINESS_OBJECT_BATCH_SIZE
The maximum batch size for loading the business objects.

See Also:
Constant Field Values

MIN_BUSINESS_OBJECT_BATCH_SIZE

public static final int MIN_BUSINESS_OBJECT_BATCH_SIZE
The minimum batch size for loading the business objects.

See Also:
Constant Field Values

MAX_BIND_PARAM_LIMIT_ON_LOAD

public static final int MAX_BIND_PARAM_LIMIT_ON_LOAD
The maximum where clause bind parameter limit

See Also:
Constant Field Values

MIN_BIND_PARAM_LIMIT_ON_LOAD

public static final int MIN_BIND_PARAM_LIMIT_ON_LOAD
The minimum where clause bind parameter limit

See Also:
Constant Field Values

DEFAULT_BIND_PARAM_LIMIT_ON_LOAD

public static final int DEFAULT_BIND_PARAM_LIMIT_ON_LOAD
The default where clause bind parameter limit

See Also:
Constant Field Values
Method Detail

isLocalModeAvailable

public static boolean isLocalModeAvailable()
Indicates whether Local Mode is available.

Returns:
true if Local Mode is available, false otherwise.

isRemoteModeAvailable

public static boolean isRemoteModeAvailable()
Indicates whether Remote Mode is available.

Returns:
true if Remote Mode is available, false otherwise.

getDatabaseInstances

public static DatabaseInstance[] getDatabaseInstances(java.lang.String sUrl)
                                               throws ServerException,
                                                      NetworkException,
                                                      ClientException
Retrieves all database instances supported by the server. If the URL parameter is null, Local Mode is used. Otherwise, Remote Mode is used. You can use the isRemoteModeAvailable and isLocalModeAvailable methods to check if the specific modes are available. Note that instances can be added to a configuration using the Primavera Administrator utility. See the Integration API Installation Guide for more information.

Parameters:
sUrl - the location of the server, or null for Local Mode. Use the RMIURL class to create the URL.
Returns:
DatabaseInstance[] array of DatabaseInstance objects representing available databases
Throws:
ServerException - if a problem occurred on the server-side
ClientException - if a problem occurred on the client-side
NetworkException - if a problem occurred in the network layer
See Also:
isRemoteModeAvailable, isLocalModeAvailable

login

public static Session login(java.lang.String sUrl,
                            java.lang.String sDbId,
                            java.lang.String sUserName,
                            java.lang.String sPassword)
                     throws ServerException,
                            NetworkException,
                            ClientException
Logs in and obtains a Session object.
if the URL parameter is null, Local Mode is used. Otherwise, Remote Mode is used. Please use isRemoteModeAvailable and isLocalModeAvailable methods to check if the specific mode is available.

Parameters:
sUrl - the location of the server, or null for Local Mode. Use the RMIURL class to create the URL.
sDbId - the database instance id
sUserName - the user name
sPassword - the password
Returns:
Session session object
Throws:
ServerException - if a problem occurred on the server-side
ClientException - if a problem occurred on the client-side
NetworkException - if a problem occurred in the network layer
See Also:
isRemoteModeAvailable, isLocalModeAvailable

logout

public abstract void logout()
Notifies the server that this session is no longer needed and releases any resources allocated for this session. You should always call logout after you finish working with the API.


isValid

public abstract boolean isValid()
                         throws NetworkException
Verifies if the session is valid.

Returns:
true if session is valid
Throws:
NetworkException

getUserObjectId

public abstract ObjectId getUserObjectId()
                                  throws ServerException,
                                         NetworkException
Retrieves the ObjectId of the User who is logged in using this Session instance.

Returns:
ObjectId the user object id
Throws:
ServerException - if a problem occurred on the server-side
NetworkException - if a problem occurred in the network layer

getGlobalObjectManager

public GlobalObjectManager getGlobalObjectManager()
Gets the GlobalObjectManager for this session.

Returns:
GlobalObjectManager the global object manager

getEnterpriseLoadManager

public EnterpriseLoadManager getEnterpriseLoadManager()
Gets the EnterpriseLoadManager for this session.

Returns:
EnterpriseLoadManager the enterprise load manager

getJobManager

public JobManager getJobManager()
Gets the JobManager for this session.

Returns:
JobManager the job manager

getXMLExporter

@Deprecated
public XMLExporter getXMLExporter()
Deprecated. As of release 6.2, the flat XML exporter XMLExporter should be used instead of the hierarchical exporter.

Gets the hierarchical XML exporter for this session.

Returns:
XMLExporter the XML exporter

getXMLImporter

@Deprecated
public XMLImporter getXMLImporter()
Deprecated. As of release 6.2, the flat XML importer XMLImporter should be used instead of the hierarchical importer.

Gets the hierarchical XML importer for this session.

Returns:
XMLImporter the XML importer

getDatabaseInstanceId

public java.lang.String getDatabaseInstanceId()
Retrieves the database instance ID used to login and establish this session.

Returns:
String the current database instance ID

getUserName

public java.lang.String getUserName()
Retrieves the name of the User who is logged in using this Session instance.

Returns:
String the current user name

getDatabaseUrl

public java.lang.String getDatabaseUrl()
Retrieves the URL of the database this session is logged into.

Returns:
database url, including machine name and port number.

getDatabaseName

public java.lang.String getDatabaseName()
Retrieves the name of the database this session is logged into.

Returns:
database name

getDatabaseType

public int getDatabaseType()
Retrieves the database type this session is logged into.

Returns:
database type ( Oracle = 0, SQL Server = 1, Otherwise = -1)

getDatabaseEncoding

public java.lang.String getDatabaseEncoding()
Retrieves the database encoding this session is logged into

Returns:
encoding

getBusinessObjectBatchSize

public int getBusinessObjectBatchSize()
Retrieves the current batch size for loading business objects.

Returns:
int the current batch size for loading business objects

setBusinessObjectBatchSize

public void setBusinessObjectBatchSize(int iBatchSize)
                                throws ClientException
Set the new batch size for loading business objects.

Parameters:
iBatchSize - the new batch size for loading business objects
Throws:
ClientException - the new batch size was wrong

getBindParameterLimitOnLoad

public int getBindParameterLimitOnLoad()
Retrieves the current limit on bind parameters

Returns:
int the current limit on bind parameter

setBindParameterLimitOnLoad

public void setBindParameterLimitOnLoad(int iBindParameterLimit)
                                 throws ClientException
Set the new bind parameter limit for loading business objects. The bind parameter limit is used to determine if a prepared statement or where criteria is used to load business objects.

Parameters:
iBindParameterLimit - the new bind parameter limit for loading business objects
Throws:
ClientException - the new bind parameter limit is outside of acceptable range

getUSessionId

public abstract ObjectId getUSessionId()
                                throws ServerException,
                                       NetworkException
Returns and ObjectId representation of the usession id

Returns:
ObjectId USessionId
Throws:
ServerException - if a problem occurred on the server-side
NetworkException

getDocumentManager

@Deprecated
public abstract DocumentManager getDocumentManager()
Deprecated. As of release 6.2, this method is no longer supported in the API.

Gets the class that allows access to collaboration.

Returns:
the DocumentManager to access the collaboration space.

getInitiationManager

@Deprecated
public abstract com.primavera.integration.collab.initiation.InitiationManager getInitiationManager()
Deprecated. As of release 6.2, this method is no longer supported in the API.

Gets the class that allows access to Initiation.

Returns:
the InitiationManager to access the Initiation space.

loadSafetyDate

public abstract java.sql.Timestamp loadSafetyDate()
                                           throws ServerException,
                                                  NetworkException
Loads the safety date from the database. The safety date can be used to identify business objects that have been updated since the last load of the safety date.

Returns:
the safety date
Throws:
ServerException - when a Server exception occurs
NetworkException - when a Network exception occurs

setBatchFailOnFirstFlag

public void setBatchFailOnFirstFlag(boolean fail)
Sets the flag that indicates whether batch creates and updates should be aborted when the first exception occurs (the default behavior), or whether the entire batch should be processed and then all business rule exceptions reported in a single BatchException.

Parameters:
fail - true to fail on first, false otherwise

getBatchFailOnFirstFlag

public boolean getBatchFailOnFirstFlag()
Gets the flag that indicates whether batch creates and updates should be aborted when the first exception occurs (the default behavior), or whether the entire batch should be processed and then all business rule exceptions reported in a single BatchException.

Returns:
boolean true for fail on first, false otherwise

Primavera Integration API 7.0

Copyright © 2003, 2009, Oracle and/or its affiliates. All rights reserved.