ext.sulis
Class StaticHelper

java.lang.Object
  extended by ext.sulis.StaticHelper
All Implemented Interfaces:
wt.method.RemoteAccess

public class StaticHelper
extends java.lang.Object
implements wt.method.RemoteAccess

purpose: provide static methods to ease various common windchill tasks


Field Summary
static java.text.SimpleDateFormat DATE_WITH_TIME
           
static int MULTIVAL_ERR
           
static int MULTIVAL_FIRST
           
static int MULTIVAL_VECTOR
           
static boolean WITH_UNITS
           
static boolean WITHOUT_UNITS
           
 
Fields inherited from interface wt.method.RemoteAccess
versionID
 
Constructor Summary
StaticHelper()
           
 
Method Summary
static void _insert(wt.fc.collections.WTHashSet ws)
           
static void addIBAs(com.infoengine.object.factory.Element e, wt.iba.value.IBAHolder i, java.lang.String prefix)
          add the ibas of an object to an element as Atts, prefixing optionally with a string; use default data and time, no units and throw error on multivalued iba.
static void addIBAs(com.infoengine.object.factory.Element e, wt.iba.value.IBAHolder i, java.lang.String prefix, java.text.SimpleDateFormat fmt, boolean withUnits, int multival_flag)
          add the ibas of an object to an element as Atts, prefixing optionally with a string
static java.lang.String getFullTypeName(java.lang.String typeName)
          return a type"s full type name e˙g˙, WCTYPE|wt.part.WTPart|de.sulis.Stype
static java.lang.String getType(wt.fc.WTObject o)
          return an objects type name
static java.util.Hashtable IBAHash(wt.iba.value.DefaultAttributeContainer dac)
          return the result of IBAHash(DefaultAttributeContainer,SimpleDateFormat) with default date "yyyyMMdd hh:mm:ss"
static java.util.Hashtable IBAHash(wt.iba.value.DefaultAttributeContainer dac, java.text.SimpleDateFormat f)
          return the IBAs of an IBAHolder's attribute container; format Timestamps with dateformat passed in.
static java.util.Hashtable IBAHash(wt.iba.value.DefaultAttributeContainer dac, java.text.SimpleDateFormat f, boolean withUnits)
          return the IBAs of an IBAHolder's attribute container; format Timestamps with dateformat passed in.
static java.util.Hashtable IBAHash(wt.iba.value.DefaultAttributeContainer dac, java.text.SimpleDateFormat f, boolean withUnits, int multival_flag)
          return the IBAs of an IBAHolder's attribute container; format Timestamps with dateformat passed in.
static java.util.Hashtable IBAHash(wt.iba.value.IBAHolder i)
          return the result of IBAHash(IBAHolder,SimpleDateFormat) with default date "yyyyMMdd hh:mm:ss"
static java.util.Hashtable IBAHash(wt.iba.value.IBAHolder h, java.text.SimpleDateFormat f)
          return the IBAs of an IBAHolder; format Timestamps with dateformat passed in.
static java.util.Hashtable IBAHash(wt.iba.value.IBAHolder h, java.text.SimpleDateFormat f, boolean withUnits)
          return the IBAs of an IBAHolder; format Timestamps with dateformat passed in.
static java.util.Hashtable IBAHash(wt.iba.value.IBAHolder h, java.text.SimpleDateFormat f, boolean withUnits, int multival_flag)
          return the IBAs of an IBAHolder; format Timestamps with dateformat passed in.
static java.util.Hashtable IBAHash(wt.iba.value.IBAHolder i, java.lang.String newFmt)
          return the result of IBAHash(IBAHolder,SimpleDateFormat) with dateformat passed in
static java.util.Hashtable IBAHash(wt.iba.value.IBAHolder i, java.lang.String newFmt, boolean withUnits)
          return the result of IBAHash(IBAHolder,SimpleDateFormat,withUnits) with dateformat passed in
static void insert(wt.fc.collections.WTHashSet ws)
          persiste the objects in the WTHashSet using server side method.
static void main(java.lang.String[] a)
          print program usage info or invoke testConn()
static wt.vc.OneOffVersioned newOneOff(wt.vc.OneOffVersioned v)
           
static wt.vc.Versioned newVersion(wt.vc.Versioned v)
           
static boolean stackTraceContains(java.util.regex.Pattern p)
           
static boolean stackTraceContains(java.lang.String s)
           
static boolean stackTraceContains(java.lang.String s, boolean lower)
           
static void testConn(java.lang.String[] a)
          allow testing of oracle connection running "select sysdate from dual", either with supplied args or the connection info from db.properties. prints result to STDERR
static java.lang.String[] typeArray(java.lang.String t)
          return an array with an objects type hierarchy
static java.lang.String[] typeArray(wt.fc.WTObject o)
          return an array with an objects type hierarchy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MULTIVAL_ERR

public static final int MULTIVAL_ERR
See Also:
Constant Field Values

MULTIVAL_FIRST

public static final int MULTIVAL_FIRST
See Also:
Constant Field Values

MULTIVAL_VECTOR

public static final int MULTIVAL_VECTOR
See Also:
Constant Field Values

WITH_UNITS

public static final boolean WITH_UNITS
See Also:
Constant Field Values

WITHOUT_UNITS

public static final boolean WITHOUT_UNITS
See Also:
Constant Field Values

DATE_WITH_TIME

public static java.text.SimpleDateFormat DATE_WITH_TIME
Constructor Detail

StaticHelper

public StaticHelper()
Method Detail

main

public static void main(java.lang.String[] a)
                 throws java.lang.Exception
print program usage info or invoke testConn()

Parameters:
a - commandline args
Throws:
java.lang.Exception

testConn

public static void testConn(java.lang.String[] a)
                     throws java.lang.Exception
allow testing of oracle connection running "select sysdate from dual", either with supplied args or the connection info from db.properties. prints result to STDERR

Parameters:
a - arguments, -c [host port sid user [pass]]
Throws:
java.lang.Exception

getType

public static java.lang.String getType(wt.fc.WTObject o)
                                throws wt.util.WTException
return an objects type name

Parameters:
o - the WTObject
Returns:
void
Throws:
wt.util.WTException

getFullTypeName

public static java.lang.String getFullTypeName(java.lang.String typeName)
                                        throws wt.util.WTException
return a type"s full type name e˙g˙, WCTYPE|wt.part.WTPart|de.sulis.Stype

Parameters:
o - the name, without prefix (e.g., not com.ptc.myType but just myType)
Returns:
void
Throws:
wt.util.WTException

typeArray

public static java.lang.String[] typeArray(wt.fc.WTObject o)
                                    throws wt.util.WTException
return an array with an objects type hierarchy

Parameters:
o - the WTObject
Returns:
void
Throws:
wt.util.WTException

typeArray

public static java.lang.String[] typeArray(java.lang.String t)
return an array with an objects type hierarchy

Parameters:
t - the windchill type string
Returns:
void
Throws:
wt.util.WTException

IBAHash

public static java.util.Hashtable IBAHash(wt.iba.value.IBAHolder i)
                                   throws wt.util.WTException,
                                          java.rmi.RemoteException
return the result of IBAHash(IBAHolder,SimpleDateFormat) with default date "yyyyMMdd hh:mm:ss"

Parameters:
i - the IBA Holder
Returns:
Hashtable
Throws:
wt.util.WTException - from windchill code
java.rmi.RemoteException - from windchill code

IBAHash

public static java.util.Hashtable IBAHash(wt.iba.value.DefaultAttributeContainer dac)
                                   throws wt.util.WTException,
                                          java.rmi.RemoteException
return the result of IBAHash(DefaultAttributeContainer,SimpleDateFormat) with default date "yyyyMMdd hh:mm:ss"

Parameters:
i - the IBA Holder's Attribute Container
Returns:
Hashtable
Throws:
wt.util.WTException - from windchill code
java.rmi.RemoteException - from windchill code

IBAHash

public static java.util.Hashtable IBAHash(wt.iba.value.IBAHolder i,
                                          java.lang.String newFmt)
                                   throws wt.util.WTException,
                                          java.rmi.RemoteException
return the result of IBAHash(IBAHolder,SimpleDateFormat) with dateformat passed in

Parameters:
i - the IBA Holder
newFmt - the DateFormat to use for formatting Timestamps
Returns:
Hashtable
Throws:
wt.util.WTException - from windchill code or if SimpleDateFormat is bad
java.rmi.RemoteException - from windchill code

IBAHash

public static java.util.Hashtable IBAHash(wt.iba.value.IBAHolder i,
                                          java.lang.String newFmt,
                                          boolean withUnits)
                                   throws wt.util.WTException,
                                          java.rmi.RemoteException
return the result of IBAHash(IBAHolder,SimpleDateFormat,withUnits) with dateformat passed in

Parameters:
i - the IBA Holder
newFmt - the DateFormat to use for formatting Timestamps
Returns:
Hashtable
Throws:
wt.util.WTException - from windchill code or if SimpleDateFormat is bad
java.rmi.RemoteException - from windchill code

IBAHash

public static java.util.Hashtable IBAHash(wt.iba.value.IBAHolder h,
                                          java.text.SimpleDateFormat f)
                                   throws wt.util.WTException,
                                          java.rmi.RemoteException
return the IBAs of an IBAHolder; format Timestamps with dateformat passed in. if an IBA is multivalued a WTException is thrown.

Parameters:
h - the IBA Holder
f - the DateFormat to use for formatting Timestamps
Returns:
Hashtable filled with IBANAME/IBAVALUE pairs
Throws:
wt.util.WTException - from windchill code or if multivalued IBA encountered.
java.rmi.RemoteException - from windchill code

IBAHash

public static java.util.Hashtable IBAHash(wt.iba.value.DefaultAttributeContainer dac,
                                          java.text.SimpleDateFormat f)
                                   throws wt.util.WTException,
                                          java.rmi.RemoteException
return the IBAs of an IBAHolder's attribute container; format Timestamps with dateformat passed in. if an IBA is multivalued a WTException is thrown.

Parameters:
h - the IBA Holder
f - the DateFormat to use for formatting Timestamps
Returns:
Hashtable filled with IBANAME/IBAVALUE pairs
Throws:
wt.util.WTException - from windchill code or if multivalued IBA encountered.
java.rmi.RemoteException - from windchill code

IBAHash

public static java.util.Hashtable IBAHash(wt.iba.value.IBAHolder h,
                                          java.text.SimpleDateFormat f,
                                          boolean withUnits)
                                   throws wt.util.WTException,
                                          java.rmi.RemoteException
return the IBAs of an IBAHolder; format Timestamps with dateformat passed in. if an IBA is multivalued a WTException is thrown

Returns:
Hashtable filled with IBANAME/IBAVALUE pairs
Throws:
wt.util.WTException - from windchill code or if multivalued IBA encountered.
java.rmi.RemoteException - from windchill code

IBAHash

public static java.util.Hashtable IBAHash(wt.iba.value.DefaultAttributeContainer dac,
                                          java.text.SimpleDateFormat f,
                                          boolean withUnits)
                                   throws wt.util.WTException,
                                          java.rmi.RemoteException
return the IBAs of an IBAHolder's attribute container; format Timestamps with dateformat passed in. if an IBA is multivalued a WTException is thrown

Returns:
Hashtable filled with IBANAME/IBAVALUE pairs
Throws:
wt.util.WTException - from windchill code or if multivalued IBA encountered.
java.rmi.RemoteException - from windchill code

IBAHash

public static java.util.Hashtable IBAHash(wt.iba.value.IBAHolder h,
                                          java.text.SimpleDateFormat f,
                                          boolean withUnits,
                                          int multival_flag)
                                   throws wt.util.WTException,
                                          java.rmi.RemoteException
return the IBAs of an IBAHolder; format Timestamps with dateformat passed in. if an IBA is multivalued a WTException may be thrown, as requested by caller.

Parameters:
h - the IBA Holder
f - the DateFormat to use for formatting Timestamps
withUnits - if true add a float/units att's unit display string to the string value
multival_flag - indicate what to do if multivalued IBA found:
  • throw exception MULTIVAL_ERR=0
  • return first value (MULTIVAL_FIRST=1)
  • return all as vector (MULTIVAL_VECTOR=2)
Returns:
Hashtable filled with IBANAME/IBAVALUE pairs
Throws:
wt.util.WTException - from windchill code or if multivalued IBA encountered.
java.rmi.RemoteException - from windchill code

IBAHash

public static java.util.Hashtable IBAHash(wt.iba.value.DefaultAttributeContainer dac,
                                          java.text.SimpleDateFormat f,
                                          boolean withUnits,
                                          int multival_flag)
                                   throws wt.util.WTException,
                                          java.rmi.RemoteException
return the IBAs of an IBAHolder's attribute container; format Timestamps with dateformat passed in. if an IBA is multivalued a WTException may be thrown, as requested by caller.

Parameters:
h - the IBA Holder
f - the DateFormat to use for formatting Timestamps
withUnits - if true add a float/units att's unit display string to the string value
multival_flag - indicate what to do if multivalued IBA found:
  • throw exception MULTIVAL_ERR=0
  • return first value (MULTIVAL_FIRST=1)
  • return all as vector (MULTIVAL_VECTOR=2)
Returns:
Hashtable filled with IBANAME/IBAVALUE pairs
Throws:
wt.util.WTException - from windchill code or if multivalued IBA encountered.
java.rmi.RemoteException - from windchill code

insert

public static void insert(wt.fc.collections.WTHashSet ws)
                   throws wt.util.WTException,
                          java.rmi.RemoteException,
                          java.lang.reflect.InvocationTargetException
persiste the objects in the WTHashSet using server side method.

Parameters:
ws -
Throws:
WTException, - RemoteException, InvocationTargetException
wt.util.WTException
java.rmi.RemoteException
java.lang.reflect.InvocationTargetException

_insert

public static void _insert(wt.fc.collections.WTHashSet ws)
                    throws wt.util.WTException
Throws:
wt.util.WTException

addIBAs

public static void addIBAs(com.infoengine.object.factory.Element e,
                           wt.iba.value.IBAHolder i,
                           java.lang.String prefix)
                    throws wt.util.WTException,
                           java.rmi.RemoteException
add the ibas of an object to an element as Atts, prefixing optionally with a string; use default data and time, no units and throw error on multivalued iba.

Parameters:
e - the Element
i - the IBAHolder
prefix - prefix to use, e.g., "xx_" would add IBA blah as xx_blah
Throws:
WTException, - RemoteException
wt.util.WTException
java.rmi.RemoteException

addIBAs

public static void addIBAs(com.infoengine.object.factory.Element e,
                           wt.iba.value.IBAHolder i,
                           java.lang.String prefix,
                           java.text.SimpleDateFormat fmt,
                           boolean withUnits,
                           int multival_flag)
                    throws wt.util.WTException,
                           java.rmi.RemoteException
add the ibas of an object to an element as Atts, prefixing optionally with a string

Parameters:
e - the Element
i - the IBAHolder
prefix - prefix to use, e.g., "xx_" would add IBA blah as xx_blah
fmt - date format for dates
withUnits - flag if unit should be appended to float-with-unit
multival_flag - indicate what to do if multivalued IBA found:
  • throw exception MULTIVAL_ERR=0
  • return first value (MULTIVAL_FIRST=1)
  • return all as vector (MULTIVAL_VECTOR=2)
Throws:
WTException, - RemoteException
wt.util.WTException
java.rmi.RemoteException

newVersion

public static wt.vc.Versioned newVersion(wt.vc.Versioned v)
                                  throws wt.util.WTException,
                                         wt.util.WTPropertyVetoException
Throws:
wt.util.WTException
wt.util.WTPropertyVetoException

newOneOff

public static wt.vc.OneOffVersioned newOneOff(wt.vc.OneOffVersioned v)
                                       throws wt.util.WTException,
                                              wt.util.WTPropertyVetoException
Throws:
wt.util.WTException
wt.util.WTPropertyVetoException

stackTraceContains

public static boolean stackTraceContains(java.lang.String s)

stackTraceContains

public static boolean stackTraceContains(java.lang.String s,
                                         boolean lower)

stackTraceContains

public static boolean stackTraceContains(java.util.regex.Pattern p)