|
Copyright © 2000, 2009, Oracle and/or its affiliates. All rights reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bea.p13n.model.Model com.bea.p13n.model.XmlObjectModel
public abstract class XmlObjectModel
A base class for a model that holds onto an XmlObject.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.bea.p13n.model.Model |
---|
Model.ChangeEvent, Model.ChangeListener, Model.ChangeSupport, Model.Debug |
Field Summary | |
---|---|
protected org.apache.xmlbeans.XmlObject |
copyRootXmlObject
A copy of our root xml object, initialized in preRemove() . |
protected String |
instanceUri
The opaque instanceUri value. |
protected boolean |
isComplete
The is-complete flag for this clause. |
Fields inherited from class com.bea.p13n.model.Model |
---|
childrenModels, docModel, parentModel, roChildrenModels |
Constructor Summary | |
---|---|
XmlObjectModel()
|
Method Summary | |
---|---|
static void |
checkElement(org.apache.xmlbeans.XmlObject element,
Class cl,
String... names)
Check if the specified element is an instanceof the specified class and has one of the specified local names. |
protected boolean |
childAdded(Model child)
Override to determine completeness on change updates. |
protected boolean |
childRemoved(Model child)
Override to determine completeness on change updates. |
abstract void |
clearCachedData()
Subclasses need to override this to clear out any cached data. |
protected boolean |
determineIsComplete()
Determine if this model is complete. |
static org.apache.xmlbeans.XmlObject |
fixQName(org.apache.xmlbeans.XmlObject element,
QName newName,
boolean removeXsiType)
Set the specified element's QName. |
String |
getApplicationInstanceUri()
Get the application-specific location identifier associated to the model. |
static org.apache.xmlbeans.XmlObject |
getChild(org.apache.xmlbeans.XmlObject parent,
int index)
|
protected org.apache.xmlbeans.XmlObject |
getCopyXmlObject()
Get a copy of our root xml object. |
static org.apache.xmlbeans.XmlObject |
getDocument(org.apache.xmlbeans.XmlObject o)
Get the top-level document of the specified XmlObject. |
static String |
getLocalName(org.apache.xmlbeans.XmlObject o)
Get the local name of the specified XmlObject. |
static org.apache.xmlbeans.XmlObject |
getParent(org.apache.xmlbeans.XmlObject o)
Get the parent XmlObject of the specified XmlObject. |
static QName |
getQName(org.apache.xmlbeans.XmlObject o)
Get the qualified name of the specified XmlObject. |
org.apache.xmlbeans.XmlObject |
getRootXmlObject()
Get the root xml object. |
boolean |
isComplete()
Tell if this model is complete. |
boolean |
isNil(org.apache.xmlbeans.XmlObject o)
|
void |
preRemove()
Called prior to being removed. |
protected boolean |
propertyChanged(String name,
Object oldVal,
Object newVal)
Override to determine completeness on change updates. |
static int |
removeAllChildren(org.apache.xmlbeans.XmlObject o)
Remove all the children elements of the specified object. |
static boolean |
removeChild(org.apache.xmlbeans.XmlObject parent,
int index)
Remove the index'th child of the specified parent. |
void |
setApplicationInstanceUri(String uri)
Set an application-specific value to associate the model with a location. |
void |
setIsComplete()
Determine completeness and set it. |
protected void |
setIsComplete(boolean isComplete)
Manually set the isComplete flag. |
protected void |
setParent(Model parent)
Override to set our root xml object to the
copyRootXmlObject initialized in preRemove() if parent
is null (i.e. |
protected void |
setRootXmlObject(org.apache.xmlbeans.XmlObject object)
Set the root xml object of this model. |
Methods inherited from class com.bea.p13n.model.Model |
---|
addChangeListener, addChild, addChild, clone, copy, doubleEquals, equals, getChildren, getDebug, getDebug, getDocument, getParent, longEquals, removeChangeListener, removeChild, removeChild, removeEmpties, setDocument |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected transient org.apache.xmlbeans.XmlObject copyRootXmlObject
preRemove()
. The
root xml object
will be set to
this after we're removed from our parent. This is to avoid runtime
errors from xml beans about being orphaned if we're used after
being removed.
protected boolean isComplete
protected String instanceUri
Constructor Detail |
---|
public XmlObjectModel()
Method Detail |
---|
public String getApplicationInstanceUri()
This is not used by the model apis at all. Applications using the model apis can use this field to save a location identifier on the model, which can used for retrieval or storage.
The portal admin tools framework will set value to the datasync uri of where the model came from. Other clients may not set this field.
public void setApplicationInstanceUri(String uri)
uri
- the instance uri (null for none).getApplicationInstanceUri()
protected void setRootXmlObject(org.apache.xmlbeans.XmlObject object)
public org.apache.xmlbeans.XmlObject getRootXmlObject()
public void preRemove()
copy of the root xml object
.
Parent's of XmlObjectModel's need to call this method prior to
unhooking any xbeans objects or removing any children.
preRemove
in class Model
protected void setParent(Model parent)
root xml object
to the
copyRootXmlObject
initialized in preRemove()
if parent
is null (i.e. we were removed from our parent).
setParent
in class Model
protected org.apache.xmlbeans.XmlObject getCopyXmlObject()
root xml object
.
Subclasses can override if they need to make a copy of the root xml
object in a different way (some schema classes require copying from the
document).
public abstract void clearCachedData()
changes
.
public boolean isComplete()
protected void setIsComplete(boolean isComplete)
This will fire a model change event.
Subclasses can override this method to update our stores (e.g. an attribute on the root xml object) as well.
public void setIsComplete()
determineIsComplete()
protected boolean determineIsComplete()
Currently hard-wired to return true. Subclasses need to override with appropriate behavior by inspecting their underlying data.
protected boolean propertyChanged(String name, Object oldVal, Object newVal)
propertyChanged
in class Model
name
- the property name.oldVal
- the previous value (null is valid).newVal
- the new value (null is valid).
setIsComplete(boolean)
protected boolean childAdded(Model child)
childAdded
in class Model
child
- the child that was added.
setIsComplete(boolean)
protected boolean childRemoved(Model child)
childRemoved
in class Model
child
- the child that was removed.
setIsComplete(boolean)
public static QName getQName(org.apache.xmlbeans.XmlObject o)
XmlCursor.getName()
public static String getLocalName(org.apache.xmlbeans.XmlObject o)
getQName(org.apache.xmlbeans.XmlObject)
public static org.apache.xmlbeans.XmlObject getParent(org.apache.xmlbeans.XmlObject o)
public static org.apache.xmlbeans.XmlObject getDocument(org.apache.xmlbeans.XmlObject o)
public static org.apache.xmlbeans.XmlObject fixQName(org.apache.xmlbeans.XmlObject element, QName newName, boolean removeXsiType)
element
- the element.newName
- the name the element should be.removeXsiType
- true to remove any xsi:type variable (which xbeans
addes when it changes element names).
public boolean isNil(org.apache.xmlbeans.XmlObject o)
public static void checkElement(org.apache.xmlbeans.XmlObject element, Class cl, String... names) throws IllegalArgumentException
element
- the element to check.cl
- the class the element must be (null for no check).names
- the array of local names the element must be (null for no
check).
IllegalArgumentException
- if element doesn't match.public static int removeAllChildren(org.apache.xmlbeans.XmlObject o)
public static boolean removeChild(org.apache.xmlbeans.XmlObject parent, int index)
public static org.apache.xmlbeans.XmlObject getChild(org.apache.xmlbeans.XmlObject parent, int index)
|
Copyright © 2000, 2009, Oracle and/or its affiliates. All rights reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |