com.ptc.windchill.ws
Class GenericBusinessObject

java.lang.Object
  extended bycom.ptc.windchill.ws.GenericBusinessObject
All Implemented Interfaces:
Introspectable, SAXSOAPElementHandler, Serializable, SOAPElementHandler

public class GenericBusinessObject
extends Object
implements Serializable, Introspectable, SAXSOAPElementHandler

Java bean that defines a generic business object.

A generic business object has three properties

See Also:
Property, Serialized Form

Nested Class Summary
private  class GenericBusinessObject.PropertySAXHandler
           
 
Field Summary
private  javax.xml.soap.Name _arrayTypeName
           
private  javax.xml.soap.SOAPFactory _soapFactory
           
private  javax.xml.soap.Name _typeName
           
private static String CLASS
           
private static boolean CLIENT
           
static String CLIENT_PROPERTY
          The name of the boolean System property to set to true when running in a client JVM
private  StringBuffer currentElementValue
          SAX implementation for server side des11n
private  boolean inPropertyArray
           
private static String ITEM_ELM
           
private static String NAME_ELM
           
private static String OBID
           
private  List properties
           
private  GenericBusinessObject.PropertySAXHandler propertyHandler
           
private static String PROPS_ELM
           
private static String QPROP_TYPE
           
private static String QSTRING_TYPE
           
private static String QTHIS_TYPE
           
private  Element saxElement
           
private  SAXObjectDeserializer saxHandler
           
private static String TYPEID_ELM
           
private  String typeIdentifier
           
private  String ufid
           
private static String UFID_ELM
           
private static String VALUE_ELM
           
 
Constructor Summary
GenericBusinessObject()
          Constructs a new empty GenericBusinessObject.
 
Method Summary
private  void addProperty(Element elem, javax.xml.soap.SOAPElement property)
          Deserializes a property SOAP element and maps it to an I*E attribute.
 void addProperty(Property property)
          Adds a Property object to the list of this object's properties.
 void addProperty(String name, String value)
          Adds a Property object to the list with name and value.
 void characters(char[] ch, int start, int length)
           
 void childCharacters(char[] ch, int start, int length)
           
private  Object clientElementToObject(javax.xml.soap.SOAPElement element, javax.xml.soap.SOAPMessage message)
          Generates a client side appropriate business object representation.
private  javax.xml.soap.SOAPElement clientObjectToElement(String elementName, GenericBusinessObject object, javax.xml.soap.SOAPElement parent, javax.xml.soap.SOAPMessage message)
          Translate a GenericBusinessObject to SOAPElement (client side).
 Object elementToObject(javax.xml.soap.SOAPElement element, javax.xml.soap.SOAPMessage message)
          Deserializes SOAP into business object representation.
 void endChildElement(String namespaceURI, String localName, String qName)
           
 void endElement(String namespaceURI, String localName, String qName)
           
 boolean equals(Object o)
          Tests this GenericBusinessObject object against another object for equality.
 Property[] getProperties()
          Retrieves the entire list of Property objects.
 Property getProperties(int index)
          Retrieves a Property object by index.
 Property getPropertyObject(String name)
          Gets a Property object by name.
 Property[] getPropertyObjects(String name)
          Gets a list of Property objects by name.
 String getPropertyValue(String name)
          Gets a property value by name.
 String[] getPropertyValues(String name)
          Gets a list of property values by name.
 Object getSAXObject()
           
 String getTypeIdentifier()
          Retrieves this business object's typeIdentifier.
 String getUfid()
          Retrieves this business object's Unique Federation Identifier.
private  void newPropertySOAPElement(javax.xml.soap.SOAPElement arry, String name, String value)
          Constructs a property item for insertion into the properties array.
private  javax.xml.soap.SOAPElement newStringSOAPElement(String name, javax.xml.soap.SOAPElement parent)
          Constructs a new SOAPElement with a type of string.
 javax.xml.soap.SOAPElement objectToElement(String elementName, Object object, javax.xml.soap.SOAPElement parent, javax.xml.soap.SOAPMessage message)
          Serializes business object representation to SOAP.
private  Object serverElementToObject(javax.xml.soap.SOAPElement element, javax.xml.soap.SOAPMessage message)
          Generates a server side appropriate business object representation.
private  javax.xml.soap.SOAPElement serverObjectToElement(String elementName, Element object, javax.xml.soap.SOAPElement parent, javax.xml.soap.SOAPMessage message)
          Translate an Element business object to SOAPElement (server side).
 void setProperties(int index, Property property)
          Sets a Property object by index.
 void setProperties(Property[] properties)
          Sets the entire list of Property objects.
 void setTypeIdentifier(String typeIdentifier)
          Sets this business object's typeIdentifier.
 void setUfid(String ufid)
          Sets this business object's Unique Federation Identifier.
 void startChildElement(String namespaceURI, String localName, String qName, Attributes atts)
           
 void startElement(String namespaceURI, String localName, String qName, Attributes atts)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

typeIdentifier

private String typeIdentifier

ufid

private String ufid

properties

private List properties

CLIENT_PROPERTY

public static final String CLIENT_PROPERTY
The name of the boolean System property to set to true when running in a client JVM

See Also:
Constant Field Values

CLIENT

private static final boolean CLIENT

OBID

private static final String OBID
See Also:
Constant Field Values

CLASS

private static final String CLASS
See Also:
Constant Field Values

UFID_ELM

private static final String UFID_ELM
See Also:
Constant Field Values

TYPEID_ELM

private static final String TYPEID_ELM
See Also:
Constant Field Values

PROPS_ELM

private static final String PROPS_ELM
See Also:
Constant Field Values

NAME_ELM

private static final String NAME_ELM
See Also:
Constant Field Values

VALUE_ELM

private static final String VALUE_ELM
See Also:
Constant Field Values

ITEM_ELM

private static final String ITEM_ELM
See Also:
Constant Field Values

QTHIS_TYPE

private static final String QTHIS_TYPE

QPROP_TYPE

private static final String QPROP_TYPE

QSTRING_TYPE

private static final String QSTRING_TYPE

_soapFactory

private javax.xml.soap.SOAPFactory _soapFactory

_typeName

private javax.xml.soap.Name _typeName

_arrayTypeName

private javax.xml.soap.Name _arrayTypeName

currentElementValue

private StringBuffer currentElementValue
SAX implementation for server side des11n


saxHandler

private SAXObjectDeserializer saxHandler

saxElement

private Element saxElement

propertyHandler

private GenericBusinessObject.PropertySAXHandler propertyHandler

inPropertyArray

private boolean inPropertyArray
Constructor Detail

GenericBusinessObject

public GenericBusinessObject()
Constructs a new empty GenericBusinessObject.

Method Detail

setTypeIdentifier

public void setTypeIdentifier(String typeIdentifier)
Sets this business object's typeIdentifier.

Parameters:
typeIdentifier - The new typeIdentifier value.

getTypeIdentifier

public String getTypeIdentifier()
Retrieves this business object's typeIdentifier.

Returns:
The typeIdentifier.

setUfid

public void setUfid(String ufid)
Sets this business object's Unique Federation Identifier.

Parameters:
ufid - The new ufid.

getUfid

public String getUfid()
Retrieves this business object's Unique Federation Identifier.

Returns:
The ufid.

setProperties

public void setProperties(int index,
                          Property property)
Sets a Property object by index.

Parameters:
index - The index of the Property object to set.
property - The property object to set.

getProperties

public Property getProperties(int index)
Retrieves a Property object by index.

Parameters:
index - The index of the property object to get.
Returns:
The Property object or null if invalid index.

setProperties

public void setProperties(Property[] properties)
Sets the entire list of Property objects.

Parameters:
properties - The new list of Property objects.

getProperties

public Property[] getProperties()
Retrieves the entire list of Property objects.

Returns:
The list of Property objects or null if none..

toString

public String toString()
Returns:
A basic String representation of this business object.

addProperty

public void addProperty(Property property)
Adds a Property object to the list of this object's properties.

Parameters:
property - The property to add.

addProperty

public void addProperty(String name,
                        String value)
Adds a Property object to the list with name and value.

Parameters:
name - The name of the new property.
value - The value of the new proprty.

getPropertyObject

public Property getPropertyObject(String name)
Gets a Property object by name.

Parameters:
name - The name of the Property object to retrieve.
Returns:
The Property object or null if not found.

getPropertyObjects

public Property[] getPropertyObjects(String name)
Gets a list of Property objects by name.

Parameters:
name - The name of the property objects to retrieve.
Returns:
The Property objects or null if not found.

getPropertyValue

public String getPropertyValue(String name)
Gets a property value by name.

Parameters:
name - The name of the property value to retrieve.
Returns:
The value or null if not found.

getPropertyValues

public String[] getPropertyValues(String name)
Gets a list of property values by name.

Parameters:
name - The name of the property values to retrieve.
Returns:
The values or null if not found.

elementToObject

public Object elementToObject(javax.xml.soap.SOAPElement element,
                              javax.xml.soap.SOAPMessage message)
                       throws javax.xml.soap.SOAPException
Deserializes SOAP into business object representation.

Depending on environment may generate an I*E specific data structure (Element instance) or an instance of GenericBusinessObject if running in a client JVM.

Specified by:
elementToObject in interface SOAPElementHandler
Parameters:
element - The SOAPElement to deserialize.
message - The associated SOAPMessage object.
Returns:
Business object representation appropriate for the runtime environment.
Throws:
javax.xml.soap.SOAPException - if element is malformed.
See Also:
CLIENT

objectToElement

public javax.xml.soap.SOAPElement objectToElement(String elementName,
                                                  Object object,
                                                  javax.xml.soap.SOAPElement parent,
                                                  javax.xml.soap.SOAPMessage message)
                                           throws javax.xml.soap.SOAPException
Serializes business object representation to SOAP.

object must be an instance of GenericBusinessObject or Element.

Specified by:
objectToElement in interface SOAPElementHandler
Parameters:
elementName - The name of the SOAP Element to be created.
object - The business object to serialize.
message - The associated SOAPMessage object.
Returns:
A SOAP representation of object.
Throws:
javax.xml.soap.SOAPException - if object is of the wrong type or there is an error during serialization.

clientElementToObject

private Object clientElementToObject(javax.xml.soap.SOAPElement element,
                                     javax.xml.soap.SOAPMessage message)
                              throws javax.xml.soap.SOAPException
Generates a client side appropriate business object representation.

Parameters:
element - The SOAPElement to deserialize.
message - The associated SOAPMessage object.
Returns:
An instance of GenericBusinessObject initialized from element.
Throws:
javax.xml.soap.SOAPException - if element is malformed.
See Also:
CLIENT

serverElementToObject

private Object serverElementToObject(javax.xml.soap.SOAPElement element,
                                     javax.xml.soap.SOAPMessage message)
                              throws javax.xml.soap.SOAPException
Generates a server side appropriate business object representation.

Parameters:
element - The SOAPElement to deserialize.
message - The associated SOAPMessage object.
Returns:
An instance of Element initialized from element.
Throws:
javax.xml.soap.SOAPException - if element is malformed.
See Also:
CLIENT

addProperty

private void addProperty(Element elem,
                         javax.xml.soap.SOAPElement property)
                  throws javax.xml.soap.SOAPException
Deserializes a property SOAP element and maps it to an I*E attribute.

Parameters:
elem - The Info*Engine Element object.
property - The SOAP property representation.
Throws:
javax.xml.soap.SOAPException - if the SOAP property representation is malformed.

newStringSOAPElement

private javax.xml.soap.SOAPElement newStringSOAPElement(String name,
                                                        javax.xml.soap.SOAPElement parent)
                                                 throws javax.xml.soap.SOAPException
Constructs a new SOAPElement with a type of string.

Parameters:
name - The element name to create
parent - The element to add the new element to.
Returns:
The new element qualfied with a type of string
Throws:
javax.xml.soap.SOAPException

newPropertySOAPElement

private void newPropertySOAPElement(javax.xml.soap.SOAPElement arry,
                                    String name,
                                    String value)
                             throws javax.xml.soap.SOAPException
Constructs a property item for insertion into the properties array.

Parameters:
arry - The properties array.
name - The property name.
Throws:
javax.xml.soap.SOAPException

clientObjectToElement

private javax.xml.soap.SOAPElement clientObjectToElement(String elementName,
                                                         GenericBusinessObject object,
                                                         javax.xml.soap.SOAPElement parent,
                                                         javax.xml.soap.SOAPMessage message)
                                                  throws javax.xml.soap.SOAPException
Translate a GenericBusinessObject to SOAPElement (client side).

Parameters:
elementName - The name of the SOAP Element to be created.
object - The business object.
message - The associated SOAPMessage object.
Returns:
The SOAP representation of the business object.
Throws:
javax.xml.soap.SOAPException - if there is a problem during serialization.

serverObjectToElement

private javax.xml.soap.SOAPElement serverObjectToElement(String elementName,
                                                         Element object,
                                                         javax.xml.soap.SOAPElement parent,
                                                         javax.xml.soap.SOAPMessage message)
                                                  throws javax.xml.soap.SOAPException
Translate an Element business object to SOAPElement (server side).

Parameters:
elementName - The name of the SOAP Element to be created.
object - The business object.
message - The associated SOAPMessage object.
Returns:
The SOAP representation of the business object.
Throws:
javax.xml.soap.SOAPException - if there is a problem during serialization.

equals

public boolean equals(Object o)
Tests this GenericBusinessObject object against another object for equality.

Returns:
true if o is equivalent.

startElement

public void startElement(String namespaceURI,
                         String localName,
                         String qName,
                         Attributes atts)
                  throws SAXException
Specified by:
startElement in interface SAXSOAPElementHandler
Throws:
SAXException

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
Specified by:
characters in interface SAXSOAPElementHandler
Throws:
SAXException

endElement

public void endElement(String namespaceURI,
                       String localName,
                       String qName)
                throws SAXException
Specified by:
endElement in interface SAXSOAPElementHandler
Throws:
SAXException

getSAXObject

public Object getSAXObject()
Specified by:
getSAXObject in interface SAXSOAPElementHandler

startChildElement

public void startChildElement(String namespaceURI,
                              String localName,
                              String qName,
                              Attributes atts)
                       throws SAXException
Specified by:
startChildElement in interface SAXSOAPElementHandler
Throws:
SAXException

childCharacters

public void childCharacters(char[] ch,
                            int start,
                            int length)
                     throws SAXException
Specified by:
childCharacters in interface SAXSOAPElementHandler
Throws:
SAXException

endChildElement

public void endChildElement(String namespaceURI,
                            String localName,
                            String qName)
                     throws SAXException
Specified by:
endChildElement in interface SAXSOAPElementHandler
Throws:
SAXException