wt.ixb.conflictFramework
Class ImportSessionHelper

java.lang.Object
  extended bywt.ixb.conflictFramework.ImportSessionHelper

public class ImportSessionHelper
extends Object

Helper class for working with Import session


Field Summary
private static boolean DEBUG
           
 
Constructor Summary
ImportSessionHelper()
           
 
Method Summary
private static void copyStreams(InputStream in, OutputStream out)
           
static ElementImportInfo findElementInfoBySessionAndFileId(ImportSession session, String fileId)
           
static Enumeration getAllElementInfos(ImportSession session)
           
static Enumeration getAllEnvironmentConflicts(ImportSession session)
           
static String getFileId(IxbDocument fileXML)
           
static File getJarFileForSession(File tempDir, ImportSession session)
          Gets jar file with import data (as stream) from Import session and stores it in temporary directory on server
static void PP(String s)
           
private static void printStackTrace(Exception e)
           
static IxbDocument setInfoForActualImport(ImportSession session, IxbDocument fileXML)
          Helper method to be used by conflictFramework.
static void updateImportSessionByConflictInfo(ImportSession session, ExistObjConflictSet exObjConflictSet, IXBImpConflictSet otherConflictsSet)
          Transforms and stores information gathered during conflict check.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

private static boolean DEBUG
Constructor Detail

ImportSessionHelper

public ImportSessionHelper()
Method Detail

updateImportSessionByConflictInfo

public static void updateImportSessionByConflictInfo(ImportSession session,
                                                     ExistObjConflictSet exObjConflictSet,
                                                     IXBImpConflictSet otherConflictsSet)
                                              throws WTException,
                                                     WTPropertyVetoException
Transforms and stores information gathered during conflict check.

Parameters:
session - current Import Session
exObjConflictSet - conflicts against existing object (that is, conflicts indicating that for object to be imported there is a matching object in the system). These conflicts could be resolved by performing appropriate import action.
otherConflictsSet - conflicts against environment. These conflicts arise when the value of some attribute of imported object is invalid for importing system (for example, there is no such LC State). They can be overridable and non-overridable. Non-overridable conflicts should be resolved by user manually (either by creating the new attribute in the system or by altering XML file). Overridable conflicts can be resolved automatically (if overrideConflicts = true)
Throws:
WTException
WTPropertyVetoException

findElementInfoBySessionAndFileId

public static ElementImportInfo findElementInfoBySessionAndFileId(ImportSession session,
                                                                  String fileId)
                                                           throws WTException
Throws:
WTException

getAllElementInfos

public static Enumeration getAllElementInfos(ImportSession session)
                                      throws WTException
Throws:
WTException

getAllEnvironmentConflicts

public static Enumeration getAllEnvironmentConflicts(ImportSession session)
                                              throws WTException
Throws:
WTException

setInfoForActualImport

public static IxbDocument setInfoForActualImport(ImportSession session,
                                                 IxbDocument fileXML)
                                          throws WTException
Helper method to be used by conflictFramework. It should be called from service explicitly before actual import. It sets Import action which should be performed for a given imported object, id (ufid) of the matching existing object and action parameters (if any). This information is obtained fron Import session and written to IxbDocument representing imported object.

Parameters:
session - Import session (normally, this session contains results of preview/setting user defined actions)
fileXML - IxbDocument representing imported object
Returns:
updated IxbDocument representing imported object
Throws:
WTException

getFileId

public static String getFileId(IxbDocument fileXML)

getJarFileForSession

public static File getJarFileForSession(File tempDir,
                                        ImportSession session)
                                 throws WTException
Gets jar file with import data (as stream) from Import session and stores it in temporary directory on server

Parameters:
tempDir - temporary directory on server
session - Import session
Returns:
stored jar file
Throws:
WTException

copyStreams

private static void copyStreams(InputStream in,
                                OutputStream out)
                         throws IOException
Throws:
IOException

printStackTrace

private static void printStackTrace(Exception e)

PP

public static void PP(String s)