wt.projmgmt.ix
Class ProjectTemplateIxHandler

java.lang.Object
  extended bywt.ixb.publicforhandlers.ClassExporterImporterTemplateGeneral
      extended bywt.ixb.publicforhandlers.ClassExporterImporterTemplate
          extended bywt.projmgmt.ix.ProjectTemplateIxHandler
All Implemented Interfaces:
ClassExporter, ClassExporterImporter, ElementImporter

public class ProjectTemplateIxHandler
extends ClassExporterImporterTemplate

This handler updates the project seed object. Changes to organization name are not allowed, although an organization must exist.


Nested Class Summary
 
Nested classes inherited from class wt.ixb.publicforhandlers.ClassExporterImporterTemplate
ClassExporterImporterTemplate.ContentHolderCommitListener
 
Field Summary
private static Object[] DEF_PARAMS
           
private  List fileNameList
           
private static int[] FROM_INDICES
           
private static String[] LEGAL_TAGS
           
private static String RESOURCE
           
private static String SYSTEM_FOLDER
           
private static boolean VERBOSE
           
 
Fields inherited from class wt.ixb.publicforhandlers.ClassExporterImporterTemplate
 
Fields inherited from class wt.ixb.publicforhandlers.ClassExporterImporterTemplateGeneral
CONFLICT_RESOURCE
 
Constructor Summary
ProjectTemplateIxHandler()
           
 
Method Summary
private  DefaultWTContainerTemplate assignTemplateToProfile(DefaultWTContainerTemplate tmpl, IxbElement elem, Importer imp)
           
private  void cleanupContentDirectory(String contName, String tmplName)
           
private  String computeClassName(IxbElement elem)
           
private  String computeTemplateName(IxbElement topElement)
           
 Object createObject(IxbElement topElement, Importer imp)
          Create a project template object.
 void exportObject(Object seed, Exporter exporter)
          Export of a project template is not supported at this time.
 Object finalizeImportObject(boolean isNew, Object origpt, IxbElement elem, Importer imp)
          Finalize import object is called when the project template already exists.
 Object findAmongExistingObjects(IxbElement elem, Importer imp)
          Reads the data from the sub elements to determine if the project exists.
private  File generateOutputDir(String orgName, String templateName)
           
private  Tuner generateTuner(String orgName, String templateName)
          This method generates the appropriate tuner for use in transforming a foreign project config into a a local project config.
private  String getIdStr(Object obj)
           
 int getImportPriority()
          Needs to be implemented, but the meaning of the return value has never been documented.
private  IxbElement getLobTag(IxbElement topElement)
           
private  UploadTemplateRequest getUploadRequest(DefaultWTContainerTemplate tmpl, IxbElement topElement, Importer imp)
           
private  UploadTemplateRequest getUploadRequestFromLoadPath(IxbElement elem, Importer imp)
           
private  UploadTemplateRequest getUploadRequestFromText(IxbElement xmlLob, Importer imp)
           
private  UploadTemplateRequest getUploadRequestFromZipEntry(DefaultWTContainerTemplate tmpl, IxbElement zipEntry, Importer imp)
           
private  DefaultWTContainerTemplate initializeTemplate(IxbElement topElement, Importer imp)
           
private  DefaultWTContainerTemplate populateAttributes(DefaultWTContainerTemplate tmpl, IxbElement topElement, Importer imp)
           
private  DefaultWTContainerTemplate populateAttributes(DefaultWTContainerTemplate tmpl, IxbElement topElement, Importer imp, boolean onlyIfNeeded)
           
private  DefaultWTContainerTemplate populateAttributes(IxbElement topElement, Importer imp)
           
private  void storeHashReference(IxbElement elem, WTContainerTemplate pt, Importer imp)
           
 Object storeObject(Object obj, IxbElement elem, Importer imp)
          That is the general template how to store object.
private  boolean templateExists(WTContainerRef contRef, DefaultWTContainerTemplate tmpl)
           
private  void writeContentToFileSystem(File output_dir, IxbElement elem, ImportHandler ih)
           
 
Methods inherited from class wt.ixb.publicforhandlers.ClassExporterImporterTemplate
createFileXMLOnExport, exportAttributes, getRootTag, importElement, importObjectAttributes, importObjectAttributesAfterStore, isObjectIgnored, isObjectNew, outputLog, rememberNewObInfo, setObjectIgnored, setObjectIsNew, storeAdditionalInfo, storeElement
 
Methods inherited from class wt.ixb.publicforhandlers.ClassExporterImporterTemplateGeneral
checkConflicts, finalizeCheckConflicts, finalizeExport, finalizeImport, getAdditionalImportPriority, getObjectDisplayID, prepareForCheckConflicts, prepareForImport, previewElement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEF_PARAMS

private static final Object[] DEF_PARAMS

FROM_INDICES

private static final int[] FROM_INDICES

LEGAL_TAGS

private static String[] LEGAL_TAGS

SYSTEM_FOLDER

private static String SYSTEM_FOLDER

fileNameList

private List fileNameList

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

VERBOSE

private static final boolean VERBOSE
Constructor Detail

ProjectTemplateIxHandler

public ProjectTemplateIxHandler()
Method Detail

exportObject

public void exportObject(Object seed,
                         Exporter exporter)
                  throws WTException
Export of a project template is not supported at this time.

Specified by:
exportObject in interface ClassExporter
Overrides:
exportObject in class ClassExporterImporterTemplate
Parameters:
seed -
exporter - The Exporter instance that represents the context of the export operation.
Throws:
WTException

createObject

public Object createObject(IxbElement topElement,
                           Importer imp)
                    throws WTException
Create a project template object. An exception is thrown if the tag is not .

Specified by:
createObject in class ClassExporterImporterTemplate
Parameters:
topElement - : IxbElement, a node in the XML tree which correpsonds to the tag.
imp - : Importer the application which is controlling the import process.
Returns:
Object The newly created ProjectTemplate object.
Throws:
WTException

populateAttributes

private DefaultWTContainerTemplate populateAttributes(IxbElement topElement,
                                                      Importer imp)
                                               throws WTException
Throws:
WTException

templateExists

private boolean templateExists(WTContainerRef contRef,
                               DefaultWTContainerTemplate tmpl)
                        throws WTException
Throws:
WTException

initializeTemplate

private DefaultWTContainerTemplate initializeTemplate(IxbElement topElement,
                                                      Importer imp)
                                               throws WTException
Throws:
WTException

computeTemplateName

private String computeTemplateName(IxbElement topElement)
                            throws WTException
Throws:
WTException

populateAttributes

private DefaultWTContainerTemplate populateAttributes(DefaultWTContainerTemplate tmpl,
                                                      IxbElement topElement,
                                                      Importer imp)
                                               throws WTException
Throws:
WTException

populateAttributes

private DefaultWTContainerTemplate populateAttributes(DefaultWTContainerTemplate tmpl,
                                                      IxbElement topElement,
                                                      Importer imp,
                                                      boolean onlyIfNeeded)
                                               throws WTException
Throws:
WTException

getUploadRequest

private UploadTemplateRequest getUploadRequest(DefaultWTContainerTemplate tmpl,
                                               IxbElement topElement,
                                               Importer imp)
                                        throws WTException
Throws:
WTException

getUploadRequestFromLoadPath

private UploadTemplateRequest getUploadRequestFromLoadPath(IxbElement elem,
                                                           Importer imp)
                                                    throws WTException
Throws:
WTException

getUploadRequestFromZipEntry

private UploadTemplateRequest getUploadRequestFromZipEntry(DefaultWTContainerTemplate tmpl,
                                                           IxbElement zipEntry,
                                                           Importer imp)
                                                    throws WTException
Throws:
WTException

cleanupContentDirectory

private void cleanupContentDirectory(String contName,
                                     String tmplName)

writeContentToFileSystem

private void writeContentToFileSystem(File output_dir,
                                      IxbElement elem,
                                      ImportHandler ih)
                               throws WTException
Throws:
WTException

getUploadRequestFromText

private UploadTemplateRequest getUploadRequestFromText(IxbElement xmlLob,
                                                       Importer imp)
                                                throws WTException
Throws:
WTException

getLobTag

private IxbElement getLobTag(IxbElement topElement)
                      throws WTException
Throws:
WTException

getImportPriority

public int getImportPriority()
                      throws WTException
Needs to be implemented, but the meaning of the return value has never been documented.

Specified by:
getImportPriority in interface ElementImporter
Specified by:
getImportPriority in class ClassExporterImporterTemplateGeneral
Returns:
int
Throws:
WTException

findAmongExistingObjects

public Object findAmongExistingObjects(IxbElement elem,
                                       Importer imp)
                                throws WTException
Reads the data from the sub elements to determine if the project exists. If so the project is returned.

Overrides:
findAmongExistingObjects in class ClassExporterImporterTemplate
Parameters:
elem -
imp -
Returns:
Object
Throws:
WTException

finalizeImportObject

public Object finalizeImportObject(boolean isNew,
                                   Object origpt,
                                   IxbElement elem,
                                   Importer imp)
                            throws WTException
Finalize import object is called when the project template already exists. The action here is to create a new iteration.

Overrides:
finalizeImportObject in class ClassExporterImporterTemplate
Throws:
WTException

storeHashReference

private void storeHashReference(IxbElement elem,
                                WTContainerTemplate pt,
                                Importer imp)
                         throws WTException
Throws:
WTException

generateOutputDir

private File generateOutputDir(String orgName,
                               String templateName)
                        throws WTException
Throws:
WTException

computeClassName

private String computeClassName(IxbElement elem)
                         throws WTException
Throws:
WTException

generateTuner

private Tuner generateTuner(String orgName,
                            String templateName)
                     throws WTException
This method generates the appropriate tuner for use in transforming a foreign project config into a a local project config. The only thing that needs to be changed is the contentId tag.

Throws:
WTException

storeObject

public Object storeObject(Object obj,
                          IxbElement elem,
                          Importer imp)
                   throws WTException
Description copied from class: ClassExporterImporterTemplate
That is the general template how to store object. It looks like it will be good for many classes. If for some class it is not good then it can be override this method

Supported API: true

Overrides:
storeObject in class ClassExporterImporterTemplate
Parameters:
obj -
elem -
imp -
Returns:
Object
Throws:
WTException

assignTemplateToProfile

private DefaultWTContainerTemplate assignTemplateToProfile(DefaultWTContainerTemplate tmpl,
                                                           IxbElement elem,
                                                           Importer imp)
                                                    throws WTException
Throws:
WTException

getIdStr

private String getIdStr(Object obj)
                 throws WTException
Throws:
WTException