com.ihr.xbrl.om.exLinks

## Class XBRLResource

- java.lang.Object
- - com.ihr.xbrl.om.XMLFragment
  - - com.ihr.xbrl.om.exLinks.XLinkElement
    - - com.ihr.xbrl.om.exLinks.XBRLPointerOfARelationship
      - - com.ihr.xbrl.om.exLinks.XBRLResource

- All Implemented Interfaces:
    HasAdditionalEqualityForReassignation, XBRLRelationshipPoint, Thinable, XBRLValidation, XBRLValueKey, XMLHasParent, java.lang.Cloneable, javax.xml.namespace.NamespaceContext
  Direct Known Subclasses:
    AutoFill, FlMessage, RenderHints, StaticRole, XBRLFormulaResource, XBRLLabelResource, XBRLTableResource

      public class XBRLResource
      extends XBRLPointerOfARelationship
      implements XBRLValueKey, XBRLRelationshipPoint, XBRLValidation

  This is the base type for XBRL resources. This object represents the content of an XBRL Resource as indicated in the XBRL Infoset documentation. Every other XBRL resource is derived from this XBRLResource and may overwrite methods in this class or any other class in the hierarchy tree. Label resources, for example, are implemented as XBRLLabelResource objects with additional properties, validation constraints etc.
  Author:
    Ignacio

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.ihr.xbrl.om.XBRLValidation

      `XBRLValidation.Direction`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static org.apache.log4j.Logger` | `log` The log.
    `static XBRLResource` | `nullResource` The Constant nullResource.

    - ### Fields inherited from class com.ihr.xbrl.om.exLinks.XLinkElement

      `actuate, ACTUATE, ARC, arcrole, ARCROLE, ETITLE, EXTENDED, from, FROM, href, HREF, label, LABEL, LOCATOR, RESOURCE, role, ROLE, show, SHOW, SIMPLE, title, TITLE, to, TO, TYPE`

    - ### Fields inherited from class com.ihr.xbrl.om.XMLFragment

      `CONCEPT_LABEL, CONCEPT_QNAME, EASY_TO_READ, ELEMENT_LABEL, EMPTYRELATIONSHIPSITERATORINSTANCE, EMPTYXMLFRAGMENTITERATORINSTANCE, FACT_CONCEPT_DATATYPE, FACT_CONCEPT_LABEL, FACT_QNAME, HIDE_COMMON_ACCURACY, idQName, NO_POSITION, OrderComparator, OrderComparator2, PERIOD_TYPE, PERIOD_VALUE, SHORT_TEXT, SOURCE_DOCUMENT, XPATH, XPOINTER`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `XBRLResource(XBRLExtendedLink parent, javax.xml.namespace.QName type, boolean bAddToParent)` Creates a XBRLResource programatically Set bAddToParent to false if the resource is not fully initialized in this case this function never throws a XBRLDuplicateResource exception Starting with release 2.6.5 this constructor requires the element declaration of the type parameter to be loaded in the set of schemas available in the DTSContainer of the parent.
    `XBRLResource(XBRLExtendedLink parent, net.sf.saxon.s9api.XdmNode resNode)` constructor of an XBRLResource object.
    `XBRLResource(XBRLResource other)` Constructor of a resource based on another resource that is already in the resource cache of the container.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addChild(XMLFragment f)` Sets the resource value to a comples type value and adds a fragment to it.
    `void` | `clear()` Removes all referneces to this resource in the DTS.
    `boolean` | `equals(java.lang.Object other)` Sets a new XPathFunctionResolver for this object.
    `XBRLLocator` | `generateLocatorToNode(boolean relativize, java.net.URI base)` Generate locator to node.
    `org.jdom.Element` | `generateNode(boolean relativize, java.net.URI base)` Serializes to a jdom Element the representation of the properties of this Information Item This method should be called from classes derived from this class
    `java.util.Iterator<XBRLAttribute>` | `getAttributes()` Access to the [Attributes] property.
    `DTSBase` | `getDTSBase()` Gets the DTS base.
    `java.lang.String` | `getFriendlyName()` Returns a string description that represents the element content in a form that users can understand.
    `java.lang.String` | `getFriendlyName(int modifiers, LabelsProvider lp)` Returns a string description that represents the element content in a form that users can understand.
    `XBRLExtendedLink` | `getParent()` Access to the [Parent] property.
    `static java.lang.String` | `getResourceIdentifier(XBRLResource resource)` Returns a text identifying the resource from the linkbase syntax. this is either the value of the id attribute or the value of the xlink:label on the resource
    `XBRLRoleType` | `getRoleType()` Access to the [Role Type] property The resource is validated against the content of the roleType information Return null if no roleType exist on resource.
    `XBRLXSDTypeDefinition` | `getType()` Gets the type.
    `XBRLValidationReport` | `getValidationReport()` Access to the last stored validation report.
    `net.sf.saxon.value.AnyURIValue` | `getValueKey()` Gets the value key.
    `int` | `hashCode()`
    `void` | `invalidate()` Invalidates the XBRLFact for XBRL validation.
    `boolean` | `invalidate(XBRLValidation.Direction dir)` Invalidates this object and the elements in the XML tree according with the parameter in dir This method is used by GUI tools that requires to reset validation before a manual validation cycle is started.
    `boolean` | `isComplexType()` Checks if is complex type.
    `boolean` | `isOnValidation()` When validation is a recursive process, this function returns true if the object going to be validated is already under validation.
    `boolean` | `isSimpleType()` Checks if is simple type.
    `void` | `setComplexType()` Programatically sets if the resource type is simple or complex.
    `void` | `setDTSBase(DTSBase base)` Sets the DTS base.
    `void` | `setId(java.lang.String id)` Sets the content of the id attribute of this element the ID MUST not have any space, but null is allowed and removes an id from an XML Fragment.
    `void` | `setParent(XBRLExtendedLink parent)` Sets the parent of this resource to the Extended link that is used in the parameter.
    `void` | `setRole(java.lang.String role)` Sets the value of the xlink:role attribute to a specific value.
    `void` | `setRoleType(XBRLRoleType role)` Sets the role type.
    `void` | `setSimpleType()` Programatically sets if the resource type is simple or complex.
    `void` | `setValue(net.sf.saxon.s9api.XdmValue v)` Sets the resource value to a specific simple type value.
    `XBRLValidationReport` | `validate(XBRLPlugInProcessor proc)` Executes validation on the instance object and returns a validation report.

    - ### Methods inherited from class com.ihr.xbrl.om.exLinks.XLinkElement

      `getActuate, getArcrole, getFromTxt, getHRef, getLabel, getRole, getShow, getStaticLabel, getSType, getTitle, getToTxt, isRequiredAttribute, isValidAttribute, setActuate, setArcrole, setFrom, setHRef, setLabel, setShow, setSType, setTitle, setTo`

    - ### Methods inherited from class com.ihr.xbrl.om.XMLFragment

      `addAttribute, addFromRelationship, addNamespace, addNamespace, addToRelationship, addXMLChild, changeBase, checkBase, clone, clone, delAttribute, delAttribute, equalXdmValues, evaluateBoolean, evaluateList, evaluateNode, evaluateNumber, evaluateString, generateId, generateNodeNamespacesAndAttributes, generateNodeValue, generatePrefix, getAllAttributes, getAttribute, getAttributeBooleanValue, getAttributeQNameValue, getAttributes, getAttributeStringValue, getAttributeValue, getBase, getBase, getBaseURI, getBooleanValue, getChild, getContainer, getContainerDocumentURI, getDeclaredNamespaces, getDocument, getElements, getElementsHashCode, getFragment, getFromRelationships, getFromRelationships, getFromRelationships, getFromRelationships, getFromRelationships, getGenericLabelText, getId, getLang, getNamespaceURI, getNodeName, getNumberOfAttributes, getNumberOfElements, getNumberOfFromRelationships, getNumberOfToRelationships, getOrGenerateId, getPrefix, getPrefixes, getQNameValue, getRelationshipsBases, getRelationshipsChain, getRelationshipTypes, getStaticContext, getStaticNamespace, getStringValue, getToolTipText, getToRelationships, getToRelationships, getToRelationships, getToRelationships, getToRelationships, getValue, getXPathExecutable, getXPathNamespaceContext, getXPathToNode, getXPathToRoot, getXPointerElementScheme, getXPointerElementScheme, getXPointerShorthandScheme, getXPointerToNode, isDead, isNamespaceDefined, isXdmDocumentAttached, objEquals, objHashCode, qNameToString, removeAttribute, removeChild, removeChild, removeFromRelationship, removeToRelationship, removeXMLChild, resetElements, resetHash, resolve_equal2, resolveHRef, resolveHRef, s_equal2, s_equal2, s_equal2, setAttributes, setBase, setDocument, setDocumentAndReload, setElements, setLang, setNamespaceContext, setNamespaces, setNode, setNodeName, setParent, setRegenerateNodeIfnotFound, setValue, setVariablesDefined, size, thin, toString, valueEquals, xEqual`

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface com.ihr.xbrl.om.exLinks.XBRLRelationshipPoint

      `addFromRelationship, addToRelationship, getFromRelationships, getToRelationships, removeFromRelationship, removeToRelationship`

- - ### Field Detail

    - #### log

          public static org.apache.log4j.Logger log

      The log.

    - #### nullResource

          public static final XBRLResource nullResource

      The Constant nullResource.

  - ### Constructor Detail

    - #### XBRLResource

          public XBRLResource(XBRLExtendedLink parent,
                      net.sf.saxon.s9api.XdmNode resNode)

      constructor of an XBRLResource object. This class creates an instance of a XBRL resource and registers it in the container.
      Parameters:
        `parent` - the parent
        `resNode` - the res node, can be null

    - #### XBRLResource

          public XBRLResource(XBRLResource other)

      Constructor of a resource based on another resource that is already in the resource cache of the container. This method will replace the old resource from the DTS and add a new resource (of a different type) at the same place.
      Parameters:
        `other` - the other

    - #### XBRLResource

          public XBRLResource(XBRLExtendedLink parent,
                      javax.xml.namespace.QName type,
                      boolean bAddToParent)

      Creates a XBRLResource programatically Set bAddToParent to false if the resource is not fully initialized in this case this function never throws a XBRLDuplicateResource exception Starting with release 2.6.5 this constructor requires the element declaration of the type parameter to be loaded in the set of schemas available in the DTSContainer of the parent.
      Parameters:
        `parent` - XBRLExtendedLink the extended link
        `type` - QName the type of this new resource
        `bAddToParent` - if this is true the resource will be added to the extended link and to the DTS Container.

  - ### Method Detail

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `XMLFragment`

    - #### equals

          public boolean equals(java.lang.Object other)

      Description copied from class: `XMLFragment`
      Sets a new XPathFunctionResolver for this object.
      Overrides:
        `equals` in class `XMLFragment`
      Parameters:
        `other` - the other
      Returns:
        true, if successful

    - #### getParent

          public XBRLExtendedLink getParent()

      Access to the [Parent] property.
      Specified by:
        `getParent` in interface `XMLHasParent`
      Overrides:
        `getParent` in class `XMLFragment`
      Returns:
        XBRLExtendedLink

    - #### setParent

          public void setParent(XBRLExtendedLink parent)
                         throws XBRLDuplicateException

      Sets the parent of this resource to the Extended link that is used in the parameter. If the resource had a previous parent this method detach the resource from previous parent and attach it to the new parent.
      Parameters:
        `parent` - XBRLExtendedLink
      Throws:
        `XBRLDuplicateException` - the XBRL duplicate exception

    - #### getResourceIdentifier

          public static java.lang.String getResourceIdentifier(XBRLResource resource)

      Returns a text identifying the resource from the linkbase syntax. this is either the value of the id attribute or the value of the xlink:label on the resource
      Parameters:
        `resource` - the resource
      Returns:
        the resource identification

    - #### getRoleType

          public XBRLRoleType getRoleType()

      Access to the [Role Type] property The resource is validated against the content of the roleType information Return null if no roleType exist on resource.
      Returns:
        XBRLRoleType

    - #### setRoleType

          public void setRoleType(XBRLRoleType role)

      Sets the role type.
      Parameters:
        `role` - the new role type

    - #### setRole

          public void setRole(java.lang.String role)

      Description copied from class: `XLinkElement`
      Sets the value of the xlink:role attribute to a specific value.
      Overrides:
        `setRole` in class `XLinkElement`
      Parameters:
        `role` - the new role

    - #### getDTSBase

          public DTSBase getDTSBase()

      Gets the DTS base.
      Returns:
        the DTS base

    - #### setDTSBase

          public void setDTSBase(DTSBase base)

      Sets the DTS base.
      Parameters:
        `base` - DTSBase

    - #### getAttributes

          public java.util.Iterator<XBRLAttribute> getAttributes()

      Access to the [Attributes] property.
      Overrides:
        `getAttributes` in class `XMLFragment`
      Returns:
        Iterator
      See Also:
        `XMLFragment.getAllAttributes()`

    - #### getType

          public XBRLXSDTypeDefinition getType()

      Gets the type.
      Returns:
        the type

    - #### isComplexType

          public boolean isComplexType()

      Checks if is complex type.
      Returns:
        boolean

    - #### setComplexType

          public void setComplexType()

      Programatically sets if the resource type is simple or complex.

    - #### setSimpleType

          public void setSimpleType()

      Programatically sets if the resource type is simple or complex.

    - #### setValue

          public void setValue(net.sf.saxon.s9api.XdmValue v)

      Sets the resource value to a specific simple type value.
      Overrides:
        `setValue` in class `XMLFragment`
      Parameters:
        `v` - the new value

    - #### setId

          public void setId(java.lang.String id)
                     throws XBRLInconsistentDTSException

      Description copied from class: `XMLFragment`
      Sets the content of the id attribute of this element the ID MUST not have any space, but null is allowed and removes an id from an XML Fragment. This method may be overwritten by other classes that require storing an indexed table of elements and IDs in order to prevent duplicate IDs to exist
      Overrides:
        `setId` in class `XMLFragment`
      Parameters:
        `id` - the new ID
      Throws:
        `XBRLInconsistentDTSException` - if the id is not lexicographically valid

    - #### addChild

          public void addChild(XMLFragment f)

      Sets the resource value to a comples type value and adds a fragment to it.
      Overrides:
        `addChild` in class `XMLFragment`
      Parameters:
        `f` - the f

    - #### isSimpleType

          public boolean isSimpleType()

      Checks if is simple type.
      Returns:
        boolean

    - #### generateNode

          public org.jdom.Element generateNode(boolean relativize,
                                      java.net.URI base)
                                        throws XBRLSerializationException

      Description copied from class: `XMLFragment`
      Serializes to a jdom Element the representation of the properties of this Information Item This method should be called from classes derived from this class
      Overrides:
        `generateNode` in class `XLinkElement`
      Parameters:
        `relativize` - boolean indicating if URIs should be relativized to the base URI (see next argument)
        `base` - the URI to which some attributes of this object should be relativided
      Returns:
        a clone of the surrounding jdom Element so it can be incorporated into multiple trees
      Throws:
        `XBRLSerializationException` - the XBRL serialization exception

    - #### generateLocatorToNode

          public XBRLLocator generateLocatorToNode(boolean relativize,
                                          java.net.URI base)
                                            throws java.net.URISyntaxException

      Generate locator to node.
      Parameters:
        `relativize` - the relativize
        `base` - the base
      Returns:
        XBRLLocator
      Throws:
        `java.net.URISyntaxException` - the URI syntax exception

    - #### getValueKey

          public net.sf.saxon.value.AnyURIValue getValueKey()

      Description copied from interface: `XBRLValueKey`
      Gets the value key.
      Specified by:
        `getValueKey` in interface `XBRLValueKey`
      Returns:
        the value key

    - #### clear

          public void clear()
                     throws java.lang.Throwable

      Removes all referneces to this resource in the DTS.
      Overrides:
        `clear` in class `XMLFragment`
      Throws:
        `java.lang.Throwable` - the throwable

    - #### getFriendlyName

          public java.lang.String getFriendlyName()

      Description copied from class: `XMLFragment`
      Returns a string description that represents the element content in a form that users can understand. This method may be overridden by parent classes.

      Remarks, this method may return very long names not suitable for user interface

      Overrides:
        `getFriendlyName` in class `XMLFragment`
      Returns:
        Non empty String. Internationalization is enabled

    - #### getFriendlyName

          public java.lang.String getFriendlyName(int modifiers,
                                         LabelsProvider lp)

      Description copied from class: `XMLFragment`
      Returns a string description that represents the element content in a form that users can understand. This method may be override by parent classes.

      This function accepts flags that are defined as constants in XMLFragment in order to modify the output.

      - `XMLFragment.XPOINTER` includes the element position in the source file using the XPointer specification. Note, if the document is created from objects the value may not be available
      - `XMLFragment.XPATH` includes the element position in the source file using XPATH. Note, if the document is created from objects the value may not be available
      - `XMLFragment.NO_POSITION` does not include the element position in the source file.
      - `XMLFragment.CONCEPT_QNAME` for XBRLItem, XBRLTuple and XMLElementDefinition.
      - `XMLFragment.CONCEPT_LABEL` for XBRLItem and XBRLTuple.
      - `XMLFragment.FACT_QNAME` for facts.
      - `XMLFragment.FACT_CONCEPT_LABEL` for facts.
      - `XMLFragment.SHORT_TEXT` for resources, returns the resource text, id or xlink:label
      - `XMLFragment.EASY_TO_READ` for contexts, returns the context date and dimensions in a user friendly text representation
      Overrides:
        `getFriendlyName` in class `XMLFragment`
      Parameters:
        `modifiers` - integer
        `lp` - the lp
      Returns:
        Non empty String. Internationalization is enabled

    - #### getValidationReport

          public XBRLValidationReport getValidationReport()

      Description copied from interface: `XBRLValidation`
      Access to the last stored validation report.
      Specified by:
        `getValidationReport` in interface `XBRLValidation`
      Returns:
        XBRLValidationReport or null if the object has not been validated or no errors exists

    - #### validate

          public XBRLValidationReport validate(XBRLPlugInProcessor proc)

      Description copied from interface: `XBRLValidation`
      Executes validation on the instance object and returns a validation report.

      The validation result may be cached internally. A call to `XBRLValidation.invalidate(Direction)` clears the validation cache.

      Specified by:
        `validate` in interface `XBRLValidation`
      Parameters:
        `proc` - the processor under which the object is going to be validated. Note the same object can be validated on multiple processors.
      Returns:
        the validation report or null if no errors.

    - #### invalidate

          public void invalidate()

      Description copied from interface: `XBRLValidation`
      Invalidates the XBRLFact for XBRL validation.
      Specified by:
        `invalidate` in interface `XBRLValidation`

    - #### invalidate

          public boolean invalidate(XBRLValidation.Direction dir)

      Description copied from interface: `XBRLValidation`
      Invalidates this object and the elements in the XML tree according with the parameter in dir

      This method is used by GUI tools that requires to reset validation before a manual validation cycle is started.

      Specified by:
        `invalidate` in interface `XBRLValidation`
      Parameters:
        `dir` - see the `XBRLValidation.Direction` enumeration for more information.
      Returns:
        true, if successful

    - #### isOnValidation

          public boolean isOnValidation()

      Description copied from interface: `XBRLValidation`
      When validation is a recursive process, this function returns true if the object going to be validated is already under validation. This prevents a recursive loop to enter the same validation component in an infinite loop.
      Specified by:
        `isOnValidation` in interface `XBRLValidation`
      Returns:
        true if the document is under validation. Means, the validation has not finished.