opendatatrentino / jackan

Java client to access CKAN repositories
http://opendatatrentino.github.io/jackan
Other
19 stars 13 forks source link

Manage Visibility/Searchable fields in dataset creation #28

Open CostantinoPerciante opened 8 years ago

CostantinoPerciante commented 8 years ago

Hi guys, I'm currently using the Jackan version 0.4.2 and I'm wondering if there is a way of using the Visibility/Searchable fields in order to make (make not) the dataset under creation visible and/or searchable. The extended CKanDataset class you provide, seems to have setPriv() and setOpen() methods, but I do not know if they are the ones I was looking for.

However I tried to use them, but they seem to have no effect. When creating a dataset using the CKanDataset (which extends CkanDatasetBase), the call reaches this point

` public synchronized CkanDataset createDataset(CkanDatasetBase dataset) { checkNotNull(dataset, "Need a valid dataset!");

    checkToken("Tried to create dataset" + dataset.getName());

    String json = null;
    try {

        json = getObjectMapperForPosting(CkanDatasetBase.class).writeValueAsString(dataset);
    } catch (IOException e) {
        throw new CkanException(COULDNT_JSONIZE + dataset.getClass()
                                                         .getSimpleName(),
                this, e);
    }

    DatasetResponse response = postHttp(DatasetResponse.class, "/api/3/action/package_create", json,
            ContentType.APPLICATION_JSON);

    return response.result;
}`

Is getObjectMapperForPosting(CkanDatasetBase.class) method invocation right? Or we need to differenciate between CkanDatasetBase and CkanDataset?

Thanks :)