it.eng.spagobi.tools.importexport
Class ImportManager

java.lang.Object
  extended by it.eng.spagobi.commons.dao.AbstractHibernateDAO
      extended by it.eng.spagobi.tools.importexport.ImportManager
All Implemented Interfaces:
IImportManager, java.io.Serializable

public class ImportManager
extends AbstractHibernateDAO
implements IImportManager, java.io.Serializable

Implements the interface which defines methods for managing the import requests

See Also:
Serialized Form

Field Summary
static java.lang.String messageBundle
           
 
Fields inherited from class it.eng.spagobi.commons.dao.AbstractHibernateDAO
TENANT_FILTER_NAME
 
Fields inherited from interface it.eng.spagobi.tools.importexport.IImportManager
IMPORT_ASS_DEFAULT_MODE, IMPORT_ASS_PREDEFINED_MODE
 
Constructor Summary
ImportManager()
           
 
Method Summary
 boolean associateAllExportedDataSourcesByUserAssociation()
          Tries to associate all exported data sources using the user associations; returns true is some data sources associations is required, false otherwise.
 boolean associateAllExportedEnginesByUserAssociation()
          Tries to associate all exported engines using the user associations; returns true is some engines associations is required, false otherwise.
 boolean associateAllExportedRolesByUserAssociation()
          Tries to associate all exported roles using the user associations; returns true is some roles associations is required, false otherwise.
 void checkExistingMetadata()
          Check the existance of the exported metadata into the current system metadata and insert their associations into the association object MeatadataAssociation.
 void checkRoleReferences(java.util.Map roleAssociations)
          checks if two or more exported roles are associate to the same current role.
 void closeSession()
          Close session to exported and current databases.
 ImportResultInfo commitAllChanges()
          Commits all changes made on exported and current databases.
 void deleteOldParametersUse(java.lang.Integer existingParId, java.lang.Integer exportParId, java.util.List sbiExistingParuses, java.util.List sbiExpParuses, org.hibernate.Session currSessDB)
          Handle already present parameter's paruse if a paruse is not present between exported delete
 AssociationFile getAssociationFile()
          Returns the AssociationFile involved in the current import operation, if any.
 java.lang.String getCurrentVersion()
          Gets the current SpagobI version.
 java.lang.Object getExistingObject(java.lang.Integer id, java.lang.Class objClass)
          Get an existing object identified by the id and the class.
 java.util.List getExportedDataSources()
          Gets the list of exported data sources.
 java.util.List getExportedEngines()
          Gets the list of all exported engines.
 java.lang.Object getExportedObject(java.lang.Integer id, java.lang.Class objClass)
          Get an exported object identified by the id and the class.
 java.util.List getExportedRoles()
          Gets the list of all exported roles.
 java.lang.String getExportVersion()
          Gets the SpagoBI version of the exported file.
 java.lang.String getImpAssMode()
          Gets the import association mode.
 MetadataAssociations getMetadataAssociation()
          Gets the object which contains the association between exported metadata and the current system metadata.
 UserAssociationsKeeper getUserAssociation()
          Gets the object which contains only the association set by user between exported metadata and the current system metadata.
 void importObjects(boolean overwrite)
          Imports the exported objects.
 void init(java.lang.String pathImpTmpFold, java.lang.String archiveName, byte[] archiveContent)
          Prepare the environment for the import procedure.
 void openSession()
          Open session to exported and current databases.
 void setAssociationFile(AssociationFile associationFile)
          Sets the AssociationFile involved in the current import operation.
 void setImpAssMode(java.lang.String impAssMode)
          Sets the import association mode.
 void stopImport()
          Ends the import procedure.
 void updateDataSourceReferences(java.util.Map mapDataSources)
          Update the data source name for each list of values of type query based on association between exported data sources and current system data sources.
 void updateExistingObjParUse(java.lang.Integer existingObjectId)
          check existing correlation: correlation must be mantained if the filter column is still present in the LOV columns
 
Methods inherited from class it.eng.spagobi.commons.dao.AbstractHibernateDAO
commitIfActiveAndClose, disableTenantFilter, enableTenantFilter, getSession, getTenant, getUserProfile, logException, rollbackIfActiveAndClose, setTenant, setUserID, setUserProfile, updateSbiCommonInfo4Insert, updateSbiCommonInfo4Update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface it.eng.spagobi.tools.importexport.IImportManager
setUserProfile
 

Field Detail

messageBundle

public static final java.lang.String messageBundle
See Also:
Constant Field Values
Constructor Detail

ImportManager

public ImportManager()
Method Detail

init

public void init(java.lang.String pathImpTmpFold,
                 java.lang.String archiveName,
                 byte[] archiveContent)
          throws it.eng.spago.error.EMFUserError
Prepare the environment for the import procedure.

Specified by:
init in interface IImportManager
Parameters:
pathImpTmpFold - The path of the temporary import folder
archiveName - the name of the compress exported file
archiveContent - the bytes of the compress exported file
Throws:
it.eng.spago.error.EMFUserError - the EMF user error

openSession

public void openSession()
                 throws it.eng.spago.error.EMFUserError
Description copied from interface: IImportManager
Open session to exported and current databases. This method must be invoked before any operation.

Specified by:
openSession in interface IImportManager
Throws:
it.eng.spago.error.EMFUserError - the EMF user error

closeSession

public void closeSession()
Description copied from interface: IImportManager
Close session to exported and current databases. This method must be invoked when all needed operation are performed.

Specified by:
closeSession in interface IImportManager

importObjects

public void importObjects(boolean overwrite)
                   throws it.eng.spago.error.EMFUserError
Imports the exported objects.

Specified by:
importObjects in interface IImportManager
Parameters:
overwrite - the overwrite
Throws:
it.eng.spago.error.EMFUserError - the EMF user error

getExportVersion

public java.lang.String getExportVersion()
Gets the SpagoBI version of the exported file.

Specified by:
getExportVersion in interface IImportManager
Returns:
The SpagoBI version of the exported file

getCurrentVersion

public java.lang.String getCurrentVersion()
Gets the current SpagobI version.

Specified by:
getCurrentVersion in interface IImportManager
Returns:
The current SpagoBI version

getExportedRoles

public java.util.List getExportedRoles()
                                throws it.eng.spago.error.EMFUserError
Gets the list of all exported roles.

Specified by:
getExportedRoles in interface IImportManager
Returns:
The list of exported roles
Throws:
it.eng.spago.error.EMFUserError - the EMF user error

getExportedEngines

public java.util.List getExportedEngines()
                                  throws it.eng.spago.error.EMFUserError
Gets the list of all exported engines.

Specified by:
getExportedEngines in interface IImportManager
Returns:
The list of exported engines
Throws:
it.eng.spago.error.EMFUserError - the EMF user error

checkRoleReferences

public void checkRoleReferences(java.util.Map roleAssociations)
                         throws it.eng.spago.error.EMFUserError
checks if two or more exported roles are associate to the same current role.

Specified by:
checkRoleReferences in interface IImportManager
Parameters:
roleAssociations - Map of assocaition between exported roles and roles of the portal in use
Throws:
it.eng.spago.error.EMFUserError - if two ore more exported roles are associate to the same current role

updateDataSourceReferences

public void updateDataSourceReferences(java.util.Map mapDataSources)
                                throws it.eng.spago.error.EMFUserError
Update the data source name for each list of values of type query based on association between exported data sources and current system data sources.

Parameters:
mapDataSources - Map of the associations between exported data sources and current system data sources
Throws:
it.eng.spago.error.EMFUserError - the EMF user error

commitAllChanges

public ImportResultInfo commitAllChanges()
                                  throws it.eng.spago.error.EMFUserError
Commits all changes made on exported and current databases.

Specified by:
commitAllChanges in interface IImportManager
Returns:
the import result info
Throws:
it.eng.spago.error.EMFUserError - the EMF user error

deleteOldParametersUse

public void deleteOldParametersUse(java.lang.Integer existingParId,
                                   java.lang.Integer exportParId,
                                   java.util.List sbiExistingParuses,
                                   java.util.List sbiExpParuses,
                                   org.hibernate.Session currSessDB)
                            throws it.eng.spago.error.EMFUserError
Handle already present parameter's paruse if a paruse is not present between exported delete

Throws:
it.eng.spago.error.EMFUserError

updateExistingObjParUse

public void updateExistingObjParUse(java.lang.Integer existingObjectId)
                             throws it.eng.spago.error.EMFUserError
check existing correlation: correlation must be mantained if the filter column is still present in the LOV columns

Parameters:
existingParId -
exportParId -
sbiExistingParuses -
sbiExpParuses -
Throws:
it.eng.spago.error.EMFUserError

stopImport

public void stopImport()
Ends the import procedure.

Specified by:
stopImport in interface IImportManager

getExportedDataSources

public java.util.List getExportedDataSources()
                                      throws it.eng.spago.error.EMFUserError
Gets the list of exported data sources.

Specified by:
getExportedDataSources in interface IImportManager
Returns:
List of the exported data sources
Throws:
it.eng.spago.error.EMFUserError - the EMF user error

checkExistingMetadata

public void checkExistingMetadata()
                           throws it.eng.spago.error.EMFUserError
Check the existance of the exported metadata into the current system metadata and insert their associations into the association object MeatadataAssociation.

Specified by:
checkExistingMetadata in interface IImportManager
Throws:
it.eng.spago.error.EMFUserError - the EMF user error

getMetadataAssociation

public MetadataAssociations getMetadataAssociation()
Gets the object which contains the association between exported metadata and the current system metadata.

Specified by:
getMetadataAssociation in interface IImportManager
Returns:
MetadataAssociation the object which contains the association between exported metadata and the current system metadata

getExistingObject

public java.lang.Object getExistingObject(java.lang.Integer id,
                                          java.lang.Class objClass)
Description copied from interface: IImportManager
Get an existing object identified by the id and the class.

Specified by:
getExistingObject in interface IImportManager
Parameters:
id - The Object id
objClass - The class of the object
Returns:
The existing hibernate object

getExportedObject

public java.lang.Object getExportedObject(java.lang.Integer id,
                                          java.lang.Class objClass)
Description copied from interface: IImportManager
Get an exported object identified by the id and the class.

Specified by:
getExportedObject in interface IImportManager
Parameters:
id - The Object id
objClass - The class of the object
Returns:
The existing hibernate object

getUserAssociation

public UserAssociationsKeeper getUserAssociation()
Description copied from interface: IImportManager
Gets the object which contains only the association set by user between exported metadata and the current system metadata.

Specified by:
getUserAssociation in interface IImportManager
Returns:
MetadataAssociation the object which contains the association, set by user, between exported metadata and the current system metadata

getImpAssMode

public java.lang.String getImpAssMode()
Description copied from interface: IImportManager
Gets the import association mode.

Specified by:
getImpAssMode in interface IImportManager
Returns:
the association mode

setImpAssMode

public void setImpAssMode(java.lang.String impAssMode)
Description copied from interface: IImportManager
Sets the import association mode.

Specified by:
setImpAssMode in interface IImportManager
Parameters:
impAssMode - The import association mode

getAssociationFile

public AssociationFile getAssociationFile()
Description copied from interface: IImportManager
Returns the AssociationFile involved in the current import operation, if any.

Specified by:
getAssociationFile in interface IImportManager
Returns:
the AssociationFile involved in the current import operation, if any

setAssociationFile

public void setAssociationFile(AssociationFile associationFile)
Description copied from interface: IImportManager
Sets the AssociationFile involved in the current import operation.

Specified by:
setAssociationFile in interface IImportManager
Parameters:
associationFile - the association file

associateAllExportedRolesByUserAssociation

public boolean associateAllExportedRolesByUserAssociation()
                                                   throws it.eng.spago.error.EMFUserError
Description copied from interface: IImportManager
Tries to associate all exported roles using the user associations; returns true is some roles associations is required, false otherwise.

Specified by:
associateAllExportedRolesByUserAssociation in interface IImportManager
Returns:
true is some roles associations is required, false otherwise
Throws:
it.eng.spago.error.EMFUserError - the EMF user error

associateAllExportedEnginesByUserAssociation

public boolean associateAllExportedEnginesByUserAssociation()
                                                     throws it.eng.spago.error.EMFUserError
Description copied from interface: IImportManager
Tries to associate all exported engines using the user associations; returns true is some engines associations is required, false otherwise.

Specified by:
associateAllExportedEnginesByUserAssociation in interface IImportManager
Returns:
true is some engines associations is required, false otherwise
Throws:
it.eng.spago.error.EMFUserError - the EMF user error

associateAllExportedDataSourcesByUserAssociation

public boolean associateAllExportedDataSourcesByUserAssociation()
                                                         throws it.eng.spago.error.EMFUserError
Description copied from interface: IImportManager
Tries to associate all exported data sources using the user associations; returns true is some data sources associations is required, false otherwise.

Specified by:
associateAllExportedDataSourcesByUserAssociation in interface IImportManager
Returns:
true is some data sources associations is required, false otherwise
Throws:
it.eng.spago.error.EMFUserError - the EMF user error