com.ptc.wgmecad.ecad
Class ClientInterface

java.lang.Object
  extended bycom.ptc.wgmecad.ecad.ClientInterface
All Implemented Interfaces:
IRegisterProgress

public class ClientInterface
extends Object
implements IRegisterProgress


Field Summary
private static ArgumentMap argMap
           
private static ArgumentRegister argReg
           
private static String IGNORE_THIS_ATTRIBUTE
           
(package private) static org.apache.log4j.Logger logger
           
private static SecondaryArgumentMap sargMap
           
private static SecondaryArgumentRegister sargReg
           
 
Constructor Summary
ClientInterface()
           
 
Method Summary
static void addAttributes(DocCreationHelper dch, Element document, String type, ECADAttributes attributes, Properties attributeProperties)
          iterate thru all the ECADAttributDef's for the document type and then create an appropriate Integer, String or Double value based on the attributes type in the ECADAttributDef, set the value to what is read in from the properties file, and then set these values on the document.
private  void addAttributesToAllDocs(DocCreationHelper dch, Element ecadDesign, Properties attributeProperties, ECADAttributes attributes)
           
private  void addBOMsToDOM(Collection asm_nums, DocCreationHelper dch, Element ecadDesign, File bomFile, String asm_number)
          add the BOMs to all the variants
private  void addBOMToAssembly(DocCreationHelper dch, Element ecadDesign, File bomFile, String asm_number)
           
 void cancelCheckout(String functionName, DesignAll design)
           
private  boolean checkExistence(File file)
           
 void checkin(String functionName, File tempdirpath, File attrdef_file, File[] attributeFiles, File tarFile, WindchillIntegrationManager im, ProcessManager pm, DesignAll design, boolean checkout)
          create new design in Windchill, or checkin existing design.
private  void checkoutLegacy(String functionName, DesignAll design, File targetPath, String ecadToolHLI)
           
 void createnew(String functionName, File tempdirpath, File attrdef_file, File[] attributeFiles, File tarFile, WindchillIntegrationManager im, ProcessManager pm, DesignAll design)
          create new design in Windchill, or checkin existing design.
private  void createVariantAssemblyElements(Collection asm_nums, DocCreationHelper dch, Element ecadDesign, DesignAll dsn)
          create elements within the DOM for the variant assemblies
 void download(String functionName, DesignAll design, File targetPath, boolean checkout)
           
 void download(String functionName, DesignAll design, File boardPath, File schPath, boolean checkout)
           
private static String fixInvalidValues(ECADAttributesDef attributeDefinition, String value)
          for Integer or Float attributes, make sure that we can construct the appropriate types, and if not, then reset the values to 0 or 0.0 respectively.
 Vector getCabinetNames(String solution, String context)
           
 Vector getCabinets(String solution, String context)
           
 Vector getProducts()
           
 Vector getProjects()
           
 Vector getTeams(String solution, String context)
           
 int getTotalInitTime()
           
 int getTotalOperation()
           
 int getTotalPre()
           
static String getVersion(boolean server, boolean fromClassPath)
           
 boolean isContextValid(String solution, String context)
           
 boolean isDocInWindchill(String number, String revision, WTContainerRef containerRef)
           
private  boolean isEmpty(String string)
           
private static Properties loadAttributeProperties(File attributeFile)
           
 EPMDocument lookupDocument(String number, String revision, WTContainerRef containerRef)
           
 void newRevision(String functionName, DesignAll design)
           
private static void printIrregularPropertiesToSystemOut(File attributeFile)
           
static Properties readAttributeProperties(File attributeFile)
           
private  ECADAttributes readAttributesDefinition(File attrdef_file)
           
private  Vector splitOnSpaces(String refDess)
           
static String toolTypeToHLI(String toolTypeWGM)
           
static String toolTypeToWGM(String toolTypeHLI)
           
private static void validateAttribute(Properties attrs, String attrName)
           
static void validateWorkspacesForCheckin(DesignAll design, String function)
           
private  void verifyFiles(File attrdef_file, File[] attributeFiles, File rootDirectory, File tarFile, File bomFile)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IGNORE_THIS_ATTRIBUTE

private static final String IGNORE_THIS_ATTRIBUTE
See Also:
Constant Field Values

argMap

private static ArgumentMap argMap

argReg

private static ArgumentRegister argReg

sargMap

private static SecondaryArgumentMap sargMap

sargReg

private static SecondaryArgumentRegister sargReg

logger

static org.apache.log4j.Logger logger
Constructor Detail

ClientInterface

public ClientInterface()
Method Detail

verifyFiles

private void verifyFiles(File attrdef_file,
                         File[] attributeFiles,
                         File rootDirectory,
                         File tarFile,
                         File bomFile)
                  throws FileNotFoundException
Throws:
FileNotFoundException

checkExistence

private boolean checkExistence(File file)
                        throws FileNotFoundException
Throws:
FileNotFoundException

validateAttribute

private static void validateAttribute(Properties attrs,
                                      String attrName)
                               throws MissingAttributeException
Throws:
MissingAttributeException

readAttributeProperties

public static Properties readAttributeProperties(File attributeFile)
                                          throws FileNotFoundException,
                                                 IOException,
                                                 MissingAttributeException,
                                                 BoardSameAsAssemblyNumException
Throws:
FileNotFoundException
IOException
MissingAttributeException
BoardSameAsAssemblyNumException

loadAttributeProperties

private static Properties loadAttributeProperties(File attributeFile)
                                           throws IOException
Throws:
IOException

printIrregularPropertiesToSystemOut

private static void printIrregularPropertiesToSystemOut(File attributeFile)
                                                 throws IOException
Throws:
IOException

readAttributesDefinition

private ECADAttributes readAttributesDefinition(File attrdef_file)
                                         throws FileNotFoundException,
                                                IOException
Throws:
FileNotFoundException
IOException

addAttributes

public static void addAttributes(DocCreationHelper dch,
                                 Element document,
                                 String type,
                                 ECADAttributes attributes,
                                 Properties attributeProperties)
                          throws IllegalArgumentException
iterate thru all the ECADAttributDef's for the document type and then create an appropriate Integer, String or Double value based on the attributes type in the ECADAttributDef, set the value to what is read in from the properties file, and then set these values on the document.

Parameters:
document - - where to set these attributes
type - - what type of document to treat this as - for the purposed of getting its defined attributes
Throws:
IllegalArgumentException

fixInvalidValues

private static String fixInvalidValues(ECADAttributesDef attributeDefinition,
                                       String value)
for Integer or Float attributes, make sure that we can construct the appropriate types, and if not, then reset the values to 0 or 0.0 respectively.

Parameters:
attributeDefinition -
value -
Returns:

createnew

public void createnew(String functionName,
                      File tempdirpath,
                      File attrdef_file,
                      File[] attributeFiles,
                      File tarFile,
                      WindchillIntegrationManager im,
                      ProcessManager pm,
                      DesignAll design)
               throws WindchillFunctionException
create new design in Windchill, or checkin existing design.

Parameters:
functionName -
tempdirpath -
attrdef_file -
tarFile -
im -
design -
Throws:
DesignNotInWindchillException
WindchillFunctionException
DesignNotCheckedOutException
MissingAttributeException
ECADPropertiesMissingException
CancelledException
BoardSameAsAssemblyNumException

checkin

public void checkin(String functionName,
                    File tempdirpath,
                    File attrdef_file,
                    File[] attributeFiles,
                    File tarFile,
                    WindchillIntegrationManager im,
                    ProcessManager pm,
                    DesignAll design,
                    boolean checkout)
             throws WindchillFunctionException
create new design in Windchill, or checkin existing design.

Parameters:
functionName -
tempdirpath -
attrdef_file -
tarFile -
im -
design -
Throws:
DesignNotInWindchillException
WindchillFunctionException
DesignNotCheckedOutException
MissingAttributeException
ECADPropertiesMissingException
CancelledException
BoardSameAsAssemblyNumException

addBOMsToDOM

private void addBOMsToDOM(Collection asm_nums,
                          DocCreationHelper dch,
                          Element ecadDesign,
                          File bomFile,
                          String asm_number)
add the BOMs to all the variants

Parameters:
asm_nums -
dch -
ecadDesign -
bomFile -
asm_number -

createVariantAssemblyElements

private void createVariantAssemblyElements(Collection asm_nums,
                                           DocCreationHelper dch,
                                           Element ecadDesign,
                                           DesignAll dsn)
create elements within the DOM for the variant assemblies

Parameters:
asm_nums -
dch -
ecadDesign -
dsn -

addBOMToAssembly

private void addBOMToAssembly(DocCreationHelper dch,
                              Element ecadDesign,
                              File bomFile,
                              String asm_number)
                       throws MissingAssemblyException
Throws:
MissingAssemblyException

splitOnSpaces

private Vector splitOnSpaces(String refDess)

addAttributesToAllDocs

private void addAttributesToAllDocs(DocCreationHelper dch,
                                    Element ecadDesign,
                                    Properties attributeProperties,
                                    ECADAttributes attributes)

cancelCheckout

public void cancelCheckout(String functionName,
                           DesignAll design)
                    throws WindchillFunctionException
Throws:
WindchillFunctionException

newRevision

public void newRevision(String functionName,
                        DesignAll design)
                 throws WindchillFunctionException
Throws:
WindchillFunctionException

isEmpty

private boolean isEmpty(String string)

checkoutLegacy

private void checkoutLegacy(String functionName,
                            DesignAll design,
                            File targetPath,
                            String ecadToolHLI)
                     throws WTException
Throws:
WTException

download

public void download(String functionName,
                     DesignAll design,
                     File targetPath,
                     boolean checkout)
              throws WTException,
                     WindchillFunctionException
Throws:
WTException
WindchillFunctionException

download

public void download(String functionName,
                     DesignAll design,
                     File boardPath,
                     File schPath,
                     boolean checkout)
              throws WTException,
                     WindchillFunctionException
Throws:
WTException
WindchillFunctionException

isContextValid

public boolean isContextValid(String solution,
                              String context)

getCabinetNames

public Vector getCabinetNames(String solution,
                              String context)
                       throws WTException
Throws:
WTException

getCabinets

public Vector getCabinets(String solution,
                          String context)
                   throws WTException
Throws:
WTException

getTeams

public Vector getTeams(String solution,
                       String context)
                throws WTException
Throws:
WTException

getProducts

public Vector getProducts()
                   throws WTException
Throws:
WTException

getProjects

public Vector getProjects()
                   throws WTException
Throws:
WTException

toolTypeToHLI

public static String toolTypeToHLI(String toolTypeWGM)

toolTypeToWGM

public static String toolTypeToWGM(String toolTypeHLI)

lookupDocument

public EPMDocument lookupDocument(String number,
                                  String revision,
                                  WTContainerRef containerRef)
                           throws WTException
Throws:
WTException

isDocInWindchill

public boolean isDocInWindchill(String number,
                                String revision,
                                WTContainerRef containerRef)
                         throws WTException
Throws:
WTException

getTotalPre

public int getTotalPre()
Specified by:
getTotalPre in interface IRegisterProgress

getTotalOperation

public int getTotalOperation()
Specified by:
getTotalOperation in interface IRegisterProgress

getTotalInitTime

public int getTotalInitTime()
Specified by:
getTotalInitTime in interface IRegisterProgress

getVersion

public static String getVersion(boolean server,
                                boolean fromClassPath)
                         throws UnableToGetDataFromServerException
Throws:
UnableToGetDataFromServerException

validateWorkspacesForCheckin

public static void validateWorkspacesForCheckin(DesignAll design,
                                                String function)
                                         throws DesignNotInWindchillException,
                                                DesignNotCheckedOutException,
                                                DesignPartsInSameWorkspaceException,
                                                DesignPartsNotInSameWorkspaceException
Throws:
DesignNotInWindchillException
DesignNotCheckedOutException
DesignPartsInSameWorkspaceException
DesignPartsNotInSameWorkspaceException