minor fixes
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/ckan-util-library@134859 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
50ca67c356
commit
32a50abe9a
1
pom.xml
1
pom.xml
|
@ -123,6 +123,7 @@
|
|||
<groupId>com.googlecode.json-simple</groupId>
|
||||
<artifactId>json-simple</artifactId>
|
||||
<version>1.1.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
|
|
@ -1695,10 +1695,10 @@ public class DataCatalogueImpl implements DataCatalogue{
|
|||
httpPostRequest.setHeader("Authorization", token);
|
||||
HttpEntity mpEntity =
|
||||
MultipartEntityBuilder.create()
|
||||
.addTextBody("package_id", packageId)
|
||||
.addTextBody("url", "upload")
|
||||
.addTextBody("description", description == null ? "" : description)
|
||||
.addTextBody("name", name)
|
||||
.addTextBody("package_id", packageId, ContentType.TEXT_PLAIN)
|
||||
.addTextBody("url", "upload", ContentType.TEXT_PLAIN)
|
||||
.addTextBody("description", description == null ? "" : description, ContentType.TEXT_PLAIN)
|
||||
.addTextBody("name", name, ContentType.TEXT_PLAIN)
|
||||
.addBinaryBody("upload", file,
|
||||
ContentType.create(
|
||||
"application/octet-stream",
|
||||
|
@ -1714,21 +1714,22 @@ public class DataCatalogueImpl implements DataCatalogue{
|
|||
+ apiRequestUrl + " was: " + response.getStatusLine());
|
||||
}
|
||||
|
||||
logger.info("Returned message is " + response.getStatusLine());
|
||||
|
||||
String json = EntityUtils.toString(response.getEntity());
|
||||
Object obj = JSONValue.parse(json);
|
||||
JSONObject finalResult=(JSONObject)obj;
|
||||
JSONObject result = (JSONObject)finalResult.get("result");
|
||||
logger.debug("Returned json is " + result.get("id"));
|
||||
returnedId = (String) result.get("id");
|
||||
|
||||
return new CheckedCkanClient(CKAN_CATALOGUE_URL, token).getResource(returnedId);
|
||||
} catch (Exception e) {
|
||||
logger.error("Error while uploading file");
|
||||
return null;
|
||||
}
|
||||
|
||||
return new CheckedCkanClient(CKAN_CATALOGUE_URL, token).getResource(returnedId);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public boolean patchResource(String resourceId, String url,
|
||||
String name, String description, String urlType, String apiKey) {
|
||||
|
|
Loading…
Reference in New Issue