public class CheckedCkanClient extends CkanClient
Note: For create
operations, this client fails if item is already
existing on the server. This behaviour is different from ckan default
upsert
behaviour (update an existing) to prevent misuse.
CkanClient.Builder, CkanClient.GroupForDatasetPosting
CKAN_NO_MILLISECS_PATTERN, CKAN_TIMESTAMP_PATTERN, DEFAULT_TIMEOUT, NONE, SUPPORTED_API_VERSIONS
Modifier | Constructor and Description |
---|---|
protected |
CheckedCkanClient() |
protected |
CheckedCkanClient(String url) |
|
CheckedCkanClient(String catalogUrl,
String ckanToken) |
Modifier and Type | Method and Description |
---|---|
static CkanClient.Builder |
builder()
Returns a builder instance.
|
CkanDataset |
createDataset(CkanDatasetBase dataset)
Creates CkanDataset on the server.
|
CkanGroup |
createGroup(CkanGroup group)
Creates CkanGroup on the server.
|
CkanOrganization |
createOrganization(CkanOrganization org)
Creates CkanOrganization on the server.
|
CkanResource |
createResource(CkanResourceBase resource)
Creates ckan resource on the server.
|
CkanDataset |
patchUpdateDataset(CkanDatasetBase dataset)
Jackan specific.
|
CkanResource |
patchUpdateResource(CkanResourceBase resource)
Jackan specific.
|
CkanDataset |
updateDataset(CkanDatasetBase dataset)
Updates a dataset on the ckan server using a straight
package_update call. |
CkanResource |
updateResource(CkanResourceBase resource)
Updates a resource on the server using a straight
resource_update
call. |
configureObjectMapper, configureObjectMapperForPosting, configureRequest, createTag, createUser, createVocabulary, deleteDataset, deleteResource, extrasMapToList, formatTimestamp, getApiVersion, getCatalogUrl, getCkanToken, getDataset, getDatasetList, getDatasetList, getFormats, getGroup, getGroupList, getGroupNames, getLicenseList, getObjectMapper, getObjectMapperForPosting, getOrganization, getOrganizationList, getOrganizationNames, getProxy, getResource, getTagList, getTagNamesList, getTagNamesList, getTimeout, getUser, getUserList, makeDatasetUrl, makeGroupUrl, makeOrganizationUrl, makeResourceUrl, newBuilder, parseTimestamp, searchDatasets, searchDatasets, throwCkanException, toString
protected CheckedCkanClient()
protected CheckedCkanClient(String url)
public static CkanClient.Builder builder()
public CkanOrganization createOrganization(CkanOrganization org)
NOTE: In CheckedCkanClient create
operations fail if item already
exists. This is different from Ckan default behaviour, which updates
items if they already exist.
createOrganization
in class CkanClient
org
- requires at least the name or id. Only non-null fields of
CkanGroupOrgBase
will be sent to server.public CkanResource createResource(CkanResourceBase resource)
NOTE: In CheckedCkanClient create
operations fail if item already
exists. This is different from Ckan default behaviour, which updates
items if they already exist.
createResource
in class CkanClient
resource
- ckan resource object with the minimal set of parameters
required. See
CkanResource.CkanResource(String, String)
public CkanResource updateResource(CkanResourceBase resource)
CkanClient
resource_update
call. Null fields will not be sent and thus won't get updated, but be
careful about custom fields of CkanResourceBase.getOthers()
, if
not sent they will be erased on the server! To prevent this behaviour,
see CkanClient.patchUpdateResource(CkanResourceBase)
updateResource
in class CkanClient
public CkanResource patchUpdateResource(CkanResourceBase resource)
CkanClient
resource_update
call. Todo: this is a temporary solution until we
implement new patch
api of CKAN 2.3patchUpdateResource
in class CkanClient
resource
- ckan resource object. Fields set to null
won't be
updated on the server. Items present in lists such as
others
will be added to
existing ones on the server. To support this behaviour
provided resource
might be patched with latest
metadata from the server prior sending it for update.CkanClient.updateResource(CkanResourceBase)
public CkanGroup createGroup(CkanGroup group)
NOTE: In CheckedCkanClient create
operations fail if item already
exists. This is different from Ckan default behaviour, which updates
items if they already exist.
createGroup
in class CkanClient
group
- requires at least the name or id. Only non-null fields of
CkanGroupOrgBase
will be sent to server.public CkanDataset createDataset(CkanDatasetBase dataset)
NOTE: In CheckedCkanClient create
operations fail if item already
exists. This is different from Ckan default behaviour, which updates
items if they already exist.
createDataset
in class CkanClient
dataset
- Ckan dataset without idpublic CkanDataset updateDataset(CkanDatasetBase dataset)
CkanClient
package_update
call. Null fields will not be sent and thus won't
get updated, but be careful about list fields, if not sent they will be
erased on the server! To prevent this behaviour, see
CkanClient.patchUpdateDataset(CkanDatasetBase)
updateDataset
in class CkanClient
public CkanDataset patchUpdateDataset(CkanDatasetBase dataset)
CkanClient
package_update
call. Todo: this is a temporary solution until we
implement new patch
api of CKAN 2.3patchUpdateDataset
in class CkanClient
dataset
- ckan dataset object. Fields set to null
won't be
updated on the server. Items present in lists such as
resources
or extras
will be added to existing
ones on the server. To support this behaviour provided
dataset
might be patched with latest metadata from the
server prior sending it for update.Copyright © 2015 Trento Rise. All rights reserved.