Added method getListExtrasAsHashMap - D4Science model compliant
This commit is contained in:
parent
c4629e78be
commit
3d9080ed81
|
@ -9,6 +9,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
||||||
**Enhancements**
|
**Enhancements**
|
||||||
|
|
||||||
- Added method update item [#26640]
|
- Added method update item [#26640]
|
||||||
|
- Added method getListExtrasAsHashMap - D4Science model compliant
|
||||||
|
|
||||||
## [v1.3.0] - 2023-02-06
|
## [v1.3.0] - 2023-02-06
|
||||||
|
|
||||||
|
|
|
@ -30,17 +30,15 @@ import org.gcube.com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||||
import org.gcube.com.fasterxml.jackson.annotation.JsonIgnore;
|
import org.gcube.com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import org.gcube.com.fasterxml.jackson.annotation.JsonProperty;
|
import org.gcube.com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Ckan Dataset, which in turn holds Ckan Resources.
|
* A Ckan Dataset, which in turn holds Ckan Resources.
|
||||||
*
|
*
|
||||||
* In Ckan terminology it is also known as 'package'.
|
* In Ckan terminology it is also known as 'package'.
|
||||||
*
|
*
|
||||||
* {@link CkanDatasetBase} holds fields that can be sent when
|
* {@link CkanDatasetBase} holds fields that can be sent when <a href=
|
||||||
* <a href="http://docs.ckan.org/en/latest/api/index.html?#ckan.logic.action.create.package_create" target="_blank">creating
|
* "http://docs.ckan.org/en/latest/api/index.html?#ckan.logic.action.create.package_create"
|
||||||
* a dataset,</a>, while {@link CkanDataset} holds more fields that can be
|
* target="_blank">creating a dataset,</a>, while {@link CkanDataset} holds more
|
||||||
* returned with searches.
|
* fields that can be returned with searches.
|
||||||
*
|
*
|
||||||
* This class initializes nothing to fully preserve all we get from ckan. In
|
* This class initializes nothing to fully preserve all we get from ckan. In
|
||||||
* practice, all fields of retrieved resources can be null except maybe
|
* practice, all fields of retrieved resources can be null except maybe
|
||||||
|
@ -51,148 +49,148 @@ import org.gcube.com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
*/
|
*/
|
||||||
public class CkanDatasetBase {
|
public class CkanDatasetBase {
|
||||||
|
|
||||||
private String author;
|
private String author;
|
||||||
private String authorEmail;
|
private String authorEmail;
|
||||||
private List<CkanPair> extras;
|
private List<CkanPair> extras;
|
||||||
private List<CkanGroup> groups;
|
private List<CkanGroup> groups;
|
||||||
private String id;
|
private String id;
|
||||||
private String licenseId;
|
private String licenseId;
|
||||||
private String maintainer;
|
private String maintainer;
|
||||||
private String maintainerEmail;
|
private String maintainerEmail;
|
||||||
private String name;
|
private String name;
|
||||||
private String notes;
|
private String notes;
|
||||||
private String ownerOrg;
|
private String ownerOrg;
|
||||||
private List<CkanDatasetRelationship> relationshipsAsObject;
|
private List<CkanDatasetRelationship> relationshipsAsObject;
|
||||||
private List<CkanDatasetRelationship> relationshipsAsSubject;
|
private List<CkanDatasetRelationship> relationshipsAsSubject;
|
||||||
private List<CkanResource> resources;
|
private List<CkanResource> resources;
|
||||||
private CkanState state;
|
private CkanState state;
|
||||||
private List<CkanTag> tags;
|
private List<CkanTag> tags;
|
||||||
private String title;
|
private String title;
|
||||||
private String type;
|
private String type;
|
||||||
private String url;
|
private String url;
|
||||||
private String version;
|
private String version;
|
||||||
|
|
||||||
private Boolean priv;
|
|
||||||
|
|
||||||
/**
|
private Boolean priv;
|
||||||
* Custom CKAN instances might sometimes gift us with properties that don't
|
|
||||||
* end up in extras. They will end up here.
|
|
||||||
*/
|
|
||||||
@Nullable
|
|
||||||
private Map<String, Object> others;
|
|
||||||
|
|
||||||
public CkanDatasetBase() {
|
/**
|
||||||
}
|
* Custom CKAN instances might sometimes gift us with properties that don't end
|
||||||
|
* up in extras. They will end up here.
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
private Map<String, Object> others;
|
||||||
|
|
||||||
/**
|
public CkanDatasetBase() {
|
||||||
* Constructor with the minimal set of attributes required to successfully
|
}
|
||||||
* create a dataset on the server.
|
|
||||||
*
|
|
||||||
* @param name the dataset name (contains no spaces and has dashes as
|
|
||||||
* separators, i.e. "limestone-pavement-orders")
|
|
||||||
*/
|
|
||||||
public CkanDatasetBase(String name) {
|
|
||||||
this();
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CKAN instances might have
|
* Constructor with the minimal set of attributes required to successfully
|
||||||
* <a href="http://docs.ckan.org/en/latest/extensions/adding-custom-fields.html">
|
* create a dataset on the server.
|
||||||
* custom data schemas</a> that force presence of custom properties among
|
*
|
||||||
* 'regular' ones. In this case, they go to 'others' field. Note that to
|
* @param name the dataset name (contains no spaces and has dashes as
|
||||||
* further complicate things there is also an {@link #getExtras() extras}
|
* separators, i.e. "limestone-pavement-orders")
|
||||||
* field.
|
*/
|
||||||
*
|
public CkanDatasetBase(String name) {
|
||||||
* @see #putOthers(java.lang.String, java.lang.Object)
|
this();
|
||||||
*/
|
this.name = name;
|
||||||
@JsonAnyGetter
|
}
|
||||||
@Nullable
|
|
||||||
public Map<String, Object> getOthers() {
|
|
||||||
return others;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see #getOthers()
|
* CKAN instances might have <a href=
|
||||||
* @see #putOthers(java.lang.String, java.lang.Object)
|
* "http://docs.ckan.org/en/latest/extensions/adding-custom-fields.html"> custom
|
||||||
*/
|
* data schemas</a> that force presence of custom properties among 'regular'
|
||||||
public void setOthers(@Nullable Map<String, Object> others) {
|
* ones. In this case, they go to 'others' field. Note that to further
|
||||||
this.others = others;
|
* complicate things there is also an {@link #getExtras() extras} field.
|
||||||
}
|
*
|
||||||
|
* @see #putOthers(java.lang.String, java.lang.Object)
|
||||||
|
*/
|
||||||
|
@JsonAnyGetter
|
||||||
|
@Nullable
|
||||||
|
public Map<String, Object> getOthers() {
|
||||||
|
return others;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See {@link #getOthers()}
|
* @see #getOthers()
|
||||||
*
|
* @see #putOthers(java.lang.String, java.lang.Object)
|
||||||
* @see #setOthers(java.util.Map)
|
*/
|
||||||
*/
|
public void setOthers(@Nullable Map<String, Object> others) {
|
||||||
@JsonAnySetter
|
this.others = others;
|
||||||
public void putOthers(String name, Object value) {
|
}
|
||||||
if (others == null) {
|
|
||||||
others = new HashMap<>();
|
|
||||||
}
|
|
||||||
others.put(name, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAuthor() {
|
/**
|
||||||
return author;
|
* See {@link #getOthers()}
|
||||||
}
|
*
|
||||||
|
* @see #setOthers(java.util.Map)
|
||||||
|
*/
|
||||||
|
@JsonAnySetter
|
||||||
|
public void putOthers(String name, Object value) {
|
||||||
|
if (others == null) {
|
||||||
|
others = new HashMap<>();
|
||||||
|
}
|
||||||
|
others.put(name, value);
|
||||||
|
}
|
||||||
|
|
||||||
public void setAuthor(String author) {
|
public String getAuthor() {
|
||||||
this.author = author;
|
return author;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAuthorEmail() {
|
public void setAuthor(String author) {
|
||||||
return authorEmail;
|
this.author = author;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAuthorEmail(String authorEmail) {
|
public String getAuthorEmail() {
|
||||||
this.authorEmail = authorEmail;
|
return authorEmail;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public void setAuthorEmail(String authorEmail) {
|
||||||
* Notice that if the dataset was obtained with a
|
this.authorEmail = authorEmail;
|
||||||
* {@link eu.trentorise.opendata.jackan.CkanClient#getDataset(java.lang.String)} call, the returned group
|
}
|
||||||
* won't have all the params you would get with a
|
|
||||||
* {@link eu.trentorise.opendata.jackan.CkanClient#getGroup(java.lang.String)} call.
|
|
||||||
*/
|
|
||||||
public List<CkanGroup> getGroups() {
|
|
||||||
return groups;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGroups(List<CkanGroup> groups) {
|
/**
|
||||||
this.groups = groups;
|
* Notice that if the dataset was obtained with a
|
||||||
}
|
* {@link eu.trentorise.opendata.jackan.CkanClient#getDataset(java.lang.String)}
|
||||||
|
* call, the returned group won't have all the params you would get with a
|
||||||
|
* {@link eu.trentorise.opendata.jackan.CkanClient#getGroup(java.lang.String)}
|
||||||
|
* call.
|
||||||
|
*/
|
||||||
|
public List<CkanGroup> getGroups() {
|
||||||
|
return groups;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
public void setGroups(List<CkanGroup> groups) {
|
||||||
* Adds CkanGroups
|
this.groups = groups;
|
||||||
*
|
}
|
||||||
* @param ckanGroups The CkanGroups elements
|
|
||||||
*
|
|
||||||
* @since 0.4.3
|
|
||||||
*/
|
|
||||||
public void addGroups(CkanGroup... ckanGroups) {
|
|
||||||
if (this.groups == null) {
|
|
||||||
this.groups = new ArrayList<>(ckanGroups.length);
|
|
||||||
}
|
|
||||||
Collections.addAll(this.groups, ckanGroups);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Regular place where to put custom metadata. See also
|
* Adds CkanGroups
|
||||||
* {@link #getOthers()}. Note also extras can be in CkanDataset but not in
|
*
|
||||||
* CkanResource.
|
* @param ckanGroups The CkanGroups elements
|
||||||
*/
|
*
|
||||||
public List<CkanPair> getExtras() {
|
* @since 0.4.3
|
||||||
return extras;
|
*/
|
||||||
}
|
public void addGroups(CkanGroup... ckanGroups) {
|
||||||
|
if (this.groups == null) {
|
||||||
|
this.groups = new ArrayList<>(ckanGroups.length);
|
||||||
|
}
|
||||||
|
Collections.addAll(this.groups, ckanGroups);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See {@link #getExtras()}
|
* Regular place where to put custom metadata. See also {@link #getOthers()}.
|
||||||
*/
|
* Note also extras can be in CkanDataset but not in CkanResource.
|
||||||
public void setExtras(List<CkanPair> extras) {
|
*/
|
||||||
this.extras = extras;
|
public List<CkanPair> getExtras() {
|
||||||
}
|
return extras;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See {@link #getExtras()}
|
||||||
|
*/
|
||||||
|
public void setExtras(List<CkanPair> extras) {
|
||||||
|
this.extras = extras;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Always returns a non-null map (which might be empty)
|
* Always returns a non-null map (which might be empty)
|
||||||
*/
|
*/
|
||||||
|
@ -207,285 +205,306 @@ public class CkanDatasetBase {
|
||||||
return hm;
|
return hm;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds CkanExtras
|
* Always returns a non-null map (which might be empty)
|
||||||
*
|
*
|
||||||
* @param extras The CkanExtra elements
|
* updated by Francesco Mangiacrapa at ISTI-CNR
|
||||||
*
|
*
|
||||||
* @since 0.4.3
|
* The D4Science model accepts extra fields with multiple keys
|
||||||
*/
|
*/
|
||||||
public void addExtras(CkanPair... extras) {
|
@JsonIgnore
|
||||||
if (this.extras == null) {
|
public Map<String, List<String>> getListExtrasAsHashMap() {
|
||||||
this.extras = new ArrayList<>(extras.length);
|
HashMap<String, List<String>> hm = new HashMap<>();
|
||||||
}
|
if (extras != null) {
|
||||||
Collections.addAll(this.extras, extras);
|
for (CkanPair cp : extras) {
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
List<String> list = hm.get(cp.getKey());
|
||||||
* Returns the alphanumerical id, i.e.
|
if (list == null)
|
||||||
* "c4577b8f-5603-4098-917e-da03e8ddf461"
|
list = new ArrayList<String>();
|
||||||
*/
|
|
||||||
public String getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
list.add(cp.getValue());
|
||||||
* Sets the alphanumerical id, i.e. "c4577b8f-5603-4098-917e-da03e8ddf461"
|
hm.put(cp.getKey(), list);
|
||||||
*/
|
}
|
||||||
public void setId(String id) {
|
}
|
||||||
this.id = id;
|
return hm;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The license id (i.e. 'cc-zero')
|
* Adds CkanExtras
|
||||||
*/
|
*
|
||||||
public String getLicenseId() {
|
* @param extras The CkanExtra elements
|
||||||
return licenseId;
|
*
|
||||||
}
|
* @since 0.4.3
|
||||||
|
*/
|
||||||
|
public void addExtras(CkanPair... extras) {
|
||||||
|
if (this.extras == null) {
|
||||||
|
this.extras = new ArrayList<>(extras.length);
|
||||||
|
}
|
||||||
|
Collections.addAll(this.extras, extras);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The license id (i.e. 'cc-zero')
|
* Returns the alphanumerical id, i.e. "c4577b8f-5603-4098-917e-da03e8ddf461"
|
||||||
*/
|
*/
|
||||||
public void setLicenseId(String licenseId) {
|
public String getId() {
|
||||||
this.licenseId = licenseId;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMaintainer() {
|
/**
|
||||||
return maintainer;
|
* Sets the alphanumerical id, i.e. "c4577b8f-5603-4098-917e-da03e8ddf461"
|
||||||
}
|
*/
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
public void setMaintainer(String maintainer) {
|
/**
|
||||||
this.maintainer = maintainer;
|
* The license id (i.e. 'cc-zero')
|
||||||
}
|
*/
|
||||||
|
public String getLicenseId() {
|
||||||
|
return licenseId;
|
||||||
|
}
|
||||||
|
|
||||||
public String getMaintainerEmail() {
|
/**
|
||||||
return maintainerEmail;
|
* The license id (i.e. 'cc-zero')
|
||||||
}
|
*/
|
||||||
|
public void setLicenseId(String licenseId) {
|
||||||
|
this.licenseId = licenseId;
|
||||||
|
}
|
||||||
|
|
||||||
public void setMaintainerEmail(String maintainerEmail) {
|
public String getMaintainer() {
|
||||||
this.maintainerEmail = maintainerEmail;
|
return maintainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public void setMaintainer(String maintainer) {
|
||||||
* The dataset name (contains no spaces and has dashes as separators, i.e.
|
this.maintainer = maintainer;
|
||||||
* "limestone-pavement-orders")
|
}
|
||||||
*/
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public String getMaintainerEmail() {
|
||||||
* The dataset name. Name must not contain spaces and have dashes as
|
return maintainerEmail;
|
||||||
* separators, i.e. "limestone-pavement-orders"
|
}
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public void setMaintainerEmail(String maintainerEmail) {
|
||||||
* A description of the dataset. See also
|
this.maintainerEmail = maintainerEmail;
|
||||||
* {@link CkanDataset#getNotesRendered()} Note CkanResource has instead a
|
}
|
||||||
* field called {@link CkanResourceBase#getDescription() description}.
|
|
||||||
*/
|
|
||||||
public String getNotes() {
|
|
||||||
return notes;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A description of the dataset. See also
|
* The dataset name (contains no spaces and has dashes as separators, i.e.
|
||||||
* {@link CkanDataset#getNotesRendered()} Note CkanResource has instead a
|
* "limestone-pavement-orders")
|
||||||
* field called {@link CkanResourceBase#getDescription() description}.
|
*/
|
||||||
*/
|
public String getName() {
|
||||||
public void setNotes(String notes) {
|
return name;
|
||||||
this.notes = notes;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The owner organization alphanunmerical id, like
|
* The dataset name. Name must not contain spaces and have dashes as separators,
|
||||||
* "b112ed55-01b7-4ca4-8385-f66d6168efcc".
|
* i.e. "limestone-pavement-orders"
|
||||||
*/
|
*
|
||||||
public String getOwnerOrg() {
|
*/
|
||||||
return ownerOrg;
|
public void setName(String name) {
|
||||||
}
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The owner organization alphanunmerical id, like
|
* A description of the dataset. See also {@link CkanDataset#getNotesRendered()}
|
||||||
* "b112ed55-01b7-4ca4-8385-f66d6168efcc".
|
* Note CkanResource has instead a field called
|
||||||
*/
|
* {@link CkanResourceBase#getDescription() description}.
|
||||||
public void setOwnerOrg(String ownerOrg) {
|
*/
|
||||||
this.ownerOrg = ownerOrg;
|
public String getNotes() {
|
||||||
}
|
return notes;
|
||||||
|
}
|
||||||
|
|
||||||
public List<CkanDatasetRelationship> getRelationshipsAsObject() {
|
/**
|
||||||
return relationshipsAsObject;
|
* A description of the dataset. See also {@link CkanDataset#getNotesRendered()}
|
||||||
}
|
* Note CkanResource has instead a field called
|
||||||
|
* {@link CkanResourceBase#getDescription() description}.
|
||||||
|
*/
|
||||||
|
public void setNotes(String notes) {
|
||||||
|
this.notes = notes;
|
||||||
|
}
|
||||||
|
|
||||||
public void setRelationshipsAsObject(List<CkanDatasetRelationship> relationshipsAsObject) {
|
/**
|
||||||
this.relationshipsAsObject = relationshipsAsObject;
|
* The owner organization alphanunmerical id, like
|
||||||
}
|
* "b112ed55-01b7-4ca4-8385-f66d6168efcc".
|
||||||
|
*/
|
||||||
|
public String getOwnerOrg() {
|
||||||
|
return ownerOrg;
|
||||||
|
}
|
||||||
|
|
||||||
public List<CkanDatasetRelationship> getRelationshipsAsSubject() {
|
/**
|
||||||
return relationshipsAsSubject;
|
* The owner organization alphanunmerical id, like
|
||||||
}
|
* "b112ed55-01b7-4ca4-8385-f66d6168efcc".
|
||||||
|
*/
|
||||||
|
public void setOwnerOrg(String ownerOrg) {
|
||||||
|
this.ownerOrg = ownerOrg;
|
||||||
|
}
|
||||||
|
|
||||||
public void setRelationshipsAsSubject(List<CkanDatasetRelationship> relationshipsAsSubject) {
|
public List<CkanDatasetRelationship> getRelationshipsAsObject() {
|
||||||
this.relationshipsAsSubject = relationshipsAsSubject;
|
return relationshipsAsObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<CkanResource> getResources() {
|
public void setRelationshipsAsObject(List<CkanDatasetRelationship> relationshipsAsObject) {
|
||||||
return this.resources;
|
this.relationshipsAsObject = relationshipsAsObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setResources(List<CkanResource> resources) {
|
public List<CkanDatasetRelationship> getRelationshipsAsSubject() {
|
||||||
this.resources = resources;
|
return relationshipsAsSubject;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public void setRelationshipsAsSubject(List<CkanDatasetRelationship> relationshipsAsSubject) {
|
||||||
* Adds CkanResources
|
this.relationshipsAsSubject = relationshipsAsSubject;
|
||||||
*
|
}
|
||||||
* @param resources The CkanResources elements
|
|
||||||
*
|
|
||||||
* @since 0.4.3
|
|
||||||
*/
|
|
||||||
public void addCkanResources(CkanResource... resources) {
|
|
||||||
if (this.resources == null) {
|
|
||||||
this.resources = new ArrayList<>(resources.length);
|
|
||||||
}
|
|
||||||
Collections.addAll(this.resources, resources);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public List<CkanResource> getResources() {
|
||||||
* The current state of the dataset, e.g. 'active' or 'deleted', only active
|
return this.resources;
|
||||||
* datasets show up in search results and other lists of datasets, this
|
}
|
||||||
* parameter will be ignored if you are not authorized to change the state
|
|
||||||
* of the dataset (optional, default: 'active')
|
|
||||||
*/
|
|
||||||
public CkanState getState() {
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public void setResources(List<CkanResource> resources) {
|
||||||
* The current state of the dataset, e.g. 'active' or 'deleted', only active
|
this.resources = resources;
|
||||||
* datasets show up in search results and other lists of datasets, this
|
}
|
||||||
* parameter will be ignored if you are not authorized to change the state
|
|
||||||
* of the dataset (optional, default: 'active')
|
|
||||||
*/
|
|
||||||
public void setState(CkanState state) {
|
|
||||||
this.state = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<CkanTag> getTags() {
|
/**
|
||||||
return tags;
|
* Adds CkanResources
|
||||||
}
|
*
|
||||||
|
* @param resources The CkanResources elements
|
||||||
|
*
|
||||||
|
* @since 0.4.3
|
||||||
|
*/
|
||||||
|
public void addCkanResources(CkanResource... resources) {
|
||||||
|
if (this.resources == null) {
|
||||||
|
this.resources = new ArrayList<>(resources.length);
|
||||||
|
}
|
||||||
|
Collections.addAll(this.resources, resources);
|
||||||
|
}
|
||||||
|
|
||||||
public void setTags(List<CkanTag> tags) {
|
/**
|
||||||
this.tags = tags;
|
* The current state of the dataset, e.g. 'active' or 'deleted', only active
|
||||||
}
|
* datasets show up in search results and other lists of datasets, this
|
||||||
|
* parameter will be ignored if you are not authorized to change the state of
|
||||||
|
* the dataset (optional, default: 'active')
|
||||||
|
*/
|
||||||
|
public CkanState getState() {
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds CkanTag
|
* The current state of the dataset, e.g. 'active' or 'deleted', only active
|
||||||
*
|
* datasets show up in search results and other lists of datasets, this
|
||||||
* @param tags The CkanTags elements
|
* parameter will be ignored if you are not authorized to change the state of
|
||||||
*
|
* the dataset (optional, default: 'active')
|
||||||
* @since 0.4.3
|
*/
|
||||||
*/
|
public void setState(CkanState state) {
|
||||||
public void addTags(CkanTag... tags) {
|
this.state = state;
|
||||||
if (this.tags == null) {
|
}
|
||||||
this.tags = new ArrayList<>(tags.length);
|
|
||||||
}
|
|
||||||
Collections.addAll(this.tags, tags);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public List<CkanTag> getTags() {
|
||||||
* The title, like "Hospitals of Trento"
|
return tags;
|
||||||
*/
|
}
|
||||||
public String getTitle() {
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public void setTags(List<CkanTag> tags) {
|
||||||
* The title, like "Hospitals of Trento"
|
this.tags = tags;
|
||||||
*/
|
}
|
||||||
public void setTitle(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of the dataset (optional), IDatasetForm plugins associate
|
* Adds CkanTag
|
||||||
* themselves with different dataset types and provide custom dataset
|
*
|
||||||
* handling behaviour for these types
|
* @param tags The CkanTags elements
|
||||||
*/
|
*
|
||||||
public String getType() {
|
* @since 0.4.3
|
||||||
return type;
|
*/
|
||||||
}
|
public void addTags(CkanTag... tags) {
|
||||||
|
if (this.tags == null) {
|
||||||
|
this.tags = new ArrayList<>(tags.length);
|
||||||
|
}
|
||||||
|
Collections.addAll(this.tags, tags);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of the dataset (optional), IDatasetForm plugins associate
|
* The title, like "Hospitals of Trento"
|
||||||
* themselves with different dataset types and provide custom dataset
|
*/
|
||||||
* handling behaviour for these types
|
public String getTitle() {
|
||||||
*/
|
return title;
|
||||||
public void setType(String type) {
|
}
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should be the landing page on original data provider website describing
|
* The title, like "Hospitals of Trento"
|
||||||
* the dataset.
|
*/
|
||||||
*/
|
public void setTitle(String title) {
|
||||||
public String getUrl() {
|
this.title = title;
|
||||||
return url;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should be the landing page on original data provider website describing
|
* The type of the dataset (optional), IDatasetForm plugins associate themselves
|
||||||
* the dataset.
|
* with different dataset types and provide custom dataset handling behaviour
|
||||||
*/
|
* for these types
|
||||||
public void setUrl(String url) {
|
*/
|
||||||
this.url = url;
|
public String getType() {
|
||||||
}
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
public String getVersion() {
|
/**
|
||||||
return version;
|
* The type of the dataset (optional), IDatasetForm plugins associate themselves
|
||||||
}
|
* with different dataset types and provide custom dataset handling behaviour
|
||||||
|
* for these types
|
||||||
|
*/
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
public void setVersion(String version) {
|
/**
|
||||||
this.version = version;
|
* Should be the landing page on original data provider website describing the
|
||||||
}
|
* dataset.
|
||||||
|
*/
|
||||||
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the id if non-empty, the name otherwise
|
* Should be the landing page on original data provider website describing the
|
||||||
*/
|
* dataset.
|
||||||
@Nullable
|
*/
|
||||||
public String idOrName() {
|
public void setUrl(String url) {
|
||||||
return isNotEmpty(getId()) ? getId() : getName();
|
this.url = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public String getVersion() {
|
||||||
* Returns the name if non-empty, the id otherwise
|
return version;
|
||||||
*/
|
}
|
||||||
@Nullable
|
|
||||||
public String nameOrId() {
|
|
||||||
|
|
||||||
return isNotEmpty(getName()) ? getName() : getId();
|
public void setVersion(String version) {
|
||||||
}
|
this.version = version;
|
||||||
|
}
|
||||||
/**
|
|
||||||
* Actually it is named "private" in the CKAN API. Appears in dataset
|
|
||||||
* searches.
|
|
||||||
*/
|
|
||||||
@JsonProperty("private")
|
|
||||||
public Boolean isPriv() {
|
|
||||||
return priv;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Actually it is named "private" in the CKAN API. Appears in dataset
|
* Returns the id if non-empty, the name otherwise
|
||||||
* searches.
|
*/
|
||||||
*/
|
@Nullable
|
||||||
public void setPriv(Boolean priv) {
|
public String idOrName() {
|
||||||
this.priv = priv;
|
return isNotEmpty(getId()) ? getId() : getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the name if non-empty, the id otherwise
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public String nameOrId() {
|
||||||
|
|
||||||
|
return isNotEmpty(getName()) ? getName() : getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Actually it is named "private" in the CKAN API. Appears in dataset searches.
|
||||||
|
*/
|
||||||
|
@JsonProperty("private")
|
||||||
|
public Boolean isPriv() {
|
||||||
|
return priv;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Actually it is named "private" in the CKAN API. Appears in dataset searches.
|
||||||
|
*/
|
||||||
|
public void setPriv(Boolean priv) {
|
||||||
|
this.priv = priv;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
@ -537,7 +556,5 @@ public class CkanDatasetBase {
|
||||||
builder.append("]");
|
builder.append("]");
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue