public class MetadataService extends AbstractService
AbstractService.OutputStreamResponseExtractormapper, noopRequestCallback, restTemplate, WAIT_BEFORE_RETRY_IN_MILLIS| Constructor and Description |
|---|
MetadataService(org.springframework.web.client.RestTemplate restTemplate) |
| Modifier and Type | Method and Description |
|---|---|
<T extends Obj> |
createObj(Project project,
T obj)
Create metadata object in given project
|
<T extends Queryable> |
find(Project project,
java.lang.Class<T> cls,
Restriction... restrictions)
Find metadata by restrictions like identifier, title or summary.
|
<T extends Queryable> |
findUris(Project project,
java.lang.Class<T> cls,
Restriction... restrictions)
Find metadata URIs by restrictions like identifier, title or summary.
|
java.util.Collection<java.lang.String> |
findUris(Project project,
Restriction... restrictions)
Find metadata URIs by restrictions.
|
java.util.List<AttributeElement> |
getAttributeElements(Attribute attribute)
Fetches attribute elements for given attribute using default display form.
|
java.util.List<AttributeElement> |
getAttributeElements(DisplayForm displayForm)
Fetches attribute elements by given display form.
|
<T extends Queryable> |
getObj(Project project,
java.lang.Class<T> cls,
Restriction... restrictions)
Get metadata object by restrictions like identifier, title or summary.
|
<T extends Obj> |
getObjById(Project project,
java.lang.String id,
java.lang.Class<T> cls)
Get metadata object by id.
|
<T extends Obj> |
getObjByUri(java.lang.String uri,
java.lang.Class<T> cls)
Get metadata object by URI (format is
/gdc/md/{PROJECT_ID}/obj/{OBJECT_ID}) |
<T extends Queryable> |
getObjUri(Project project,
java.lang.Class<T> cls,
Restriction... restrictions)
Get metadata object URI by restrictions like identifier, title or summary.
|
java.util.Map<java.lang.String,java.lang.String> |
identifiersToUris(Project project,
java.util.Collection<java.lang.String> identifiers)
Find metadata URIs for given identifiers.
|
void |
removeObj(Obj obj)
Remove metadata object URI
|
void |
removeObjByUri(java.lang.String uri)
Remove metadata object by URI (format is
/gdc/md/{PROJECT_ID}/obj/{OBJECT_ID}) |
<T extends Updatable> |
updateObj(T obj)
Update given metadata object.
|
java.util.Collection<Usage> |
usedBy(Project project,
java.util.Collection<java.lang.String> uris,
boolean nearest,
java.lang.Class<? extends Obj>... types)
Find all objects which use the given objects.
|
java.util.Collection<Entry> |
usedBy(Project project,
Obj obj,
boolean nearest,
java.lang.Class<? extends Obj>... types)
Find all objects which use the given object.
|
java.util.Collection<Entry> |
usedBy(Project project,
java.lang.String uri,
boolean nearest,
java.lang.Class<? extends Obj>... types)
Find all objects which use the given object.
|
extractDatapublic MetadataService(org.springframework.web.client.RestTemplate restTemplate)
public <T extends Obj> T createObj(Project project, T obj)
T - type of the object to be createdproject - projectobj - metadata object to be createdObjCreateException - if creation failedObjNotFoundException - if new metadata object not found after creationGoodDataRestException - if GoodData REST API returns unexpected status code when getting
the new objectGoodDataException - if no response from API or client-side HTTP error when getting the new objectpublic <T extends Obj> T getObjByUri(java.lang.String uri, java.lang.Class<T> cls)
/gdc/md/{PROJECT_ID}/obj/{OBJECT_ID})T - type of the object to be returneduri - URI in format /gdc/md/{PROJECT_ID}/obj/{OBJECT_ID}cls - class of the resulting objectObjNotFoundException - if metadata object not foundGoodDataRestException - if GoodData REST API returns unexpected status codeGoodDataException - if no response from API or client-side HTTP errorpublic <T extends Updatable> T updateObj(T obj)
T - type of the updated objectobj - object to updateObjUpdateException - in case of errorpublic void removeObj(Obj obj)
obj - metadata object to removeObjNotFoundException - if metadata object not foundGoodDataRestException - if GoodData REST API returns unexpected status codeGoodDataException - if no response from API or client-side HTTP errorpublic void removeObjByUri(java.lang.String uri)
/gdc/md/{PROJECT_ID}/obj/{OBJECT_ID})uri - URI in format /gdc/md/{PROJECT_ID}/obj/{OBJECT_ID}ObjNotFoundException - if metadata object not foundGoodDataRestException - if GoodData REST API returns unexpected status codeGoodDataException - if no response from API or client-side HTTP errorpublic <T extends Obj> T getObjById(Project project, java.lang.String id, java.lang.Class<T> cls)
T - type of the object to be returnedproject - project where to search for the objectid - id of the objectcls - class of the resulting objectObjNotFoundException - if metadata object not foundGoodDataRestException - if GoodData REST API returns unexpected status codeGoodDataException - if no response from API or client-side HTTP errorpublic <T extends Queryable> java.lang.String getObjUri(Project project, java.lang.Class<T> cls, Restriction... restrictions)
T - type of the object to be returnedproject - project where to search for the objectcls - class of the resulting objectrestrictions - query restrictionsObjNotFoundException - if metadata object not foundNonUniqueObjException - if more than one object corresponds to search restrictionspublic <T extends Queryable> T getObj(Project project, java.lang.Class<T> cls, Restriction... restrictions)
T - type of the object to be returnedproject - project where to search for the objectcls - class of the resulting objectrestrictions - query restrictionsObjNotFoundException - if metadata object not foundNonUniqueObjException - if more than one object corresponds to search restrictionspublic <T extends Queryable> java.util.Collection<Entry> find(Project project, java.lang.Class<T> cls, Restriction... restrictions)
T - type of the metadata referenced in returned entriesproject - project where to search for the metadatacls - class of searched metadatarestrictions - query restrictionsGoodDataException - if unable to query metadatapublic <T extends Queryable> java.util.Collection<java.lang.String> findUris(Project project, java.lang.Class<T> cls, Restriction... restrictions)
T - type of the metadata referenced by returned URIsproject - project where to search for the metadatacls - class of searched metadatarestrictions - query restrictionsGoodDataException - if unable to query metadatapublic java.util.Collection<Entry> usedBy(Project project, Obj obj, boolean nearest, java.lang.Class<? extends Obj>... types)
project - projectobj - object to find using objects fornearest - find nearest objects onlytypes - what types (categories) to search for (for example 'reportDefinition', 'report', 'tableDataLoad',
'table'...)public java.util.Collection<Entry> usedBy(Project project, java.lang.String uri, boolean nearest, java.lang.Class<? extends Obj>... types)
project - projecturi - URI of object to find using objects fornearest - find nearest objects onlytypes - what types (categories) to search for (for example 'reportDefinition', 'report', 'tableDataLoad',
'table'...)usedBy(Project, Collection, boolean, Class[])public java.util.Collection<Usage> usedBy(Project project, java.util.Collection<java.lang.String> uris, boolean nearest, java.lang.Class<? extends Obj>... types)
usedBy(Project, String, boolean, Class[])project - projecturis - URIs of object to find using objects fornearest - find nearest objects onlytypes - what types (categories) to search for (for example 'reportDefinition', 'report', 'tableDataLoad',
'table'...), returns all objects if no type is providedusedBy(Project, String, boolean, Class[])public java.util.Collection<java.lang.String> findUris(Project project, Restriction... restrictions)
project - project where to search for the metadatarestrictions - query restrictionsGoodDataException - if unable to query metadatapublic java.util.Map<java.lang.String,java.lang.String> identifiersToUris(Project project, java.util.Collection<java.lang.String> identifiers)
project - project where to search for the metadataidentifiers - query restrictionsGoodDataException - if unable to query metadatafindUris(Project, Restriction...)public java.util.List<AttributeElement> getAttributeElements(Attribute attribute)
attribute - attribute to fetch elements forpublic java.util.List<AttributeElement> getAttributeElements(DisplayForm displayForm)
displayForm - display form to fetch attributes forCopyright © 2016. All Rights Reserved.