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 TypeMethodDescriptionvoidacquireLock(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.voidaddSubstitution(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.voidclose()This method will clean up all resources associated with this object.voidThrow an exception and don't activatevoidcreate a session bean and try to acquire the lock.voidPassivate the ebjbvoidRemove 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 substitutionsbooleanCheck to see if we have the lockReturn a list of root objects that allow substitions, and are dependencies to the objects passed as collection.voidperformImport(Collection col) Perform the actual import operation on the selected objects.voidpopulateChildren(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.voidremoveSubstitution(RootObject robj) Remove substitutions for a given root objectretrieveChildren(Collection objects) Returns collection of RootObjects whose children need to be populated.voidThe TaskObject contain the details of a process Task which needs to be updated to check if it needs to be deleted/ImportedvoidValidate the imported Process Form and throw an exception if any of the new imported SDH_CHILD_VERSION is older than the current versionvoidvalidateSDHChildVersion(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, setVariantMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javax.ejb.SessionBean
setSessionContextMethods 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:
closein interfacetcUtilityOperationsIntf- Overrides:
closein classtcBaseUtility
-
ejbRemove
Remove the EJB and release the lock- Specified by:
ejbRemovein interfacejavax.ejb.SessionBean- Overrides:
ejbRemovein 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:
ejbPassivatein interfacejavax.ejb.SessionBean- Overrides:
ejbPassivatein 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:
ejbActivatein interfacejavax.ejb.SessionBean- Overrides:
ejbActivatein 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:
isLockAcquiredin interfacetcImportOperationsIntf- Returns:
- Did the current bean have the lock
-
getCurrentLockInfo
Return information about the current owner of the lock- Specified by:
getCurrentLockInfoin interfacetcImportOperationsIntf- Returns:
-
acquireLock
public void acquireLock(boolean forcedAcquisition) throws SQLException, NamingException, DDMException Try to acquire the lock- Specified by:
acquireLockin interfacetcImportOperationsIntf- Parameters:
forcedAcquisition- True, if lock must be acquired regardless of another import in progress- Throws:
SQLExceptionNamingExceptionUnableToAcquireLockDDMException
-
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:
addXMLFilein 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:tcImportOperationsIntfAdd a new XML File to import some more objects in the current session.- Specified by:
addXMLFilein 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:
DDMExceptionTransformationException
-
addXMLFile
public Collection<RootObject> addXMLFile(String filename, String content, String objectSkip) throws DDMException, TransformationException - Specified by:
addXMLFilein interfacetcImportOperationsIntf- Throws:
DDMExceptionTransformationException
-
addXMLFile
public Collection<RootObject> addXMLFile(String filename, String content, String objectSkip, boolean importReview) throws DDMException, TransformationException - Throws:
DDMExceptionTransformationException
-
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:
removeFilesin 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:
getFilePreviewin interfacetcImportOperationsIntf- Returns:
- Throws:
TransformationException- Transformation of the file failedDDMException- Generic deployment manager exception
-
getFileList
Retrieve list of files currently added for import- Specified by:
getFileListin 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:
addLastPreviewedFilein 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:
getImportMessagesin 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:
getImportViewin 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:
listPossibleSubstitutionsin interfacetcImportOperationsIntf- Parameters:
col- collection of objects for which substitutions can be made- Returns:
- substitutable dependencies
- Throws:
DDMException- Deployment Error
-
findITResourceType
Description copied from interface:tcImportOperationsIntfReturn IT Resource type- Specified by:
findITResourceTypein interfacetcImportOperationsIntf- Parameters:
RootObject- obj- Returns:
- RootObject IT Resource Type
- Throws:
DDMException- Deployment ErrorSQLException- SQL Error
-
findITResourceTypeParams
Description copied from interface:tcImportOperationsIntfReturn Collection which contains IT Resource type parameters- Specified by:
findITResourceTypeParamsin 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:
addSubstitutionin interfacetcImportOperationsIntf- Parameters:
robj-name-- Throws:
DDMExceptionSQLException
-
removeSubstitution
Remove substitutions for a given root object- Specified by:
removeSubstitutionin interfacetcImportOperationsIntf- Parameters:
robj-- Throws:
DDMException
-
getSubstitutions
get the current substitutions- Specified by:
getSubstitutionsin 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:
performImportin interfacetcImportOperationsIntf- Parameters:
col- Collection of root objects- Throws:
NamingExceptionDDMException- 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:
getMissingDependenciesin 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:
addConnectorPreviewedFilein 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:
DDMExceptionUnableToAcquireLock- 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:
getConnectorRootObjectsin 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:
UnableToAcquireLockDDMException- 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:
populateChildrenin 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:
getProcessTasksin 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:
updateTasksin 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:
retrieveChildrenin 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:
checkTasksin 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
-