Class: EMLEntities

EMLEntities()

A collection of EMLEntities.

Constructor

new EMLEntities()

Since:
  • 2.33.0
Source:

Extends

  • Backbone.Collection

Methods

addFromDataONEObject(dataONEObject, options) → {EMLEntity}

Add a new entity to the collection using info from a DataONE object. Sets listeners to remove the entity if the DataONE object fails to save, and to add it back if it later saves successfully.
Parameters:
Name Type Description
dataONEObject DataONEObject DataONE object model
options object Options for the entity
Properties
Name Type Description
parentModel EMLModel The parent model of the entity
Source:
Returns:
The new entity that was added to the collection
Type
EMLEntity

copyAttributeList(source, targets, errorIfInvalidopt)

Duplicate the attribute list from a source entity to given target entities in this collection. Any attributes in the target entities will be removed and replaced with the source attributes. Remove events will be triggered on the target entities. The attributes are copied over as a deep copy, so changes to the new target attributes will not affect the source attributes. If any xmlIDs are present in the copied attributes, they will be removed.
Parameters:
Name Type Attributes Description
source EMLEntity The entity to copy attributes from. Must contain at least one non-empty attribute.
targets Array.<EMLEntity> The entities to copy attributes to
errorIfInvalid boolean <optional>
If true (default), an error will be thrown if any attributes from the source entity are invalid. If set to false, only valid attributes will be copied over, and invalid attributes will be ignored.
Source:

getAllFileNames() → {Array.<string>}

Get the names of all the entities in the collection.
Source:
Returns:
The names of all the entities in the collection, either the entityName or physicalObjectName for each entity
Type
Array.<string>

getByDataONEObject(dataONEObject, dataPackageopt) → {EMLEntity|boolean}

Search the collection for an entity that matches the given DataONE object. Matches are made based on the DataONE object's identifier, checksum, file name, or format type. Optionally, a DataPackage collection can be provided to assess whether the entity is the only one in the package, and therefore must be the entity for the given DataONE object.
Parameters:
Name Type Attributes Description
dataONEObject DataONEObject The DataONE object to match
dataPackage DataPackage <optional>
The DataPackage collection to check
Source:
Returns:
The matching EMLEntity model or false if no match is found
Type
EMLEntity | boolean

getByFileName(fileName) → {Array.<EMLEntity>}

Get all entities in the collection that have the given file name set as the entity name or physical object name.
Parameters:
Name Type Description
fileName string The file name to search for
Source:
Returns:
The entities that have the given file name
Type
Array.<EMLEntity>

getByFormatName(formatName) → {Array.<EMLEntity>}

Get all entities in the collection that have the given format name set as the entity type.
Parameters:
Name Type Description
formatName string The format name to search for
Source:
Returns:
The entities that have the given format name
Type
Array.<EMLEntity>

getEntitiesWithValidAttributes() → {Array.<EMLEntity>}

Get all entities in the collection that have valid attributes. An entity with no attributes is considered valid.
Source:
Returns:
The entities that have valid attributes
Type
Array.<EMLEntity>

getParentModel() → {EMLEntity}

Get the model that contains this collection. Searches through all of the entities in the collection to find the one that has the parentModel set.
Source:
Returns:
The model that contains this collection or null if no parent model is found
Type
EMLEntity

hasNonEmptyEntity() → {boolean}

Check that the collection has at least one entity that has data.
Source:
Returns:
True if the collection has at least one entity that is not empty, false otherwise
Type
boolean

model()

Source:

parse()

Source:

updateDatasetDOM(datasetNode, eml)

Update an EML dataset node with the entities in this collection. Will add, remove, or update entities and re-order according to the order in this collection.
Parameters:
Name Type Description
datasetNode Element The dataset node to update
eml EML211 The EML model that contains the dataset node
Source:

validate()

Source: