com.sage.accpac.sm
Class Session

java.lang.Object
  extended by com.sage.accpac.sm.Session
All Implemented Interfaces:
HasDispose, ISession

@ThreadSafe
public class Session
extends java.lang.Object
implements ISession

Represents an authenticated session with the Sage Sage 300 ERP System Manager.
The caller must call the dispose method when finished with the object so that all its resources can be released. The caller must not call any other method on the object after calling dispose.


Constructor Summary
Session(ProgramSet programSet, SharedDataSet sharedDataSet, java.lang.String userID, java.lang.String password, java.lang.String companyID, java.util.Date sessionDate)
          constructs an instance of the Session class using a full set of arguments.
Session(java.lang.String userID, java.lang.String password, java.lang.String companyID, java.util.Date sessionDate)
          Constructs an instance of the Session class with a default ProgramSet and SharedDataSet.
 
Method Summary
 void dispose()
          call this when the instance is no longer required, to free up resources.
protected  void finalize()
          This implementation overrides the finalize method of object so that the dispose gets called if it hasn't already.
 java.lang.String getCharacterSetName()
          Gets the name of the character set used for the session.
 java.lang.String getCompanyID()
          Gets the company database ID that the current session is signed on to.
 java.lang.String getCompanyName()
          Returns the name of the company
 IProgramSet getIProgramSet()
          Get the session's program set
 ISharedDataSet getISharedDataSet()
          Get the shared data set for this session
 LicenseStatus getLicenseStatus(java.lang.String appID, java.lang.String appVersion)
          Gets the license status of the given version of the given application.
static Session getMetaDataInquirySession(ProgramSet programSet, SharedDataSet sharedDataSet, java.lang.String companyID)
          constructs an instance of the Session class that can only be used to inquire about the metadata of the application.
 ProgramSet getProgramSet()
          Get the session's program set
 java.util.Date getSessionDate()
          Gets the date represented by the session
 SharedDataSet getSharedDataSet()
          Get the shared data set for this session
 java.lang.String getSystemID()
          Gets the system database ID that the current session is signed on to.
static java.lang.String getSystemVersion()
          get the system version (e.g., "60A")
 java.lang.String getUserID()
          Gets the Sage 300 ERP user ID of the session.
 java.lang.String getUserLanguage()
          Gets the language preference of the current user.
 java.lang.String getUserName()
          Gets the name of the current user.
 boolean isMetaDataInquiryOnly()
          checks if the session is only to be used for inquiring about the metadata (e.g.
 boolean isTimecardUser()
          check if the current user is a Timecard user.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Session

public Session(ProgramSet programSet,
               SharedDataSet sharedDataSet,
               java.lang.String userID,
               java.lang.String password,
               java.lang.String companyID,
               java.util.Date sessionDate)
constructs an instance of the Session class using a full set of arguments.

Parameters:
programSet - the non-null ProgramSet that the Session will use
sharedDataSet - the non-null SharedDataSet that the Session will use
userID - the non-null user ID
password - the non-null password
companyID - the non-null company ID (dataset)
sessionDate - the non-null session date

Session

public Session(java.lang.String userID,
               java.lang.String password,
               java.lang.String companyID,
               java.util.Date sessionDate)
Constructs an instance of the Session class with a default ProgramSet and SharedDataSet.

Parameters:
userID - the non-null user ID
password - the non-null password
companyID - the non-null company ID (dataset)
sessionDate - the non-null session date
Method Detail

getMetaDataInquirySession

public static Session getMetaDataInquirySession(ProgramSet programSet,
                                                SharedDataSet sharedDataSet,
                                                java.lang.String companyID)
constructs an instance of the Session class that can only be used to inquire about the metadata of the application.

This is equivalent to logging on with the administrator credentials but only being able to look at the screens, not the data.

This is intended for internal use only; do not use this in third party code.

Parameters:
programSet - the non-null ProgramSet that the Session will use
sharedDataSet - the non-null SharedDataSet that the Session will use
companyID - the non-null company ID (dataset)
Returns:
the non-null Session.
See Also:
isMetaDataInquiryOnly()

dispose

public void dispose()
call this when the instance is no longer required, to free up resources. It is normal to throw NullPointerException if this has already been called.

Specified by:
dispose in interface HasDispose

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getCharacterSetName

public java.lang.String getCharacterSetName()
Gets the name of the character set used for the session. This reflects how the bytes of the underlying Sage 300 ERP data are interpreted.

Specified by:
getCharacterSetName in interface ISession
Returns:
the name of the session character set.

getCompanyID

public java.lang.String getCompanyID()
Gets the company database ID that the current session is signed on to.

Specified by:
getCompanyID in interface ISession
Returns:
the company database ID that the Session is using.

getCompanyName

public final java.lang.String getCompanyName()
Returns the name of the company

Specified by:
getCompanyName in interface ISession
Returns:
the name of the company

getIProgramSet

public IProgramSet getIProgramSet()
Get the session's program set

Specified by:
getIProgramSet in interface ISession
Returns:
the IProgramSet that the Session is using.

getISharedDataSet

public ISharedDataSet getISharedDataSet()
Get the shared data set for this session

Specified by:
getISharedDataSet in interface ISession
Returns:
the ISharedDataSet for this session

getLicenseStatus

public LicenseStatus getLicenseStatus(java.lang.String appID,
                                      java.lang.String appVersion)
Gets the license status of the given version of the given application.
If the caller passes invalid data or the underlying system fails the behavior of this method is undefined. It may throw an exception, return a status of NotKNown or even cause the system to fail.

Specified by:
getLicenseStatus in interface ISession
Parameters:
appID - ID of the application
appVersion - version of the application
Returns:
the status of the license for the given version of the given application.

getProgramSet

public ProgramSet getProgramSet()
Get the session's program set

Returns:
the ProgramSet that the Session is using.

getSessionDate

public java.util.Date getSessionDate()
Gets the date represented by the session

Specified by:
getSessionDate in interface ISession
Returns:
the session date that was provided to the constructor

getSystemID

public java.lang.String getSystemID()
Gets the system database ID that the current session is signed on to.

Specified by:
getSystemID in interface ISession
Returns:
the system database ID

getSharedDataSet

public SharedDataSet getSharedDataSet()
Get the shared data set for this session

Returns:
the SharedDataSet for this session

getSystemVersion

public static java.lang.String getSystemVersion()
get the system version (e.g., "60A")

Returns:
the system version (e.g., "60A")

getUserID

public java.lang.String getUserID()
Gets the Sage 300 ERP user ID of the session.

Specified by:
getUserID in interface ISession
Returns:
the Sage 300 ERP user ID of the session

getUserLanguage

public java.lang.String getUserLanguage()
Gets the language preference of the current user. The property returns the 3-letter upper-case language code of the preferred language.

Specified by:
getUserLanguage in interface ISession
Returns:
the language the user is using

getUserName

public java.lang.String getUserName()
Gets the name of the current user.

Specified by:
getUserName in interface ISession
Returns:
the name of the user

isMetaDataInquiryOnly

public boolean isMetaDataInquiryOnly()
checks if the session is only to be used for inquiring about the metadata (e.g. field names etc.)

Specified by:
isMetaDataInquiryOnly in interface ISession
Returns:
true if the session is only to be used for inquiring about field names etc.

isTimecardUser

public boolean isTimecardUser()
check if the current user is a Timecard user.

Specified by:
isTimecardUser in interface ISession
Returns:
true if the current user is a Timecard user, false otherwise

finalize

protected void finalize()
                 throws java.lang.Throwable
This implementation overrides the finalize method of object so that the dispose gets called if it hasn't already.

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable


Copyright © 2011 Sage Software, Inc. All rights reserved.