product type (i.e., "Fishery" and "Stock") is added as field and tag

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/grsf-publisher-ws@133307 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-10-18 08:42:12 +00:00
parent e4f6b708fa
commit a03399fd53
3 changed files with 12 additions and 1 deletions

View File

@ -45,6 +45,7 @@ import eu.trentorise.opendata.jackan.model.CkanDataset;
public class GrsfPublisherFisheryService {
private static final String DEFAULT_FISHERY_LICENSE = "CC-BY-SA-4.0";
private static final String THIS_TYPE = "Fishery";
// the context
@Context
@ -179,6 +180,7 @@ public class GrsfPublisherFisheryService {
// evaluate the tags of the product
List<String> tags = new ArrayList<String>();
HelperMethods.getTags(tags, record);
tags.add(THIS_TYPE);
// evaluate the groups
List<String> groups = new ArrayList<String>();
@ -193,6 +195,9 @@ public class GrsfPublisherFisheryService {
// automatically retrieve the other ones
HelperMethods.getExtras(customFields, record);
// add the type
customFields.put(HelperMethods.PRODUCT_TYPE, THIS_TYPE);
// retrieve the user's email and fullname
String authorMail = HelperMethods.getUserEmail(context, SecurityTokenProvider.instance.get());
String authorFullname = HelperMethods.getUserFullname(context, SecurityTokenProvider.instance.get());

View File

@ -45,6 +45,7 @@ import eu.trentorise.opendata.jackan.model.CkanDataset;
public class GrsfPublisherStockService {
private static final String DEFAULT_STOCK_LICENSE = "CC-BY-SA-4.0";
private static final String THIS_TYPE = "Stock";
// the context
@Context
@ -171,7 +172,8 @@ public class GrsfPublisherStockService {
// evaluate the tags of the product
List<String> tags = new ArrayList<String>();
HelperMethods.getTags(tags, record);
tags.add(THIS_TYPE);
// evaluate the groups
List<String> groups = new ArrayList<String>();
HelperMethods.getGroups(groups, record);
@ -184,6 +186,9 @@ public class GrsfPublisherStockService {
// automatically retrieve the other ones
HelperMethods.getExtras(customFields, record);
// add the type
customFields.put(HelperMethods.PRODUCT_TYPE, THIS_TYPE);
// retrieve the user's email and fullname
String authorMail = HelperMethods.getUserEmail(context, SecurityTokenProvider.instance.get());

View File

@ -44,6 +44,7 @@ public abstract class HelperMethods {
// to be retrieved from the web.xml
private static final String PENDING_CONTEX_KEY = "PendingContext";
private static final String CONFIRMED_CONTEX_KEY = "ConfirmedContext";
public static final String PRODUCT_TYPE = "Product type";
/**
* Convert a group name to its id on ckan