wt.query.template
Class LoadReportTemplate

java.lang.Object
  extended bywt.query.template.LoadReportTemplate

public class LoadReportTemplate
extends Object

Creates and persists ReportTemplate objects based on input from a comma separated value (csv) file. Method names and parameters are defined in csvmapfile.txt. wt.load.StandardLoadService.load reads records from a .csv file and passes the fields in a hashtable to methods defined in this class. These methods then create and persist part objects.

The standalone version will use csvmapfile.txt and the .csv file will be loaded from command line as specified below:

The replace option "-replace" can be used to update existing reports if they exist. If the report exists, then all attributes are set (except for folder location) and the object is updated. If the report does not exist, then the normal create is done.

Standalone Usages:

java wt.query.template.LoadReportTemplate (default path)

java wt.query.template.LoadReportTemplate c:\loadReports.csv (absolute path)

java wt.query.template.LoadReportTemplate loadReports.csv (relative path)

java wt.query.template.LoadReportTemplate c:\loadReports.csv -replace (absolute path with replace)

XML File:

Within the .csv file specify the XML source with an absolute path or the default directory will be searched (wt.loadFiles.reports). Also if the folder to store the reports in does not exist, one will be created.



Supported API: true
Extendable: false

See Also:
ExportReportTemplate

Field Summary
private static String DELEGATE_XSL
           
private static String LOAD_FILE_DIR
           
private static String REPLACE_OPTION
           
private static String RESOURCE
           
private static String URL_XSL
           
private static boolean VERBOSE
           
private static String WT_HOME
           
private static String XMLDir
           
 
Constructor Summary
LoadReportTemplate()
           
 
Method Summary
private static WTContainerRef createContainerReference(Hashtable nv, Hashtable cmd_line, String a_containerPath)
           
static ReportTemplate createReportTemplate(Hashtable nv, Hashtable cmdLine)
           
static boolean createReportTemplate(Hashtable nv, Hashtable cmd_line, Vector return_objects)
          Processes "ReportTemplate" lines from a csv load file.
static ReportTemplate createReportTemplate(String a_reportName, String a_reportFolder, String a_xmlFileName, String a_containerPath, Hashtable nv, Hashtable cmdLine)
           
static String getValue(Hashtable nv, String name, boolean required)
           
private static DelegationXSLSpec loadDelegationXSL(Hashtable nv)
           
private static String loadFile(String file_name)
           
private static URLXSLSpec loadURLXSL(Hashtable nv)
           
static void main(String[] args)
          Command line method for loading demonstration data into the Windchill system.
private static void printMessage(String a_message)
           
static void setXMLDir(String a_xmlDir)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DELEGATE_XSL

private static final String DELEGATE_XSL
See Also:
Constant Field Values

URL_XSL

private static final String URL_XSL
See Also:
Constant Field Values

LOAD_FILE_DIR

private static final String LOAD_FILE_DIR

WT_HOME

private static final String WT_HOME

VERBOSE

private static final boolean VERBOSE

REPLACE_OPTION

private static final String REPLACE_OPTION
See Also:
Constant Field Values

XMLDir

private static String XMLDir

RESOURCE

private static String RESOURCE
Constructor Detail

LoadReportTemplate

public LoadReportTemplate()
Method Detail

createReportTemplate

public static boolean createReportTemplate(Hashtable nv,
                                           Hashtable cmd_line,
                                           Vector return_objects)
Processes "ReportTemplate" lines from a csv load file. Creates a new ReportTemplate using the attributes contained in the Hashtable parameter.

Parameters:
nv - Name/Value pairs of Report Template attributes. The attributes are as follows:
  • command(ReportTemplate)
  • folder
  • name(Report Template name)
  • description
  • xml(file location)
  • xslType(DEL, URL or empty)
  • service(HTML, XML, CSV.....)
  • containerPath( example - /wt.inf.container.OrgContainer=DefaultOrg/wt.inf.container.ClassicContainer=Classic)
  • url1(required for xslType = URL)
  • url2

setXMLDir

public static void setXMLDir(String a_xmlDir)

createReportTemplate

public static ReportTemplate createReportTemplate(Hashtable nv,
                                                  Hashtable cmdLine)
                                           throws WTException
Throws:
WTException

createReportTemplate

public static ReportTemplate createReportTemplate(String a_reportName,
                                                  String a_reportFolder,
                                                  String a_xmlFileName,
                                                  String a_containerPath,
                                                  Hashtable nv,
                                                  Hashtable cmdLine)
                                           throws WTException
Throws:
WTException

createContainerReference

private static WTContainerRef createContainerReference(Hashtable nv,
                                                       Hashtable cmd_line,
                                                       String a_containerPath)
                                                throws WTException
Throws:
WTException

loadDelegationXSL

private static DelegationXSLSpec loadDelegationXSL(Hashtable nv)
                                            throws WTPropertyVetoException,
                                                   WTException
Throws:
WTPropertyVetoException
WTException

loadURLXSL

private static URLXSLSpec loadURLXSL(Hashtable nv)
                              throws WTPropertyVetoException,
                                     WTException
Throws:
WTPropertyVetoException
WTException

loadFile

private static String loadFile(String file_name)
                        throws WTException
Throws:
WTException

getValue

public static String getValue(Hashtable nv,
                              String name,
                              boolean required)
                       throws WTException
Throws:
WTException

printMessage

private static void printMessage(String a_message)

main

public static void main(String[] args)
                 throws Exception
Command line method for loading demonstration data into the Windchill system.

Parameters:
args - Not used anymore, ignored.
Throws:
Exception