categories are no longer published within the item. Ehcache configuration fixed

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/catalogue-ws@147135 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2017-04-26 07:57:15 +00:00
parent 70a9e2d026
commit 9dabe607e2
3 changed files with 24 additions and 26 deletions

View File

@ -404,7 +404,6 @@ public class CatalogueUtils {
else{
extrasArrayUpdated = new JSONArray();
List<MetadataCategory> categories = profile.getMetadataCategories();
List<String> categoriesIds = new ArrayList<String>(categories.size());
if(categories == null)
@ -413,14 +412,15 @@ public class CatalogueUtils {
for (MetadataCategory metadataCategory : categories) {
categoriesIds.add(metadataCategory.getId()); // save them later for matching with custom fields
JSONObject catJsonObj = new JSONObject();
JSONObject value = new JSONObject();
value.put("id", metadataCategory.getId());
value.put("title", metadataCategory.getTitle());
value.put("description", metadataCategory.getDescription());
catJsonObj.put("key", metadataCategory.getCategoryQName());
catJsonObj.put("value", value.toString());
extrasArrayUpdated.add(catJsonObj);
// there is no longer need to submit the categories' JSON information
// JSONObject catJsonObj = new JSONObject();
// JSONObject value = new JSONObject();
// value.put("id", metadataCategory.getId());
// value.put("title", metadataCategory.getTitle());
// value.put("description", metadataCategory.getDescription());
// catJsonObj.put("key", metadataCategory.getCategoryQName());
// catJsonObj.put("value", value.toString());
// extrasArrayUpdated.add(catJsonObj);
}
}
@ -1024,8 +1024,8 @@ public class CatalogueUtils {
File file = upload.getValueAs(File.class);
long fileLenghtBytes = file.length();
long fileLenghtMegaByte = fileLenghtBytes >> 20;
logger.trace("File lenght in MegaByte is " + fileLenghtMegaByte);
logger.trace("File lenght in MegaByte is " + fileLenghtMegaByte);
if(fileLenghtMegaByte > MAX_UPLOADABLE_FILE_SIZE_MB)
throw new Exception("Exceeding maximum uploadable file size!");
@ -1034,19 +1034,17 @@ public class CatalogueUtils {
Client client = ClientBuilder.newClient();
client.register(MultiPartFeature.class);
WebTarget webResource = client.target(requestPath);
String jsonRes =
JSONObject jsonRes =
webResource
.request(MediaType.APPLICATION_JSON)
.header(Constants.AUTH_CKAN_HEADER, authorization)
.post(Entity.entity(multiPart, multiPart.getMediaType()), String.class);
.post(Entity.entity(multiPart, multiPart.getMediaType()), JSONObject.class);
logger.trace("Result from CKAN is " + jsonRes);
// substitute "help" field
JSONParser parser = new JSONParser();
JSONObject obj = (JSONObject) parser.parse(jsonRes);
obj.put(HELP_KEY, HELP_URL_GCUBE_CATALOGUE);
return obj.toJSONString();
jsonRes.put(HELP_KEY, HELP_URL_GCUBE_CATALOGUE);
return jsonRes.toJSONString();
}catch(Exception e){
logger.error("Failed to serve the request", e);

View File

@ -3,18 +3,18 @@
xsi:noNamespaceSchemaLocation="ehcache.xsd" updateCheck="true"
monitoring="autodetect" dynamicConfig="true">
<cache name="profile_readers" maxEntriesLocalHeap="100" eternal="false"
<cache name="profile_readers" maxEntriesLocalHeap="10"
maxEntriesLocalDisk="100" diskSpoolBufferSizeMB="20" eternal="false"
timeToIdleSeconds="3600" timeToLiveSeconds="3600"
memoryStoreEvictionPolicy="LFU" transactionalMode="off"
overflowToDisk="false" overflowToOffHeap="false">
<persistence strategy="none" />
memoryStoreEvictionPolicy="LFU" transactionalMode="off">
<persistence strategy="localTempSwap" />
</cache>
<cache name="profile_users" maxEntriesLocalHeap="1000" eternal="false"
<cache name="profile_users" maxEntriesLocalHeap="1000"
maxEntriesLocalDisk="1000" diskSpoolBufferSizeMB="20" eternal="false"
timeToIdleSeconds="3600" timeToLiveSeconds="3600"
memoryStoreEvictionPolicy="LFU" transactionalMode="off"
overflowToDisk="true" overflowToOffHeap="true">
<persistence strategy="none" />
memoryStoreEvictionPolicy="LFU" transactionalMode="off">
<persistence strategy="localTempSwap" />
</cache>
</ehcache>

View File

@ -14,7 +14,7 @@
</init-param>
<init-param>
<param-name>jersey.config.server.provider.classnames</param-name>
<param-value>org.glassfish.jersey.media.multipart.MultiPartFeature,org.glassfish.jersey.media.multipart.MultiPartResource</param-value>
<param-value>org.glassfish.jersey.media.multipart.MultiPartFeature</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>