Extends
Methods
fetch(optionsopt) → {jqXHR}
Retrieve the formats from the Coordinating Node
Parameters:
| Name |
Type |
Attributes |
Description |
options |
object
|
<optional>
|
Options to pass to Backbone fetch. |
- Source:
Returns:
Backbone fetch request.
-
Type
-
jqXHR
fetchPromise(optionsopt) → {Promise.<ObjectFormats>}
Fetch the formats and return a promise that settles with the Backbone
sync or error event.
Parameters:
| Name |
Type |
Attributes |
Description |
options |
object
|
<optional>
|
Options to pass to ObjectFormats#fetch |
- Since:
- Source:
Returns:
Promise resolving to this collection
-
Type
-
Promise.<ObjectFormats>
Given a formatId, filename, and/or mediaType, return the best matching
formatId from the collection.
Parameters:
| Name |
Type |
Description |
props |
object
|
Format matching properties.
Properties
| Name |
Type |
Attributes |
Description |
formatId |
string
|
<optional>
|
The formatId to match against the
collection |
existingFormatId |
string
|
<optional>
|
Existing formatId to use
when filename and mediaType are ambiguous |
filename |
string
|
<optional>
|
The filename to match against the
collection |
mediaType |
string
|
<optional>
|
The mediaType to match against the
collection |
|
- Since:
- Source:
Returns:
- The best matching formatId from the collection, or
the default formatId if no match is found.
-
Type
-
string
Determine the DataONE format type for a format signal.
Parameters:
| Name |
Type |
Description |
props |
object
|
Format properties.
Properties
| Name |
Type |
Attributes |
Description |
formatType |
string
|
<optional>
|
Explicit format type. |
formatId |
string
|
<optional>
|
DataONE format ID. |
filename |
string
|
<optional>
|
File name used for extension matching. |
mediaType |
string
|
<optional>
|
Media type used for format matching. |
|
- Since:
- Source:
Returns:
One of "RESOURCE", "METADATA", "DATA", or null
when no match is available.
-
Type
-
string
|
null
Convert a DataONE format ID into a human-readable format name.
Parameters:
| Name |
Type |
Description |
formatId |
string
|
Format ID to convert. |
- Since:
- Source:
Returns:
Friendly format name, or the original value when no
match is available.
-
Type
-
string
getType(propsopt) → {string}
Determine the general display type for an object.
Parameters:
| Name |
Type |
Attributes |
Description |
props |
object
|
<optional>
|
Object format and provenance properties |
- Since:
- Source:
Returns:
A value from ObjectFormats#OBJECT_TYPES
-
Type
-
string
initialize(modelsopt, optionsopt)
Initialize fallback and remote-fetch state for the collection.
Parameters:
| Name |
Type |
Attributes |
Description |
models |
Array.<object>
|
Array.<Backbone.Model>
|
<optional>
|
Initial format models. |
options |
object
|
<optional>
|
Collection options.
Properties
| Name |
Type |
Attributes |
Description |
remote |
boolean
|
<optional>
|
Whether the models are remote
formats. |
fallback |
boolean
|
<optional>
|
Set false to skip fallback formats. |
formatsServiceUrl |
string
|
<optional>
|
URL used to fetch formats |
|
- Since:
- Source:
isData(props) → {boolean}
Check whether format properties identify data.
Parameters:
- Since:
- Source:
Returns:
True when the format type is DATA.
-
Type
-
boolean
isEML(props) → {boolean}
Check whether format properties identify an EML document.
Parameters:
| Name |
Type |
Description |
props |
object
|
Format properties.
Properties
| Name |
Type |
Attributes |
Description |
formatId |
string
|
<optional>
|
DataONE format ID. |
filename |
string
|
<optional>
|
File name used for extension matching. |
mediaType |
string
|
<optional>
|
Media type used for format matching. |
|
- Since:
- Source:
Returns:
True when the resolved format ID is an EML format.
-
Type
-
boolean
isImage(props) → {boolean}
Check whether format properties identify a previewable image.
Parameters:
| Name |
Type |
Description |
props |
object
|
Object format and provenance properties accepted
by ObjectFormats#getType |
- Since:
- Source:
Returns:
True when the object has an image display type
-
Type
-
boolean
Check whether format properties identify science metadata.
Parameters:
- Since:
- Source:
Returns:
True when the format type is METADATA.
-
Type
-
boolean
isResource(props) → {boolean}
Check whether format properties identify a resource object.
Parameters:
- Since:
- Source:
Returns:
True when the format type is RESOURCE.
-
Type
-
boolean
isResourceMap(props) → {boolean}
Check whether format properties identify an ORE resource map.
Parameters:
| Name |
Type |
Description |
props |
object
|
Format properties.
Properties
| Name |
Type |
Attributes |
Description |
formatId |
string
|
<optional>
|
DataONE format ID. |
filename |
string
|
<optional>
|
File name used for extension matching. |
mediaType |
string
|
<optional>
|
Media type used for format matching. |
|
- Since:
- Source:
Returns:
True when the resolved format ID is the ORE format.
-
Type
-
boolean
parse(response) → {Array.<object>}
Parse the XML response from the CN
Parameters:
| Name |
Type |
Description |
response |
string
|
object
|
XML response text, or parsed formats. |
- Source:
Returns:
Parsed object formats.
-
Type
-
Array.<object>
url() → {string|null}
The constructed URL of the collection (/cn/v2/formats)
- Source:
Returns:
URL used during fetch
-
Type
-
string
|
null