|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.merlotxml.merlot.IDManager
Manages ID and IDRef attributes for one XML file. Generic implementation.
Field Summary | |
protected java.util.Hashtable |
_attrLastId
contains the last index value used for each named node. |
protected long |
_lastTimeAssigned
Used to check that the same millisecond is not assigned twice. |
protected MerlotDOMNode |
_rootNode
|
static int |
NODE_HIGHEST
|
static int |
NODE_SMALLEST
|
static int |
NODE_TIMESTAMP
|
static int |
NONE
|
static int |
TIMESTAMP
|
static int |
USERID_TIMESTAMP
|
Fields inherited from interface org.merlotxml.util.xml.DTDConstants |
ANY, CDATA, COMMENT, COMMENT_KEY, CONTENT_CONCAT, CONTENT_GROUP, CONTENT_LEAF, CONTENT_ONEMAX, CONTENT_OR, CONTENT_PLUS, CONTENT_SINGLE, CONTENT_STAR, EMPTY, ENTITIES, ENTITY, FIXED, GROUP, ID, IDREF, IDREFS, IMPLIED, NMTOKEN, NMTOKENS, NOTATION, PCDATA, PCDATA_KEY, PROCESSING_INSTRUCTION, PROCESSING_INSTRUCTION_KEY, REQUIRED, TOKEN_GROUP |
Constructor Summary | |
IDManager(MerlotDOMNode rootNode)
|
Method Summary | |
java.util.HashMap |
collectAttributesOfType(MerlotDOMElement start,
int dtdConstant)
|
java.lang.String |
getDefaultIdValue(MerlotDOMNode node,
java.lang.String attrName)
Returns a default string ID attribute value for a node. |
protected java.lang.String |
getDefaultIdValueForIndex(MerlotDOMNode node,
java.lang.String attrName,
int index)
Returns a default string ID attribute value for a node according to an integer index. |
protected java.util.Map |
getIDAttrs(MerlotDOMNode node,
MerlotDOMNode targetNode,
java.lang.String targetAttrName)
Returns all the ID attributes in the document which belongs to a node and its children. |
java.util.Map |
getIDAttrs(MerlotDOMNode targetNode,
java.lang.String targetAttrName)
Returns all the ID attributes in the document. |
int |
getIdTypeSetting()
|
protected java.util.Vector |
getIdValues(MerlotDOMNode targetNode,
java.lang.String targetAttrName)
Returns all the ID attributes in the document. |
java.lang.String |
getLogAttribute()
|
boolean |
getLogLastModifiedSetting()
|
boolean |
isDuplicate(org.w3c.dom.Attr idAttr,
java.util.Vector idValues)
|
void |
logChange(MerlotDOMNode node)
|
void |
nodeChanged(MerlotDOMNode parent,
int[] indices,
MerlotDOMNode[] children)
|
void |
nodeDeleted(MerlotDOMNode node)
|
void |
nodeInserted(MerlotDOMNode parent,
int[] indices,
MerlotDOMNode[] children)
notifies the listener that one or more nodes were inserted under the given parent. |
void |
nodeRemoved(MerlotDOMNode parent,
int[] indices,
MerlotDOMNode[] children)
notifies the listener that one or more nodes under the given parent were deleted. |
java.util.HashMap |
preventDuplicateId(MerlotDOMElement suspect,
java.util.Vector idValues)
|
void |
setDisabled(boolean disable)
|
void |
updateIdRefs(MerlotDOMElement root,
java.util.HashMap changes)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected MerlotDOMNode _rootNode
protected java.util.Hashtable _attrLastId
protected long _lastTimeAssigned
public static final int NONE
public static final int NODE_SMALLEST
public static final int NODE_HIGHEST
public static final int TIMESTAMP
public static final int NODE_TIMESTAMP
public static final int USERID_TIMESTAMP
Constructor Detail |
public IDManager(MerlotDOMNode rootNode)
Method Detail |
public java.util.Map getIDAttrs(MerlotDOMNode targetNode, java.lang.String targetAttrName)
targetNode
- the node containing the IDREF attributetargetAttrName
- the name of the IDREF attributeprotected java.util.Map getIDAttrs(MerlotDOMNode node, MerlotDOMNode targetNode, java.lang.String targetAttrName)
node
- the parent nodetargetNode
- the node containing the IDREF attributetargetAttrName
- the name of the IDREF attributeprotected java.util.Vector getIdValues(MerlotDOMNode targetNode, java.lang.String targetAttrName)
targetNode
- the node containing the IDREF attributetargetAttrName
- the name of the IDREF attributepublic java.lang.String getDefaultIdValue(MerlotDOMNode node, java.lang.String attrName)
node
- node containing the ID attributeattrName
- name of the ID attributepublic int getIdTypeSetting()
protected java.lang.String getDefaultIdValueForIndex(MerlotDOMNode node, java.lang.String attrName, int index)
node
- node containing the ID attributeattrName
- name of the ID attributeindex
- arbitrary integerpublic void nodeInserted(MerlotDOMNode parent, int[] indices, MerlotDOMNode[] children)
nodeInserted
in interface MerlotNodeListener
public void nodeRemoved(MerlotDOMNode parent, int[] indices, MerlotDOMNode[] children)
nodeRemoved
in interface MerlotNodeListener
public void nodeDeleted(MerlotDOMNode node)
nodeDeleted
in interface MerlotNodeListener
public void nodeChanged(MerlotDOMNode parent, int[] indices, MerlotDOMNode[] children)
nodeChanged
in interface MerlotNodeListener
public java.util.HashMap preventDuplicateId(MerlotDOMElement suspect, java.util.Vector idValues)
public boolean isDuplicate(org.w3c.dom.Attr idAttr, java.util.Vector idValues)
public void updateIdRefs(MerlotDOMElement root, java.util.HashMap changes)
public java.util.HashMap collectAttributesOfType(MerlotDOMElement start, int dtdConstant)
public boolean getLogLastModifiedSetting()
public java.lang.String getLogAttribute()
public void setDisabled(boolean disable)
public void logChange(MerlotDOMNode node)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |