Package org.gbif.api.util
Class DatasetKey
java.lang.Object
org.gbif.api.util.DatasetKey
A typed dataset key for both registered and external datasets.
External dataset keys are compound keys based on the originating network UUID key and a free String based
local identifier. The compound external datasetKey is structured as follows in its serialized form:
{NETWORK_KEY}:{DATASET_ID}
This class is intended as a utility class, lacks mutability and therefore is not suitable serialization via Jackson!-
Constructor Summary
ConstructorsConstructorDescriptionDatasetKey(UUID datasetKey) Constructor for a registered dataset key.DatasetKey(UUID networkKey, String datasetId) Constructor for an external dataset key. -
Method Summary
Modifier and TypeMethodDescriptionstatic DatasetKeyfromString(String key) Parses a datasetKey which can be either a compound external key or a simple UUID for registered datasets.A registered UUID of either a dataset or the network of origin in the case of external datasets.booleanGenerates the serialized dataset key as used in theDatasetclass.
-
Constructor Details
-
DatasetKey
Constructor for a registered dataset key. -
DatasetKey
Constructor for an external dataset key.- Parameters:
networkKey- of the originating networkdatasetId- the local dataset id within the network
-
-
Method Details
-
fromString
Parses a datasetKey which can be either a compound external key or a simple UUID for registered datasets.- Parameters:
key- a simple registered dataset uuid key or an external compound dataset key- Returns:
- a valid DatasetKey instance
- Throws:
IllegalArgumentException- for invalid external or registered dataset keys
-
getRegistryKey
A registered UUID of either a dataset or the network of origin in the case of external datasets.- Returns:
- the registered network or dataset key
-
getDatasetId
- Returns:
- the local identifier of an external dataset key or null if its a registered dataset
-
isExternalKey
-
toDatasetKey
Generates the serialized dataset key as used in theDatasetclass.- Returns:
- the serialized dataset key
-