Catalog

Catalog

new Catalog(terria)

Source:

The view model for the data catalog.

Parameters:
Name Type Description
terria Terria

The Terria instance.

Members

group :CatalogGroup

Source:

Gets the catalog's top-level group.

Type:

isLoading :Boolean

Source:

Gets or sets a flag indicating whether the catalog is currently loading.

Type:
  • Boolean

terria :Terria

Source:

Gets the Terria instance.

Type:

Methods

serializeToJson(optionsopt) → {Object}

Source:

Serializes the catalog to JSON.

Parameters:
Name Type Attributes Description
options Object <optional>

Object with the following properties:

Properties
Name Type Attributes Description
propertyFilter function <optional>

Filter function that will be executed to determine whether a property should be serialized.

itemFilter function <optional>

Filter function that will be executed for each item in a group to determine whether that item should be serialized.

Returns:

The serialized JSON object-literal.

Type
Object

updateByShareKeys(sharedObjects) → {Promise}

Source:

Resolves items in the catalog based on the share keys provided, and updates them with the passed info and enables them along with all their ancestors in the catalog hierarchy. This is asynchronous as it may involve a number of CatalogItem#load calls.

Note that because of the lazily-loaded nature of the catalog, items within it may not be resolvable by shareKey until their parents have loaded. As a result this loads sharedObjects in serial from left to right. If a catalog member is the child of an asynchronously-loaded catalog group (like a ckan or socrata group), then that group's shareKey precede the child member.

Parameters:
Name Type Description
sharedObjects Object

A flat map of string-based share keys with data to update on the resolved object. It is possible to pass an empty object if nothing needs updating.

Returns:

A promise that will resolve when all the items have been loaded and enabled.

Type
Promise

updateFromJson(json, optionsopt) → {Promise}

Source:

Updates the catalog from a JSON object-literal description of the available collections. Existing collections with the same name as a collection in the JSON description are updated. If the description contains a collection with a name that does not yet exist, it is created. Because parts of the update may happen asynchronously, this method returns at Promise that will resolve when the update is completely done.

Parameters:
Name Type Attributes Description
json Object

The JSON description. The JSON should be in the form of an object literal, not a string.

options Object <optional>

Object with the following properties:

Properties
Name Type Attributes Description
onlyUpdateExistingItems Boolean <optional>

true to only update existing items and never create new ones, or false is new items may be created by this update.

isUserSupplied Boolean <optional>

If specified, sets the CatalogMember#isUserSupplied property of updated catalog members to the given value. If not specified, the property is left unchanged.

Returns:

A promise that resolves when the update is complete.

Type
Promise

upsertCatalogGroup(CatalogGroupConstructor, name, description) → {CatalogGroup}

Source:

If a catalog group exists with this name, update it, otherwise create it.

Parameters:
Name Type Description
CatalogGroupConstructor function

The constructor function for the catalog group (typically CatalogGroup).

name String

The catalog group's name.

description String

The catalog group's description.

Returns:

The new or updated catalog group.

Type
CatalogGroup