com.ibm.j2ca.extension.emd.description
Class BusinessObjectDefinition

java.lang.Object
  extended bycom.ibm.j2ca.extension.emd.description.BusinessObjectDefinition

public class BusinessObjectDefinition
extends java.lang.Object

Represents a Business Object defintion. In XSD terms it holds the content needed to create a definition for a complexType along an XSD. Holds information from header of the XSD to the defintion of complexType itself. Provides functions to create a String representing the XSD itself and a string representing Business Graph defintion.


Field Summary
static java.lang.String BACKSLASH
           
static java.lang.String CARET
           
protected static java.lang.String CHARSET_UTF8
           
static java.lang.String DOUBLE_QUOTE
           
static java.lang.String ESCAPED_BACKSLASH
           
static java.lang.String ESCAPED_CARET
           
static java.lang.String ESCAPED_DOUBLE_QUOTE
           
static java.lang.String ESCAPED_GRAVE
           
static java.lang.String ESCAPED_GREATER_THAN
           
static java.lang.String ESCAPED_LEFT_CURLY
           
static java.lang.String ESCAPED_LEFT_SQUARE
           
static java.lang.String ESCAPED_LESS_THAN
           
static java.lang.String ESCAPED_PERCENT
           
static java.lang.String ESCAPED_PIPE
           
static java.lang.String ESCAPED_POUND
           
static java.lang.String ESCAPED_RIGHT_CURLY
           
static java.lang.String ESCAPED_RIGHT_SQUARE
           
static java.lang.String ESCAPED_SPACE
           
static java.lang.String ESCAPED_TILDE
           
protected static java.util.HashMap fCharToEscaped
           
static java.lang.String GRAVE
           
static java.lang.String GREATER_THAN
           
protected static java.lang.String HEX_PREFIX
           
static java.lang.String LEFT_CURLY
           
static java.lang.String LEFT_SQUARE
           
static java.lang.String LESS_THAN
           
static java.lang.String PERCENT
           
static java.lang.String PIPE
           
static java.lang.String POUND
           
static java.lang.String RIGHT_CURLY
           
static java.lang.String RIGHT_SQUARE
           
static java.lang.String SPACE
           
static java.lang.String TILDE
           
 
Constructor Summary
BusinessObjectDefinition()
           
 
Method Summary
 void addImportNameSpace(ImportedNameSpace importNamespace)
           
 void addIncludeSchema(java.lang.String schema)
           
 void addNamespace(javax.xml.namespace.QName namespace)
           
 void addVerb(java.lang.String verb)
           
static java.lang.String convertNamespaceToUri(java.lang.String namespace)
          Convert a string intended to be a target namespace, i.e.
static java.lang.String escapeUnsafeCharacters(java.lang.String anyURI)
          Escapes the "delim" and "unwise" characters as specified by rfc2396.
 BusinessObjectAttributeDefinition getAttribute(java.lang.String name)
           
 java.util.Iterator getAttributes()
           
 java.lang.String getContainerDefinition(ImportedNameSpace importNameSpace)
          Returns a container defintion for a complexType
 java.lang.String getGraphDefinition(ImportedNameSpace importNameSpace)
          Returns the graph defintion for the complexType
 java.util.ArrayList getImportNameSpaces()
           
 java.util.List getIncludeSchemas()
           
 WBIMetadata getMetadata()
           
 java.lang.String getName()
           
 java.util.List getNamespaces()
           
 java.lang.String getObjectNameSpace()
           
protected  java.lang.String getRelativePathForImports()
           
static java.lang.String getSepChar()
          Returns new line character
 java.lang.String getTargetNameSpace()
           
 java.util.List getVerbs()
           
 boolean isTopLevel()
           
 void removeNamespace(javax.xml.namespace.QName namespace)
           
 void removeVerb(java.lang.String verb)
           
 java.lang.String serialize()
          This method returns the BO defintion serialized as a String.
 void setASINameSpace(java.lang.String asiNameSpace)
           
 void setAttribute(java.lang.String name, BusinessObjectAttributeDefinition attribute)
           
 void setMetadata(WBIMetadata metadata)
           
 void setName(java.lang.String name)
           
 void setObjectNameSpace(java.lang.String objectNameSpace)
           
protected  void setRelativePathForImports(java.lang.String relativePath)
           
 void setTargetNameSpace(java.lang.String targetNameSpace)
           
 void setTopLevel(boolean isTopLevel)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHARSET_UTF8

protected static java.lang.String CHARSET_UTF8

HEX_PREFIX

protected static java.lang.String HEX_PREFIX

SPACE

public static final java.lang.String SPACE
See Also:
Constant Field Values

DOUBLE_QUOTE

public static final java.lang.String DOUBLE_QUOTE
See Also:
Constant Field Values

LESS_THAN

public static final java.lang.String LESS_THAN
See Also:
Constant Field Values

GREATER_THAN

public static final java.lang.String GREATER_THAN
See Also:
Constant Field Values

POUND

public static final java.lang.String POUND
See Also:
Constant Field Values

PERCENT

public static final java.lang.String PERCENT
See Also:
Constant Field Values

LEFT_CURLY

public static final java.lang.String LEFT_CURLY
See Also:
Constant Field Values

RIGHT_CURLY

public static final java.lang.String RIGHT_CURLY
See Also:
Constant Field Values

PIPE

public static final java.lang.String PIPE
See Also:
Constant Field Values

BACKSLASH

public static final java.lang.String BACKSLASH
See Also:
Constant Field Values

CARET

public static final java.lang.String CARET
See Also:
Constant Field Values

TILDE

public static final java.lang.String TILDE
See Also:
Constant Field Values

LEFT_SQUARE

public static final java.lang.String LEFT_SQUARE
See Also:
Constant Field Values

RIGHT_SQUARE

public static final java.lang.String RIGHT_SQUARE
See Also:
Constant Field Values

GRAVE

public static final java.lang.String GRAVE
See Also:
Constant Field Values

ESCAPED_SPACE

public static final java.lang.String ESCAPED_SPACE
See Also:
Constant Field Values

ESCAPED_DOUBLE_QUOTE

public static final java.lang.String ESCAPED_DOUBLE_QUOTE
See Also:
Constant Field Values

ESCAPED_LESS_THAN

public static final java.lang.String ESCAPED_LESS_THAN
See Also:
Constant Field Values

ESCAPED_GREATER_THAN

public static final java.lang.String ESCAPED_GREATER_THAN
See Also:
Constant Field Values

ESCAPED_POUND

public static final java.lang.String ESCAPED_POUND
See Also:
Constant Field Values

ESCAPED_PERCENT

public static final java.lang.String ESCAPED_PERCENT
See Also:
Constant Field Values

ESCAPED_LEFT_CURLY

public static final java.lang.String ESCAPED_LEFT_CURLY
See Also:
Constant Field Values

ESCAPED_RIGHT_CURLY

public static final java.lang.String ESCAPED_RIGHT_CURLY
See Also:
Constant Field Values

ESCAPED_PIPE

public static final java.lang.String ESCAPED_PIPE
See Also:
Constant Field Values

ESCAPED_BACKSLASH

public static final java.lang.String ESCAPED_BACKSLASH
See Also:
Constant Field Values

ESCAPED_CARET

public static final java.lang.String ESCAPED_CARET
See Also:
Constant Field Values

ESCAPED_TILDE

public static final java.lang.String ESCAPED_TILDE
See Also:
Constant Field Values

ESCAPED_LEFT_SQUARE

public static final java.lang.String ESCAPED_LEFT_SQUARE
See Also:
Constant Field Values

ESCAPED_RIGHT_SQUARE

public static final java.lang.String ESCAPED_RIGHT_SQUARE
See Also:
Constant Field Values

ESCAPED_GRAVE

public static final java.lang.String ESCAPED_GRAVE
See Also:
Constant Field Values

fCharToEscaped

protected static java.util.HashMap fCharToEscaped
Constructor Detail

BusinessObjectDefinition

public BusinessObjectDefinition()
Method Detail

getObjectNameSpace

public java.lang.String getObjectNameSpace()
Returns:
objectNameSpace The alias for the targetNameSpace to be used within XSD when a reference is made to the complexType. E.g. in graph defintion we might have to put a reference to main complexType.

setObjectNameSpace

public void setObjectNameSpace(java.lang.String objectNameSpace)
Parameters:
objectNameSpace - The alias for targetNameSpace.

getVerbs

public java.util.List getVerbs()
Returns:
Verbs The list of verbs supported by BO. This should be set only for top level business objects.

addVerb

public void addVerb(java.lang.String verb)
Parameters:
verb - The verb that should be added to the list.

removeVerb

public void removeVerb(java.lang.String verb)
Parameters:
verb - The verb that should be removed from the list.

isTopLevel

public boolean isTopLevel()
Returns:
topLevel boolean representing if the BO is top level BO

setTopLevel

public void setTopLevel(boolean isTopLevel)
Parameters:
isTopLevel - If the BO is topLevelBO.

getIncludeSchemas

public java.util.List getIncludeSchemas()
Returns:
includeSchemas list of schemas

addIncludeSchema

public void addIncludeSchema(java.lang.String schema)

getMetadata

public WBIMetadata getMetadata()
Returns:
metadata Metadata object for the BO

setMetadata

public void setMetadata(WBIMetadata metadata)
Parameters:
metadata - Metadata object for the BO

getName

public java.lang.String getName()
Returns:
name The name of the BO

setName

public void setName(java.lang.String name)
             throws commonj.connector.metadata.MetadataException
Parameters:
name - The name of the BO
Throws:
commonj.connector.metadata.MetadataException

getNamespaces

public java.util.List getNamespaces()
Returns:
namespaces List of name spaces that should be included in the XSD. This is the first line where schema definition starts.

addNamespace

public void addNamespace(javax.xml.namespace.QName namespace)
Parameters:
namespace - The namespace to be added to the list

removeNamespace

public void removeNamespace(javax.xml.namespace.QName namespace)
Parameters:
namespace - The namespace that should be removed from the list.

getTargetNameSpace

public java.lang.String getTargetNameSpace()
Returns:
targetNameSpace The targetNameSpace for the BO

setTargetNameSpace

public void setTargetNameSpace(java.lang.String targetNameSpace)
Parameters:
targetNameSpace - The targetNameSpace for the BO

getAttributes

public java.util.Iterator getAttributes()
Returns:
Attributes Attribute list for the BO

getAttribute

public BusinessObjectAttributeDefinition getAttribute(java.lang.String name)
Parameters:
name - The name of the attribute.
Returns:
attribute BusinessObjectAttribute for the name.

setAttribute

public void setAttribute(java.lang.String name,
                         BusinessObjectAttributeDefinition attribute)
Parameters:
name - The name of the attribute

getImportNameSpaces

public java.util.ArrayList getImportNameSpaces()
Returns:
importedNameSpaces List of ImportedNameSpaces for BO

addImportNameSpace

public void addImportNameSpace(ImportedNameSpace importNamespace)

setASINameSpace

public void setASINameSpace(java.lang.String asiNameSpace)

serialize

public java.lang.String serialize()
This method returns the BO defintion serialized as a String. The string returned represents an XSD for the BO defintion.

Returns:

getGraphDefinition

public java.lang.String getGraphDefinition(ImportedNameSpace importNameSpace)
Returns the graph defintion for the complexType

Parameters:
importNameSpace - The namespace of the complexType
Returns:
String representing the graph definition

getContainerDefinition

public java.lang.String getContainerDefinition(ImportedNameSpace importNameSpace)
Returns a container defintion for a complexType

Parameters:
importNameSpace - The namespace for the complexType
Returns:
String representing the container definition

getSepChar

public static java.lang.String getSepChar()
Returns new line character

Returns:

convertNamespaceToUri

public static java.lang.String convertNamespaceToUri(java.lang.String namespace)
Convert a string intended to be a target namespace, i.e. any string typed with xsd:anyURI. According to the XSD spec, any string typed with xsd:anyURI cannot contain any characters outside the US-ASCII character set. These characters must be escaped in the UTF-8 hex notation, %HH. This method also escapes "unwise" characters by calling escapeUnsafeCharacters first. Note that models saving to an XMLResource don't need this method since the XMLResource saves/loads using a Xerces parser which automatically does this. Models using the SSE parser for saving/loading need this as the SSE parser doesn't do this automatically.

Parameters:
namespace -
Returns:
- UTF-8 character escaped string of any characters outside the US-ASCII character set.
See Also:
convertUriToNamespace, escapeUnsafeCharacters

escapeUnsafeCharacters

public static java.lang.String escapeUnsafeCharacters(java.lang.String anyURI)
Escapes the "delim" and "unwise" characters as specified by rfc2396. Also escapes the tilde (~) as this also seems to cause problems with the XSD validator. The characters are escaped using the UTF-8 hex notation, %HH. To do undo this operation, call convertUriToNamespace

Parameters:
anyURI -
Returns:

setRelativePathForImports

protected void setRelativePathForImports(java.lang.String relativePath)

getRelativePathForImports

protected java.lang.String getRelativePathForImports()