Package com.thortech.xl.ejb.beansimpl
Class tcImportOperationsBean
java.lang.Object
Thor.API.Base.tcBaseUtility
com.thortech.xl.ejb.beansimpl.tcImportOperationsBean
- All Implemented Interfaces:
com.thortech.xl.dataobj.tcErrorReceiver
,com.thortech.xl.orb.api.operations._tcUtilityIntfOperations
,com.thortech.xl.server.tcOrbServerObject
,Serializable
,javax.ejb.EnterpriseBean
,javax.ejb.SessionBean
,tcUtilityOperationsIntf
,tcImportOperationsIntf
public class tcImportOperationsBean
extends tcBaseUtility
implements javax.ejb.SessionBean, tcImportOperationsIntf
Server-side API class for Imports using Deployment Manager
The APIs will be called in following order:
- acquireLock(true) : Acquires Lock
- addXMLFile(xmlFileName, fileContents) : Get collection to pass to performImport API
- performImport(collection) : Performs import with collection returned by addXMLFile API
- Author:
- evandana
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class Thor.API.Base.tcBaseUtility
tcBaseUtility.Entities
-
Field Summary
Fields inherited from class Thor.API.Base.tcBaseUtility
ALL_ATTR_OB, DATE_FORMAT_SYS_PROP, DEFAULT_DATE_PATTERN, DEFAULT_LOCALE, DISPLAYNAME, FIRSTNAME, LASTNAME, LKU_GROUP, MANAGERKEY, OBJECTCLASS_COL_CODE, ORG_NAME, ORGANIZATION_KEY_COL_CODE, ORGANIZATION_NAME_COL_CODE, ORGANIZATION_PARENT_KEY_COL_CODE, ORGANIZATION_PARENT_NAME_COL_CODE, ORGKEY, ORGNAME, PARENTORGNAME, ROLE_KEY_COL_CODE, ROLE_NAME_COL_CODE, STATUS, USER_ENTITY, USER_MANAGEMENT, USERID, USERKEY, USR_DEFINED_COLUMN_CONSTANT, USR_KEY_COL_CODE, USR_MANAGER_DISPLAY_NAME_COL_CODE, USR_MANAGER_DISPLAY_NAME_LABEL, USR_MANAGER_FIRST_NAME_COL_CODE, USR_MANAGER_FIRST_NAME_COLUMN, USR_MANAGER_FIRST_NAME_LABEL, USR_MANAGER_KEY_COL_CODE, USR_MANAGER_LAST_NAME_COL_CODE, USR_MANAGER_LAST_NAME_COLUMN, USR_MANAGER_LAST_NAME_LABEL, USR_MANAGER_LOGIN_COL_CODE, USR_MANAGER_LOGIN_COLUMN, USR_MANAGER_LOGIN_LABEL
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
acquireLock
(boolean forcedAcquisition) Try to acquire the lockAll the RootObjects which are being calculated for deletion are to be populated.Add the file previewed before into the files to be imported.void
addSubstitution
(RootObject robj, String name) Create a substitutions for a given root object.addXMLFile
(String filename, String content) Add a new XML File to import some more objects in the current session.addXMLFile
(String filename, String content, boolean importReview) Add a new XML File to import some more objects in the current session.addXMLFile
(String filename, String content, String objectSkip) addXMLFile
(String filename, String content, String objectSkip, boolean importReview) checkTasks
(TaskObject pt) It checks the dependency tasks to be available if a task is being imported/deleted.void
close()
This method will clean up all resources associated with this object.void
Throw an exception and don't activatevoid
create a session bean and try to acquire the lock.void
Passivate the ebjbvoid
Remove the EJB and release the lockReturn IT Resource typeReturn Collection which contains IT Resource type parametersReturns a collection of RootObjects which are present in the connector XML file to be imported of a particular entity type.Return information about the current owner of the lockRetrieve list of files currently added for importgetFilePreview
(String filename, String content) Get the preview of a file.Get the import plan of selected objects.getImportView
(Collection col) Get the import view.getMissingDependencies
(Collection selection, String type) Return list of missing dependencies.Returns Collection of TaskObjects containing details of all the process tasks to be taken care of during importgetSourceTree
(RootObject root) Return the object as it appeared in the source database.get the current substitutionsboolean
Check to see if we have the lockReturn a list of root objects that allow substitions, and are dependencies to the objects passed as collection.void
performImport
(Collection col) Perform the actual import operation on the selected objects.void
populateChildren
(Collection oldObjects) Populates the name value pairs to be saved to export this dependency.removeFiles
(Collection filenames) Removes the selected XML Files and recomputes what is going to happen.void
removeSubstitution
(RootObject robj) Remove substitutions for a given root objectretrieveChildren
(Collection objects) Returns collection of RootObjects whose children need to be populated.void
The TaskObject contain the details of a process Task which needs to be updated to check if it needs to be deleted/Importedvoid
Validate the imported Process Form and throw an exception if any of the new imported SDH_CHILD_VERSION is older than the current versionvoid
validateSDHChildVersion
(String new_sdh_child_version, String new_sdh_child_key_form) Validate the FormHiearchy SDH child version and throw an exception if the new SDH_CHILD_VERSION is older than the current active versionMethods inherited from class Thor.API.Base.tcBaseUtility
addError, addErrorReceiver, addReject, clearErrors, getDataBase, getDefaultLocaleCode, getEJBContext, getErrors, getMap, getMapping, getName, getQueryFilter, getRejections, getSessionContext, getUnAuthorizedTargetFieldSet, removeErrorReceiver, removeInstance, setCountry, setLanguage, setSessionContext, setVariant
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface javax.ejb.SessionBean
setSessionContext
Methods inherited from interface Thor.API.Base.tcUtilityOperationsIntf
getName, setCountry, setLanguage, setVariant
-
Constructor Details
-
tcImportOperationsBean
public tcImportOperationsBean()
-
-
Method Details
-
ejbCreate
public void ejbCreate() throws DDMException, javax.ejb.CreateException, SQLException, NamingExceptioncreate a session bean and try to acquire the lock.- Throws:
UnableToAcquireLock
- if some other import is in progressDDMException
- General Deployment Manager errorsSQLException
- General database errorsNamingException
- When the database cannot be lookedupjavax.ejb.CreateException
-
close
public void close()This method will clean up all resources associated with this object. Called when it will no longer be used.- Specified by:
close
in interfacetcUtilityOperationsIntf
- Overrides:
close
in classtcBaseUtility
-
ejbRemove
Remove the EJB and release the lock- Specified by:
ejbRemove
in interfacejavax.ejb.SessionBean
- Overrides:
ejbRemove
in classtcBaseUtility
- Throws:
javax.ejb.EJBException
- Thrown if the instance could not perform the function requested by the container because of an system-level error.RemoteException
-
ejbPassivate
Passivate the ebjb- Specified by:
ejbPassivate
in interfacejavax.ejb.SessionBean
- Overrides:
ejbPassivate
in classtcBaseUtility
- Throws:
javax.ejb.EJBException
- Thrown if the instance could not perform the function requested by the container because of an system-level error.RemoteException
-
ejbActivate
Throw an exception and don't activate- Specified by:
ejbActivate
in interfacejavax.ejb.SessionBean
- Overrides:
ejbActivate
in classtcBaseUtility
- Throws:
javax.ejb.EJBException
- Thrown if the instance could not perform the function requested by the container because of an system-level error.RemoteException
-
isLockAcquired
public boolean isLockAcquired()Check to see if we have the lock- Specified by:
isLockAcquired
in interfacetcImportOperationsIntf
- Returns:
- Did the current bean have the lock
-
getCurrentLockInfo
Return information about the current owner of the lock- Specified by:
getCurrentLockInfo
in interfacetcImportOperationsIntf
- Returns:
-
acquireLock
public void acquireLock(boolean forcedAcquisition) throws SQLException, NamingException, DDMException Try to acquire the lock- Specified by:
acquireLock
in interfacetcImportOperationsIntf
- Parameters:
forcedAcquisition
- True, if lock must be acquired regardless of another import in progress- Throws:
SQLException
NamingException
UnableToAcquireLock
DDMException
-
addXMLFile
public Collection<RootObject> addXMLFile(String filename, String content, boolean importReview) throws DDMException, TransformationException Add a new XML File to import some more objects in the current session.- Specified by:
addXMLFile
in interfacetcImportOperationsIntf
- Parameters:
filename
- Filename of the file being imported. For tracking purposes.content
- Content of the file to be imported.- Throws:
DDMException
- Generic deployment manager errorSQLException
- Generic database errorTransformationException
- Input file version is different from the current version and transformation of the data to current version failed.
-
addXMLFile
public Collection<RootObject> addXMLFile(String filename, String content) throws DDMException, TransformationException Description copied from interface:tcImportOperationsIntf
Add a new XML File to import some more objects in the current session.- Specified by:
addXMLFile
in interfacetcImportOperationsIntf
- Parameters:
filename
- Filename of the file being imported. For tracking purposes.content
- Content of the file to be imported.- Returns:
- List of objects after adding xml file as a flat list
- Throws:
DDMException
TransformationException
-
addXMLFile
public Collection<RootObject> addXMLFile(String filename, String content, String objectSkip) throws DDMException, TransformationException - Specified by:
addXMLFile
in interfacetcImportOperationsIntf
- Throws:
DDMException
TransformationException
-
addXMLFile
public Collection<RootObject> addXMLFile(String filename, String content, String objectSkip, boolean importReview) throws DDMException, TransformationException - Throws:
DDMException
TransformationException
-
removeFiles
public Collection<RootObject> removeFiles(Collection filenames) throws DDMException, TransformationException Removes the selected XML Files and recomputes what is going to happen. Very expensive call in terms of computation.- Specified by:
removeFiles
in interfacetcImportOperationsIntf
- Parameters:
filenames
- Files to be removed- Returns:
- List of objects found in the remaining files as a flat list
- Throws:
DDMException
- Generic Deployment error during mergingSQLException
- Generic database error during mergingTransformationException
- Input versions cannot be transformed to current version
-
getFilePreview
public FilePreview getFilePreview(String filename, String content) throws DDMException, TransformationException Get the preview of a file. File name, who exported it, source database etc- Specified by:
getFilePreview
in interfacetcImportOperationsIntf
- Returns:
- Throws:
TransformationException
- Transformation of the file failedDDMException
- Generic deployment manager exception
-
getFileList
Retrieve list of files currently added for import- Specified by:
getFileList
in interfacetcImportOperationsIntf
- Returns:
- Return list of files being imported. Contains the FilePreview objects.
- Throws:
DDMException
-
addLastPreviewedFile
Add the file previewed before into the files to be imported.- Specified by:
addLastPreviewedFile
in interfacetcImportOperationsIntf
- Returns:
- List of objects found in the file just added
- Throws:
DDMException
-
getSourceTree
Return the object as it appeared in the source database. This includes all the parents and all the childs of the selected object- Parameters:
root
- Object for which source tree is needed- Returns:
- Tree containing all the objects in the source tree
- Throws:
DDMException
-
getImportMessages
Get the import plan of selected objects. This will give any warnings, errors and other information For example: what is going to happen, any missing dependencies etc. Map contains the RootObject as the key and the a collection of ImportMessage as value.- Specified by:
getImportMessages
in interfacetcImportOperationsIntf
- Parameters:
col
-- Returns:
- Return import plan
- Throws:
DDMException
-
getImportView
Get the import view. This is to be used by the webclient to get the information to be displayed.- Specified by:
getImportView
in interfacetcImportOperationsIntf
- Parameters:
Col
- (Collection of root objects)- Returns:
- Throws:
DDMException
-
listPossibleSubstitutions
Return a list of root objects that allow substitions, and are dependencies to the objects passed as collection. This is primarily used by webclient.- Specified by:
listPossibleSubstitutions
in interfacetcImportOperationsIntf
- Parameters:
col
- collection of objects for which substitutions can be made- Returns:
- substitutable dependencies
- Throws:
DDMException
- Deployment Error
-
findITResourceType
Description copied from interface:tcImportOperationsIntf
Return IT Resource type- Specified by:
findITResourceType
in interfacetcImportOperationsIntf
- Parameters:
RootObject
- obj- Returns:
- RootObject IT Resource Type
- Throws:
DDMException
- Deployment ErrorSQLException
- SQL Error
-
findITResourceTypeParams
Description copied from interface:tcImportOperationsIntf
Return Collection which contains IT Resource type parameters- Specified by:
findITResourceTypeParams
in interfacetcImportOperationsIntf
- Parameters:
RootObject
- obj- Returns:
- Collection IT Resource Parameters
- Throws:
DDMException
- Deployment ErrorSQLException
- SQL Error
-
addSubstitution
Create a substitutions for a given root object. Basically Deployment uses the new name provided instead of the old name contained in the exported files. Useful when the names are different in development and staging and production machines.- Specified by:
addSubstitution
in interfacetcImportOperationsIntf
- Parameters:
robj
-name
-- Throws:
DDMException
SQLException
-
removeSubstitution
Remove substitutions for a given root object- Specified by:
removeSubstitution
in interfacetcImportOperationsIntf
- Parameters:
robj
-- Throws:
DDMException
-
getSubstitutions
get the current substitutions- Specified by:
getSubstitutions
in interfacetcImportOperationsIntf
- Returns:
- current substitutions - Keys in the map are RootObjects and values are the new names.
- Throws:
DDMException
-
performImport
Perform the actual import operation on the selected objects.- Specified by:
performImport
in interfacetcImportOperationsIntf
- Parameters:
col
- Collection of root objects- Throws:
NamingException
DDMException
- General ExceptiontcBulkException
-
getMissingDependencies
Return list of missing dependencies. Find all the missing dependencies of the given selection. If a type is provided dependencies of that type are returned. The type specified here is the physical type and not logical type. I.e. Form implies both types of forms.- Specified by:
getMissingDependencies
in interfacetcImportOperationsIntf
- Parameters:
selection
- List of objects selected for importtype
- Type of the objects interested in.- Returns:
- List of missing dependencies. Collection contains objects of type RootObject.
- Throws:
DDMException
- General Exception
-
addConnectorPreviewedFile
public Collection addConnectorPreviewedFile(Collection col) throws DDMException, UnableToAcquireLock All the RootObjects which are being calculated for deletion are to be populated.- Specified by:
addConnectorPreviewedFile
in interfacetcImportOperationsIntf
- Parameters:
col
- List of all root objects present in only old connector version.- Returns:
- Collection of all RootObjects which are present only in the Old connector version
- Throws:
DDMException
UnableToAcquireLock
- Since:
- 11.1.1.4.0
-
getConnectorRootObjects
Returns a collection of RootObjects which are present in the connector XML file to be imported of a particular entity type.- Specified by:
getConnectorRootObjects
in interfacetcImportOperationsIntf
- Parameters:
type
- connector object types retrieved from the xml file- Returns:
- Collection of RootObjects which are present in the connector XML file to be imported
- Throws:
UnableToAcquireLock
DDMException
- Generic deployment manager exception- Since:
- 11.1.1.4.0
-
populateChildren
public void populateChildren(Collection oldObjects) throws DDMException, TransformationException, UnableToAcquireLock Populates the name value pairs to be saved to export this dependency. These name value pairs will later be used to resolve the dependency during the import.- Specified by:
populateChildren
in interfacetcImportOperationsIntf
- Parameters:
oldObjects
- collection of Objects to be deleted , so the deletion when triggered deleted the whole tree starting from the leaf.- Throws:
TransformationException
- Transformation of the file failedDDMException
- Generic deployment manager exceptionUnableToAcquireLock
- Since:
- 11.1.1.4.0
-
getProcessTasks
public Collection getProcessTasks(Collection col) throws DDMException, TransformationException, UnableToAcquireLock Returns Collection of TaskObjects containing details of all the process tasks to be taken care of during import- Specified by:
getProcessTasks
in interfacetcImportOperationsIntf
- Parameters:
col
- List of Collection of TaskObjects containing details of all the process tasks- Returns:
- Collection of TaskObjects containing details of all the process tasks
- Throws:
TransformationException
- Transformation of the file failedDDMException
- Generic deployment manager exceptionUnableToAcquireLock
- Since:
- 11.1.1.4.0
-
updateTasks
public void updateTasks(TaskObject pt) throws DDMException, TransformationException, UnableToAcquireLock The TaskObject contain the details of a process Task which needs to be updated to check if it needs to be deleted/Imported- Specified by:
updateTasks
in interfacetcImportOperationsIntf
- Parameters:
pt
- TaskObject contain the details of a process Task to be updated- Throws:
TransformationException
- Transformation of the file failedDDMException
- Generic deployment manager exceptionUnableToAcquireLock
- Since:
- 11.1.1.4.0
-
retrieveChildren
Returns collection of RootObjects whose children need to be populated.- Specified by:
retrieveChildren
in interfacetcImportOperationsIntf
- Parameters:
objects
- Collection of RootObjects- Returns:
- collection is of the RootObjects whose children need to be populated.
- Throws:
DDMException
- Since:
- 11.1.1.4.0
-
checkTasks
It checks the dependency tasks to be available if a task is being imported/deleted.- Specified by:
checkTasks
in interfacetcImportOperationsIntf
- Parameters:
pt
- TaskObject containing the dependent tasks- Returns:
- Error Code
- Throws:
TransformationException
- Transformation of the file failedDDMException
- Generic deployment manager exception- Since:
- 11.1.1.4.0
-
validateImportedProcessForm
Validate the imported Process Form and throw an exception if any of the new imported SDH_CHILD_VERSION is older than the current version- Parameters:
doc
-- Throws:
DDMException
-
validateSDHChildVersion
public void validateSDHChildVersion(String new_sdh_child_version, String new_sdh_child_key_form) throws DDMException Validate the FormHiearchy SDH child version and throw an exception if the new SDH_CHILD_VERSION is older than the current active version- Parameters:
new_sdh_child_version
-new_sdh_child_key_form
-- Throws:
DDMException
-