Package com.adobe.xfa.data
Class DataModel
- java.lang.Object
-
- com.adobe.xfa.Obj
-
- com.adobe.xfa.Node
-
- com.adobe.xfa.Element
-
- com.adobe.xfa.Model
-
- com.adobe.xfa.data.DataModel
-
- All Implemented Interfaces:
Element.DualDomNode,Model.DualDomModel,Peer
public final class DataModel extends Model implements Model.DualDomModel
A class to model the collection of all XFA nodes that make up form data.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDataModel.AttributeWrapperThe AttributeWrapper exists so that we can pass an Attribute to a method that expects an Element.static interfaceDataModel.SourceSetLink-
Nested classes/interfaces inherited from class com.adobe.xfa.Model
Model.DualDomModel, Model.Publisher
-
Nested classes/interfaces inherited from class com.adobe.xfa.Element
Element.DualDomNode, Element.ReplaceContent
-
Nested classes/interfaces inherited from class com.adobe.xfa.Node
Node.ChangeLogger
-
-
Field Summary
Fields Modifier and Type Field Description static intFMT_XML_DATAEnumeration XFAXMLFormat: FMT_XML_DATA = 3rd party XML, FMT_XPF_DATA = XPF format.static intFMT_XPF_DATA-
Fields inherited from class com.adobe.xfa.Element
AttrIsDefault, AttrIsFragment, AttrIsTransient, CREATEACTION
-
Fields inherited from class com.adobe.xfa.Node
CREATE_ALWAYS_NEW, CREATE_IF_NOT_EXIST, CREATE_MUST_NOT_EXIST, CREATE_REPLACE, gsXFANamespacePrefix
-
Fields inherited from interface com.adobe.xfa.ut.Peer
ATTR_CHANGED, CHILD_ADDED, CHILD_REMOVED, DESCENDENT_ADDED, DESCENDENT_ATTR_CHANGED, DESCENDENT_REMOVED, DESCENDENT_VALUE_CHANGED, PARENT_CHANGED, PERMS_LOCK_CLEARED, PERMS_LOCK_SET, PROTO_ATTR_CHANGED, PROTO_CHILD_ADDED, PROTO_CHILD_REMOVED, PROTO_DESCENDENT_ADDED, PROTO_DESCENDENT_ATTR_CHANGED, PROTO_DESCENDENT_REMOVED, PROTO_DESCENDENT_VALUE_CHANGED, PROTO_VALUE_CHANGED, UPDATED, VALUE_CHANGED
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappendChild(Node newChild, boolean bValidate)Appends the given child to this element.voidconnectPeerToDocument()connectPeerToDocument() is used to rearrange the DOM tree when inserting or appending a node.NodecreateChild(boolean bIsLeaf, java.lang.String aName)DataNodecreateDataRootElement(DataNode dataDescription)ElementcreateElement(Element parent, Node prevSibling, java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes, int lineNumber, java.lang.String fileName)Creates an element with the given parent, sibling, namespace uri, local name and SAX attributes.NodecreateNode(int eClassTag, Element parent, java.lang.String aNodeName, java.lang.String ns, boolean bDoVersionCheck)Create an element with the given tag, parent, name and uri.static java.lang.StringdataDescriptionNS()voiddisableSchemaValidation(boolean bMode)static NodefindAssociation(Node dataDesc, java.lang.String aAssociationName)Recursive search of a data description for a <dd:association> with a particular name.AttributefindAttrInNS(Attribute[] attrs, java.lang.String aNodeName)Given an array of attributes, find the specified node name which exists in a namespace that is compatible with this data model's namespace.AttributefindAttrInNS(Element e, java.lang.String aNodeName)Find an attribute via loose namespace checking.java.lang.StringgetBaseNS()DataNodegetDataDescriptionRoot(java.lang.String sDataRootName)static DataModelgetDataModel(AppModel app, boolean bCreateIfNotFound, boolean bAppend)Gets the data model held within an XFA DOM hierarchy.DataNodegetDataRoot()DataWindowgetDataWindow()java.lang.StringgetHeadNS()intgetHeadVersion()static voidgetReflectedNodes(Node dataNode, java.lang.String aTargetNamespaceURI, java.lang.String aTargetName, Key targetKey, java.util.List<java.lang.String> oFKeyValueAddressList, Node namespaceContextNode, NodeList results)Recursive search of a data model for nodes of a particular target QName whose foreign key matches the supplied primary key.static DataNodegetRootOfDataDescription(Node dataDesc)Find a data description node's <dd:dataDescription> ancestor.ScriptTablegetScriptTable()DataModel.SourceSetLinkgetSourceSetLink()voidinitFromDataDescription(Element dataNode)used to ensure an export data tree has a basic population since an export data tree doesn't necessarily have any actual data bindings.voidinsertChild(Node newChild, Node refChild, boolean bValidate)Inserts a child before a specific child in the child list.booleanisCompatibleNS(java.lang.String aNS)Determine if a specified namespace string is compatible with the namespace of this model.voidloadNode(Element parent, Node node, Generator generator)booleanloadRootAttributes()voidpreSave(boolean bSaveXMLScript)Prepares thisModelto be saved.voidremove()Removes this node from its parent child list.static voidremoveDDPlaceholderFlags(Node dataNode, boolean bDeep)voidresetPostLoadXML()static ObjresolveAssociation(Element dataNode, java.lang.String aAssociationName, BooleanHolder foundNullAssociation)NoderesolveRef(java.lang.String sSOM, Element contextNode, boolean bDataValue, boolean bDefault)voidserialize(java.io.OutputStream os, DOMSaveOptions options, int level, Node prevSibling)The helper function used by saveXML()voidsetSaveFormat(int format)voidsetSourceSetLink(DataModel.SourceSetLink sourceSetLink)booleanvalidateUsage(int nXFAVersion, int nAvailability, boolean bUpdateVersion)Validate if the given Version and Availability flags are valid for the current documentbooleanvalidateUsageFailedIsFatal(int nXFAVersion, int nAvailability)Determines if disallowing a version should be considered a fatal error.-
Methods inherited from class com.adobe.xfa.Model
addErrorList, addUseHRefNode, addUseNode, addXMLLoadErrorContext, allowUpdates, checkforCompatibleNS, clearErrorList, clone, createElement, createElement, createElement, createElement, createTextNode, createTextNode, doAttributeCleanup, getAliasNode, getAppModel, getAppModelIsTransient, getCachedLocale, getContext, getCurrentVersion, getDelta, getDeltas, getDocument, getErrorContextList, getErrorList, getEventManager, getGenerator, getIDValueMap, getLegacySetting, getLogMessenger, getName, getNeedsNSNormalize, getNode, getNS, getOriginalVersion, getOriginalVersionNode, getOriginalXFAVersion, getProtoList, getSchema, getSourceBelow, getVersion, getXmlPeer, isContainer, isLoading, isVersionCompatible, loadSpecialAttribute, loadSpecialNode, modelCleanup, nodeCleanup, normalizeNameSpaces, normalizeNameSpaces, normalizeNameSpaces, preLoadNode, publish, ready, remapTag, removeLastError, removeReferences, resolveNodes, resolveProtos, setAliasNode, setAppModel, setAppModelIsTransient, setContext, setCurrentVersion, setDOMProperties, setIDValueMap, setName, setNeedsNSNormalize, setOriginalXFAVersion, setXmlPeer, shortCutName, willDirtyDoc, willDirtyDoc
-
Methods inherited from class com.adobe.xfa.Element
appendChild, appendPI, appendPI, assignNode, clone, constructKey, constructKeys, copyContent, defaultAttribute, defaultElement, defaultElement, establishID, evaluate, explodeQName, findAttr, findSchemaAttr, foundBadAttribute, foundBadAttribute, getAll, getAtom, getAttr, getAttribute, getAttribute, getAttributeByName, getAttrIndex, getAttrName, getAttrNS, getAttrProp, getAttrQName, getAttrVal, getChildReln, getClassAll, getClassIndex, getClassName, getDeltas, getElement, getElement, getElementClass, getElementLocal, getEnum, getEnum, getEventTable, getFirstXFAChild, getFirstXMLChild, getID, getIndex, getInheritedNS, getInstalledLocale, getIsNull, getLastXMLChild, getLineNumber, getLocalName, getModel, getNode, getNodes, getNodeSchema, getNumAttrs, getOneOfChild, getOneOfChild, getPI, getPI, getPrefix, getProperty, getProperty, getSaveXMLSaveTransient, getSchemaType, getScriptMethodInfo, getSibling, getText, getXFAChild, getXMLChild, getXMLName, getXPath, getXsiNilAttribute, inhibitPrettyPrint, inhibitPrettyPrint, isFragment, isHidden, isHidden, isIndexed, isInstalledLocaleAmbient, isLeaf, isNameSpaceAttr, isPropertySpecified, isPropertySpecified, isPropertyValid, isSpecified, isSpecified, isSpecified, isTransient, isTransparent, isValidAttr, isValidChild, isValidElement, loadXML, loadXML, makeDefault, makeNonDefault, newAttribute, optimizeNameSpace, peekAttribute, peekElement, peekOneOfChild, peekProperty, peekProperty, postSave, privateSetName, processTextChildrenDuringParse, removeAttr, removeAttr, removeChild, removePI, removePI, removeWhiteSpace, removeXsiNilAttribute, replaceChild, resolveAndEnumerateChildren, resolveNodeCreate, resolvePrefix, saveFilteredXML, saveXML, saveXML, setAttribute, setAttribute, setAttribute, setAttribute, setAttrProp, setDefaultFlag, setElement, setIsDataWindowRoot, setIsIndexed, setLineNumber, setLocalName, setModel, setNS, setOneOfChild, setProperty, setProperty, setQName, setSaveXMLSaveTransient, setTransparent, setXMLName, setXsiNilAttribute, updateFromPeer
-
Methods inherited from class com.adobe.xfa.Node
checkAncestorPerms, checkDescendentPerms, checkPerms, cleanDirtyFlags, compareVersions, getData, getFirstXMLChildElement, getLocked, getNextXFASibling, getNextXMLSibling, getNextXMLSiblingElement, getNodeAsXML, getOwnerDocument, getPIAsXML, getPIName, getPreviousXMLSibling, getPrivateName, getPropName, getSOMExpression, getSOMExpression, getSomName, getUniqueSOMName, getWillDirty, getXFAChildCount, getXFAParent, getXfaPeer, getXMLChildCount, getXMLParent, hasChanged, isDefault, isDirty, isMapped, isPermsLockSet, isTransient, locateChildByClass, locateChildByName, logValueChangeHelper, notifyPeers, performSOMAssignment, resolveNode, resolveNode, resolveNode, resolveNodes, sendMessenge, setDirty, setDocument, setLocked, setMapped, setPermsLock, setPrivateName, setWillDirty, setXfaPeer, unLock, validateSchema
-
Methods inherited from class com.adobe.xfa.Obj
addPeer, addPeeredNode, clearPeers, deafen, getClassAtom, getClassTag, getPeer, getScriptProperty, getScriptThis, invokeFunction, isDeaf, isMute, isSameClass, isSameClass, isSameClass, mute, peerRemoved, removePeer, removePeeredNode, setClass, setClassTag, setScriptProperty, unDeafen, unMute
-
-
-
-
Field Detail
-
FMT_XML_DATA
public static final int FMT_XML_DATA
Enumeration XFAXMLFormat:- FMT_XML_DATA = 3rd party XML,
- FMT_XPF_DATA = XPF format.
- See Also:
- Constant Field Values
-
FMT_XPF_DATA
public static final int FMT_XPF_DATA
- See Also:
- Constant Field Values
-
-
Method Detail
-
dataDescriptionNS
public static java.lang.String dataDescriptionNS()
-
getDataModel
public static DataModel getDataModel(AppModel app, boolean bCreateIfNotFound, boolean bAppend)
Gets the data model held within an XFA DOM hierarchy.- Parameters:
app- the application model.bCreateIfNotFound- when true, create a data model if needed.bAppend- when true, append any underling xml to the xfa root element when loading, and when false, create orphan xfa:datasets and xfa:data nodes. This behaviour occurs only works when bCreateIfNotFound is set to true.- Returns:
- the data model, or null if none found.
-
getScriptTable
public ScriptTable getScriptTable()
- Overrides:
getScriptTablein classModel
-
appendChild
public void appendChild(Node newChild, boolean bValidate)
Description copied from class:ElementAppends the given child to this element.- Overrides:
appendChildin classElement- Parameters:
newChild- the child node being appended.bValidate- when true, ensures the given child is valid per the model's schema and throws anExFullif not.
-
createChild
public Node createChild(boolean bIsLeaf, java.lang.String aName)
-
createNode
public Node createNode(int eClassTag, Element parent, java.lang.String aNodeName, java.lang.String ns, boolean bDoVersionCheck)
Description copied from class:ModelCreate an element with the given tag, parent, name and uri.- Specified by:
createNodein classModel- Parameters:
eClassTag- the element's tag.parent- the element's parent.aNodeName- the element's name.ns- the element's namespace.bDoVersionCheck- check the element's version.- Returns:
- a new element.
-
createElement
public Element createElement(Element parent, Node prevSibling, java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes, int lineNumber, java.lang.String fileName)
Description copied from class:ModelCreates an element with the given parent, sibling, namespace uri, local name and SAX attributes.- Overrides:
createElementin classModel- Parameters:
parent- the element's parent, if any.prevSibling- the element's previous sibling, if any.uri- the element's namespace. This string must be interned.localName- the element's name. This string must be interned.qName- the element's qualified name. This string must be interned.attributes- the element's (SAX) attribute definitions.- Returns:
- a new element conformant to our schema.
- See Also:
Model.createElement(Element, Node, String, String, String, Attributes, int, String)
-
findAttrInNS
public Attribute findAttrInNS(Element e, java.lang.String aNodeName)
Find an attribute via loose namespace checking. Our check simply verifies that the namespace is compatible with any variation of namespaces for this model. Using the variations are simply changes in version number.- Parameters:
e- the element to searchaNodeName- the local name of the attribute- Returns:
- attribute index. -1 if not found.
-
findAttrInNS
public Attribute findAttrInNS(Attribute[] attrs, java.lang.String aNodeName)
Given an array of attributes, find the specified node name which exists in a namespace that is compatible with this data model's namespace. (This is a direct port of the C++ method by the same name, unlike the other variant of findAttrInNS above).- Parameters:
attrs- the array of attributes to searchaNodeName- the local name of the attribute- Returns:
- the attribute. null if not found.
-
getBaseNS
public java.lang.String getBaseNS()
- Specified by:
getBaseNSin classModel- See Also:
Model.getBaseNS()
-
getDataDescriptionRoot
public DataNode getDataDescriptionRoot(java.lang.String sDataRootName)
-
connectPeerToDocument
public void connectPeerToDocument()
Description copied from class:ElementconnectPeerToDocument() is used to rearrange the DOM tree when inserting or appending a node. It is provided here as a utility function for derived classes that could be adding child nodes, when peered against an orphan node. In particular, this happens with xfa:datasets and xfa:data, both of which may be created during the load process. On the C++ side, this method is only used by the data model. Due to the differences between the relationship of Documents and AppModels in Java, on the Java side it is also called when creating a DOM from scratch, from any ModelFactory's createDOM method. In the DataModel context at least, it should only be called if the DOM peer is an orphan. It takes that orphan and connects it to the document, and then moves the original peer of this node to be a child of the node that previously was orphaned.- Overrides:
connectPeerToDocumentin classElement
-
getDataRoot
public DataNode getDataRoot()
-
getDataWindow
public DataWindow getDataWindow()
-
getSourceSetLink
public DataModel.SourceSetLink getSourceSetLink()
-
initFromDataDescription
public void initFromDataDescription(Element dataNode)
used to ensure an export data tree has a basic population since an export data tree doesn't necessarily have any actual data bindings.
-
insertChild
public void insertChild(Node newChild, Node refChild, boolean bValidate)
Description copied from class:ElementInserts a child before a specific child in the child list.- Overrides:
insertChildin classElement- Parameters:
newChild- the child to be insertedrefChild- the child to insert beforebValidate- if true, validate the insertion
-
isCompatibleNS
public boolean isCompatibleNS(java.lang.String aNS)
Description copied from class:ModelDetermine if a specified namespace string is compatible with the namespace of this model. Essentially this determines if the two namespaces are equivalent (though the strings that represent them may not be identical).- Overrides:
isCompatibleNSin classModel- Parameters:
aNS- The namespace to compare.
-
loadRootAttributes
public boolean loadRootAttributes()
- Overrides:
loadRootAttributesin classModel
-
preSave
public void preSave(boolean bSaveXMLScript)
Description copied from class:ModelPrepares thisModelto be saved. Any model maintenance that may have been deferred is performed to ensure that the serialized form of theModelis correct. This method is called automatically before aModelis serialized to a stream, so it does not normally need to be called directly. The exception is when aDocumentis saved usingDocument.saveAs(java.io.OutputStream, Node, DOMSaveOptions)orDocument.saveXML(java.io.OutputStream, DOMSaveOptions).- Overrides:
preSavein classModel- See Also:
Node.preSave(boolean)
-
remove
public void remove()
Description copied from class:NodeRemoves this node from its parent child list.- Overrides:
removein classModel- See Also:
Node.remove()
-
removeDDPlaceholderFlags
public static void removeDDPlaceholderFlags(Node dataNode, boolean bDeep)
-
resetPostLoadXML
public void resetPostLoadXML()
- Overrides:
resetPostLoadXMLin classElement
-
resolveRef
public Node resolveRef(java.lang.String sSOM, Element contextNode, boolean bDataValue, boolean bDefault)
-
serialize
public void serialize(java.io.OutputStream os, DOMSaveOptions options, int level, Node prevSibling) throws java.io.IOExceptionDescription copied from class:NodeThe helper function used by saveXML()- Overrides:
serializein classModel- Parameters:
os- Streamfile to write tooptions- save optionslevel- the indent levelprevSibling- our previous sibling -- needed for some markup options.- Throws:
java.io.IOException- See Also:
Element.serialize(OutputStream, DOMSaveOptions, int, Node)
-
setSourceSetLink
public void setSourceSetLink(DataModel.SourceSetLink sourceSetLink)
-
setSaveFormat
public void setSaveFormat(int format)
-
validateUsage
public boolean validateUsage(int nXFAVersion, int nAvailability, boolean bUpdateVersion)Description copied from class:ObjValidate if the given Version and Availability flags are valid for the current document- Overrides:
validateUsagein classModel- Parameters:
nXFAVersion- The target XFA VersionnAvailability- The target Availability flags, this indicates for what clients the script is availablebUpdateVersion- indicates if the model version can be updated by the calling code- Returns:
- if true, Version and Availability flags are valid
- See Also:
Model.validateUsage(int, int, boolean)
-
validateUsageFailedIsFatal
public boolean validateUsageFailedIsFatal(int nXFAVersion, int nAvailability)Description copied from class:ObjDetermines if disallowing a version should be considered a fatal error.This method is called after calling
Obj.validateUsage(int, int, boolean)when that method returns false.- Overrides:
validateUsageFailedIsFatalin classModel- Parameters:
nXFAVersion- The target XFA VersionnAvailability- The target Availability flags, this indicates for what clients the script is available- Returns:
- true if disallowing nVersion should be considered a fatal error
- See Also:
Model.validateUsageFailedIsFatal(int, int)
-
disableSchemaValidation
public void disableSchemaValidation(boolean bMode)
-
getHeadVersion
public int getHeadVersion()
- Overrides:
getHeadVersionin classModel
-
resolveAssociation
public static Obj resolveAssociation(Element dataNode, java.lang.String aAssociationName, BooleanHolder foundNullAssociation)
-
getRootOfDataDescription
public static DataNode getRootOfDataDescription(Node dataDesc)
Find a data description node's <dd:dataDescription> ancestor.
-
findAssociation
public static Node findAssociation(Node dataDesc, java.lang.String aAssociationName)
Recursive search of a data description for a <dd:association> with a particular name. The first hit is returned.
-
getReflectedNodes
public static void getReflectedNodes(Node dataNode, java.lang.String aTargetNamespaceURI, java.lang.String aTargetName, Key targetKey, java.util.List<java.lang.String> oFKeyValueAddressList, Node namespaceContextNode, NodeList results)
Recursive search of a data model for nodes of a particular target QName whose foreign key matches the supplied primary key. All hits are returned.
-
-