public class GdcRESTApiWrapper extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
GdcRESTApiWrapper.GdcRole |
static class |
GdcRESTApiWrapper.GdcUser |
static class |
GdcRESTApiWrapper.ProjectExportResult |
static class |
GdcRESTApiWrapper.TaskmanStatus |
| Modifier and Type | Field and Description |
|---|---|
static String |
ATTR_QUERY |
protected org.apache.commons.httpclient.HttpClient |
client |
protected NamePasswordConfiguration |
config |
static String |
DLI_MANIFEST_FILENAME |
static String |
DML_EXEC_URI |
static String |
ETL_MODE_DLI |
static String |
ETL_MODE_URI |
static String |
ETL_MODE_VOID |
static String |
EXECUTOR |
static String |
EXPORT_EXECUTOR |
static String |
INVITATION_URI |
static String |
LINKS_UPLOADS_KEY |
static String |
MAQL_ASYNC_EXEC_URI |
static String |
OBJ_URI |
static String |
PROJECT_EXPORT_URI |
static String |
PROJECT_IMPORT_URI |
static String |
PROJECT_PARTIAL_EXPORT_URI |
static String |
PROJECT_PARTIAL_IMPORT_URI |
static String |
QUERY_DATASETS |
static String |
QUERY_DIMENSIONS |
static String |
QUERY_FOLDERS |
static String |
QUERY_PREFIX |
static String |
QUERY_PROJECTDASHBOARDS |
static String |
REPORT_QUERY |
static String |
ROLES_URI |
static String |
USERS_URI |
| Constructor and Description |
|---|
GdcRESTApiWrapper(NamePasswordConfiguration config)
Constructs the GoodData REST API Java wrapper
|
| Modifier and Type | Method and Description |
|---|---|
void |
addUsersToProject(String projectId,
List<String> uris,
String role)
Create a new user
|
void |
addUsersToProjectWithRoleUri(String projectId,
List<String> uris,
String roleUri) |
double |
computeMetric(String metricUri)
Computes the metric value
|
String |
computeReport(String reportUri)
Computes a simple report and returns the report text
|
net.sf.json.JSONObject |
createMetadataObject(String projectId,
net.sf.json.JSON content)
Creates a new object in the metadata server
|
String |
createProject(String name,
String desc,
String templateUri)
Deprecated.
|
String |
createProject(String name,
String desc,
String templateUri,
String driver,
String accessToken)
Create a new GoodData project
|
String |
createUser(String domain,
GdcRESTApiWrapper.GdcUser user)
Create a new user
|
void |
deleteMetadataObject(String uri)
Deletes an object in the metadata server
|
void |
deleteMetadataObject(String projectId,
int objectId)
Deletes an object in the metadata server
|
void |
disableUsersInProject(String projectId,
List<String> uris)
Disables a user in project
|
void |
dropProject(String projectId)
Drops a GoodData project
|
List<String> |
enumerateAttributes(String projectId)
Enumerates all attributes in the project
|
List<String> |
enumerateDashboards(String projectId) |
List<String> |
enumerateDataSets(String projectId) |
List<String> |
enumerateDimensions(String projectId) |
List<String> |
enumerateFolders(String projectId) |
List<String> |
enumerateReports(String projectId)
Enumerates all reports on in a project
|
protected List<String> |
enumerateResource(String projectId,
String resource) |
String |
executeDML(String projectId,
String maql)
Executes the MAQL and creates/modifies the project's LDM
|
void |
executeMAQLAsync(String projectId,
String maql)
Executes the MAQL and creates/modifies the project's LDM asynchronously
|
protected String |
executeMethodOk(org.apache.commons.httpclient.HttpMethod method) |
protected String |
executeMethodOk(org.apache.commons.httpclient.HttpMethod method,
boolean reloginOn401) |
net.sf.json.JSONObject |
executeReport(String reportUri)
Report to execute.
|
String |
executeReportDefinition(String reportDefUri)
Report definition to execute
|
GdcRESTApiWrapper.ProjectExportResult |
exportMD(String projectId,
List<Integer> ids)
Exports selected MD object with dependencies from the project
|
GdcRESTApiWrapper.ProjectExportResult |
exportMDByUrl(String projectId,
List<String> urls) |
GdcRESTApiWrapper.ProjectExportResult |
exportProject(String projectId,
boolean exportUsers,
boolean exportData,
String[] authorizedUsers)
Exports the project
|
byte[] |
exportReportResult(net.sf.json.JSONObject execResult,
String format)
Export a report result
|
protected void |
finalize() |
net.sf.json.JSONObject |
getAttribute(String attrUri)
Enumerates all attributes in the project
|
List<net.sf.json.JSONObject> |
getAttributeFk(String attrUri)
Gets attribute FK
|
List<net.sf.json.JSONObject> |
getAttributePk(String attrUri)
Gets attribute PK
|
String |
getColumnDbName(net.sf.json.JSONObject column)
Gets column DB name
|
String |
getColumnTableName(net.sf.json.JSONObject column)
Gets column table name
|
String |
getCopyStatus(String link)
Checks if report copying is finished.
|
GdcRESTApiWrapper.TaskmanStatus |
getDetailedTaskManStatus(String link) |
String |
getLoadingStatus(String link)
Checks if the loading is finished
|
protected net.sf.json.JSONObject |
getMDExportStructureStrings(String projectId,
List<String> urls) |
MetadataObject |
getMetadataObject(String objectUri)
Retrieves a metadata object definition
|
MetadataObject |
getMetadataObject(String projectId,
int objectId)
Retrieves a metadata object definition
|
MetadataObject |
getMetadataObject(String projectId,
String identifier)
Retrieves a metadata object definition
|
protected net.sf.json.JSONObject |
getMigrationRequest(List<String> manifests) |
String |
getMigrationStatus(String link)
Checks if the migration is finished
|
NamePasswordConfiguration |
getNamePasswordConfiguration() |
net.sf.json.JSONObject |
getObjectByUri(String objectUri)
Retrieves a metadata object definition by Uri
|
protected net.sf.json.JSONObject |
getProfile()
Profile getter
|
Project |
getProjectById(String id)
Retrieves the project info by the project's ID
|
Project |
getProjectByName(String name)
Deprecated.
|
String |
getProjectDeleteUri(String projectId)
Gets the project delete URI from the project id
|
String |
getProjectEtlMode(String pid)
Determines the projet's ETL mode (SLI/DLI/VOID)
|
protected String |
getProjectId(String uri)
Retrieves the project id from the URI returned by the create project
|
String |
getProjectIdFromUri(String projectUri)
Gets the project ID from the project URI
|
protected String |
getProjectMdUrl(String projectId)
Constructs project's metadata uri
|
ArrayList<GdcRESTApiWrapper.GdcRole> |
getProjectRoles(String pid)
Returns the selected project's roles
|
String |
getProjectStatus(String id)
Returns the project status
|
protected String |
getProjectUrl(String projectId)
Constructs project's projects uri
|
ArrayList<GdcRESTApiWrapper.GdcUser> |
getProjectUsers(String pid,
boolean activeUsersOnly)
Returns the selected project's users
|
String |
getReportDefinition(String reportUri)
Deprecated.
|
byte[] |
getReportResult(String uri)
Retrieves the report export result
|
ArrayList<String> |
getRoleUsers(GdcRESTApiWrapper.GdcRole role,
boolean activeUsersOnly)
Returns the selected project's roles
|
protected String |
getServerUrl() |
static SLI |
getSLIById(String id,
List<SLI> slis,
String projectId)
Finds a project SLI in list of SLI
|
SLI |
getSLIById(String id,
String projectId)
Finds a project SLI by it's id
|
String |
getSLIColumnDataType(String projectId,
String sliColumnIdentifier)
Retrieves the SLI column data type
|
List<Column> |
getSLIColumns(String uri)
Retrieves the SLI columns
|
net.sf.json.JSONObject |
getSLIManifest(String uri)
Retrieves the SLI columns
|
List<SLI> |
getSLIs(String projectId)
Returns a list of project's SLIs
|
String |
getSLIsUri(String projectId)
Returns the data interfaces URI
|
String |
getSLIUri(String sliId,
String projectId)
Returns the SLI URI
|
String |
getTaskManStatus(String link)
Checks if the migration is finished
|
Map<String,GdcRESTApiWrapper.GdcUser> |
getUsers(String domain)
API for querying users in a domain
|
URL |
getWebDavURL() |
Map<String,String> |
identifierToUri(String projectId,
String[] identifiers)
Converst MD identifier to uri
|
String |
importMD(String projectId,
String token,
boolean overwrite,
boolean updateLDM)
Imports a MD object to the project
|
String |
importProject(String projectId,
String token)
Imports the project
|
void |
inviteUser(String projectId,
String eMail,
String message)
Invites a new user to a project
|
void |
inviteUser(String projectId,
String eMail,
String message,
String role)
Invites a new user to a project
|
List<Project> |
listProjects()
Deprecated.
|
void |
login()
GDC login - obtain GDC SSToken
|
void |
logout()
GDC logout - remove active session, if any exists
|
String |
migrateDataSets(String pid,
List<String> manifests)
Migrates project datasets from DLI to SLI
|
net.sf.json.JSONObject |
modifyMetadataObject(String projectId,
int objectId,
net.sf.json.JSON content)
Modifies an object in the metadata server
|
net.sf.json.JSONObject |
modifyMetadataObject(String uri,
net.sf.json.JSON content)
Modifies an object in the metadata server
|
String |
startLoading(String projectId,
String remoteDir)
Kicks the GDC platform to inform it that the FTP transfer is finished.
|
List<net.sf.json.JSONObject> |
usedBy(String uri)
Returns the dependent objects
|
List<net.sf.json.JSONObject> |
using(String uri)
Returns the dependent objects
|
public static final String MAQL_ASYNC_EXEC_URI
public static final String DML_EXEC_URI
public static final String PROJECT_EXPORT_URI
public static final String PROJECT_IMPORT_URI
public static final String PROJECT_PARTIAL_EXPORT_URI
public static final String PROJECT_PARTIAL_IMPORT_URI
public static final String REPORT_QUERY
public static final String ATTR_QUERY
public static final String EXECUTOR
public static final String EXPORT_EXECUTOR
public static final String INVITATION_URI
public static final String ETL_MODE_URI
public static final String OBJ_URI
public static final String ROLES_URI
public static final String USERS_URI
public static final String ETL_MODE_DLI
public static final String ETL_MODE_VOID
public static final String LINKS_UPLOADS_KEY
public static final String DLI_MANIFEST_FILENAME
public static final String QUERY_PROJECTDASHBOARDS
public static final String QUERY_FOLDERS
public static final String QUERY_DATASETS
public static final String QUERY_DIMENSIONS
public static final String QUERY_PREFIX
protected org.apache.commons.httpclient.HttpClient client
protected NamePasswordConfiguration config
public GdcRESTApiWrapper(NamePasswordConfiguration config)
config - NamePasswordConfiguration object with the GDC name and password configurationpublic void login()
throws HttpMethodException
HttpMethodExceptionpublic void logout()
throws HttpMethodException
HttpMethodExceptionpublic Project getProjectById(String id) throws HttpMethodException, GdcProjectAccessException
id - the project idHttpMethodExceptionGdcProjectAccessExceptionpublic URL getWebDavURL()
public List<SLI> getSLIs(String projectId) throws HttpMethodException, GdcProjectAccessException
projectId - project's IDHttpMethodException - if there is a communication errorGdcProjectAccessException - if the SLI doesn't existpublic List<Column> getSLIColumns(String uri) throws GdcProjectAccessException, HttpMethodException
uri - the SLI uriGdcProjectAccessException - if the SLI doesn't existHttpMethodException - if there is a communication issue with the GDC platformpublic String getSLIColumnDataType(String projectId, String sliColumnIdentifier)
projectId - projectIdsliColumnIdentifier - SLI column identifier (name in the SLI manifest)public net.sf.json.JSONObject getSLIManifest(String uri) throws GdcProjectAccessException, HttpMethodException
uri - the SLI uriGdcProjectAccessException - if the SLI doesn't existHttpMethodException - if there is a communication issue with the GDC platformpublic SLI getSLIById(String id, String projectId) throws GdcProjectAccessException, HttpMethodException
id - the SLI idprojectId - the project idGdcProjectAccessException - if the SLI doesn't existHttpMethodException - if there is a communication issue with the GDC platformpublic static SLI getSLIById(String id, List<SLI> slis, String projectId) throws GdcProjectAccessException
id - the SLI idslis - of SLI (related to one project)projectId - the project idGdcProjectAccessException - if the SLI doesn't existpublic List<String> enumerateAttributes(String projectId)
projectId - project Idpublic List<net.sf.json.JSONObject> getAttributePk(String attrUri)
attrUri - attribute URIpublic List<net.sf.json.JSONObject> getAttributeFk(String attrUri)
attrUri - attribute URIpublic String getColumnDbName(net.sf.json.JSONObject column)
column - column objectpublic String getColumnTableName(net.sf.json.JSONObject column)
column - column objectpublic net.sf.json.JSONObject getAttribute(String attrUri)
attrUri - attribute URIpublic List<String> enumerateReports(String projectId)
projectId - project Idpublic double computeMetric(String metricUri)
metricUri - metric URIpublic String computeReport(String reportUri)
reportUri - report URIpublic String executeReportDefinition(String reportDefUri)
reportDefUri - report definition to executepublic net.sf.json.JSONObject executeReport(String reportUri)
reportUri - report definition to executepublic byte[] exportReportResult(net.sf.json.JSONObject execResult,
String format)
execResult - object returned by the executeReport(String) methodformat - export format (pdf | xls | png | csv)public byte[] getReportResult(String uri)
uri - the export resultpublic String startLoading(String projectId, String remoteDir) throws GdcRestApiException
projectId - the project's IDremoteDir - the remote (FTP) directory that contains the dataGdcRestApiExceptionpublic String getLoadingStatus(String link) throws HttpMethodException
link - the link returned from the start loadingHttpMethodExceptionpublic String createProject(String name, String desc, String templateUri, String driver, String accessToken) throws GdcRestApiException
name - project namedesc - project descriptiontemplateUri - project template uridriver - underlying database driveraccessToken - access tokenGdcRestApiExceptionpublic String getProjectStatus(String id)
id - project IDpublic void dropProject(String projectId) throws GdcRestApiException
projectId - project idGdcRestApiExceptionprotected String getProjectId(String uri) throws GdcRestApiException
uri - the create project URIGdcRestApiException - in case the project doesn't existpublic void executeMAQLAsync(String projectId, String maql) throws GdcRestApiException
projectId - the project's IDmaql - String with the MAQL statementsGdcRestApiExceptionpublic GdcRESTApiWrapper.ProjectExportResult exportProject(String projectId, boolean exportUsers, boolean exportData, String[] authorizedUsers) throws GdcRestApiException
projectId - the project's IDexportUsers - flagexportData - flagauthorizedUsers - list of authorized usersGdcRestApiExceptionpublic String createUser(String domain, GdcRESTApiWrapper.GdcUser user) throws GdcRestApiException
domain - the domain where the user is going to be createduser - new user dataGdcRestApiExceptionpublic void addUsersToProject(String projectId, List<String> uris, String role) throws GdcRestApiException
projectId - project IDuris - user URIsrole - user's roleGdcRestApiExceptionpublic void addUsersToProjectWithRoleUri(String projectId, List<String> uris, String roleUri) throws GdcRestApiException
GdcRestApiExceptionpublic void disableUsersInProject(String projectId, List<String> uris) throws GdcRestApiException
projectId - project IDuris - user URIsGdcRestApiExceptionpublic ArrayList<GdcRESTApiWrapper.GdcRole> getProjectRoles(String pid)
pid - project IDpublic ArrayList<String> getRoleUsers(GdcRESTApiWrapper.GdcRole role, boolean activeUsersOnly)
public ArrayList<GdcRESTApiWrapper.GdcUser> getProjectUsers(String pid, boolean activeUsersOnly)
pid - project IDactiveUsersOnly - lists only active userspublic String importProject(String projectId, String token) throws GdcRestApiException
projectId - the project's IDtoken - export tokenGdcRestApiExceptionpublic String importMD(String projectId, String token, boolean overwrite, boolean updateLDM) throws GdcRestApiException
projectId - the project's IDtoken - export tokenoverwrite - overwrite existing objectsupdateLDM - update LDM names, descriptions and tagsGdcRestApiExceptionpublic GdcRESTApiWrapper.ProjectExportResult exportMD(String projectId, List<Integer> ids) throws GdcRestApiException
projectId - the project's IDids - - list of the exported MD objects IDsGdcRestApiExceptionpublic String getMigrationStatus(String link) throws HttpMethodException
link - the link returned from the start loadingHttpMethodExceptionpublic String executeDML(String projectId, String maql) throws GdcRestApiException
projectId - the project's IDmaql - String with the MAQL statementsGdcRestApiExceptionprotected String executeMethodOk(org.apache.commons.httpclient.HttpMethod method) throws HttpMethodException
HttpMethodExceptionprotected String executeMethodOk(org.apache.commons.httpclient.HttpMethod method, boolean reloginOn401) throws HttpMethodException
HttpMethodExceptionpublic String getSLIsUri(String projectId)
projectId - project IDpublic String getSLIUri(String sliId, String projectId)
sliId - SLI IDprojectId - project IDprotected String getServerUrl()
protected String getProjectMdUrl(String projectId)
projectId - project IDprotected String getProjectUrl(String projectId)
projectId - project IDpublic String getProjectIdFromUri(String projectUri)
projectUri - project URIpublic String getProjectDeleteUri(String projectId)
projectId - project IDprotected net.sf.json.JSONObject getProfile()
public void inviteUser(String projectId, String eMail, String message)
projectId - project IDeMail - invited user e-mailmessage - invitation messagepublic void inviteUser(String projectId, String eMail, String message, String role)
projectId - project IDeMail - invited user e-mailmessage - invitation messagepublic Map<String,String> identifierToUri(String projectId, String[] identifiers)
projectId - project IDidentifiers - MD object identifierspublic net.sf.json.JSONObject getObjectByUri(String objectUri)
objectUri - object uripublic MetadataObject getMetadataObject(String objectUri)
objectUri - object uripublic MetadataObject getMetadataObject(String projectId, int objectId)
projectId - project id (hash)objectId - object id (integer)public MetadataObject getMetadataObject(String projectId, String identifier)
projectId - project id (hash)identifier - object identifierpublic List<net.sf.json.JSONObject> using(String uri)
uri - the uri of the top-level objectpublic List<net.sf.json.JSONObject> usedBy(String uri)
uri - the uri of the top-level objectpublic net.sf.json.JSONObject createMetadataObject(String projectId, net.sf.json.JSON content)
projectId - project id (hash)content - the new object contentpublic net.sf.json.JSONObject modifyMetadataObject(String projectId, int objectId, net.sf.json.JSON content)
projectId - project id (hash)objectId - object id (integer)content - the new object contentpublic net.sf.json.JSONObject modifyMetadataObject(String uri, net.sf.json.JSON content)
uri - object uricontent - the new object contentpublic void deleteMetadataObject(String projectId, int objectId)
projectId - project id (hash)objectId - object id (integer)public void deleteMetadataObject(String uri)
uri - object uripublic String getProjectEtlMode(String pid)
pid - project idpublic String getTaskManStatus(String link) throws HttpMethodException
link - the link returned from the start loadingHttpMethodExceptionpublic GdcRESTApiWrapper.TaskmanStatus getDetailedTaskManStatus(String link) throws HttpMethodException
HttpMethodExceptionpublic String migrateDataSets(String pid, List<String> manifests)
pid - project IDmanifests - array of all dataset's manifestsprotected void finalize()
throws Throwable
public Map<String,GdcRESTApiWrapper.GdcUser> getUsers(String domain)
domain - public GdcRESTApiWrapper.ProjectExportResult exportMDByUrl(String projectId, List<String> urls)
protected net.sf.json.JSONObject getMDExportStructureStrings(String projectId, List<String> urls)
public NamePasswordConfiguration getNamePasswordConfiguration()
public String getCopyStatus(String link)
link - the link returned from the start loading@Deprecated public Project getProjectByName(String name) throws HttpMethodException, GdcProjectAccessException
name - the project nameHttpMethodExceptionGdcProjectAccessException@Deprecated public String createProject(String name, String desc, String templateUri) throws GdcRestApiException
name - project namedesc - project descriptiontemplateUri - project template uriGdcRestApiException@Deprecated public List<Project> listProjects() throws HttpMethodException
HttpMethodException@Deprecated public String getReportDefinition(String reportUri)
reportUri - report uri (/gdc/obj...)Copyright © 2014. All rights reserved.