Package nl.knaw.dans.lib.dataverse
Class DataverseApi
java.lang.Object
nl.knaw.dans.lib.dataverse.DataverseApi
API end-points that operate on a dataverse collection.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected final nl.knaw.dans.lib.dataverse.HttpClientWrapper
protected static final String
-
Method Summary
Modifier and TypeMethodDescriptionassignDefaultRoleOnDataset
(String roleName) assignRole
(RoleAssignment roleAssignment) protected Path
createDataset
(String dataset) createDataset
(String dataset, Map<String, String> metadataKeys) createDataset
(Dataset dataset) createDataset
(Dataset dataset, Map<String, String> metadataKeys) createRole
(String role) createRole
(Role role) defineMetadataBlocks
(List<String> metadataBlocks) delete()
deleteRoleAssignment
(int roleAssignmentId) getQueryParamsFromMetadataKeys
(Map<String, String> metadataKeys) importDataset
(String dataset, String persistentId, boolean autoPublish) importDataset
(String dataset, String persistentId, boolean autoPublish, Map<String, String> metadataKeys) importDataset
(Dataset dataset, String persistentId, boolean autoPublish) importDataset
(Dataset dataset, String persistentId, boolean autoPublish, Map<String, String> metadataKeys) publish()
setMetadataBlocksRoot
(boolean isRoot) toString()
view()
-
Field Details
-
MDKEY_PARAM_NAME_PREFIX
- See Also:
-
httpClientWrapper
protected final nl.knaw.dans.lib.dataverse.HttpClientWrapper httpClientWrapper
-
-
Method Details
-
create
public DataverseHttpResponse<Dataverse> create(String dataverse) throws IOException, DataverseException - Parameters:
dataverse
- dataverse to create- Returns:
- description of the dataverse just created
- Throws:
IOException
- when I/O problems occur during the interaction with DataverseDataverseException
- when Dataverse fails to perform the request- See Also:
-
create
public DataverseHttpResponse<Dataverse> create(Dataverse dataverse) throws IOException, DataverseException - Parameters:
dataverse
- dataverse to create- Returns:
- description of the dataverse just created
- Throws:
IOException
- when I/O problems occur during the interaction with DataverseDataverseException
- when Dataverse fails to perform the request- See Also:
-
view
- Returns:
- Information about a dataverse
- Throws:
IOException
- when I/O problems occur during the interaction with DataverseDataverseException
- when Dataverse fails to perform the request- See Also:
-
delete
- Returns:
- a generic response
- Throws:
IOException
- when I/O problems occur during the interaction with DataverseDataverseException
- when Dataverse fails to perform the request- See Also:
-
getContents
public DataverseHttpResponse<List<DataverseItem>> getContents() throws IOException, DataverseException- Returns:
- a list of information items about subverses
- Throws:
IOException
- when I/O problems occur during the interaction with DataverseDataverseException
- when Dataverse fails to perform the request- See Also:
-
getStorageSize
- Returns:
- a data message containing information about the storage size
- Throws:
IOException
- when I/O problems occur during the interaction with DataverseDataverseException
- when Dataverse fails to perform the request- See Also:
-
listRoles
- Returns:
- a list of roles
- Throws:
IOException
- when I/O problems occur during the interaction with DataverseDataverseException
- when Dataverse fails to perform the request- See Also:
-
listFacets
- Returns:
- a list of facets
- Throws:
IOException
- when I/O problems occur during the interaction with DataverseDataverseException
- when Dataverse fails to perform the request- See Also:
-
setFacets
public DataverseHttpResponse<DataMessage> setFacets(List<String> facets) throws IOException, DataverseException - Throws:
IOException
DataverseException
-
createRole
public DataverseHttpResponse<DataMessage> createRole(String role) throws IOException, DataverseException - Throws:
IOException
DataverseException
-
createRole
public DataverseHttpResponse<DataMessage> createRole(Role role) throws IOException, DataverseException - Throws:
IOException
DataverseException
-
listRoleAssignments
public DataverseHttpResponse<List<RoleAssignmentReadOnly>> listRoleAssignments() throws IOException, DataverseException- Throws:
IOException
DataverseException
-
assignDefaultRoleOnDataset
public DataverseHttpResponse<DataMessage> assignDefaultRoleOnDataset(String roleName) throws IOException, DataverseException - Throws:
IOException
DataverseException
-
assignRole
public DataverseHttpResponse<DataMessage> assignRole(RoleAssignment roleAssignment) throws IOException, DataverseException - Throws:
IOException
DataverseException
-
deleteRoleAssignment
public DataverseHttpResponse<DataMessage> deleteRoleAssignment(int roleAssignmentId) throws IOException, DataverseException - Parameters:
roleAssignmentId
- Delete the assignment with this id- Returns:
- A data information message
- Throws:
IOException
- when I/O problems occur during the interaction with DataverseDataverseException
- when Dataverse fails to perform the request- See Also:
-
listMetadataBlocks
public DataverseHttpResponse<List<MetadataBlockSummary>> listMetadataBlocks() throws IOException, DataverseException- Returns:
- a list of metadata block summaries
- Throws:
IOException
- when I/O problems occur during the interaction with DataverseDataverseException
- when Dataverse fails to perform the request- See Also:
-
defineMetadataBlocks
public DataverseHttpResponse<DataMessage> defineMetadataBlocks(List<String> metadataBlocks) throws IOException, DataverseException - Throws:
IOException
DataverseException
-
isMetadataBlocksRoot
- Returns:
true
if this dataverse is a metadata blocks root,false
otherwise- Throws:
IOException
- when I/O problems occur during the interaction with DataverseDataverseException
- when Dataverse fails to perform the request- See Also:
-
setMetadataBlocksRoot
public DataverseHttpResponse<DataMessage> setMetadataBlocksRoot(boolean isRoot) throws IOException, DataverseException - Parameters:
isRoot
- whether to make this dataverse collection a metadata blocks root- Returns:
- a data message
- Throws:
IOException
- when I/O problems occur during the interaction with DataverseDataverseException
- when Dataverse fails to perform the request- See Also:
-
createDataset
public DataverseHttpResponse<DatasetCreationResult> createDataset(String dataset) throws IOException, DataverseException - Parameters:
dataset
- JSON string defining the dataset to create- Returns:
- a creation result message
- Throws:
IOException
- when I/O problems occur during the interaction with DataverseDataverseException
- when Dataverse fails to perform the request- See Also:
-
createDataset
public DataverseHttpResponse<DatasetCreationResult> createDataset(String dataset, Map<String, String> metadataKeys) throws IOException, DataverseException- Parameters:
dataset
- JSON string defining the dataset to createmetadataKeys
- the HashMap maps the names of the metadata blocks to their 'secret' key values- Returns:
- a creation result message
- Throws:
IOException
- when I/O problems occur during the interaction with DataverseDataverseException
- when Dataverse fails to perform the request- See Also:
-
createDataset
public DataverseHttpResponse<DatasetCreationResult> createDataset(Dataset dataset) throws IOException, DataverseException - Parameters:
dataset
- the dataset to create- Returns:
- a creation result message
- Throws:
IOException
- when I/O problems occur during the interaction with DataverseDataverseException
- when Dataverse fails to perform the request- See Also:
-
createDataset
public DataverseHttpResponse<DatasetCreationResult> createDataset(Dataset dataset, Map<String, String> metadataKeys) throws IOException, DataverseException- Parameters:
dataset
- the dataset to createmetadataKeys
- maps the names of the metadata blocks to their 'secret' key values- Returns:
- a creation result message
- Throws:
IOException
- when I/O problems occur during the interaction with DataverseDataverseException
- when Dataverse fails to perform the request- See Also:
-
importDataset
public DataverseHttpResponse<DatasetCreationResult> importDataset(Dataset dataset, String persistentId, boolean autoPublish) throws IOException, DataverseException - Parameters:
dataset
- the dataset to importpersistentId
- existing persistent identifier (PID)autoPublish
- immediately publish the dataset- Returns:
- an import result message
- Throws:
IOException
- when I/O problems occur during the interaction with DataverseDataverseException
- when Dataverse fails to perform the request- See Also:
-
importDataset
public DataverseHttpResponse<DatasetCreationResult> importDataset(Dataset dataset, String persistentId, boolean autoPublish, Map<String, String> metadataKeys) throws IOException, DataverseException- Parameters:
dataset
- the dataset to importpersistentId
- existing persistent identifier (PID)autoPublish
- immediately publish the datasetmetadataKeys
- maps the names of the metadata blocks to their 'secret' key values- Returns:
- an import result message
- Throws:
IOException
- when I/O problems occur during the interaction with DataverseDataverseException
- when Dataverse fails to perform the request- See Also:
-
importDataset
public DataverseHttpResponse<DatasetCreationResult> importDataset(String dataset, String persistentId, boolean autoPublish) throws IOException, DataverseException - Parameters:
dataset
- JSON string defining the dataset to importpersistentId
- existing persistent identifier (PID)autoPublish
- immediately publish the dataset- Returns:
- an import result message
- Throws:
IOException
- when I/O problems occur during the interaction with DataverseDataverseException
- when Dataverse fails to perform the request- See Also:
-
importDataset
public DataverseHttpResponse<DatasetCreationResult> importDataset(String dataset, String persistentId, boolean autoPublish, Map<String, String> metadataKeys) throws IOException, DataverseException- Parameters:
dataset
- JSON string defining the dataset to importpersistentId
- existing persistent identifier (PID)autoPublish
- immediately publish the datasetmetadataKeys
- maps the names of the metadata blocks to their 'secret' key values- Returns:
- an import result message
- Throws:
IOException
- when I/O problems occur during the interaction with DataverseDataverseException
- when Dataverse fails to perform the request- See Also:
-
importDatasetFromDdi
public DataverseHttpResponse<DatasetCreationResult> importDatasetFromDdi() throws IOException, DataverseException- Throws:
IOException
DataverseException
-
publish
- Returns:
- a data message
- Throws:
IOException
- when I/O problems occur during the interaction with DataverseDataverseException
- when Dataverse fails to perform the request- See Also:
-
getGuestBookResponses
public DataverseHttpResponse<DataMessage> getGuestBookResponses() throws IOException, DataverseException- Throws:
IOException
DataverseException
-
toString
-
buildPath
-
getQueryParamsFromMetadataKeys
-