further changes due to requests in ticket #8719
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/grsf-publisher-ws@149332 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
7363174702
commit
6d76255071
|
@ -19,6 +19,10 @@
|
|||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
|
|
@ -26,6 +26,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||
public class Base {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(Base.class);
|
||||
public static final String UUID_KB_KEY = "UUID Knowledge Base";
|
||||
|
||||
@JsonProperty("description")
|
||||
private String description;
|
||||
|
@ -57,7 +58,7 @@ public class Base {
|
|||
private List<ResourceBean> extrasResources = new ArrayList<ResourceBean>();
|
||||
|
||||
@JsonProperty("uuid_knowledge_base")
|
||||
@CustomField(key="UUID Knowledge Base")
|
||||
@CustomField(key=UUID_KB_KEY)
|
||||
@NotNull(message="uuid_knowledge_base cannot be null")
|
||||
@Size(min=1, message="uuid_knowledge_base cannot be empty")
|
||||
private String uuid;
|
||||
|
|
|
@ -37,6 +37,9 @@ public class CommonServiceUtils {
|
|||
private static final String REGEX_TAGS = "[^\\s\\w-_.]";
|
||||
public static final String SYSTEM_TYPE = "system:type";
|
||||
|
||||
// item url property
|
||||
public static final String ITEM_URL_FIELD = "UUID";
|
||||
|
||||
/**
|
||||
* Retrieve the list of licenses for stocks and fisheries
|
||||
* @return
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.gcube.common.authorization.library.provider.AuthorizationProvider;
|
|||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||
import org.gcube.common.authorization.library.utils.Caller;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.data_catalogue.grsf_publish_ws.json.input.Base;
|
||||
import org.gcube.data_catalogue.grsf_publish_ws.json.input.Common;
|
||||
import org.gcube.data_catalogue.grsf_publish_ws.json.input.DeleteProductBean;
|
||||
import org.gcube.data_catalogue.grsf_publish_ws.json.input.FisheryRecord;
|
||||
|
@ -59,9 +60,6 @@ public class GrsfPublisherFisheryService {
|
|||
// the default license for these records
|
||||
private static final String DEFAULT_FISHERY_LICENSE = "CC-BY-SA-4.0";
|
||||
|
||||
// item url property
|
||||
private static final String ITEM_URL_FIELD = "Item URL";
|
||||
|
||||
// the context
|
||||
@Context ServletContext contextServlet;
|
||||
|
||||
|
@ -272,7 +270,7 @@ public class GrsfPublisherFisheryService {
|
|||
|
||||
// add the "Product URL" to the field
|
||||
Map<String, List<String>> addField = new HashMap<String, List<String>>();
|
||||
addField.put(ITEM_URL_FIELD, Arrays.asList(itemUrl));
|
||||
addField.put(CommonServiceUtils.ITEM_URL_FIELD, Arrays.asList(itemUrl));
|
||||
catalogue.patchProductCustomFields(id, apiKey, addField);
|
||||
|
||||
if(!groups.isEmpty()){
|
||||
|
@ -499,9 +497,17 @@ public class GrsfPublisherFisheryService {
|
|||
|
||||
// retrieve the product url
|
||||
Map<String, String> customFields = dataset.getExtrasAsHashMap();
|
||||
if(customFields.containsKey(ITEM_URL_FIELD))
|
||||
result.put("url", customFields.get(ITEM_URL_FIELD));
|
||||
else
|
||||
|
||||
boolean found = false;
|
||||
Set<String> KeySet = customFields.keySet();
|
||||
for (String key : KeySet) {
|
||||
if(key.contains(CommonServiceUtils.ITEM_URL_FIELD) && !key.contains(Base.UUID_KB_KEY)){
|
||||
result.put("url", customFields.get(key));
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!found)
|
||||
result.put("url", catalogue.getUnencryptedUrlFromDatasetIdOrName(dataset.getId()));
|
||||
|
||||
responseBean.setResult(result);
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.gcube.common.authorization.library.provider.AuthorizationProvider;
|
|||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||
import org.gcube.common.authorization.library.utils.Caller;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.data_catalogue.grsf_publish_ws.json.input.Base;
|
||||
import org.gcube.data_catalogue.grsf_publish_ws.json.input.Common;
|
||||
import org.gcube.data_catalogue.grsf_publish_ws.json.input.DeleteProductBean;
|
||||
import org.gcube.data_catalogue.grsf_publish_ws.json.input.RefersToBean;
|
||||
|
@ -64,9 +65,6 @@ public class GrsfPublisherStockService {
|
|||
// Logger
|
||||
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(GrsfPublisherStockService.class);
|
||||
|
||||
// item url property
|
||||
private static final String ITEM_URL_FIELD = "Item URL";
|
||||
|
||||
@GET
|
||||
@Path("hello")
|
||||
@Produces(MediaType.TEXT_PLAIN)
|
||||
|
@ -265,7 +263,7 @@ public class GrsfPublisherStockService {
|
|||
|
||||
// add the "Product URL" to the field
|
||||
Map<String, List<String>> addField = new HashMap<String, List<String>>();
|
||||
addField.put(ITEM_URL_FIELD, Arrays.asList(itemUrl));
|
||||
addField.put(CommonServiceUtils.ITEM_URL_FIELD, Arrays.asList(itemUrl));
|
||||
catalogue.patchProductCustomFields(id, apiKey, addField);
|
||||
|
||||
if(!groups.isEmpty()){
|
||||
|
@ -488,9 +486,17 @@ public class GrsfPublisherStockService {
|
|||
|
||||
// retrieve the product url
|
||||
Map<String, String> customFields = dataset.getExtrasAsHashMap();
|
||||
if(customFields.containsKey(ITEM_URL_FIELD))
|
||||
result.put("url", customFields.get(ITEM_URL_FIELD));
|
||||
else
|
||||
|
||||
boolean found = false;
|
||||
Set<String> KeySet = customFields.keySet();
|
||||
for (String key : KeySet) {
|
||||
if(key.contains(CommonServiceUtils.ITEM_URL_FIELD) && !key.contains(Base.UUID_KB_KEY)){
|
||||
result.put("url", customFields.get(key));
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!found)
|
||||
result.put("url", catalogue.getUnencryptedUrlFromDatasetIdOrName(dataset.getId()));
|
||||
|
||||
responseBean.setResult(result);
|
||||
|
|
Loading…
Reference in New Issue