wt.projmgmt.msproject
Class ObjectContentHandler

java.lang.Object
  extended bywt.projmgmt.msproject.DefaultSAXContentHandler
      extended bywt.projmgmt.msproject.ChildContentHandler
          extended bywt.projmgmt.msproject.ObjectContentHandler
All Implemented Interfaces:
ContentHandler, ContentHandler

public class ObjectContentHandler
extends ChildContentHandler

This ContentHandler supports importing objects from a Microsoft Project Plan. This includes tasks, resources and assignments.


Field Summary
private  MPPObjectBuilder builder
           
private  String childTag
           
private static int MAP_INIT_CAPACITY
           
private  Map objects
           
private  String parentTag
           
 
Fields inherited from class wt.projmgmt.msproject.ChildContentHandler
 
Constructor Summary
ObjectContentHandler(ContentHandler parent)
          Create a handler to process the child elements of a parent element.
ObjectContentHandler(ContentHandler parent, String parentTag, String childTag)
          Create a handler to process the child elements of a parent element.
 
Method Summary
protected  void addObject(MPPObject mppObj)
          Add an object to this handlers collection of objects.
 void endElement(String namespaceURL, String localName, String qName)
           
 Map getObjects()
          Get the objects that have been built by this handler.
 void reset()
          Reset the handler so that it can be used again.
 void setBuilder(MPPObjectBuilder builder)
          Set the builder to the specified MPPObjectBuilder.
 void setScope(String parentTag, String childTag)
          Set the parent tag and child tag used for scoping this handlers work.
 void startElement(String namespaceURL, String localName, String qName, Attributes atts)
           
 
Methods inherited from class wt.projmgmt.msproject.ChildContentHandler
getDocumentLocator, getImportInfo, getParent, getReader, setDocumentLocator, setParent
 
Methods inherited from class wt.projmgmt.msproject.DefaultSAXContentHandler
characters, endDocument, endPrefixMapping, ignorableWhitespace, outputEndElement, outputStartElement, processingInstruction, skippedEntity, startDocument, startPrefixMapping
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xml.sax.ContentHandler
characters, endDocument, endPrefixMapping, ignorableWhitespace, processingInstruction, skippedEntity, startDocument, startPrefixMapping
 

Field Detail

MAP_INIT_CAPACITY

private static final int MAP_INIT_CAPACITY
See Also:
Constant Field Values

parentTag

private String parentTag

childTag

private String childTag

builder

private MPPObjectBuilder builder

objects

private Map objects
Constructor Detail

ObjectContentHandler

public ObjectContentHandler(ContentHandler parent)
Create a handler to process the child elements of a parent element. If this constructor is used, then setScope(java.lang.String, java.lang.String) must be called to set the parent and child tags and setBuilder(wt.projmgmt.msproject.mppobject.MPPObjectBuilder) must be called to set the builder before this handler can be used.

Parameters:
parent - the parent handler to return control to

ObjectContentHandler

public ObjectContentHandler(ContentHandler parent,
                            String parentTag,
                            String childTag)
Create a handler to process the child elements of a parent element. When the end tag for the parent element is encountered, control is passed back to the parent handler.

Parameters:
parent - the parent handler to return control to
parentTag - the tag that determines when control is passed back to the parent handler
childTag - the tag that specifies the child elements
Method Detail

setScope

public final void setScope(String parentTag,
                           String childTag)
Set the parent tag and child tag used for scoping this handlers work. Resets the handler and sets the builder's scope.


reset

public final void reset()
Reset the handler so that it can be used again. This causes the object map to be cleared and the object builder to be reset.


setBuilder

public void setBuilder(MPPObjectBuilder builder)
Set the builder to the specified MPPObjectBuilder. If this handler's scope is set, set the builder's scope appropriately. Set the builder's parent to be this handler.


getObjects

public final Map getObjects()
Get the objects that have been built by this handler.


addObject

protected void addObject(MPPObject mppObj)
Add an object to this handlers collection of objects. If mppObj is null then no object is added.


startElement

public void startElement(String namespaceURL,
                         String localName,
                         String qName,
                         Attributes atts)
                  throws SAXException
Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class DefaultSAXContentHandler
Throws:
SAXException

endElement

public void endElement(String namespaceURL,
                       String localName,
                       String qName)
                throws SAXException
Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class DefaultSAXContentHandler
Throws:
SAXException