HERE Android SDK Developer's Guide

CollectionProvider

The interface CollectionProvider is a member of com.here.android.mpa.nlp .

Interface Summary

public abstract interface CollectionProvider

Collection interface for adding, removing, renaming, retrieving collections and/or places.

[For complete information, see the section Interface Details]

Method Summary

Table 1. Methods in CollectionProvider
Methods

public abstract void addCollection (String collectionName, java.lang.ref.WeakReference <OnCollectionListener> listener)

Add the specified collection.

public abstract void addPlace (String collectionName, Place place, java.lang.ref.WeakReference <OnCollectionListener> listener)

Add the specified place to the specified collection.

public abstract void clear (java.lang.ref.WeakReference <OnCollectionListener> listener)

Remove all collections.

public abstract void copyCollection (String sourceCollectionName, String destinationCollectionName, java.lang.ref.WeakReference <OnCollectionListener> listener)

Copy a collection.

public abstract void copyPlace (String sourceCollectionName, String placeName, String destinationCollectionName, java.lang.ref.WeakReference <OnCollectionListener> listener)

Copy the specified place in a collection to another collection.

public abstract List getCollectionNames ()

Retrieve all collection names.

public abstract List getCollectionNames (String placeName)

Get all collection names that has a place with the specified name.

public abstract Place getPlace (String collectionName, String placeName)

Retrieve the place matching the specified name from the specified collection.

public abstract java.util.List <Place> getPlaces (String collectionName)

Retrieve all places in the specified collection.

public abstract void removeCollection (String collectionName, java.lang.ref.WeakReference <OnCollectionListener> listener)

Remove the specified collection.

public abstract void removePlace (String collectionName, String placeName, java.lang.ref.WeakReference <OnCollectionListener> listener)

Remove the specified place from the specified collection.

public abstract void renameCollection (String originalCollectionName, String newCollectionName, java.lang.ref.WeakReference <OnCollectionListener> listener)

Rename a collection.

public abstract void renamePlace (String collectionName, String originalPlaceName, String newPlaceName, java.lang.ref.WeakReference <OnCollectionListener> listener)

Rename the specified place in a collection.

Interface Details

Collection interface for adding, removing, renaming, retrieving collections and/or places. If this interface is not implemented, all collection related utterances will result in feature not supported announcement to the users. If application chooses to implement this interface, be sure to adopt a strategy for handling the use cases where a user does not explicitly specify a collection name, whether to persist collection data and how to persist and synchronize data, whether to support duplicates, and whether to allow any discrepancies in the names to accommodate inaccuracies of speech-to-text or user accents. To achieve better user experience, it's highly recommended that the names used for collections and places be a single word without any punctuation or symbol and they should be case insensitive.

IMPORTANT: Natural language processor is a Beta feature. The related classes are subject to change without notice.

Method Details

public abstract void addCollection (String collectionName, java.lang.ref.WeakReference <OnCollectionListener> listener)

Parameters:

  • collectionName

    The name of the collection to be added. null if user does not explicitly specify the name of the collection.

  • listener

    The OnCollectionListener to handle the callback after operation is completed. The error provided in the onComplete(Error) should be NONE if the specified collection is successfully added; otherwise return FAILED. Any message returned from getMessage() will be read to the user regardless whether the operation is successful.

See also:

addPlace(String, Place, WeakReference<OnCollectionListener>)

public abstract void addPlace (String collectionName, Place place, java.lang.ref.WeakReference <OnCollectionListener> listener)

Parameters:

  • collectionName

    The name of the collection. null if user does not explicitly specify the name of the collection.

  • place

    The Place to be added into collection.

  • listener

    The OnCollectionListener to handle the callback after operation is completed. The error provided in the onComplete(Error) should be NONE if the specified place is successfully added; otherwise return FAILED. Any message returned from getMessage() will be read to the user regardless whether the operation is successful.

public abstract void clear (java.lang.ref.WeakReference <OnCollectionListener> listener)

Remove all collections.

Parameters:

  • listener

    The OnCollectionListener to handle the callback after operation is completed. The error provided in the onComplete(Error) should be NONE if all collections are successfully removed; otherwise return FAILED. Any message returned from getMessage() will be read to the user regardless whether the operation is successful.

public abstract void copyCollection (String sourceCollectionName, String destinationCollectionName, java.lang.ref.WeakReference <OnCollectionListener> listener)

Copy a collection.

Parameters:

  • sourceCollectionName

    The name of the collection to be renamed. null if user does not explicitly specify the name of the collection.

  • destinationCollectionName

    The new name of the collection. null if user does not explicitly specify the name of the collection.

  • listener

    The OnCollectionListener to handle the callback after operation is completed. The error provided in the onComplete(Error) should be NONE if the specified collection is successfully renamed; otherwise return FAILED. Any message returned from getMessage() will be read to the user regardless whether the operation is successful.

See also:

addPlace(String, Place, WeakReference<OnCollectionListener>)

addCollection(String, WeakReference<OnCollectionListener>)

public abstract void copyPlace (String sourceCollectionName, String placeName, String destinationCollectionName, java.lang.ref.WeakReference <OnCollectionListener> listener)

Copy the specified place in a collection to another collection.

Parameters:

  • sourceCollectionName

    The name of the collection. null if user does not explicitly specify the name of the collection.

  • placeName

    The name of the place to be copied.

  • destinationCollectionName

    The name of the collection to copied to. null if user does not explicitly specify the name of the collection.

  • listener

    The OnCollectionListener to handle the callback after operation is completed. The error provided in the onComplete(Error) should be NONE if the specified place is successfully copied; otherwise return FAILED. Any message returned from getMessage() will be read to the user regardless whether the operation is successful.

See also:

addPlace(String, Place, WeakReference<OnCollectionListener>)

public abstract List getCollectionNames ()

Retrieve all collection names. These names may be announced to the users so if you have a special collection to store places whenever user does not explicitly a collection, return the name of that special collection. e.g. A special collection called "unnamed", then return "unnamed" instead of an empty string or null.

Returns:

A list of collection names. An empty list if there isn't any collection.

See also:

addPlace(String, Place, WeakReference<OnCollectionListener>)

addCollection(String, WeakReference<OnCollectionListener>)

public abstract List getCollectionNames (String placeName)

Get all collection names that has a place with the specified name. These names may be announced to the users so if you have a special collection to store places whenever user does not explicitly a collection and the given place is found in that special collection, return the name of that collection. e.g. A special collection called "unnamed", then return "unnamed" instead of an empty string or null.

Parameters:

  • placeName

    The name of the place.

Returns:

A list of collection names, or empty list if the specified place exists but does not belong to any collection, or null if the specified place does not exist.

See also:

addPlace(String, Place, WeakReference<OnCollectionListener>)

addCollection(String, WeakReference<OnCollectionListener>)

public abstract Place getPlace (String collectionName, String placeName)

Retrieve the place matching the specified name from the specified collection.

Parameters:

  • collectionName

    The name of the collection. null if user does not explicitly specify the name of the collection.

  • placeName

    The name of the place to retrieve.

Returns:

Place in the specified collection. null if the specified place does not exist in the specified collection.

See also:

addPlace(String, Place, WeakReference<OnCollectionListener>)

public abstract java.util.List <Place> getPlaces (String collectionName)

Retrieve all places in the specified collection.

Parameters:

  • collectionName

    The name of the collection. null if user does not explicitly specify the name of the collection.

Returns:

Places in the specified collection. null if the specified collection does not exist; an empty list if the specified collection exists but does not contain any place.

See also:

addPlace(String, Place, WeakReference<OnCollectionListener>)

addCollection(String, WeakReference<OnCollectionListener>)

public abstract void removeCollection (String collectionName, java.lang.ref.WeakReference <OnCollectionListener> listener)

Remove the specified collection.

Parameters:

  • collectionName

    The name of the collection to be removed. null if user does not explicitly specify the name of the collection.

  • listener

    The OnCollectionListener to handle the callback after operation is completed. The error provided in the onComplete(Error) should be NONE for the following scenarios: 1) if the specified collection is successfully removed. 2) if the specified collection does not exist to begin with. If the specified collection cannot be successfully removed, return FAILED. Any message returned from getMessage() will be read to the user regardless whether the operation is successful.

See also:

addCollection(String, WeakReference<OnCollectionListener>)

public abstract void removePlace (String collectionName, String placeName, java.lang.ref.WeakReference <OnCollectionListener> listener)

Remove the specified place from the specified collection.

Parameters:

  • collectionName

    The name of the collection. null if user does not explicitly specify the name of the collection.

  • placeName

    The name of the place to be removed from collection.

  • listener

    The OnCollectionListener to handle the callback after operation is completed. The error provided in the onComplete(Error) should be NONE for the following scenarios: 1) if the specified place is successfully removed from the specified collection. 2) if the specified place does not exist in the specified collection to begin with. If the specified place cannot be successfully removed from the specified collection, return FAILED. Any message returned from getMessage() will be read to the user regardless whether the operation is successful.

See also:

addPlace(String, Place, WeakReference<OnCollectionListener>)

public abstract void renameCollection (String originalCollectionName, String newCollectionName, java.lang.ref.WeakReference <OnCollectionListener> listener)

Rename a collection.

Parameters:

  • originalCollectionName

    The name of the collection to be renamed. null if user does not explicitly specify the name of the collection.

  • newCollectionName

    The new name of the collection. null if user does not explicitly specify the name of the collection.

  • listener

    The OnCollectionListener to handle the callback after operation is completed. The error provided in the onComplete(Error) should be NONE if the specified collection is successfully renamed; otherwise return FAILED. Any message returned from getMessage() will be read to the user regardless whether the operation is successful.

See also:

addPlace(String, Place, WeakReference<OnCollectionListener>)

addCollection(String, WeakReference<OnCollectionListener>)

public abstract void renamePlace (String collectionName, String originalPlaceName, String newPlaceName, java.lang.ref.WeakReference <OnCollectionListener> listener)

Rename the specified place in a collection.

Parameters:

  • collectionName

    The name of the collection. null if user does not explicitly specify the name of the collection.

  • originalPlaceName

    The name of the place to be renamed.

  • newPlaceName

    The new name of the place.

  • listener

    The OnCollectionListener to handle the callback after operation is completed. The error provided in the onComplete(Error) should be NONE if the specified place is successfully renamed; otherwise return FAILED. Any message returned from getMessage() will be read to the user regardless whether the operation is successful.

See also:

addPlace(String, Place, WeakReference<OnCollectionListener>)