Package com.saperion.connector.rmi
Class SaRMIClientCommandImpl
- All Implemented Interfaces:
SaRMIClientCommand
The implementation of the
SaRemoteApplication interface. This is the main point of
communication between Java kernel and LARIX connector. The essential functionality consists of
the documents processing, the transactions handling and log in/of-
Field Summary
Fields inherited from class com.saperion.connector.rmi.AbstractRMIClientCommand
APPEND_CONTENT, appl, credentials, LOGGER, props, session, sessionInfo, sysConnector, writeBufferSize -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidchangePassword(String user, String oldPassword, String client, String newPassword) Changes the password of an existing user.booleancloseSession(com.saperion.connector.authentication.Session session) Close the givenSessionbooleandeleteSetting(String name, String section, boolean isLong) Deletes a setting in the database.intgetArchivedSize(String hDoc) Returns the total document size in archive.getAuthorizedUsers(String hDoc, String rights, MatchKind match) Returns the users, that have specific rights on a document.intcom.lexmark.saperion.administration.RoleTypeReturns information about the specified DDC.intbooleanReturns whether events (e.g.Read the features.getFieldDescriptions(String ddcName) Reads the field descriptions for a given DDC.getFieldDescriptions(String ddcName, String mandant) Reads the field descriptions for a given DDC.getFullTextFields(String ddcName, List<String> fullTextFields, String hdoc) intgetLicenseCount(int type) Read the licence count for the given user.getMember(WorkflowMember member, int depth, String filter) Reads the member.Reads the member.getRealDBName(String ddcName, String field, String mandant) returns the real database table name for a given DDC.Get the RMI interface version from java core server.Returns a list of objects describing the servers this connector is connected to.com.saperion.connector.authentication.SessiongetSetting(String name, String section, boolean isLong) Retrieves a setting from the database.getSystemFiles(SystemFileKind kind, String filter) Gets the system files of a specific kind.Reads system info.getSystemSetting(String accessKey) Retrieves a system setting object.intgetToken()int[]Read the userids.final SaUserSettinggetUserSetting(String accessKey) Retrieves a user setting object.<T extends Serializable>
Tinvoke(com.lexmark.saperion.remote.common.operations.Operation<T, SaBasicException, LegacyConnection> operation) This method invokes aOperationon the backend.booleanisAlive()Test the lifetime of this token.booleanisRevisionEnabled(int mandant, String ddcName) Gets the information whether the provided ddc table contains the fields required for revisions.List<com.saperion.connector.authentication.Session>List the active sessions of the logged in user.String[]Retrieves the available DDC names.String[]Retrieves the available folder DDC names.final PropertiesloadSettings(String section) Load settings from backend.loadSystemFile(SystemFileKind kind, String name) Loads a system file of a specific kind.Retrieves the workflow DDC name.booleanlogoff()Log off the user from the server instance.com.saperion.connector.authentication.Sessionlogon(com.lexmark.saperion.remote.common.authentication.Credentials credentials) Logon with the passed credentials.com.saperion.connector.authentication.Sessionlogon(com.lexmark.saperion.remote.common.authentication.Credentials credentials, com.saperion.connector.authentication.SessionInfo sessionInfo) Logon with the passed credentials and associate the given session information.<ResultType extends Serializable,ExceptionType extends com.lexmark.saperion.exceptions.EcmException>
ResultTypenewInvoke(com.lexmark.saperion.remote.common.operations.EcmOperation<ResultType, ExceptionType> operation) This method invokes aEcmOperationin the backend.protected voidPerforms relogon in the backend.resolveLatestHdoc(String oldHdoc) Resolves the hdoc of the latest version of the document identified by the given hdoc.searchSettings(SettingSearchInfo searchInfo) Searches for settings.voidsendBarcode(String indexMask, String docUid, String contentRep, String sid, String docType, String value, int mandant) Send barcode to SAP.voidsetEventsEnabled(boolean enabled) Sets whether events (e.g.voidSet the locale for localization.voidsetSetting(Setting setting) Persists a setting in the database.booleansetUsedLicense(int type, int count) Set the count of used licenses.final voidsetUserSetting(SaUserSetting setting) Persists a user setting object.voidstoreSystemFile(SystemFileKind kind, String name, InputStream data) Stores a system file of a specific kind.Methods inherited from class com.saperion.connector.rmi.AbstractWfRMIClientCommand
addComment, addHistory, executeCommand, getBoxCount, getBoxDefinitions, getCommandInfos, getCommandInfos, getCommentInfos, getCompleteHistoryInfos, getHistoryInfos, getOutOfOffice, getParentTask, getSubstitute, getTask, getTaskAuditList, getTaskList, getUsers, getWorkflowDefinitions, setOutOfOffice, setSubstituteMethods inherited from class com.saperion.connector.rmi.AbstractQueryRMIClientCommand
finishSQLTransaction, getFulltext, getHDocForSysRowId, getIdsFromQuery, getStringQueryResult, getVersionList, readDocumentMetadata, startSQLTransactionMethods inherited from class com.saperion.connector.rmi.AbstractDocRMIClientCommand
cacheDocument, checkoutDocument, checkoutDocument, checkSapUrl, clearContent, closeDocument, createDocument, createExternalStorageFolderMapping, createLink, deleteDocument, deleteExternalStorageFolderMapping, discardDocument, dsicardCheckout, finishTransaction, getACLNames, getACLRights, getAcls, getAllACLs, getAnnotations, getExternalStorageFoldersForUpload, getExternalStorageFoldersForUpload, getExternalStorageMapping, getInvolvedUsers, getLockInfo, getLocks, getLocks, getNodeAccessData, getThumbnail, lockNode, logClientEvent, readDocumentFirst, readDocumentFirst, readDocumentNext, readVersionMetadata, readVersionMetadata, releaseDocument, removeElement, removeElement, restoreVersion, saveDocument, saveDocument, setACLName, setAnnotations, setElementMark, setVariables, startTransaction, storeDocument, storeDocument, unlockNode, updateExternalStorageUploadStatus, writeContent, writeContent, writeContent, writeContentMethods inherited from class com.saperion.connector.rmi.AbstractFolderRMIClientCommand
addToFolder, copyFolder, createFolder, deleteFolder, getDocumentFolderCount, getDocumentFolders, getFolderChildren, getFolderClass, getFolderFromPath, getFolderInfo, getFolderParent, getFolderRights, getFolderUpdateInfo, moveFolder, moveToFolder, removeFromFolder, searchFolderClass, searchFolderDocuments, setFolderAcl, updateFolderMethods inherited from class com.saperion.connector.rmi.AbstractRMIClientCommand
getRemoteCommand, init, reLogon, reLogonAfterConnectionFailureMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.saperion.connector.rmi.SaRMIClientCommand
logon
-
Constructor Details
-
SaRMIClientCommandImpl
Constructor.- Throws:
RemoteException- RemoteExceptionNotBoundException- Server not found
-
-
Method Details
-
performLogonAfterFailure
Performs relogon in the backend. If relogon fails aSaSystemExceptionis thrown.- Throws:
SaSystemException
-
getToken
public int getToken()- Returns:
- Token
- See Also:
-
getSession
public com.saperion.connector.authentication.Session getSession()- Returns:
- the actual valid session
- See Also:
-
getSystemConnector
- Returns:
- System connector
- See Also:
-
getMandant
- Returns:
- Mandant name
- See Also:
-
getCommitMode
public int getCommitMode()- Returns:
- Commitmode from the configuration.
- See Also:
-
getDeleteMode
public int getDeleteMode()- Returns:
- Deletemode from the configuration.
- See Also:
-
logoff
Log off the user from the server instance.- Returns:
- True, if done. False if session is not alive.
- Throws:
SaSystemException- SaRMICommandExceptionSaAuthenticationException- SaAuthenticationException- See Also:
-
logon
public com.saperion.connector.authentication.Session logon(com.lexmark.saperion.remote.common.authentication.Credentials credentials) throws SaSystemException, SaAuthenticationException Logon with the passed credentials.- Parameters:
credentials- credentials which should be used for logon- Returns:
- Session which holds all information about the created session
- Throws:
SaSystemException- SaRMICommandExceptionSaAuthenticationException- SaAuthenticationException- See Also:
-
logon
public com.saperion.connector.authentication.Session logon(com.lexmark.saperion.remote.common.authentication.Credentials credentials, com.saperion.connector.authentication.SessionInfo sessionInfo) throws SaSystemException, SaAuthenticationException Logon with the passed credentials and associate the given session information.- Parameters:
credentials- credentials which should be used for logonsessionInfo- The session information like user agent, remote address etc.- Returns:
- Session which holds all information about the created session
- Throws:
SaSystemException- SaRMICommandExceptionSaAuthenticationException- SaAuthenticationException- See Also:
-
listActiveSessions
public List<com.saperion.connector.authentication.Session> listActiveSessions() throws SaSystemExceptionList the active sessions of the logged in user.- Returns:
- A list of
Session - Throws:
SaSystemException- See Also:
-
closeSession
public boolean closeSession(com.saperion.connector.authentication.Session session) throws SaSystemException Close the givenSession- Returns:
- true if successful, false otherwise
- Throws:
SaSystemException- See Also:
-
getUserIdsForQuery
Read the userids.- Returns:
- User ids
- Throws:
SaSystemException- SaRMICommandException- See Also:
-
getFieldDescriptions
public SaFieldDescription[] getFieldDescriptions(String ddcName) throws SaSystemException, SaAuthenticationException, SaDDCException Reads the field descriptions for a given DDC.- Parameters:
ddcName- DDC name- Returns:
- Array of field description objects
- Throws:
SaSystemException- SaRMICommandExceptionSaAuthenticationException- SaAuthenticationExceptionSaDDCException- SaDDCException- See Also:
-
getFieldDescriptions
public SaFieldDescription[] getFieldDescriptions(String ddcName, String mandant) throws SaSystemException Reads the field descriptions for a given DDC.- Parameters:
ddcName- DDC namemandant- Mandant- Returns:
- Array of field description objects
- Throws:
SaSystemException- SaRMICommandException- See Also:
-
loadDDCNames
Retrieves the available DDC names.- Returns:
- Array of DDC names
- Throws:
SaSystemException- SaRMICommandExceptionSaAuthenticationException- SaAuthenticationException- See Also:
-
loadFolderDDCNames
Retrieves the available folder DDC names.- Returns:
- Array of folder DDC names
- Throws:
SaSystemException- SaRMICommandExceptionSaAuthenticationException- SaAuthenticationException- See Also:
-
loadWorkflowDDCName
Retrieves the workflow DDC name.- Returns:
- workflow DDC name
- Throws:
SaSystemException- SaRMICommandException- See Also:
-
isAlive
Test the lifetime of this token. 1. Check if session is set, if not -> return false 2. If session is set, check if session is still alive viaSaRMIServerCommand.isAlive(int)- Returns:
- if session is set and alive return true otherwise false
- Throws:
SaSystemException- System exception- See Also:
-
isRevisionEnabled
public boolean isRevisionEnabled(int mandant, String ddcName) throws SaSystemException, SaAuthenticationException Gets the information whether the provided ddc table contains the fields required for revisions.- Parameters:
mandant- mandant numberddcName- table/jcr workspace name- Returns:
- true, if the revision fields are present. False otherwise.
- Throws:
SaSystemException- SaRMICommandExceptionSaAuthenticationException- SaAuthenticationException- See Also:
-
loadSettings
Load settings from backend.- Parameters:
section- Section- Returns:
- Settings
- Throws:
SaSystemException- Exception
-
getRealDBName
returns the real database table name for a given DDC.- Parameters:
ddcName- DDC namefield- field namemandant- Mandant- Returns:
- Array of field description objects
- Throws:
SaSystemException- SaRMICommandException- See Also:
-
getSystemSetting
Retrieves a system setting object.- Parameters:
accessKey- key to get associated system setting- Returns:
SaSystemSetting- Throws:
SaSystemException- System exception
-
getSystemInfo
Reads system info.- Returns:
- System info
- Throws:
SaSystemException- System exception- See Also:
-
getFeatures
Read the features.- Returns:
- Features
- Throws:
SaSystemException- System exception- See Also:
-
getUserSetting
public final SaUserSetting getUserSetting(String accessKey) throws SaSystemException, SaAuthenticationException Retrieves a user setting object.- Parameters:
accessKey- key to get associated user setting- Returns:
SaUserSetting- Throws:
SaSystemException- System exceptionSaAuthenticationException- authentication exception
-
setUserSetting
public final void setUserSetting(SaUserSetting setting) throws SaSystemException, SaAuthenticationException Persists a user setting object.- Parameters:
setting- theSaUserSettingobject to be stored- Throws:
SaSystemException- System exceptionSaAuthenticationException- authentication exception
-
getSetting
public Setting getSetting(String name, String section, boolean isLong) throws SaSystemException, SaAuthenticationException Retrieves a setting from the database.- Parameters:
name- the setting's namesection- the setting's sectionisLong- whether this is a setting with a long (>2KB) value or not- Returns:
- the setting or null if no setting with the given key and section was found
- Throws:
SaSystemException- system error when retrieving the settingSaAuthenticationException- authentication error- See Also:
-
searchSettings
public SettingSearchResult searchSettings(SettingSearchInfo searchInfo) throws SaSystemException, SaAuthenticationException Searches for settings.- Parameters:
searchInfo-SettingSearchInfocontaining information about what to search- Returns:
- a
SettingSearchResult - Throws:
SaSystemException- system error when searchingSaAuthenticationException- authentication error- See Also:
-
setSetting
Persists a setting in the database.- Parameters:
setting- the setting to persist- Throws:
SaSystemException- system error when persisting the settingSaAuthenticationException- authenticatin error when persisting the setting- See Also:
-
deleteSetting
public boolean deleteSetting(String name, String section, boolean isLong) throws SaSystemException, SaAuthenticationException Deletes a setting in the database.- Parameters:
name- the name of the setting to deletesection- the section of the setting to deleteisLong- whether this is a setting with a long (>2KB) value or not- Returns:
- true if setting was deleted, false if there was no such setting
- Throws:
SaSystemException- system error when deleting the settingSaAuthenticationException- authentication error when deleting the setting- See Also:
-
setLocale
Set the locale for localization.- Parameters:
local- Locale- Throws:
SaSystemException- SaRMICommandExceptionSaAuthenticationException- SaAuthenticationException- See Also:
-
getMembers
Reads the member.- Returns:
- Member tree
- Throws:
SaSystemException- SaRMICommandExceptionSaAuthenticationException- SaAuthenticationException- See Also:
-
getMember
public WorkflowMember getMember(WorkflowMember member, int depth, String filter) throws SaSystemException, SaAuthenticationException Reads the member.- Parameters:
member- workflow member, which direct children have to be returned.depth- depth of the returned children.filter- filter for search, only matching members will be found, leave empty to get all members.- Returns:
- Member tree
- Throws:
SaSystemException- SaRMICommandExceptionSaAuthenticationException- SaAuthenticationException- See Also:
-
getSystemFiles
public List<String> getSystemFiles(SystemFileKind kind, String filter) throws SaSystemException, SaAuthenticationException Gets the system files of a specific kind.- Parameters:
kind- the kind of systemfiles to read.filter- A filter string. Only files will be returned, that match the filter. To get all systemfiles of a kind set filter to the empty string.- Returns:
- The system files of a specific kind.
- Throws:
SaSystemException- general errorSaAuthenticationException- error on the authentification / insufficient rights- See Also:
-
changePassword
public void changePassword(String user, String oldPassword, String client, String newPassword) throws SaAuthenticationException, SaSystemException Changes the password of an existing user. This has to be done before a call toSaRMIClientCommand.logon(Credentials)was successfully invoked.- Parameters:
user- The name of the user.oldPassword- The old password. This parameter is required, since the password should only be changed by the user himselfclient- The client of the actionsnewPassword- The new password- Throws:
SaAuthenticationExceptionSaSystemException- See Also:
-
getAuthorizedUsers
public List<UsersRights> getAuthorizedUsers(String hDoc, String rights, MatchKind match) throws SaAuthenticationException, SaSystemException Returns the users, that have specific rights on a document.- Parameters:
hDoc- The id of the document.rights- The rights the requested users should have.match- How the rights are matched: MKONEOF - find all users that have one of the specified rights MKEXACT - find all users that have exactly the specified rights MKATLEAST - find all users that have at least the specified rights- Returns:
- The users, that have specific rights on the document or null if the document has no acl set. In this case everyone has every right on the document.
- Throws:
SaAuthenticationExceptionSaSystemException- See Also:
-
getArchivedSize
Returns the total document size in archive.- Parameters:
hDoc- The document whichs size is wanted.- Returns:
- The total document size in archive.
- Throws:
SaAuthenticationExceptionSaSystemException- See Also:
-
storeSystemFile
public void storeSystemFile(SystemFileKind kind, String name, InputStream data) throws SaSystemException, SaAuthenticationException Stores a system file of a specific kind.- Parameters:
kind- The kind of systemfile to store.name- The name of the file. This has to be a filename without path and extension.data- The content of the file to save.- Throws:
SaSystemException- Remote exceptionSaAuthenticationException- Authentication error- See Also:
-
loadSystemFile
public InputStream loadSystemFile(SystemFileKind kind, String name) throws SaSystemException, SaAuthenticationException Loads a system file of a specific kind.- Parameters:
kind- The kind of system file to loadname- The name of the file to load.- Returns:
- an InputStream that holds the content of the file.
- Throws:
SaSystemException- general errorSaAuthenticationException- error on the authentification / insufficient rights- See Also:
-
getRMIVersion
Get the RMI interface version from java core server.- Throws:
SaSystemException- See Also:
-
resolveLatestHdoc
Resolves the hdoc of the latest version of the document identified by the given hdoc.- Parameters:
oldHdoc- the old hdoc- Returns:
- the hdoc of the latest version of the document identified by the given hdoc.
- Throws:
SaSystemException- the system error exceptionSaAuthenticationException- the authentication error exception- See Also:
-
invoke
public <T extends Serializable> T invoke(com.lexmark.saperion.remote.common.operations.Operation<T, SaBasicException, throws SaSystemException, SaAuthenticationExceptionLegacyConnection> operation) This method invokes aOperationon the backend.- Type Parameters:
T- The return type- Parameters:
operation- The operation to invoke- Returns:
- The result of the invocation
- Throws:
SaSystemExceptionSaAuthenticationException- See Also:
-
newInvoke
public <ResultType extends Serializable,ExceptionType extends com.lexmark.saperion.exceptions.EcmException> ResultType newInvoke(com.lexmark.saperion.remote.common.operations.EcmOperation<ResultType, ExceptionType> operation) throws SaSystemException, SaAuthenticationExceptionDescription copied from interface:SaRMIClientCommandThis method invokes aEcmOperationin the backend.- Parameters:
operation- the operation to invoke- Returns:
- the result of the operation
- Throws:
SaSystemExceptionSaAuthenticationException
-
sendBarcode
public void sendBarcode(String indexMask, String docUid, String contentRep, String sid, String docType, String value, int mandant) throws SaSystemException, SaAuthenticationException Send barcode to SAP.- Parameters:
indexMask- Index mask namedocUid- Document UIDcontentRep- SAP Content repositorysid- SAP IDdocType- Document typevalue- Valuemandant- Mandant name- Throws:
SaSystemException- when a system error occuredSaAuthenticationException- when the user is not logged in or has insufficient rights- See Also:
-
getServerInfos
Returns a list of objects describing the servers this connector is connected to.- Returns:
- set of
SaRMIServerInfo - See Also:
-
getLicenseCount
Read the licence count for the given user.- Parameters:
type- Client type- Returns:
- License count
- Throws:
SaSystemException- Error on the saperion system- See Also:
-
setUsedLicense
Set the count of used licenses.- Parameters:
type- Client typecount- Number of licenses- Returns:
- True, if success
- Throws:
SaSystemException- Error on the saperion system- See Also:
-
setEventsEnabled
Description copied from interface:SaRMIClientCommandSets whether events (e.g. for the IS) should be enabled for the current session.- Parameters:
enabled- true, if events should be enabled, otherwise false.- Throws:
SaSystemException- when a system error occured.SaAuthenticationException- when the user is not logged in or has insufficient rights.
-
getEventsEnabled
Description copied from interface:SaRMIClientCommandReturns whether events (e.g. for the IS) are enabled for the current session.- Returns:
- true, if events are enabled, otherwise false.
- Throws:
SaSystemException- when a system error occured.SaAuthenticationException- when the user is not logged in or has insufficient rights.
-
getDDC
Description copied from interface:SaRMIClientCommandReturns information about the specified DDC.- Parameters:
ddcName- the name of the DDC- Returns:
- DDC information
- Throws:
SaSystemException- system error when retrieving information about requested DDCSaAuthenticationException- authentication exception when retrieving information about requested DDC
-
getFullTextFields
public Set<Map.Entry<String,String>> getFullTextFields(String ddcName, List<String> fullTextFields, String hdoc) throws SaSystemException - Parameters:
ddcName- name of the DDCfullTextFields- List of Fields which are of Text retrieval type. Make sure to prefixSaConstants.FULL_TEXT_COLUMN_PREFIXhdoc- hdoc of the document- Returns:
- Set of entries containing full text coulmn and corresponding value
- Throws:
SaSystemException
-
getCurrentUserRole
public com.lexmark.saperion.administration.RoleType getCurrentUserRole() throws SaSystemException, SaAuthenticationException- Returns:
- the effective role (combined rights of all roles / profiles) of the current logged-in user
- Throws:
SaSystemExceptionSaAuthenticationException- See Also:
-