public abstract class Session extends Object implements Closeable
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.
Modifier and Type | Field and Description |
---|---|
static String |
BATCH_OVERRIDE
Batch over-ride system property.
|
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 |
DEFAULT_REMOTE_BATCH_SIZE
The default batch size for loading business objects in Remote 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.
|
Constructor and Description |
---|
Session() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Allow try-with-resources blocks to autoclose a session by logging out
|
com.primavera.integration.apiapps.ImportExportProjectsOutput |
exportProjects(com.primavera.integration.apiapps.ImportExportProjectsInput input) |
String |
fixupWhereClause(com.primavera.bo.defs.BusinessObjectDef boDef,
String whereClause)
Verifies and translates column names from integration to
logical.
|
abstract Object |
getAdminConfigSetting(String name,
Class type) |
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.
|
String |
getDatabaseEncoding()
Retrieves the database encoding this session is logged into
|
String |
getDatabaseInstanceId()
Retrieves the database instance ID used to login and establish this session.
|
static DatabaseInstance[] |
getDatabaseInstances(String sUrl)
Retrieves all database instances supported by the server.
|
String |
getDatabaseName()
Retrieves the name of the database this session is logged into.
|
int |
getDatabaseType()
Retrieves the database type this session is logged into.
|
DBType |
getDatabaseTypeEnum()
Retrieves the database type this session is logged into.
|
String |
getDatabaseUrl()
Retrieves the URL of the database this session is logged into.
|
EnterpriseLoadManager |
getEnterpriseLoadManager()
Gets the
EnterpriseLoadManager for this session. |
GlobalObjectManager |
getGlobalObjectManager()
Gets the
GlobalObjectManager for this session. |
JobManager |
getJobManager()
Gets the
JobManager for this session. |
abstract Map<Object,Object> |
getTemplateMap(String templateId,
String userId) |
abstract byte[] |
getUCMDocument(String uuid,
String version)
Gets the byte array of UCM document.
|
abstract DocumentDetail |
getUCMDocumentDetail(String uuid)
Gets the most recent version of a content repository document.
|
abstract DocumentDetail[] |
getUCMDocumentsRecentVersion(List<String> uuids)
Gets the most recent version of each document.
|
abstract DocumentVersion[] |
getUCMVersionHistory(String uuid)
Gets all the versions of a content repository document.
|
String |
getUserName()
Retrieves the name of the
User who is logged in using this Session instance. |
abstract ObjectId |
getUserObjectId()
|
abstract ObjectId |
getUSessionId()
Returns and
ObjectId representation of the usession id |
com.primavera.integration.apiapps.ImportExportProjectsOutput |
importProjects(com.primavera.integration.apiapps.ImportExportProjectsInput input) |
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 Timestamp |
loadSafetyDate()
Loads the safety date from the database.
|
static Session |
login(String sUrl,
String sDbId,
String sUserName,
String sPassword) |
static Session |
login(String sUrl,
String sDbId,
String sUserName,
String sPassword,
String remoteClientIP)
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.
|
<T extends BusinessObject> |
pagingLoad(com.primavera.bo.defs.BusinessObjectDef boDef,
String[] aIntgFieldName,
String sWhereClause,
String sOrderBy,
com.primavera.bo.common.PRequestOptions opts,
com.primavera.bo.base.RemoteTXId txId,
String pageKey) |
abstract int |
populateUPKLIST(ObjectId epsObjectId) |
int |
removeDeletedObjectsFromBaseline(String boTypeName,
ObjectId origProjectId,
ObjectId blProjectId,
Collection<String> parentActivityIdsToConsider)
Removes certain child objects from a baseline which do not exist in the original project
This method is only supported for local sessions.
|
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.
|
void |
setExportOption(String exportOption) |
void |
setIpmDarExportOption(Boolean ipmdarExport) |
abstract void |
updateLicense() |
public static final String BATCH_OVERRIDE
public static final int DEFAULT_LOCAL_BATCH_SIZE
public static final int MAX_BUSINESS_OBJECT_BATCH_SIZE
public static final int MIN_BUSINESS_OBJECT_BATCH_SIZE
public static final int MAX_BIND_PARAM_LIMIT_ON_LOAD
public static final int MIN_BIND_PARAM_LIMIT_ON_LOAD
public static final int DEFAULT_BIND_PARAM_LIMIT_ON_LOAD
public static final int DEFAULT_REMOTE_BATCH_SIZE
public static boolean isLocalModeAvailable()
public static boolean isRemoteModeAvailable()
public static DatabaseInstance[] getDatabaseInstances(String sUrl) throws ServerException, NetworkException, ClientException
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.sUrl
- the location of the server, or null for Local Mode. Use the RMIURL
class to create the URL.ServerException
- if a problem occurred on the server-sideClientException
- if a problem occurred on the client-sideNetworkException
- if a problem occurred in the network layerisRemoteModeAvailable
,
isLocalModeAvailable
public static Session login(String sUrl, String sDbId, String sUserName, String sPassword) throws ServerException, NetworkException, ClientException
public static Session login(String sUrl, String sDbId, String sUserName, String sPassword, String remoteClientIP) throws ServerException, NetworkException, ClientException
isRemoteModeAvailable
and isLocalModeAvailable
methods to check
if the specific mode is available.sUrl
- the location of the server, or null for Local Mode. Use the RMIURL
class to create the URL.sDbId
- the database instance idsUserName
- the user namesPassword
- the passwordServerException
- if a problem occurred on the server-sideClientException
- if a problem occurred on the client-sideNetworkException
- if a problem occurred in the network layerisRemoteModeAvailable
,
isLocalModeAvailable
public abstract void logout()
public abstract boolean isValid() throws NetworkException
NetworkException
public abstract ObjectId getUserObjectId() throws ServerException, NetworkException
ServerException
- if a problem occurred on the server-sideNetworkException
- if a problem occurred in the network layerpublic GlobalObjectManager getGlobalObjectManager()
GlobalObjectManager
for this session.public EnterpriseLoadManager getEnterpriseLoadManager()
EnterpriseLoadManager
for this session.public JobManager getJobManager()
JobManager
for this session.public String getDatabaseInstanceId()
public String getUserName()
User
who is logged in using this Session instance.public String getDatabaseUrl()
public String getDatabaseName()
public int getDatabaseType()
public DBType getDatabaseTypeEnum()
public String getDatabaseEncoding()
public int getBusinessObjectBatchSize()
public void setBusinessObjectBatchSize(int iBatchSize) throws ClientException
iBatchSize
- the new batch size for loading business objectsClientException
- the new batch size was wrongpublic int getBindParameterLimitOnLoad()
public void setBindParameterLimitOnLoad(int iBindParameterLimit) throws ClientException
iBindParameterLimit
- the new bind parameter limit for loading business objectsClientException
- the new bind parameter limit is outside of acceptable rangepublic abstract ObjectId getUSessionId() throws ServerException, NetworkException
ObjectId
representation of the usession idServerException
- if a problem occurred on the server-sideNetworkException
public <T extends BusinessObject> com.primavera.integration.client.bo.BOPaging<T> pagingLoad(com.primavera.bo.defs.BusinessObjectDef boDef, String[] aIntgFieldName, String sWhereClause, String sOrderBy, com.primavera.bo.common.PRequestOptions opts, com.primavera.bo.base.RemoteTXId txId, String pageKey) throws ServerException, BusinessObjectException, NetworkException
public int removeDeletedObjectsFromBaseline(String boTypeName, ObjectId origProjectId, ObjectId blProjectId, Collection<String> parentActivityIdsToConsider) throws ServerException
boTypeName
- - the type of objects to remove. Supported type names are ["ActivityCodeAssignment", "ActivityUDFValue"]origProjectId
- - ObjectId of original projectblProjectId
- - ObjectId of the baseline projectparentActivityIdsToConsider
- - If non-null, only the child objects owned by these activities will be considered for removalServerException
- if a problem occurred on the server-side, or an unsupported bOTypeName was provided,
or if this method was called from a non-local sessionpublic String fixupWhereClause(com.primavera.bo.defs.BusinessObjectDef boDef, String whereClause) throws WhereClauseException
boDef
- which BO we are handlingwhereClause
- User supplied where clauseWhereClauseException
- if a problem occurred while parsing the where clausepublic abstract Timestamp loadSafetyDate() throws ServerException, NetworkException
ServerException
- when a Server exception occursNetworkException
- when a Network exception occurspublic abstract byte[] getUCMDocument(String uuid, String version) throws ServerException, RemoteException, Exception
uuid
- the UCM ID of a document.version
- the version of the document.Exception
- if a problem occurred.ServerException
RemoteException
public abstract DocumentVersion[] getUCMVersionHistory(String uuid) throws ServerException, RemoteException, Exception
uuid
- the ID of a content repository document.Exception
- if a problem occurred.ServerException
RemoteException
public abstract DocumentDetail[] getUCMDocumentsRecentVersion(List<String> uuids) throws Exception
uuids
- the unique ID of content repository documents.Exception
- if a problem occurred.public abstract DocumentDetail getUCMDocumentDetail(String uuid) throws Exception
uuid
- the unique ID of a content repository document.Exception
- if a problem occurred.public void setBatchFailOnFirstFlag(boolean fail)
fail
- true to fail on first, false otherwisepublic void setExportOption(String exportOption)
public void setIpmDarExportOption(Boolean ipmdarExport)
public boolean getBatchFailOnFirstFlag()
public com.primavera.integration.apiapps.ImportExportProjectsOutput importProjects(com.primavera.integration.apiapps.ImportExportProjectsInput input) throws Exception
Exception
public com.primavera.integration.apiapps.ImportExportProjectsOutput exportProjects(com.primavera.integration.apiapps.ImportExportProjectsInput input) throws Exception
Exception
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public abstract int populateUPKLIST(ObjectId epsObjectId) throws ServerException, NetworkException
ServerException
NetworkException
public abstract Map<Object,Object> getTemplateMap(String templateId, String userId) throws ServerException, NetworkException
ServerException
NetworkException
public abstract Object getAdminConfigSetting(String name, Class type) throws ServerException, NetworkException
ServerException
NetworkException
public abstract void updateLicense() throws ServerException, NetworkException
ServerException
NetworkException
Copyright © 2003, 2024, Oracle and/or its affiliates.
Oracle®, Java, and MySQL are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.