wt.pdmlink
Class ProductIXUtils

java.lang.Object
  extended bywt.pdmlink.ProductIXUtils

public class ProductIXUtils
extends Object


Field Summary
private static String _rb
           
private static int[] DEF_FROM_INDEXES
           
private static Object[] DEF_PARAMS
           
private static String DEFAULT_ENCODING
           
private static String DEFAULT_LIFECYCLE
           
private static Object[] EMPTY_ARRAY
           
private static Class ENUM_TYPE_CLASS
           
private static String HEADER_ENCODING
           
private static NMProjectConstants.ProjectMemberInfo memberTags
           
private static Class OBJ_REF_CLASS
           
private static NMProjectConstants.ObjectIDInfo oidInfoTags
           
private static String PJL_NULL
           
private static String PROJ_MGMT_KEY
           
(package private) static String USER_KEY
           
private static Class WT_OBJECT_CLASS
           
 
Constructor Summary
ProductIXUtils()
           
 
Method Summary
static void addRoleElem(IxbElement elem, Role role)
          Adds a role element to the passed element.
static boolean checkBufferSanity(StringBuffer strBuff)
           
static PushbackInputStream checkStreamSanity(InputStream in)
          This method performs a sanity check on an input stream.
static void checkTag(IxbElement elem, String expected_tag)
           
static TimeToElapse computeDuration(IxbElement elem, Importer imp)
           
static void copyStream(InputStream in, OutputStream out)
          Copies an input stream to an output stream.
static void exportCost(IxbElement elem, String tag, Currency currency, Exporter exporter)
           
static File exportDocumentToJarFile(WTContainerRef contRef, WTDocument document, File tmpFile)
           
static void exportDuration(WfExecutionObject exec_obj, IxbElement elem, Exporter exporter)
           
static void exportExecObjAttributes(ExecutionObject exec_obj, IxbElement exec_elem, Exporter exporter)
          
static File exportFolderStructureToJarFile(WTContainerRef contRef, Folder folder, File tmpFile)
           
static void exportOwner(Ownable own_obj, IxbElement elem, Exporter exporter)
          
static File exportProductStructureToJarFile(WTContainerRef contRef, List parts, File tmpFile)
           
static void exportProjectNodeAttributes(ProjectNode node, IxbElement elem, Exporter exporter, int node_id)
          
static void exportProjectVariables(WfExecutionObject exec_obj, IxbElement elem, Exporter exporter)
          
static void exportRate(IxbElement elem, String tag, CurrencyRate currency_rate, Exporter exporter)
          
static void exportReference(Persistable pers_obj, IxbElement elem, Exporter exporter)
          
static void exportSubscriptions(ExecutionObject obj, IxbElement elem, Exporter exp)
          
static void exportTimeToElapse(IxbElement elem, String tag, TimeToElapse time, Exporter exporter)
           
static File exportToJarFile(Persistable persistObj, File tmpFile)
          Deprecated. use epxortToJarFile(WTContainerRef contRef, Persistable persistObj, File tmpFile) instead
static File exportToJarFile(WTContainerRef contRef, Persistable persistObj, File tmpFile)
           
static void exportWork(IxbElement elem, String tag, Work work, Exporter exporter)
           
static void exportWTDocument(WTDocument doc, IxbElement elem, Exporter exporter)
          Exports a document into the given IxbElement.
static void exportWTPart(WTPart part, IxbElement elem, Exporter exporter)
          Exports a part into the given IxbElement.
static void exportWTPartReferenceLink(WTPartReferenceLink part_link, IxbElement elem, Exporter exporter)
          Exports a part reference link into the given IxbElement.
static void exportWTPartUsageLink(WTPartUsageLink part_link, IxbElement elem, Exporter exporter)
          Exports a part reference link into the given IxbElement.
static ProjectPlan findProjectPlan(IxbElement elem, Importer imp)
          Finds the project plan referenced by the element passed as argument.
private static IxbElement findProjectPlanTag(IxbElement elem)
           
static IxbDocument generateExportMappingRules()
           
static IxbDocument generateFolderMappingRules(Folder theFolder)
          This generates mapping rules for the savePath.
static IxbDocument generateImportMappingRules()
           
private static IxbDocument generateImportMappingRules(NotebookFolder notebook_folder)
           
static Currency getCost(IxbElement elem, String tag, Importer imp)
          Extracts the cost from the element that corresponds to the tag passed as argument.
static Deliverable getDeliverable(ProjectPlan plan, String deli_name)
           
static Enumeration getDeliverables(ProjectPlan plan)
           
static QueryResult getDocuments(Project2 project)
          Returns documents contained in project.
static String getEncoding(File xmlFile)
          Get the character encoding that is specified in the XML file.
static String getEncoding(String xmlText)
          Get the character encoding that is specified in the XML text.
private static String getEncodingFromHeader(String header)
          Get the character encoding that is specified in the given XML header.
private static String getFolderPath(NotebookFolder folder)
           
static WTGroup getGroupByName(WTContainerRef contRef, String princName)
           
private static String getHeader(File file)
          Get the
private static String getHeader(InputStream is)
          Get the
private static String getHeader(String content)
          Get the
private  ObjectIdentifier getId(Object obj)
           
static Iterated getIteratedObject(WTContainerRef contRef, Class theClass, String attrName, String attrValue)
           
static QueryResult getObjects(WTContainer cont, Class object_class)
          Returns objects of a given class contained in project.
static Object getObjFromObjectIDElement(IxbElement objId, Importer imp)
          ObjectIds may come in two flavors.
static Object getObjFromObjRefElem(IxbElement objRef, Importer imp)
          ObjectReferences can come in three flavors localId, ufid, and custom.
private static WfContainerTemplate getParentTemplate(WfTemplateObject template)
           
static QueryResult getParts(Project2 project)
          Returns parts contained in project.
static QueryResult getPlans(PDMLinkProduct product)
          Returns project plans associated with project.
static QueryResult getPlans(WTLibrary library)
          Returns project plans associated with project.
static WTPrincipal getPrincipalByDN(String dnName)
           
static WTPrincipal getPrincipalByName(WTContainerRef contRef, String princName)
          There has been some volatility in these methods so the logic is being localized here.
static Project2 getProject(String project_name)
           
static ProjectCategory getProjectCategory(IxbElement elem)
          This method returns the ProjectCategory object.
private static Map getProjectEventTypes(IxbElement elem)
           
static ProjectHealthStatus getProjectHealthStatus(IxbElement elem)
          This method returns a ProjectHealthStatus object.
static ProjectPhase getProjectPhase(IxbElement elem)
           
static ProjectPlan getProjectPlan(IxbElement elem, Importer imp)
           
static ProjectPlan getProjectPlan(Project2 project)
          Returns project plan associated with project or 'null' if none exists.
static ProjectRiskValue getProjectRiskValue(IxbElement elem)
           
static ProjectState getProjectState(IxbElement elem)
           
static CurrencyRate getRate(IxbElement elem, String tag, Importer imp)
          
static Reader getReader(File xmlFile)
          Get a Reader on the contents of the specified File.
static ObjectReference getReference(String ref_str, Importer imp)
           
static Role getRole(IxbElement role_elem)
          Returns a role given an IxbElement corresponding to the Role tag.
static TimeToElapse getTimeToElapse(IxbElement elem, String tag, Importer imp)
          Extracts the elapsed time from the element that corresponds to the tag passed as argument.
static WTUser getUserByDN(String dnName)
           
static WTUser getUserByName(WTContainerRef contRef, String userName)
           
static Work getWork(IxbElement elem, String tag, Importer imp)
          Extracts the work from the element that corresponds to the tag passed as argument.
static boolean hasTag(IxbElement elem, String expected_tag)
           
static WTLibrary importBaseLibraryInfo(WTLibrary lib, IxbElement elem, Importer imp)
           
static PDMLinkProduct importBaseProductInfo(PDMLinkProduct prod, IxbElement elem, Importer imp)
           
static ExecutionObject importDuration(ExecutionObject exec_obj, IxbElement elem, Importer imp)
           
static ExecutionObject importExecObjectAttributes(ExecutionObject exec_obj, IxbElement elem, Importer imp)
           TODO: This is a very old version of the DTD.
static boolean importFromJarFile(Object obj, String file_name)
           
static boolean importFromJarFile(WTContainerRef contRef, Object obj, String file_name)
           
static boolean importFromJarFileToContainer(WTContainerRef target, File tmpFile)
           
static boolean importFromJarFileToFolder(Folder folder, File tmpFile)
          Deprecated.  
static boolean importFromJarFileToNotebook(NotebookFolder notebook_folder, File tmpFile)
           
static boolean importFromJarFileToProject(WTContainerRef target, File tmpFile)
           
private static ExecutionObject importManagerSubscriptions(ExecutionObject target, IxbElement elem)
          This method deals with the import of ManagerSubscriptions for a Milestone or a Deliverable tag.
private static ExecutionObject importOwnerSubscriptions(ExecutionObject target, IxbElement elem)
           
private static ExecutionObject importPlanLevelManagerSubscriptions(ExecutionObject target, IxbElement elem)
           
private static ExecutionObject importPlanLevelOwnerSubscriptions(ExecutionObject target, IxbElement elem)
           
static ProjectNode importProjectNodeAttributes(ProjectNode node, IxbElement elem, Importer imp)
          
static ExecutionObject importProjectPlanLevelSubscriptions(ExecutionObject target, IxbElement elem, Importer imp)
           
static WfExecutionObject importProjectVariables(WfExecutionObject exec_obj, IxbElement elem, Importer imp)
          
static ExecutionObject importSubscriptions(ExecutionObject target, IxbElement elem, Importer imp)
          This method expects an IxbElement corresponding to a <subsriberPolicy> tag.
static void postExportFeedback(String rb, String key)
           
static void postExportFeedback(String rb, String key, Object[] params)
           
static void postFeedback(Importer imp, String rb, String key, Object[] params, int level)
          Posts message to the logger.
private static boolean processBooleanStr(String str)
           
static ExecutionObject setOwner(ExecutionObject exec_obj, IxbElement elem, Importer imp)
          
static void setTmpId(IxbElement elem, Importer imp)
          Takes an ObjectId object and if the object id is a localId, we store the tmpId.
static void setVariableValue(ProcessData context, String var_name, Class var_cls, String val_str, Importer imp)
           
static Timestamp stringToTimeStamp(String str)
          Utility function that convers a string to a timestamp returns null on any type of failure.
private static void updateFolderPathRules(IxbElement rootElem, String path, String value, String newValue)
           
private static void updateLifecyclePathRules(IxbElement rootElement)
           
static boolean validateXMLInputStream(InputStream in)
          This method does some simple validation on the input stream to verify that its contents do in fact contain an XML file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USER_KEY

static final String USER_KEY
See Also:
Constant Field Values

_rb

private static final String _rb
See Also:
Constant Field Values

PJL_NULL

private static final String PJL_NULL
See Also:
Constant Field Values

PROJ_MGMT_KEY

private static final String PROJ_MGMT_KEY

DEFAULT_LIFECYCLE

private static final String DEFAULT_LIFECYCLE

DEF_PARAMS

private static final Object[] DEF_PARAMS

ENUM_TYPE_CLASS

private static final Class ENUM_TYPE_CLASS

OBJ_REF_CLASS

private static final Class OBJ_REF_CLASS

WT_OBJECT_CLASS

private static final Class WT_OBJECT_CLASS

DEFAULT_ENCODING

private static final String DEFAULT_ENCODING

HEADER_ENCODING

private static final String HEADER_ENCODING

oidInfoTags

private static final NMProjectConstants.ObjectIDInfo oidInfoTags

memberTags

private static final NMProjectConstants.ProjectMemberInfo memberTags

DEF_FROM_INDEXES

private static final int[] DEF_FROM_INDEXES

EMPTY_ARRAY

private static final Object[] EMPTY_ARRAY
Constructor Detail

ProductIXUtils

public ProductIXUtils()
Method Detail

importProjectNodeAttributes

public static ProjectNode importProjectNodeAttributes(ProjectNode node,
                                                      IxbElement elem,
                                                      Importer imp)
                                               throws WTException
 
 

Throws:
WTException

exportProjectNodeAttributes

public static void exportProjectNodeAttributes(ProjectNode node,
                                               IxbElement elem,
                                               Exporter exporter,
                                               int node_id)
                                        throws WTException
 
 
 

Throws:
WTException

exportOwner

public static void exportOwner(Ownable own_obj,
                               IxbElement elem,
                               Exporter exporter)
                        throws WTException
 
 

Throws:
WTException

exportReference

public static void exportReference(Persistable pers_obj,
                                   IxbElement elem,
                                   Exporter exporter)
                            throws WTException
 
 
This implementation is limited to the localId option.

Throws:
WTException

exportExecObjAttributes

public static void exportExecObjAttributes(ExecutionObject exec_obj,
                                           IxbElement exec_elem,
                                           Exporter exporter)
                                    throws WTException
 
 

Throws:
WTException

exportDuration

public static void exportDuration(WfExecutionObject exec_obj,
                                  IxbElement elem,
                                  Exporter exporter)
                           throws WTException
Throws:
WTException

exportTimeToElapse

public static void exportTimeToElapse(IxbElement elem,
                                      String tag,
                                      TimeToElapse time,
                                      Exporter exporter)
                               throws WTException
Throws:
WTException

exportWork

public static void exportWork(IxbElement elem,
                              String tag,
                              Work work,
                              Exporter exporter)
                       throws WTException
Throws:
WTException

exportCost

public static void exportCost(IxbElement elem,
                              String tag,
                              Currency currency,
                              Exporter exporter)
                       throws WTException
Throws:
WTException

exportRate

public static void exportRate(IxbElement elem,
                              String tag,
                              CurrencyRate currency_rate,
                              Exporter exporter)
                       throws WTException
 
 

Throws:
WTException

exportSubscriptions

public static void exportSubscriptions(ExecutionObject obj,
                                       IxbElement elem,
                                       Exporter exp)
                                throws WTException

Throws:
WTException

exportProjectVariables

public static void exportProjectVariables(WfExecutionObject exec_obj,
                                          IxbElement elem,
                                          Exporter exporter)
                                   throws WTException
 
 
 
 
 
 

Throws:
WTException

checkTag

public static void checkTag(IxbElement elem,
                            String expected_tag)
                     throws WTException
Throws:
WTException

hasTag

public static boolean hasTag(IxbElement elem,
                             String expected_tag)
                      throws WTException
Throws:
WTException

getProjectPlan

public static ProjectPlan getProjectPlan(IxbElement elem,
                                         Importer imp)
                                  throws WTException
Throws:
WTException

importSubscriptions

public static ExecutionObject importSubscriptions(ExecutionObject target,
                                                  IxbElement elem,
                                                  Importer imp)
                                           throws WTException
This method expects an IxbElement corresponding to a <subsriberPolicy> tag. It reads the XML and determines whether or not susbcription policies needs to be set on the object, and then it sets them.

Throws:
WTException

importOwnerSubscriptions

private static ExecutionObject importOwnerSubscriptions(ExecutionObject target,
                                                        IxbElement elem)
                                                 throws WTException
Throws:
WTException

importProjectPlanLevelSubscriptions

public static ExecutionObject importProjectPlanLevelSubscriptions(ExecutionObject target,
                                                                  IxbElement elem,
                                                                  Importer imp)
                                                           throws WTException
Throws:
WTException

importPlanLevelManagerSubscriptions

private static ExecutionObject importPlanLevelManagerSubscriptions(ExecutionObject target,
                                                                   IxbElement elem)
                                                            throws WTException
Throws:
WTException

importPlanLevelOwnerSubscriptions

private static ExecutionObject importPlanLevelOwnerSubscriptions(ExecutionObject target,
                                                                 IxbElement elem)
                                                          throws WTException
Throws:
WTException

importManagerSubscriptions

private static ExecutionObject importManagerSubscriptions(ExecutionObject target,
                                                          IxbElement elem)
                                                   throws WTException
This method deals with the import of ManagerSubscriptions for a Milestone or a Deliverable tag.

Throws:
WTException

findProjectPlanTag

private static IxbElement findProjectPlanTag(IxbElement elem)
                                      throws WTException
Throws:
WTException

getProjectEventTypes

private static Map getProjectEventTypes(IxbElement elem)
                                 throws WTException
Throws:
WTException

importExecObjectAttributes

public static ExecutionObject importExecObjectAttributes(ExecutionObject exec_obj,
                                                         IxbElement elem,
                                                         Importer imp)
                                                  throws WTException
 TODO: This is a very old version of the DTD. We need to either update the DTD,
 or change this method so we are not checking a whole bunch of null ProjMgmtConstants.
 
 

Throws:
WTException

importBaseProductInfo

public static PDMLinkProduct importBaseProductInfo(PDMLinkProduct prod,
                                                   IxbElement elem,
                                                   Importer imp)

importBaseLibraryInfo

public static WTLibrary importBaseLibraryInfo(WTLibrary lib,
                                              IxbElement elem,
                                              Importer imp)

computeDuration

public static TimeToElapse computeDuration(IxbElement elem,
                                           Importer imp)
                                    throws WTException
Throws:
WTException

importDuration

public static ExecutionObject importDuration(ExecutionObject exec_obj,
                                             IxbElement elem,
                                             Importer imp)
                                      throws WTException
Throws:
WTException

getTimeToElapse

public static TimeToElapse getTimeToElapse(IxbElement elem,
                                           String tag,
                                           Importer imp)
                                    throws WTException
Extracts the elapsed time from the element that corresponds to the tag passed as argument. Elapsed time is typically represented as a string and an attribute giving the unit of time in which the elapsed time is represented, as shown below.
 
 
 

Throws:
WTException

getWork

public static Work getWork(IxbElement elem,
                           String tag,
                           Importer imp)
                    throws WTException
Extracts the work from the element that corresponds to the tag passed as argument. Work is typically represented as a string and an attribute giving the unit of time in which the work is represented, as shown below.
 
 
 

Throws:
WTException

getCost

public static Currency getCost(IxbElement elem,
                               String tag,
                               Importer imp)
                        throws WTException
Extracts the cost from the element that corresponds to the tag passed as argument. Cost (Currency) is typically represented as a string and an attribute giving the locale in which the currency is represented, as shown below.
 
 
 

Throws:
WTException

getRate

public static CurrencyRate getRate(IxbElement elem,
                                   String tag,
                                   Importer imp)
                            throws WTException
 
 

Throws:
WTException

importProjectVariables

public static WfExecutionObject importProjectVariables(WfExecutionObject exec_obj,
                                                       IxbElement elem,
                                                       Importer imp)
                                                throws WTException
 
 
 
 

Throws:
WTException

setVariableValue

public static void setVariableValue(ProcessData context,
                                    String var_name,
                                    Class var_cls,
                                    String val_str,
                                    Importer imp)
                             throws WTException
Throws:
WTException

getReference

public static ObjectReference getReference(String ref_str,
                                           Importer imp)
                                    throws WTException
Throws:
WTException

stringToTimeStamp

public static Timestamp stringToTimeStamp(String str)
                                   throws WTException
Utility function that convers a string to a timestamp returns null on any type of failure.

Throws:
WTException

getProjectState

public static ProjectState getProjectState(IxbElement elem)
                                    throws WTException
Returns:
ProjectState object
Throws:
WTException

getObjFromObjectIDElement

public static Object getObjFromObjectIDElement(IxbElement objId,
                                               Importer imp)
                                        throws WTException
ObjectIds may come in two flavors. One with a local identifier such as PROJECT_1, and the other would be an explicit object identifer as one would get from the export of a non-federatable object. This looks like wt.part.WTPart:3432. This function unifies the logic of checking which type of object to get.

Throws:
WTException - if the tag is not an ObjectID tag.

getObjFromObjRefElem

public static Object getObjFromObjRefElem(IxbElement objRef,
                                          Importer imp)
                                   throws WTException
ObjectReferences can come in three flavors localId, ufid, and custom. This method only assumes localId since custom is for a very specific scenario, and ufid is handled elsewhere.

Throws:
WTException

setTmpId

public static void setTmpId(IxbElement elem,
                            Importer imp)
                     throws WTException
Takes an ObjectId object and if the object id is a localId, we store the tmpId. This is only relevent for interfacing with WTDocument and WTPart in netmarkets scenarios

Throws:
WTException

getProjectRiskValue

public static ProjectRiskValue getProjectRiskValue(IxbElement elem)
                                            throws WTException
Returns:
ProjectRiskValue constant is returned corresponding to the value of the value attribute. If the input element is null the model default is returned.
Throws:
WTException - is thrown if the input IxbElement does not correspond to a tag.

getProjectPhase

public static ProjectPhase getProjectPhase(IxbElement elem)
                                    throws WTException
Returns:
ProjectPhase.KICKOFF if the elem is null, or the attribute is not defined, otherwise the phase specified by the XML element.
Throws:
WTException - is thrown if the input IxbElement does not correspond to a tag.

getProjectHealthStatus

public static ProjectHealthStatus getProjectHealthStatus(IxbElement elem)
                                                  throws WTException
This method returns a ProjectHealthStatus object. An exception is thrown if it does not recieve an IxbElement corresponding to a tag. This is used for both execution objects and template objects.

Throws:
WTException

getProjectCategory

public static ProjectCategory getProjectCategory(IxbElement elem)
                                          throws WTException
This method returns the ProjectCategory object. An exception is thrown if it does not receive a tag. This is used for both execution objects and template objects.

Throws:
WTException

findProjectPlan

public static ProjectPlan findProjectPlan(IxbElement elem,
                                          Importer imp)
                                   throws WTException
Finds the project plan referenced by the element passed as argument.

Throws:
WTException

validateXMLInputStream

public static boolean validateXMLInputStream(InputStream in)
                                      throws WTException
This method does some simple validation on the input stream to verify that its contents do in fact contain an XML file. It also validates the XML file. It returns true if the file is valid, and returns false otherwise. This method should only be used in development scenarios since it does more extra checks than the default parser code. This method will throw a WTException with a diagnostic method on failure. It returns true on success. The InputStream passed to this method cannot be re-used.

Throws:
WTException

checkBufferSanity

public static boolean checkBufferSanity(StringBuffer strBuff)
                                 throws WTException
Throws:
WTException

checkStreamSanity

public static PushbackInputStream checkStreamSanity(InputStream in)
                                             throws WTException
This method performs a sanity check on an input stream. It does so by chaining the InputStream to a PushbackInputStream. A minimal sanity check is performed on the xml file. (Check for null, nothing but whitespacr, and that it begins with the string Since actual version numbers may change in the future we do not check for 1.0 The returned input stream is ready to be passed into the parser.

Throws:
WTException

exportToJarFile

public static File exportToJarFile(Persistable persistObj,
                                   File tmpFile)
                            throws WTException
Deprecated. use epxortToJarFile(WTContainerRef contRef, Persistable persistObj, File tmpFile) instead

Throws:
WTException

exportToJarFile

public static File exportToJarFile(WTContainerRef contRef,
                                   Persistable persistObj,
                                   File tmpFile)
                            throws WTException
Throws:
WTException

exportDocumentToJarFile

public static File exportDocumentToJarFile(WTContainerRef contRef,
                                           WTDocument document,
                                           File tmpFile)
                                    throws WTException
Throws:
WTException

exportProductStructureToJarFile

public static File exportProductStructureToJarFile(WTContainerRef contRef,
                                                   List parts,
                                                   File tmpFile)
                                            throws WTException
Throws:
WTException

exportFolderStructureToJarFile

public static File exportFolderStructureToJarFile(WTContainerRef contRef,
                                                  Folder folder,
                                                  File tmpFile)
                                           throws WTException
Throws:
WTException

importFromJarFile

public static boolean importFromJarFile(Object obj,
                                        String file_name)
                                 throws WTException
Throws:
WTException

importFromJarFile

public static boolean importFromJarFile(WTContainerRef contRef,
                                        Object obj,
                                        String file_name)
                                 throws WTException
Throws:
WTException

importFromJarFileToProject

public static boolean importFromJarFileToProject(WTContainerRef target,
                                                 File tmpFile)
                                          throws WTException
Throws:
WTException

importFromJarFileToContainer

public static boolean importFromJarFileToContainer(WTContainerRef target,
                                                   File tmpFile)
                                            throws WTException
Throws:
WTException

importFromJarFileToFolder

public static boolean importFromJarFileToFolder(Folder folder,
                                                File tmpFile)
                                         throws WTException
Deprecated.  

Throws:
WTException

importFromJarFileToNotebook

public static boolean importFromJarFileToNotebook(NotebookFolder notebook_folder,
                                                  File tmpFile)
                                           throws WTException
Throws:
WTException

generateImportMappingRules

private static IxbDocument generateImportMappingRules(NotebookFolder notebook_folder)
                                               throws WTException
Throws:
WTException

generateFolderMappingRules

public static IxbDocument generateFolderMappingRules(Folder theFolder)
                                              throws WTException
This generates mapping rules for the savePath. What happens is that all folder names will get mapped to the existing folder name. Sample usage scenario. I am importing into folder foo. //Step one create an instance of NMHandler. NMHandler nh = new NMHandler () IxbDocument mapDoc = ProductIXUtils.generateMappingRules ("/system/docs"); Importer imp = IxbHelper.newImporter (myHandler, IxbHelper.STANDARD_DTD, mapDoc); InputStream is= getInputStreamContaingingXMLFile ( whatever data is needed). imp.doImport (is, validateFlag); imp.finalizeImport (); if null is passed in, the default folder will be used.

Throws:
WTException

generateExportMappingRules

public static IxbDocument generateExportMappingRules()
                                              throws WTException
Throws:
WTException

generateImportMappingRules

public static IxbDocument generateImportMappingRules()
                                              throws WTException
Throws:
WTException

updateLifecyclePathRules

private static final void updateLifecyclePathRules(IxbElement rootElement)
                                            throws WTException
Throws:
WTException

updateFolderPathRules

private static final void updateFolderPathRules(IxbElement rootElem,
                                                String path,
                                                String value,
                                                String newValue)
                                         throws WTException
Throws:
WTException

exportWTDocument

public static void exportWTDocument(WTDocument doc,
                                    IxbElement elem,
                                    Exporter exporter)
                             throws WTException
Exports a document into the given IxbElement. This method should be in the WT document handler. It is here so not to change the basic framework.

Throws:
WTException

exportWTPart

public static void exportWTPart(WTPart part,
                                IxbElement elem,
                                Exporter exporter)
                         throws WTException
Exports a part into the given IxbElement. This method should be in the WT part handler. It is here so not to change the basic framework.

Throws:
WTException

exportWTPartReferenceLink

public static void exportWTPartReferenceLink(WTPartReferenceLink part_link,
                                             IxbElement elem,
                                             Exporter exporter)
                                      throws WTException
Exports a part reference link into the given IxbElement. This method should be in the WT part link handler. It is here so not to change the basic framework.

Throws:
WTException

exportWTPartUsageLink

public static void exportWTPartUsageLink(WTPartUsageLink part_link,
                                         IxbElement elem,
                                         Exporter exporter)
                                  throws WTException
Exports a part reference link into the given IxbElement. This method should be in the WT part link handler. It is here so not to change the basic framework.

Throws:
WTException

copyStream

public static void copyStream(InputStream in,
                              OutputStream out)
                       throws WTException
Copies an input stream to an output stream. Caller is responsible for closing after completion.

Throws:
WTException

postFeedback

public static void postFeedback(Importer imp,
                                String rb,
                                String key,
                                Object[] params,
                                int level)
                         throws WTException
Posts message to the logger.

Throws:
WTException

postExportFeedback

public static void postExportFeedback(String rb,
                                      String key)
                               throws WTException
Throws:
WTException

postExportFeedback

public static void postExportFeedback(String rb,
                                      String key,
                                      Object[] params)
                               throws WTException
Throws:
WTException

getProjectPlan

public static ProjectPlan getProjectPlan(Project2 project)
                                  throws WTException
Returns project plan associated with project or 'null' if none exists.

Throws:
WTException

getPlans

public static QueryResult getPlans(PDMLinkProduct product)
                            throws WTException
Returns project plans associated with project.

Throws:
WTException

getPlans

public static QueryResult getPlans(WTLibrary library)
                            throws WTException
Returns project plans associated with project.

Throws:
WTException

getDocuments

public static QueryResult getDocuments(Project2 project)
                                throws WTException
Returns documents contained in project.

Throws:
WTException

getParts

public static QueryResult getParts(Project2 project)
                            throws WTException
Returns parts contained in project.

Throws:
WTException

getObjects

public static QueryResult getObjects(WTContainer cont,
                                     Class object_class)
                              throws WTException
Returns objects of a given class contained in project.

Throws:
WTException

getProject

public static Project2 getProject(String project_name)
                           throws WTException
Throws:
WTException

getDeliverable

public static Deliverable getDeliverable(ProjectPlan plan,
                                         String deli_name)
                                  throws WTException
Throws:
WTException

getDeliverables

public static Enumeration getDeliverables(ProjectPlan plan)
                                   throws WTException
Throws:
WTException

setOwner

public static ExecutionObject setOwner(ExecutionObject exec_obj,
                                       IxbElement elem,
                                       Importer imp)
                                throws WTException
 
 
 

Throws:
WTException

getRole

public static Role getRole(IxbElement role_elem)
                    throws WTException
Returns a role given an IxbElement corresponding to the Role tag. Used during import.

Returns:
the Role object for which the role is the name.
Throws:
WTException

addRoleElem

public static void addRoleElem(IxbElement elem,
                               Role role)
                        throws WTException
Adds a role element to the passed element. Used during export.

Throws:
WTException

getReader

public static Reader getReader(File xmlFile)
                        throws IOException
Get a Reader on the contents of the specified File. Make sure the correct character encoding is used when reading the XML file content.

Parameters:
xmlFile - the file containg the XML
Throws:
IOException

getEncoding

public static String getEncoding(String xmlText)
                          throws IOException
Get the character encoding that is specified in the XML text. Return null if no encoding is specified in the file.

Parameters:
xmlText - a string containing well-formed XML text
Returns:
the encoding specified in the XML text or null if no encoding is specified
Throws:
IOException

getEncoding

public static String getEncoding(File xmlFile)
                          throws IOException
Get the character encoding that is specified in the XML file. Return null if no encoding is specified in the file.

Parameters:
xmlFile - a file containing well-formed XML text
Returns:
the encoding specified in the XML text or null if no encoding is specified
Throws:
IOException

getEncodingFromHeader

private static String getEncodingFromHeader(String header)
Get the character encoding that is specified in the given XML header. Return null if no encoding is specified in the declaration.

Returns:
the encoding specified in the XML header or null if no encoding is specified

getHeader

private static String getHeader(String content)
                         throws IOException
Get the
Parameters:
content - a string containing well-formed XML
Throws:
IOException

getHeader

private static String getHeader(File file)
                         throws IOException
Get the
Throws:
IOException

getHeader

private static String getHeader(InputStream is)
                         throws IOException
Get the null if the header is not well-formed or cannot be found.

Throws:
IOException

getFolderPath

private static String getFolderPath(NotebookFolder folder)
                             throws WTException
Throws:
WTException

getParentTemplate

private static WfContainerTemplate getParentTemplate(WfTemplateObject template)
                                              throws WTException
Throws:
WTException

getId

private ObjectIdentifier getId(Object obj)

processBooleanStr

private static boolean processBooleanStr(String str)

getIteratedObject

public static Iterated getIteratedObject(WTContainerRef contRef,
                                         Class theClass,
                                         String attrName,
                                         String attrValue)
                                  throws WTException
Throws:
WTException

getPrincipalByName

public static WTPrincipal getPrincipalByName(WTContainerRef contRef,
                                             String princName)
                                      throws WTException
There has been some volatility in these methods so the logic is being localized here.

Throws:
WTException

getGroupByName

public static WTGroup getGroupByName(WTContainerRef contRef,
                                     String princName)
                              throws WTException
Throws:
WTException

getUserByName

public static WTUser getUserByName(WTContainerRef contRef,
                                   String userName)
                            throws WTException
Throws:
WTException

getPrincipalByDN

public static WTPrincipal getPrincipalByDN(String dnName)
                                    throws WTException
Throws:
WTException

getUserByDN

public static WTUser getUserByDN(String dnName)
                          throws WTException
Throws:
WTException