added break lines for descriptions

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/grsf-publisher-ws@157577 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2017-10-25 15:13:58 +00:00
parent bcd53322e5
commit 525341b878
4 changed files with 27 additions and 30 deletions

View File

@ -3,9 +3,6 @@
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<dependent-module archiveName="ckan-util-library-2.4.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/ckan-util-library/ckan-util-library">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="context-root" value="grsf-publisher-ws"/>
<property name="java-output-path" value="/grsf-publisher-ws/target/classes"/>
</wb-module>

View File

@ -186,19 +186,20 @@ public class GrsfPublisherFisheryService {
if(id != null){
logger.info("Created record with identifier " + id);
String description = "Short Name: " + record.getShortName();
String description = "Short Name: " + record.getShortName() + "\n";
if(sourceInPath.equals(Sources.GRSF))
description += ", GRSF Semantic Identifier: " + record.getFisheryId();
description += ", GRSF Semantic Identifier: " + record.getFisheryId() + "\n";
CommonServiceUtils.actionsPostCreateOrUpdate(
id, futureName, record, apiKey, username, organization,
null, responseBean, catalogue, namespaces, groups, context, token, futureTitle, authorFullname,
contextServlet, false, description);
status = Status.CREATED;
}else{
throw new Exception("There was an error during the product generation, sorry");
throw new Exception("There was an error during the record generation, sorry");
}
}
}catch(Exception e){

View File

@ -200,10 +200,10 @@ public class GrsfPublisherStockService {
if(id != null){
logger.info("Product created! Id is " + id);
String description = "Short Name: " + record.getShortName();
String description = "Short Name: " + record.getShortName() + "\n";
if(sourceInPath.equals(Sources.GRSF))
description += ", GRSF Semantic Identifier: " + record.getStockId();
description += ", GRSF Semantic Identifier: " + record.getStockId() + "\n";
CommonServiceUtils.actionsPostCreateOrUpdate(
id, futureName, record, apiKey, username, organization, null,

View File

@ -20,7 +20,6 @@ import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.Group;
import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.Tag;
import org.gcube.data_catalogue.grsf_publish_ws.json.input.others.RefersToBean;
import org.gcube.data_catalogue.grsf_publish_ws.json.input.others.Resource;
import org.gcube.data_catalogue.grsf_publish_ws.json.input.others.SimilarRecordBean;
import org.gcube.data_catalogue.grsf_publish_ws.json.input.others.TimeSeriesBean;
import org.gcube.data_catalogue.grsf_publish_ws.json.input.record.Base;
import org.gcube.data_catalogue.grsf_publish_ws.json.input.record.Common;
@ -53,9 +52,9 @@ public class CommonServiceUtils {
private static final int TIME_SERIES_TAKE_LAST_VALUES = 5;
private static final String REGEX_TAGS = "[^\\s\\w-_.]";
public static final String SYSTEM_TYPE = "system:type";
public static final String SYSTEM_TYPE_FOR_SOURCES = "Source";
public static final String GRSF_DATABASE_SOURCE = "Database Source";
private static final String SYSTEM_TYPE_FOR_SOURCES = "Legacy";
private static final String GRSF_DATABASE_SOURCE = "Database Source";
// item url property
public static final String ITEM_URL_FIELD = "GRSF Record URL";
private static final String GRSF_ADMIN_ORGANIZATION_NAME = "grsf_admin";
@ -301,22 +300,22 @@ public class CommonServiceUtils {
String clean = HelperMethods.removeHTML(asList.get(i).toString().trim());
valuesForKey.add(clean);
}
}else if(asList.get(0).getClass().equals(SimilarRecordBean.class)){
for (int i = 0; i < asList.size(); i++) {
SimilarRecordBean similarRecord = (SimilarRecordBean) asList.get(i);
JSONObject obj = new JSONObject();
if(similarRecord.getId() != null)
obj.put("id", Common.cleanSemanticId(similarRecord.getId()));
if(similarRecord.getDescription() != null)
obj.put("description", similarRecord.getDescription());
if(similarRecord.getUrl() != null)
obj.put("url", similarRecord.getUrl() );
valuesForKey.add(obj.toJSONString());
}
}
// }else if(asList.get(0).getClass().equals(SimilarRecordBean.class)){
//
// for (int i = 0; i < asList.size(); i++) {
// SimilarRecordBean similarRecord = (SimilarRecordBean) asList.get(i);
// JSONObject obj = new JSONObject();
// if(similarRecord.getId() != null)
// obj.put("id", Common.cleanSemanticId(similarRecord.getId()));
// if(similarRecord.getDescription() != null)
// obj.put("description", similarRecord.getDescription());
// if(similarRecord.getUrl() != null)
// obj.put("url", similarRecord.getUrl() );
// valuesForKey.add(obj.toJSONString());
// }
//
// }
else
for (int i = 0; i < elementsToConsider; i++) {
String clean = HelperMethods.removeHTML(asList.get(i).toString().trim());
@ -467,12 +466,12 @@ public class CommonServiceUtils {
// set the domain
record.setDomain(productType.getOrigName());
// set system type (it is equal to the GRSF Type for GRSF records, "Source" for source records)
record.setSystemType(sourceInPath.equals(Sources.GRSF) ?
productType.equals(Product_Type.FISHERY) ? ((FisheryRecord)record).getType().getOrigName() : ((StockRecord)record).getType().getOrigName()
: SYSTEM_TYPE_FOR_SOURCES);
: SYSTEM_TYPE_FOR_SOURCES);
}
/**