wt.step.processor
Class MappingUtilities

java.lang.Object
  extended bywt.step.processor.MappingUtilities

public class MappingUtilities
extends Object

A set of utilities for mapping between Windchill and Express entity names and Strings.


Field Summary
private static Hashtable _entityMappingCache
           
(package private) static HashSet _expressReservedWords
           
private static Properties _fullnamesMapping
           
private static boolean _overridenProperties
           
private static Hashtable _wtClassMappingCache
          Cache for Step name to Windchill class mappings
private static Object[] NO_ARGS
           
private static Class[] NO_CLASS_ARGS
           
 
Constructor Summary
MappingUtilities()
           
 
Method Summary
static String convertAttributeNameToWindchillField(String attributeName)
          Defaults to starting converted name with an uppercase letter but not removing 'the_' from the start of attribute names (roles).
static String convertAttributeNameToWindchillField(String attributeName, boolean startUpperCase)
          Defaults to not removing 'the_' from the start of attribute names (roles).
static String convertAttributeNameToWindchillField(String attributeName, boolean startUpperCase, boolean removeRolePrefix)
          Converts an Entity Attribute name to the equivalent Windchill Class attribute name.
private static String convertCapsToUnderscores(String capitalsString)
          Converts all capital letters, other that the first, to underscore- lowercase.
static String convertEntityNameToWindchillClassName(String entityName)
          Because of the loss of case(Express is case independent) it is necessary to provide an explicit mapping from Express Windchill entity names to their Windchill class equivalents.
static String convertWindchillClassToEntityName(Class wtClass)
          Converts a windchill class to its associated Express Entity name.
static String convertWindchillClassToEntityName(String wtClassName)
           
static String convertWindchillFieldToAttributeName(String fieldName)
           
static String convertWindchillRoleToAttributeName(String roleName)
          Converts a windchill role name to an entity attribute name
static String expressToJava(String undecoded)
           
static boolean getBooleanProperty(String propertyName)
          Get a boolean valued property.
static String getMandatoryProperty(String propertyName)
          Uses getProperty() to access the property and exits with an error message if the propery is not set.
private static String getMappingFilename()
           
static String getProperty(String propertyName)
          A single point of access for property settings.
static Class getWindchillClassForEntityType(String entityTypeName)
           
private static void initialiseFullnamesMapping()
           
static boolean isEnumeratedType(String stepTypeName)
           
static boolean isExpressReservedWord(String word)
           
static boolean isIterationType(StepEntity entity)
           
static boolean isIterationType(String stepTypeName)
           
static boolean isLinkType(StepEntity entity)
           
static boolean isLinkType(String stepTypeName)
           
static boolean isMasterType(StepEntity entity)
           
static boolean isMasterType(String stepTypeName)
           
static boolean isNativeStepType(String stepTypeName)
           
static String javaToExpress(String unencoded)
           
static String localiseFileSeperators(String filePath)
           
private static void updateFullnamesMapping(String wtClassName, String entityTypeName)
           
static void writeMappingFile()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_wtClassMappingCache

private static final Hashtable _wtClassMappingCache
Cache for Step name to Windchill class mappings


_entityMappingCache

private static final Hashtable _entityMappingCache

NO_ARGS

private static final Object[] NO_ARGS

NO_CLASS_ARGS

private static final Class[] NO_CLASS_ARGS

_fullnamesMapping

private static Properties _fullnamesMapping

_overridenProperties

private static boolean _overridenProperties

_expressReservedWords

static final HashSet _expressReservedWords
Constructor Detail

MappingUtilities

public MappingUtilities()
Method Detail

getProperty

public static String getProperty(String propertyName)
A single point of access for property settings. Overrides the standard property settings with those from the local wt.properties file.


getBooleanProperty

public static boolean getBooleanProperty(String propertyName)
Get a boolean valued property. Defaults to false if the property is not set.


getMandatoryProperty

public static String getMandatoryProperty(String propertyName)
                                   throws TransferException
Uses getProperty() to access the property and exits with an error message if the propery is not set.

Throws:
TransferException

initialiseFullnamesMapping

private static void initialiseFullnamesMapping()
                                        throws TransferException
Throws:
TransferException

getMappingFilename

private static String getMappingFilename()

updateFullnamesMapping

private static void updateFullnamesMapping(String wtClassName,
                                           String entityTypeName)

writeMappingFile

public static void writeMappingFile()

getWindchillClassForEntityType

public static Class getWindchillClassForEntityType(String entityTypeName)
                                            throws TransferException
Throws:
TransferException

convertAttributeNameToWindchillField

public static String convertAttributeNameToWindchillField(String attributeName)
Defaults to starting converted name with an uppercase letter but not removing 'the_' from the start of attribute names (roles).


convertAttributeNameToWindchillField

public static String convertAttributeNameToWindchillField(String attributeName,
                                                          boolean startUpperCase)
Defaults to not removing 'the_' from the start of attribute names (roles).


convertAttributeNameToWindchillField

public static String convertAttributeNameToWindchillField(String attributeName,
                                                          boolean startUpperCase,
                                                          boolean removeRolePrefix)
Converts an Entity Attribute name to the equivalent Windchill Class attribute name.

The following rules are used:

e.g. 'a_number' becomes 'Number', 'part_master' becomes 'PartMaster'.


convertEntityNameToWindchillClassName

public static String convertEntityNameToWindchillClassName(String entityName)
                                                    throws TransferException
Because of the loss of case(Express is case independent) it is necessary to provide an explicit mapping from Express Windchill entity names to their Windchill class equivalents.

Throws:
TransferException

convertWindchillRoleToAttributeName

public static String convertWindchillRoleToAttributeName(String roleName)
Converts a windchill role name to an entity attribute name


convertWindchillFieldToAttributeName

public static String convertWindchillFieldToAttributeName(String fieldName)

isExpressReservedWord

public static boolean isExpressReservedWord(String word)

convertWindchillClassToEntityName

public static String convertWindchillClassToEntityName(Class wtClass)
Converts a windchill class to its associated Express Entity name. Package names are removed and an underscore is inserted before each upper case character, except for the first one.


convertWindchillClassToEntityName

public static String convertWindchillClassToEntityName(String wtClassName)

convertCapsToUnderscores

private static String convertCapsToUnderscores(String capitalsString)
Converts all capital letters, other that the first, to underscore- lowercase.


isIterationType

public static boolean isIterationType(StepEntity entity)
                               throws TransferException
Throws:
TransferException

isIterationType

public static boolean isIterationType(String stepTypeName)
                               throws TransferException
Throws:
TransferException

isNativeStepType

public static boolean isNativeStepType(String stepTypeName)

isEnumeratedType

public static boolean isEnumeratedType(String stepTypeName)
                                throws TransferException
Throws:
TransferException

isLinkType

public static boolean isLinkType(StepEntity entity)
                          throws TransferException
Throws:
TransferException

isLinkType

public static boolean isLinkType(String stepTypeName)
                          throws TransferException
Throws:
TransferException

isMasterType

public static boolean isMasterType(StepEntity entity)
                            throws TransferException
Throws:
TransferException

isMasterType

public static boolean isMasterType(String stepTypeName)
                            throws TransferException
Throws:
TransferException

localiseFileSeperators

public static String localiseFileSeperators(String filePath)

javaToExpress

public static String javaToExpress(String unencoded)

expressToJava

public static String expressToJava(String undecoded)