Skip to content
Snippets Groups Projects
Commit 81f40b85 authored by Jesper Zedlitz's avatar Jesper Zedlitz
Browse files

bulk_update_private und bulk_update_public

parent a3a863a3
No related branches found
No related tags found
No related merge requests found
Pipeline #203 passed
......@@ -16,3 +16,4 @@ build:
artifacts:
paths:
- target/*.jar
......@@ -6,7 +6,7 @@
<groupId>de.landsh.opendata</groupId>
<artifactId>dcat-uploader</artifactId>
<version>1.0.4</version>
<version>1.1.0</version>
<build>
<plugins>
......@@ -33,61 +33,61 @@
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.12</version>
<version>4.5.13</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.5.7</version>
<version>4.5.13</version>
</dependency>
<dependency>
<groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>2.1.1</version>
<version>2.1.3</version>
</dependency>
<dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
<version>1.1.6</version>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.2.3</version>
<version>1.2.7</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.3</version>
<version>1.2.7</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.28</version>
<version>1.7.32</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.6</version>
<version>3.12.0</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20190722</version>
<version>20210307</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.10</version>
<version>1.18.22</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
......
......@@ -433,4 +433,35 @@ public class CkanAPI {
return responseJSON.getBoolean("success");
}
public boolean makePackagePrivate(String packageId) throws IOException {
final String organization = getOrganization(packageId);
final JSONObject json = new JSONObject();
json.put("datasets", packageId);
json.put("org_id", organization);
final HttpPost httpPost = new HttpPost(baseURL + "/api/action/bulk_update_private");
httpPost.addHeader("Authorization", apiKey.toString());
httpPost.addHeader("Content-Type", "application/json");
httpPost.setEntity(new StringEntity(json.toString(), StandardCharsets.UTF_8));
final JSONObject responseJSON = restClient.executeHttpRequest(httpPost);
return responseJSON.getBoolean("success");
}
public boolean makePackagePublic(String packageId) throws IOException {
final String organization = getOrganization(packageId);
final JSONObject json = new JSONObject();
json.put("datasets", packageId);
json.put("org_id", organization);
final HttpPost httpPost = new HttpPost(baseURL + "/api/action/bulk_update_public");
httpPost.addHeader("Authorization", apiKey.toString());
httpPost.addHeader("Content-Type", "application/json");
httpPost.setEntity(new StringEntity(json.toString(), StandardCharsets.UTF_8));
final JSONObject responseJSON = restClient.executeHttpRequest(httpPost);
return responseJSON.getBoolean("success");
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment