it.eng.spagobi.importexport
Class ImportManager

java.lang.Object
  extended by it.eng.spagobi.importexport.ImportManager
All Implemented Interfaces:
IImportManager

public class ImportManager
extends java.lang.Object
implements IImportManager

Implements the interface which defines methods for managing the import requests


Field Summary
private  java.lang.String exportedFileName
           
private  ImporterMetadata importer
           
private  MetadataAssociations metaAss
           
private  MetadataLogger metaLog
           
private  java.lang.String pathBaseFolder
           
private  java.lang.String pathContentFolder
           
private  java.lang.String pathDBFolder
           
private  java.lang.String pathImportTmpFolder
           
private  java.util.Properties props
           
private  org.hibernate.Session sessionCurrDB
           
private  org.hibernate.Session sessionExpDB
           
private  org.hibernate.SessionFactory sessionFactoryExpDB
           
private  org.hibernate.Transaction txCurrDB
           
private  org.hibernate.Transaction txExpDB
           
 
Constructor Summary
ImportManager()
           
 
Method Summary
 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
private  void closeSession()
          Close Hibernate sessions for exported and current database
private  void closeSessionFactory()
          Closes Hibernate session factory for the exported database
 java.lang.String commitAllChanges()
          Commits all changes made on exported and current databases
private  java.lang.String getCurrentCmsBaseFolder()
          Gets the path of the cms base folder of the current SpagoBI cms repository
 java.lang.String getCurrentVersion()
          Gets the current SpagobI version
private  java.lang.String getExportedCmsBaseFolder()
          Gets the path of the cms base folder of the exported archive
 java.util.List getExportedConnections()
          Gets the list of exported connections
 java.util.List getExportedEngines()
          Gets the list of all exported engines
 java.util.List getExportedRoles()
          Gets the list of all exported roles
 java.lang.String getExportVersion()
          Gets the SpagoBI version of the exported file
 MetadataAssociations getMetadataAssociation()
          Gets the object which contains the association between exported metadata and the current system metadata
private  void importBIObjects()
          import exported biobjects
private  void importBIObjPar()
          Imports associations between exported biobjects and parameters
private  void importChecks()
          Import exported checks
private  void importEngines()
          Imports exported engines
private  void importFunctionalities()
          Imports exported functionalities
private  void importFunctObject()
          Imports associations between functionalities and objects
private  void importFunctRoles()
          Imports associations between functionalities and roles
private  void importLovs()
          Import exported lovs
 void importObjects()
          Imports the exported objects
private  void importParameters()
          Import exported parameters
private  void importParuse()
          Imports exported paruses
private  void importParuseCheck()
          Imports associations between parameter uses and checks
private  void importParuseDet()
          Importa exported paruse details
private  void importRoles()
          Import exported roles
 void prepareImport(java.lang.String pathImpTmpFold, java.lang.String archiveName, byte[] archiveContent)
          Prepare the environment for the import procedure
private  java.util.List removeFromList(java.util.List complete, SbiFunctions funct)
           
private  void rollback()
          Rollbacks each previous changes made on exported and current databases
 void stopImport()
          Ends the import procedure
 void updateConnectionReferences(java.util.Map connAssociations)
          Update the connection name for each list of values of type query based on association between exported connections and current system connections
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pathImportTmpFolder

private java.lang.String pathImportTmpFolder

pathBaseFolder

private java.lang.String pathBaseFolder

pathDBFolder

private java.lang.String pathDBFolder

pathContentFolder

private java.lang.String pathContentFolder

importer

private ImporterMetadata importer

props

private java.util.Properties props

sessionFactoryExpDB

private org.hibernate.SessionFactory sessionFactoryExpDB

sessionExpDB

private org.hibernate.Session sessionExpDB

txExpDB

private org.hibernate.Transaction txExpDB

sessionCurrDB

private org.hibernate.Session sessionCurrDB

txCurrDB

private org.hibernate.Transaction txCurrDB

metaAss

private MetadataAssociations metaAss

metaLog

private MetadataLogger metaLog

exportedFileName

private java.lang.String exportedFileName
Constructor Detail

ImportManager

public ImportManager()
Method Detail

prepareImport

public void prepareImport(java.lang.String pathImpTmpFold,
                          java.lang.String archiveName,
                          byte[] archiveContent)
                   throws EMFUserError
Prepare the environment for the import procedure

Specified by:
prepareImport 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:
EMFUserError

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

getExportedCmsBaseFolder

private java.lang.String getExportedCmsBaseFolder()
Gets the path of the cms base folder of the exported archive

Returns:
The path of the cms base folder of the exported archive

getCurrentCmsBaseFolder

private java.lang.String getCurrentCmsBaseFolder()
                                          throws EMFUserError
Gets the path of the cms base folder of the current SpagoBI cms repository

Returns:
the path of the cms base folder of the current SpagoBI cms repository
Throws:
EMFUserError

getExportedRoles

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

Specified by:
getExportedRoles in interface IImportManager
Returns:
The list of exported roles
Throws:
EMFUserError

getExportedEngines

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

Specified by:
getExportedEngines in interface IImportManager
Returns:
The list of exported engines
Throws:
EMFUserError

checkRoleReferences

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

Parameters:
roleAssociations - Map of assocaition between exported roles and roles of the portal in use
Throws:
EMFUserError - if two ore more exported roles are associate to the same current role

updateConnectionReferences

public void updateConnectionReferences(java.util.Map connAssociations)
                                throws EMFUserError
Update the connection name for each list of values of type query based on association between exported connections and current system connections

Parameters:
connAssociations - Map of the associations between exported connections and current system connections
Throws:
EMFUserError

closeSessionFactory

private void closeSessionFactory()
Closes Hibernate session factory for the exported database


closeSession

private void closeSession()
Close Hibernate sessions for exported and current database


rollback

private void rollback()
Rollbacks each previous changes made on exported and current databases


commitAllChanges

public java.lang.String commitAllChanges()
                                  throws EMFUserError
Commits all changes made on exported and current databases

Specified by:
commitAllChanges in interface IImportManager
Returns:
String, the path of the log file
Throws:
EMFUserError

importObjects

public void importObjects()
                   throws EMFUserError
Imports the exported objects

Specified by:
importObjects in interface IImportManager
Throws:
EMFUserError

importRoles

private void importRoles()
                  throws EMFUserError
Import exported roles

Throws:
EMFUserError

importEngines

private void importEngines()
                    throws EMFUserError
Imports exported engines

Throws:
EMFUserError

importFunctionalities

private void importFunctionalities()
                            throws EMFUserError
Imports exported functionalities

Throws:
EMFUserError

removeFromList

private java.util.List removeFromList(java.util.List complete,
                                      SbiFunctions funct)

importLovs

private void importLovs()
                 throws EMFUserError
Import exported lovs

Throws:
EMFUserError

importChecks

private void importChecks()
                   throws EMFUserError
Import exported checks

Throws:
EMFUserError

importParameters

private void importParameters()
                       throws EMFUserError
Import exported parameters

Throws:
EMFUserError

importBIObjects

private void importBIObjects()
                      throws EMFUserError
import exported biobjects

Throws:
EMFUserError

importParuse

private void importParuse()
                   throws EMFUserError
Imports exported paruses

Throws:
EMFUserError

importParuseDet

private void importParuseDet()
                      throws EMFUserError
Importa exported paruse details

Throws:
EMFUserError

importParuseCheck

private void importParuseCheck()
                        throws EMFUserError
Imports associations between parameter uses and checks

Throws:
EMFUserError

importFunctObject

private void importFunctObject()
                        throws EMFUserError
Imports associations between functionalities and objects

Throws:
EMFUserError

importFunctRoles

private void importFunctRoles()
                       throws EMFUserError
Imports associations between functionalities and roles

Throws:
EMFUserError

importBIObjPar

private void importBIObjPar()
                     throws EMFUserError
Imports associations between exported biobjects and parameters

Throws:
EMFUserError

stopImport

public void stopImport()
Ends the import procedure

Specified by:
stopImport in interface IImportManager

getExportedConnections

public java.util.List getExportedConnections()
                                      throws EMFUserError
Gets the list of exported connections

Specified by:
getExportedConnections in interface IImportManager
Returns:
List of the exported connections
Throws:
EMFUserError

checkExistingMetadata

public void checkExistingMetadata()
                           throws 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:
EMFUserError

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