Class: EMLEntity

EMLEntity()

EMLEntity represents an abstract data entity, corresponding with the EML EntityGroup and other elements common to all entity types, including otherEntity, dataTable, spatialVector, spatialRaster, and storedProcedure

Extends

  • Backbone.Model

Members

nodeNameMap

The map of lower case to camel case node names needed to deal with parsing issues with $.parseHTML(). Use this until we can figure out issues with $.parseXML().
Source:

Methods

addAttribute(attribute, index)

Add an attribute to the attributeList, inserting it at the zero-based index
Parameters:
Name Type Description
attribute EMLAttribute The EMLAttribute model to add
index number The index to insert the attribute at
Source:

defaults() → {object}

Attributes of any entity
Properties:
Name Type Description
xmlID string The XML id of the entity
alternateIdentifier Array Zero or more alt ids
entityName string Required, the name of the entity
entityDescription string Description of the entity
physical Array Zero to many EMLPhysical objects
physicalMD5Checksum string The MD5 checksum of the physical object
physicalSize string The size of the physical object in bytes
physicalObjectName string The name of the physical object
coverage Array Zero to many EML{Geo|Taxon|Temporal}Coverage objects
methods EMLMethod Zero or one EMLMethod object
additionalInfo Array Zero to many EMLText objects
attributeList EMLAttributes Zero to many EMLAttribute objects as a collection
constraint Array Zero to many EMLConstraint objects
references string A reference to another EMLEntity by id (needs work)
downloadID string A temporary attribute until we implement the eml-physical module
formatName string A temporary attribute until we implement the eml-physical module
fileName string The last matched package member filename
formatId string The last matched package member format
nodeOrder Array The order of the top level XML element nodes
parentModel EML211 The parent model this entity belongs to
objectXML string The serialized XML of this EML entity
objectDOM object The DOM of this EML entity
type string The type of entity
Source:
Returns:
- The default attributes
Type
object

formatXML(xmlString) → {string}

Format the EML XML for entities
Parameters:
Name Type Description
xmlString string The XML string to format
Source:
Returns:
- The formatted XML string
Type
string

getDataPid() → {string|null}

Get the data PID described by this entity's own EML.
Since:
  • 2.39.0
Source:
Returns:
The described data PID, if available
Type
string | null

getEMLPosition(objectDOM, nodeName) → {object}

Get the DOM node preceding the given nodeName to find what position in the EML document the named node should be appended
Parameters:
Name Type Description
objectDOM object The DOM object to search
nodeName string The name of the node to find
Source:
Returns:
- The DOM node to insert after
Type
object

getFileName() → {string}

Get the file name for the entity
Source:
Returns:
- The file name for the entity
Type
string

getId() → {string}

Get the id for the entity
Source:
Returns:
The id for the entity
Type
string

getParentEML() → {EML211|false}

Climbs up the model heirarchy until it finds the EML model
Source:
Returns:
- Returns the EML 211 Model or false if not found
Type
EML211 | false

initialize()

Source:

listenToAttributeList()

Listen to changes on the attributeList collection and trigger change events on the parent model and collection
Source:

parse(attrs, options) → {object}

Parse the incoming entity's common XML elements Content example: file-alt.1.1.txt file-again.1.1.txt file.1.1.txt A file summary
Parameters:
Name Type Description
attrs object The XML attributes
options object Any options passed to the parse function
Source:
Returns:
- The parsed attributes
Type
object

removeAttribute(attribute)

Remove an EMLAttribute model from the attributeList array
Parameters:
Name Type Description
attribute EMLAttribute The EMLAttribute model to remove from this model's attributeList
Source:

setMemberDescriptor(descriptor) → {EMLEntity}

Refresh the stable package member fields used by this entity without retaining the member itself. EML names and formats follow the package only while they still contain the previous descriptor value.
Parameters:
Name Type Description
descriptor object Package member descriptor
Properties
Name Type Attributes Description
id string <optional>
Package member PID
fileName string <optional>
Package member filename
formatId string <optional>
Package member format identifier
xmlID string <optional>
XML-safe form of the member PID
previousId string <optional>
Previous member PID
previousFileName string <optional>
Previous filename
previousFormatId string <optional>
Previous format
Since:
  • 2.39.0
Source:
Returns:
This entity
Type
EMLEntity

trickleUpChange()

Pass any change events up to the parent EML model
Source:

updateDOM(objectDOMOriginal) → {object}

Copy the original XML and update fields in a DOM object
Parameters:
Name Type Description
objectDOMOriginal object The original DOM object
Source:
Returns:
- The updated DOM object
Type
object

updateDownloadUrl(objectDOM) → {Element}

Update the recognized DataONE download URL in an entity DOM.
Parameters:
Name Type Description
objectDOM Element EML entity DOM
Since:
  • 2.39.0
Source:
Returns:
The supplied entity DOM
Type
Element

validate()

Source:

validateAttributes() → {Array}

Validates each of the EMLAttribute models in the attributeList
Source:
Returns:
- Returns an array of error messages for all the EMlAttribute models
Type
Array