model upgrade
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/widgets/grsf-manage-widget@152395 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
aa61fbc121
commit
7c9c341c2f
|
@ -1,4 +1,7 @@
|
|||
<ReleaseNotes>
|
||||
<Changeset component="org.gcube.portlets-widgets.grsf-manage-widget.1-2-0" date="2017-08-10">
|
||||
<Change>Minor changes to reflect the new model of grsf records</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-widgets.grsf-manage-widget.1-1-1" date="2017-04-10">
|
||||
<Change>Minor improvements</Change>
|
||||
</Changeset>
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -12,7 +12,7 @@
|
|||
|
||||
<groupId>org.gcube.portlets.widgets</groupId>
|
||||
<artifactId>grsf-manage-widget</artifactId>
|
||||
<version>1.1.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<name>gCube GRSF Manage widget</name>
|
||||
|
||||
<scm>
|
||||
|
|
|
@ -56,20 +56,23 @@ public class ManageProductWidget extends Composite{
|
|||
@UiField
|
||||
TextArea titleTextArea;
|
||||
|
||||
// @UiField
|
||||
// TextBox productType;
|
||||
@UiField
|
||||
TextBox shortNameTextBox;
|
||||
|
||||
@UiField
|
||||
TextBox productGrsfType;
|
||||
|
||||
// @UiField
|
||||
// TextBox productSemanticId;
|
||||
//
|
||||
// @UiField
|
||||
// TextBox productShortTitle;
|
||||
//
|
||||
// @UiField
|
||||
// TextBox productSource;
|
||||
@UiField
|
||||
TextArea descriptionTextArea;
|
||||
|
||||
@UiField
|
||||
TextBox GRSFNameTexBox;
|
||||
|
||||
@UiField
|
||||
TextBox semanticIdentifierTextBox;
|
||||
|
||||
@UiField
|
||||
TextBox sources;
|
||||
|
||||
@UiField
|
||||
TextBox currentStatus;
|
||||
|
@ -80,9 +83,6 @@ public class ManageProductWidget extends Composite{
|
|||
@UiField
|
||||
TextArea annotationArea;
|
||||
|
||||
@UiField
|
||||
TextArea descriptionTextArea;
|
||||
|
||||
@UiField
|
||||
Button cancelButton;
|
||||
|
||||
|
@ -115,7 +115,7 @@ public class ManageProductWidget extends Composite{
|
|||
protected static final String NO_GRSF_RECORD_BEAN = "This item is not a GRSF record, thus it cannot be managed";
|
||||
|
||||
protected static final String NO_ADMIN_ROLE = "Sorry but it seems you do not have the rights to manage items."
|
||||
+ " You are suggested to contact the VRE Manager if something is wrong.";
|
||||
+ " You are suggested to contact the VRE Manager if something is wrong with this";
|
||||
private ManageProductBean bean;
|
||||
|
||||
public ManageProductWidget(String productIdentifier) {
|
||||
|
@ -167,14 +167,15 @@ public class ManageProductWidget extends Composite{
|
|||
infoBlock.setVisible(false);
|
||||
|
||||
titleTextArea.setText(bean.getItemTitle());
|
||||
shortNameTextBox.setText(bean.getShortTitle());
|
||||
currentStatus.setText(bean.getCurrentStatus().toString());
|
||||
productGrsfType.setText(bean.getGrsfType());
|
||||
// productType.setText(bean.getType());
|
||||
// productSemanticId.setText(bean.getSemanticId());
|
||||
// productShortTitle.setText(bean.getShortTitle());
|
||||
// productSource.setText(bean.getSource());
|
||||
GRSFNameTexBox.setText(bean.getGrsfName());
|
||||
semanticIdentifierTextBox.setText(bean.getSemanticId());
|
||||
sources.setText(bean.getSources());
|
||||
descriptionTextArea.setText(bean.getDescription());
|
||||
|
||||
|
||||
// check if we need to show more
|
||||
if(bean.getExtrasIfAvailable() != null && !bean.getExtrasIfAvailable().isEmpty())
|
||||
addExtrasAfter(bean, productGrsfTypeGroup);
|
||||
|
|
|
@ -24,35 +24,76 @@
|
|||
width="100%">
|
||||
|
||||
<b:ControlGroup ui:field="productTitleGroup">
|
||||
<b:ControlLabel for="title" title="Item title">
|
||||
<b:ControlLabel for="title" title="Title">
|
||||
<b>Title:</b>
|
||||
</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextArea alternateSize="LARGE" placeholder="Item title"
|
||||
readOnly="true" width="97%" b:id="title" title="Item title"
|
||||
ui:field="titleTextArea" />
|
||||
<b:TextArea alternateSize="LARGE" placeholder="Title"
|
||||
readOnly="true" width="97%" b:id="title" title="Title" ui:field="titleTextArea" />
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
||||
<b:ControlGroup ui:field="productDescriptionGroup">
|
||||
<b:ControlLabel for="description" title="Item description">
|
||||
<b:ControlLabel for="description" title="Description">
|
||||
<b>Description:</b>
|
||||
</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextArea alternateSize="LARGE" placeholder="Item description"
|
||||
readOnly="true" width="97%" b:id="description" title="Item description"
|
||||
<b:TextArea alternateSize="LARGE" placeholder="Description"
|
||||
readOnly="true" width="97%" b:id="description" title="Description"
|
||||
ui:field="descriptionTextArea" />
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
||||
<b:ControlGroup ui:field="productShortNameGroup">
|
||||
<b:ControlLabel for="shortname" title="Short Name">
|
||||
<b>Short Name:</b>
|
||||
</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox alternateSize="LARGE" placeholder="Short Name"
|
||||
readOnly="true" width="97%" b:id="shortname" title="Short Name"
|
||||
ui:field="shortNameTextBox" />
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
||||
<b:ControlGroup ui:field="productGRSFNameGroup">
|
||||
<b:ControlLabel for="grsfname" title="GRSF Name">
|
||||
<b>GRSF Name:</b>
|
||||
</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox alternateSize="LARGE" placeholder="GRSF Name"
|
||||
readOnly="true" width="97%" b:id="grsfname" title="GRSF Name"
|
||||
ui:field="GRSFNameTexBox" />
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
||||
<b:ControlGroup ui:field="productSemanticIdentifierGroup">
|
||||
<b:ControlLabel for="semanticidentifier" title="Semantic Identifier">
|
||||
<b>Semantic Identifier:</b>
|
||||
</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox alternateSize="LARGE" placeholder="Item GRSF Name"
|
||||
readOnly="true" width="97%" b:id="semanticidentifier" title="Semantic Identifier"
|
||||
ui:field="semanticIdentifierTextBox" />
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
||||
<b:ControlGroup ui:field="productGrsfTypeGroup">
|
||||
<b:ControlLabel for="productGrsfType" title="The GRSF Item type">
|
||||
<b:ControlLabel for="productGrsfType" title="GRSF type">
|
||||
<b>GRSF Type:</b>
|
||||
</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox b:id="productGrsfType" alternateSize="LARGE"
|
||||
width="97%" title="The GRSF Item type" readOnly="true"
|
||||
ui:field="productGrsfType"></b:TextBox>
|
||||
width="97%" title="GRSF type" readOnly="true" ui:field="productGrsfType"></b:TextBox>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
||||
<b:ControlGroup ui:field="sourcesGroup">
|
||||
<b:ControlLabel for="sources" title="Sources">
|
||||
<b>Source(s):</b>
|
||||
</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox b:id="sources" alternateSize="LARGE" width="97%"
|
||||
title="Sources" readOnly="true" ui:field="sources"></b:TextBox>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
||||
|
|
|
@ -5,11 +5,9 @@ import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
|
|||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
@ -23,6 +21,7 @@ import org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogue;
|
|||
import org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogueFactory;
|
||||
import org.gcube.datacatalogue.ckanutillibrary.server.utils.UtilMethods;
|
||||
import org.gcube.datacatalogue.grsf_manage_widget.client.GRSFManageWidgetService;
|
||||
import org.gcube.datacatalogue.grsf_manage_widget.shared.Constants;
|
||||
import org.gcube.datacatalogue.grsf_manage_widget.shared.GRSFStatus;
|
||||
import org.gcube.datacatalogue.grsf_manage_widget.shared.ManageProductBean;
|
||||
import org.gcube.datacatalogue.grsf_manage_widget.shared.ex.NoGRSFRecordException;
|
||||
|
@ -30,7 +29,6 @@ import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
|||
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
||||
import org.gcube.vomanagement.usermanagement.impl.LiferayRoleManager;
|
||||
import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager;
|
||||
import org.gcube.vomanagement.usermanagement.model.GCubeRole;
|
||||
import org.gcube.vomanagement.usermanagement.model.GCubeTeam;
|
||||
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||
import org.json.simple.JSONArray;
|
||||
|
@ -60,44 +58,9 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
|
|||
|
||||
private static final long serialVersionUID = -4534905087994875893L;
|
||||
private static final Log logger = LogFactoryUtil.getLog(GRSFNotificationService.class);
|
||||
private static final String ANNOTATION_KEY = "Annotation on update";
|
||||
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
private static final int MAX_TRIAL = 5;
|
||||
|
||||
// info of the record to be shown at client-side
|
||||
private static final String STATUS_CUSTOM_FIELD_KEY = "Status";
|
||||
private static final String KB_UUID_FIELD_KEY = "UUID Knowledge Base";
|
||||
// private static final String TYPE_FIELD_KEY = "Type";
|
||||
private static final String GRSF_TYPE_FIELD_KEY = "GRSF type";
|
||||
// private static final String SHORT_TITLE_FIELD_KEY = "Short Title";
|
||||
// private static final String SOURCES_TITLE_FIELD_KEY = "Source";
|
||||
|
||||
// request post fields FORTH Service
|
||||
private static final String CATALOGUE_ID = "catalog_id";
|
||||
private static final String KB_ID = "record_id";
|
||||
private static final String PRODUCT_TYPE = "type";
|
||||
private static final String STATUS = "status";
|
||||
private static final String ANNOTATION = "annotation_msg";
|
||||
private static final String ERROR = "error";
|
||||
|
||||
// discover the endpoint of the grsf updater on IS
|
||||
public static final String GRSF_UPDATER_SERVICE = "GRSFUpdaterEndPoint";
|
||||
private static final String SERVICE_POST_METHOD = "/service/updater/post";
|
||||
|
||||
// the error of the update on success
|
||||
private static final int STATUS_SUCCESS = 200;
|
||||
|
||||
// GRSF update service information
|
||||
private static final String SERVICE_NAME = "GRSF Updater";
|
||||
private static final String SERVICE_CATEGORY = "Service";
|
||||
|
||||
// request url
|
||||
public static final String GCUBE_REQUEST_URL = "gcube-request-url";
|
||||
|
||||
// session info for user
|
||||
public static final String GRSF_ADMIN_SESSION_KEY = "IS_GRSF_ADMIN";
|
||||
private static final String GRSF_CATALOGUE_MANAGER_ROLE = "Catalogue Manager"; // managed as Team Role
|
||||
|
||||
/**
|
||||
* Instanciate the ckan util library.
|
||||
* Since it needs the scope, we need to check if it is null or not
|
||||
|
@ -127,7 +90,7 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
|
|||
DataCatalogue catalogue = getCatalogue(context);
|
||||
|
||||
// check if the base url of the service is in session
|
||||
String keyPerContext = UtilMethods.concatenateSessionKeyScope(GRSF_UPDATER_SERVICE, context);
|
||||
String keyPerContext = UtilMethods.concatenateSessionKeyScope(Constants.GRSF_UPDATER_SERVICE, context);
|
||||
String baseUrl = (String)getThreadLocalRequest().getSession().getAttribute(keyPerContext);
|
||||
if(baseUrl == null || baseUrl.isEmpty()){
|
||||
baseUrl = GRSFNotificationService.discoverEndPoint(context);
|
||||
|
@ -150,75 +113,68 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
|
|||
String scopePerCurrentUrl = getScopeFromClientUrl(getThreadLocalRequest());
|
||||
DataCatalogue catalogue = getCatalogue(scopePerCurrentUrl);
|
||||
String username = getCurrentUser(getThreadLocalRequest()).getUsername();
|
||||
CkanDataset product = catalogue.getDataset(productIdentifier, catalogue.getApiKeyFromUsername(username));
|
||||
CkanDataset record = catalogue.getDataset(productIdentifier, catalogue.getApiKeyFromUsername(username));
|
||||
|
||||
// it cannot be enabled in this case ...
|
||||
if(product == null)
|
||||
if(record == null)
|
||||
throw new Exception("Unable to retrieve information for the selected item, sorry");
|
||||
else{
|
||||
|
||||
toReturn = new ManageProductBean();
|
||||
|
||||
// check it is a grsf item, else..
|
||||
List<CkanGroup> groups = product.getGroups();
|
||||
boolean isGrsf = false;
|
||||
|
||||
for (CkanGroup ckanGroup : groups) {
|
||||
logger.debug("Group has name " + ckanGroup.getName());
|
||||
if(ckanGroup.getName().toLowerCase().contains("grsf")){
|
||||
isGrsf = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!isGrsf)
|
||||
// check it is a grsf record
|
||||
String systemType = record.getExtrasAsHashMap().get(Constants.SYSTEM_TYPE);
|
||||
if(systemType == null || systemType.isEmpty() || !systemType.equals(Constants.GRSF))
|
||||
throw new NoGRSFRecordException("This is not a GRSF Item");
|
||||
|
||||
// get extras
|
||||
Map<String, String> extrasAsHashMap = product.getExtrasAsHashMap();
|
||||
String status = extrasAsHashMap.get(STATUS_CUSTOM_FIELD_KEY);
|
||||
String uuidKB = extrasAsHashMap.get(KB_UUID_FIELD_KEY);
|
||||
// String productType = extras.get(TYPE_FIELD_KEY);
|
||||
String productGRSFType = extrasAsHashMap.get(GRSF_TYPE_FIELD_KEY);
|
||||
// String semanticId = extras.get(productGRSFType + " id"); // i.e "Stock id" or "Fishery id"
|
||||
// String shortTitle = extras.get(SHORT_TITLE_FIELD_KEY);
|
||||
// String sources = extras.get(SOURCES_TITLE_FIELD_KEY);
|
||||
String title = product.getTitle();
|
||||
String description = product.getNotes();
|
||||
Map<String, String> extrasAsHashMap = record.getExtrasAsHashMap();
|
||||
|
||||
// fetch extras
|
||||
GenericResourceReaderExtras entries = new GenericResourceReaderExtras();
|
||||
Set<String> extrasToShow = entries.getLookedUpExtrasKeys();
|
||||
// fetch map for namespaces
|
||||
Map<String, String> fieldsNamespacesMap = Utils.getFieldToFieldNameSpaceMapping(getThreadLocalRequest().getSession(),
|
||||
extrasAsHashMap.get(Constants.GRSF_DOMAIN).equals(Constants.STOCK) ? Utils.GENERIC_RESOURCE_NAME_MAP_KEY_NAMESPACES_STOCK
|
||||
: Utils.GENERIC_RESOURCE_NAME_MAP_KEY_NAMESPACES_FISHERY);
|
||||
|
||||
if(extrasToShow != null && !extrasToShow.isEmpty()){
|
||||
Map<String, String> extrasKeyValuePair = new HashMap<String, String>();
|
||||
List<CkanPair> extrasAsPairs = product.getExtras();
|
||||
for (CkanPair ckanPair : extrasAsPairs) {
|
||||
String key = ckanPair.getKey();
|
||||
String value = ckanPair.getValue();
|
||||
Map<String, String> extrasWithoutNamespaces = Utils.replaceFieldsKey(extrasAsHashMap, fieldsNamespacesMap);
|
||||
|
||||
if(extrasToShow.contains(key)){
|
||||
String currentValueInMap = extrasKeyValuePair.get(key);
|
||||
if(currentValueInMap == null)
|
||||
currentValueInMap = value;
|
||||
else
|
||||
currentValueInMap += ", " + value;
|
||||
extrasKeyValuePair.put(key, currentValueInMap);
|
||||
}
|
||||
}
|
||||
toReturn.setExtrasIfAvailable(extrasKeyValuePair);
|
||||
}
|
||||
//// other info to show TODO
|
||||
// Set<String> extrasToShow = Utils.getLookedUpExtrasKeys();
|
||||
// if(extrasToShow != null && !extrasToShow.isEmpty()){
|
||||
// Map<String, String> extrasKeyValuePair = new HashMap<String, String>();
|
||||
// List<CkanPair> extrasAsPairs = product.getExtras();
|
||||
// for (CkanPair ckanPair : extrasAsPairs) {
|
||||
// String key = ckanPair.getKey();
|
||||
// String value = ckanPair.getValue();
|
||||
//
|
||||
// if(extrasToShow.contains(key)){
|
||||
// String currentValueInMap = extrasKeyValuePair.get(key);
|
||||
// if(currentValueInMap == null)
|
||||
// currentValueInMap = value;
|
||||
// else
|
||||
// currentValueInMap += ", " + value;
|
||||
// extrasKeyValuePair.put(key, currentValueInMap);
|
||||
// }
|
||||
// }
|
||||
// toReturn.setExtrasIfAvailable(extrasKeyValuePair);
|
||||
// }
|
||||
|
||||
String status = extrasWithoutNamespaces.get(Constants.STATUS_CUSTOM_FIELD_KEY);
|
||||
String uuidKB = extrasWithoutNamespaces.get(Constants.KB_UUID_FIELD_KEY);
|
||||
String semanticId = extrasWithoutNamespaces.get(Constants.SEMANTIC_IDENTIFIER);
|
||||
String shortName = extrasWithoutNamespaces.get(Constants.SHORT_NAME_FIELD_KEY);
|
||||
String grsfType = extrasWithoutNamespaces.get(Constants.GRSF_TYPE_FIELD_KEY);
|
||||
String grsfDomain = extrasWithoutNamespaces.get(Constants.GRSF_DOMAIN);
|
||||
String grsfName = extrasWithoutNamespaces.get(grsfDomain.equals(Constants.STOCK) ? Constants.STOCK_GRSF_NAME : Constants.FISHERY_GRSF_NAME);
|
||||
String traceabilityFlag = extrasWithoutNamespaces.get(Constants.TRACEABILITY_FLAG);
|
||||
String title = record.getTitle();
|
||||
String description = record.getNotes();
|
||||
|
||||
if(status == null || uuidKB == null)
|
||||
throw new Exception("Some information is missing in this record: Status = " + status + ", knowledge_base_uuid = " + uuidKB +
|
||||
", and grsf type is = " + productGRSFType);
|
||||
throw new Exception("Some information is missing in this record: Status = " + status + ", knowledge base uuid = " + uuidKB +
|
||||
", and grsf domain is = " + grsfDomain);
|
||||
|
||||
toReturn.setCatalogueIdentifier(productIdentifier);
|
||||
toReturn.setCurrentStatus(GRSFStatus.fromString(status));
|
||||
toReturn.setKnowledgeBaseIdentifier(uuidKB);
|
||||
toReturn.setItemTitle(title);
|
||||
toReturn.setGrsfType(productGRSFType);
|
||||
toReturn.setDescription(description);
|
||||
String sources = getSourcesFromGroups(record);
|
||||
|
||||
// set the values
|
||||
toReturn = new ManageProductBean(title, semanticId, productIdentifier,
|
||||
uuidKB, grsfType, grsfDomain, sources, description, grsfName, null, GRSFStatus.fromString(status), null, null, shortName, traceabilityFlag.equalsIgnoreCase("true"));
|
||||
|
||||
logger.info("Returning item bean " + toReturn);
|
||||
|
||||
|
@ -226,6 +182,28 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sources from record
|
||||
* @param record
|
||||
* @return
|
||||
*/
|
||||
private String getSourcesFromGroups(CkanDataset record) {
|
||||
if(record == null)
|
||||
return null;
|
||||
else{
|
||||
|
||||
List<CkanGroup> groups = record.getGroups();
|
||||
|
||||
for (CkanGroup ckanGroup : groups) {
|
||||
String title = ckanGroup.getTitle();
|
||||
if(title.contains(Constants.RAM) || title.contains(Constants.FISHSOURCE) || title.contains(Constants.FIRMS))
|
||||
return title;
|
||||
}
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Discover the service endpoint and return its url
|
||||
* @param context
|
||||
|
@ -238,14 +216,14 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
|
|||
String toReturn = null;
|
||||
try{
|
||||
SimpleQuery query = queryFor(ServiceEndpoint.class);
|
||||
query.addCondition("$resource/Profile/Name/text() eq '"+ SERVICE_NAME +"'");
|
||||
query.addCondition("$resource/Profile/Category/text() eq '"+ SERVICE_CATEGORY +"'");
|
||||
query.addCondition("$resource/Profile/Name/text() eq '"+ Constants.SERVICE_NAME +"'");
|
||||
query.addCondition("$resource/Profile/Category/text() eq '"+ Constants.SERVICE_CATEGORY +"'");
|
||||
DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
|
||||
List<ServiceEndpoint> resources = client.submit(query);
|
||||
|
||||
if (resources.size() == 0){
|
||||
logger.error("There is no Runtime Resource having name " + SERVICE_NAME +" and Category " + SERVICE_CATEGORY + " in this scope.");
|
||||
throw new Exception("There is no Runtime Resource having name " + SERVICE_NAME +" and Category " + SERVICE_CATEGORY + " in this scope.");
|
||||
logger.error("There is no Runtime Resource having name " + Constants.SERVICE_NAME +" and Category " + Constants.SERVICE_CATEGORY + " in this scope.");
|
||||
throw new Exception("There is no Runtime Resource having name " + Constants.SERVICE_NAME +" and Category " + Constants.SERVICE_CATEGORY + " in this scope.");
|
||||
}
|
||||
else {
|
||||
|
||||
|
@ -292,18 +270,18 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
|
|||
try(CloseableHttpClient httpClient = HttpClientBuilder.create().build();){
|
||||
|
||||
JSONObject obj = new JSONObject();
|
||||
obj.put(CATALOGUE_ID, bean.getCatalogueIdentifier());
|
||||
obj.put(KB_ID, bean.getKnowledgeBaseIdentifier());
|
||||
obj.put(PRODUCT_TYPE, bean.getGrsfType().toLowerCase());
|
||||
obj.put(STATUS, bean.getNewStatus().toString().toLowerCase());
|
||||
obj.put(Constants.CATALOGUE_ID, bean.getCatalogueIdentifier());
|
||||
obj.put(Constants.KB_ID, bean.getKnowledgeBaseIdentifier());
|
||||
obj.put(Constants.PRODUCT_TYPE, bean.getGrsfDomain().toLowerCase());
|
||||
obj.put(Constants.STATUS, bean.getNewStatus().toString().toLowerCase());
|
||||
|
||||
String annotation = bean.getAnnotation();
|
||||
if(annotation != null)
|
||||
obj.put(ANNOTATION, annotation.replaceAll("\"", ""));
|
||||
obj.put(Constants.ANNOTATION, annotation.replaceAll("\"", ""));
|
||||
|
||||
logger.debug("Update request looks like " + obj.toJSONString());
|
||||
|
||||
HttpPost request = new HttpPost(serviceUrl + SERVICE_POST_METHOD);
|
||||
HttpPost request = new HttpPost(serviceUrl + Constants.SERVICE_POST_METHOD);
|
||||
request.setHeader("Accept", "application/json");
|
||||
request.setHeader("Content-type", "application/json");
|
||||
StringEntity params = new StringEntity(obj.toJSONString());
|
||||
|
@ -316,10 +294,10 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
|
|||
JSONParser parser = new JSONParser();
|
||||
JSONObject parsedJSON = (JSONObject)parser.parse(result);
|
||||
|
||||
if(response.getStatusLine().getStatusCode() != STATUS_SUCCESS)
|
||||
if(response.getStatusLine().getStatusCode() != Constants.STATUS_SUCCESS)
|
||||
throw new IllegalArgumentException(
|
||||
"Error while performing the update request: " + response.getStatusLine().getReasonPhrase() +
|
||||
"and error in the result bean is " + parsedJSON.get(ERROR));
|
||||
"and error in the result bean is " + parsedJSON.get(Constants.ERROR));
|
||||
|
||||
// patch the catalogue product
|
||||
return patchProduct(catalogue, bean, username);
|
||||
|
@ -360,7 +338,7 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
|
|||
// manage the custom fields
|
||||
List<CkanPair> extras = dataset.getExtras();
|
||||
for (CkanPair ckanPair : extras) {
|
||||
if(ckanPair.getKey().equals(STATUS_CUSTOM_FIELD_KEY) && ckanPair.getValue().equals(bean.getCurrentStatus().toString()))
|
||||
if(ckanPair.getKey().equals(Constants.STATUS_CUSTOM_FIELD_KEY) && ckanPair.getValue().equals(bean.getCurrentStatus().toString()))
|
||||
continue;
|
||||
|
||||
JSONObject obj = new JSONObject();
|
||||
|
@ -371,12 +349,12 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
|
|||
|
||||
// add the new one and the annotation message
|
||||
JSONObject newStatus = new JSONObject();
|
||||
newStatus.put("key", STATUS_CUSTOM_FIELD_KEY);
|
||||
newStatus.put("key", Constants.STATUS_CUSTOM_FIELD_KEY);
|
||||
newStatus.put("value", bean.getNewStatus().toString());
|
||||
customFieldsAsJson.add(newStatus);
|
||||
|
||||
JSONObject newAnnotation = new JSONObject();
|
||||
newAnnotation.put("key", ANNOTATION_KEY);
|
||||
newAnnotation.put("key", Constants.ANNOTATION_KEY);
|
||||
newAnnotation.put("value", "date: " + DATE_FORMAT.format(new Date())
|
||||
+ ", admin: " + new LiferayUserManager().getUserByUsername(username).getFullname()
|
||||
+ ", message: " + (bean.getAnnotation() != null ? bean.getAnnotation().replaceAll("\"", "") : "none")
|
||||
|
@ -485,7 +463,7 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
|
|||
if(httpServletRequest == null)
|
||||
throw new IllegalArgumentException("HttpServletRequest is null!");
|
||||
|
||||
return httpServletRequest.getHeader(GCUBE_REQUEST_URL);
|
||||
return httpServletRequest.getHeader(Constants.GCUBE_REQUEST_URL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -528,7 +506,7 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
|
|||
public boolean isAdminUser() {
|
||||
try{
|
||||
|
||||
Boolean inSession = (Boolean)getThreadLocalRequest().getSession().getAttribute(GRSF_ADMIN_SESSION_KEY);
|
||||
Boolean inSession = (Boolean)getThreadLocalRequest().getSession().getAttribute(Constants.GRSF_ADMIN_SESSION_KEY);
|
||||
|
||||
if(inSession != null)
|
||||
return inSession;
|
||||
|
@ -537,16 +515,16 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
|
|||
List<GCubeTeam> teamRoles = new LiferayRoleManager().listTeamsByUserAndGroup(pContext.getCurrentUser(getThreadLocalRequest()).getUserId(), pContext.getCurrentGroupId(getThreadLocalRequest()));
|
||||
boolean toSetInSession = false;
|
||||
for (GCubeTeam team : teamRoles) {
|
||||
if(team.getTeamName().equals(GRSF_CATALOGUE_MANAGER_ROLE)){
|
||||
if(team.getTeamName().equals(Constants.GRSF_CATALOGUE_MANAGER_ROLE)){
|
||||
toSetInSession = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
getThreadLocalRequest().getSession().setAttribute(GRSF_ADMIN_SESSION_KEY, toSetInSession);
|
||||
getThreadLocalRequest().getSession().setAttribute(Constants.GRSF_ADMIN_SESSION_KEY, toSetInSession);
|
||||
return toSetInSession;
|
||||
}
|
||||
}catch(Exception e){
|
||||
logger.error("Failed to check if the user has team " + GRSF_CATALOGUE_MANAGER_ROLE, e);
|
||||
logger.error("Failed to check if the user has team " + Constants.GRSF_CATALOGUE_MANAGER_ROLE, e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,95 +0,0 @@
|
|||
package org.gcube.datacatalogue.grsf_manage_widget.server.manage;
|
||||
|
||||
import static org.gcube.resources.discovery.icclient.ICFactory.client;
|
||||
|
||||
import java.io.StringReader;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
import org.gcube.common.resources.gcore.utils.XPathHelper;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.datacatalogue.ckanutillibrary.shared.ex.ApplicationProfileNotFoundException;
|
||||
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||
import org.gcube.resources.discovery.client.queries.api.Query;
|
||||
import org.gcube.resources.discovery.client.queries.impl.QueryBox;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.w3c.dom.Node;
|
||||
import org.xml.sax.InputSource;
|
||||
|
||||
/**
|
||||
* Look up from the IS other information that the widget should lookup
|
||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
*/
|
||||
public class GenericResourceReaderExtras {
|
||||
|
||||
private Set<String> lookedUpExtrasKeys = new HashSet<String>();
|
||||
|
||||
private static final String GENERIC_RESOURCE_NAME = "GRSFManageEntries";
|
||||
private static final String GENERIC_RESOURCE_SECONDARY_TYPE = "ApplicationProfile";
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GenericResourceReaderExtras.class);
|
||||
|
||||
// generic resource properties (a list of information)
|
||||
public GenericResourceReaderExtras(){
|
||||
|
||||
String scope = ScopeProvider.instance.get();
|
||||
logger.debug("Trying to fetch applicationProfile profile from the infrastructure for " + GENERIC_RESOURCE_NAME + " scope: " + scope);
|
||||
|
||||
try {
|
||||
Query q = new QueryBox("for $profile in collection('/db/Profiles/GenericResource')//Resource " +
|
||||
"where $profile/Profile/SecondaryType/string() eq '"+ GENERIC_RESOURCE_SECONDARY_TYPE + "' and $profile/Profile/Name/string() " +
|
||||
" eq '" + GENERIC_RESOURCE_NAME + "'" +
|
||||
"return $profile");
|
||||
|
||||
DiscoveryClient<String> client = client();
|
||||
List<String> appProfile = client.submit(q);
|
||||
|
||||
if (appProfile == null || appProfile.size() == 0)
|
||||
throw new ApplicationProfileNotFoundException("Your applicationProfile is not registered in the infrastructure");
|
||||
else {
|
||||
|
||||
String elem = appProfile.get(0);
|
||||
DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
||||
Node node = docBuilder.parse(new InputSource(new StringReader(elem))).getDocumentElement();
|
||||
XPathHelper helper = new XPathHelper(node);
|
||||
|
||||
List<String> currValue = null;
|
||||
currValue = helper.evaluate("/Resource/Profile/Body/text()");
|
||||
|
||||
if (currValue != null && currValue.size() > 0) {
|
||||
String body = currValue.get(0);
|
||||
String[] splittedSet = body.split(",");
|
||||
if(splittedSet != null && splittedSet.length > 0)
|
||||
for (String entry : splittedSet) {
|
||||
String trimmed = entry.trim();
|
||||
if(trimmed.isEmpty())
|
||||
continue;
|
||||
lookedUpExtrasKeys.add(trimmed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
logger.info("Extras entries are " + lookedUpExtrasKeys);
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("Error while trying to fetch applicationProfile profile from the infrastructure", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Set<String> getLookedUpExtrasKeys() {
|
||||
return lookedUpExtrasKeys;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GenericResourceReaderExtras [lookedUpExtrasKeys="
|
||||
+ lookedUpExtrasKeys + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,165 @@
|
|||
package org.gcube.datacatalogue.grsf_manage_widget.server.manage;
|
||||
|
||||
import static org.gcube.resources.discovery.icclient.ICFactory.client;
|
||||
|
||||
import java.io.StringReader;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
import org.gcube.common.resources.gcore.utils.XPathHelper;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.datacatalogue.ckanutillibrary.shared.ex.ApplicationProfileNotFoundException;
|
||||
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||
import org.gcube.resources.discovery.client.queries.api.Query;
|
||||
import org.gcube.resources.discovery.client.queries.impl.QueryBox;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.xml.sax.InputSource;
|
||||
|
||||
/**
|
||||
* Look up from the IS other information that the widget should show
|
||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
*/
|
||||
public class Utils {
|
||||
|
||||
public static final String GENERIC_RESOURCE_NAME_MAP_KEY_NAMESPACES_STOCK = "GRSF Stock";
|
||||
public static final String GENERIC_RESOURCE_NAME_MAP_KEY_NAMESPACES_FISHERY = "GRSF Fishery";
|
||||
private static final String GENERIC_RESOURCE_NAME = "GRSFManageEntries";
|
||||
private static final String GENERIC_RESOURCE_SECONDARY_TYPE = "ApplicationProfile";
|
||||
private static final Logger logger = LoggerFactory.getLogger(Utils.class);
|
||||
|
||||
public static Set<String> getLookedUpExtrasKeys() {
|
||||
Set<String> lookedUpExtrasKeys = new HashSet<String>();
|
||||
String scope = ScopeProvider.instance.get();
|
||||
logger.debug("Trying to fetch applicationProfile profile from the infrastructure for " + GENERIC_RESOURCE_NAME + " scope: " + scope);
|
||||
|
||||
try {
|
||||
Query q = new QueryBox("for $profile in collection('/db/Profiles/GenericResource')//Resource " +
|
||||
"where $profile/Profile/SecondaryType/string() eq '"+ GENERIC_RESOURCE_SECONDARY_TYPE + "' and $profile/Profile/Name/string() " +
|
||||
" eq '" + GENERIC_RESOURCE_NAME + "'" +
|
||||
"return $profile");
|
||||
|
||||
DiscoveryClient<String> client = client();
|
||||
List<String> appProfile = client.submit(q);
|
||||
|
||||
if (appProfile == null || appProfile.size() == 0)
|
||||
throw new ApplicationProfileNotFoundException("Your applicationProfile is not registered in the infrastructure");
|
||||
else {
|
||||
|
||||
String elem = appProfile.get(0);
|
||||
DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
||||
Node node = docBuilder.parse(new InputSource(new StringReader(elem))).getDocumentElement();
|
||||
XPathHelper helper = new XPathHelper(node);
|
||||
|
||||
List<String> currValue = null;
|
||||
currValue = helper.evaluate("/Resource/Profile/Body/text()");
|
||||
|
||||
if (currValue != null && currValue.size() > 0) {
|
||||
String body = currValue.get(0);
|
||||
String[] splittedSet = body.split(",");
|
||||
if(splittedSet != null && splittedSet.length > 0)
|
||||
for (String entry : splittedSet) {
|
||||
String trimmed = entry.trim();
|
||||
if(trimmed.isEmpty())
|
||||
continue;
|
||||
lookedUpExtrasKeys.add(trimmed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
logger.info("Extras entries are " + lookedUpExtrasKeys);
|
||||
return lookedUpExtrasKeys;
|
||||
} catch (Exception e) {
|
||||
logger.error("Error while trying to fetch applicationProfile profile from the infrastructure", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a map for converting a key to a namespace:key format by reading a generic resource.
|
||||
* @param httpSession
|
||||
* @return a map
|
||||
*/
|
||||
public static Map<String, String> getFieldToFieldNameSpaceMapping(HttpSession httpSession, String resourceName){
|
||||
|
||||
// check if this information is available in session
|
||||
String sessionKey = ScopeProvider.instance.get() + resourceName;
|
||||
if(httpSession.getAttribute(sessionKey) != null)
|
||||
return (Map<String, String>) httpSession.getAttribute(sessionKey);
|
||||
|
||||
Map<String, String> namespacesMap = new HashMap<String, String>(); // e.g. fishery_identity:Short Title -> Short Title
|
||||
try {
|
||||
Query q = new QueryBox("for $profile in collection('/db/Profiles/GenericResource')//Resource " +
|
||||
"where $profile/Profile/SecondaryType/string() eq '"+ "ApplicationProfile" + "' and $profile/Profile/Name/string() " +
|
||||
" eq '" + resourceName + "'" +
|
||||
"return $profile");
|
||||
|
||||
DiscoveryClient<String> client = client();
|
||||
List<String> appProfile = client.submit(q);
|
||||
|
||||
if (appProfile == null || appProfile.size() == 0)
|
||||
throw new Exception("Your applicationProfile is not registered in the infrastructure");
|
||||
else {
|
||||
|
||||
String elem = appProfile.get(0);
|
||||
DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
||||
Node node = docBuilder.parse(new InputSource(new StringReader(elem))).getDocumentElement();
|
||||
XPathHelper helper = new XPathHelper(node);
|
||||
|
||||
NodeList nodeListKeys = helper.evaluateForNodes("//originalKey");
|
||||
NodeList nodeListModifiedKeys = helper.evaluateForNodes("//modifiedKey");
|
||||
int sizeKeys = nodeListKeys != null ? nodeListKeys.getLength() : 0;
|
||||
int sizeKeysModifed = nodeListModifiedKeys != null ? nodeListModifiedKeys.getLength() : 0;
|
||||
if(sizeKeys != sizeKeysModifed)
|
||||
throw new Exception("Malformed XML");
|
||||
logger.debug("Size is " + sizeKeys);
|
||||
for (int i = 0; i < sizeKeys; i++) {
|
||||
namespacesMap.put(nodeListModifiedKeys.item(i).getTextContent(), nodeListKeys.item(i).getTextContent());
|
||||
}
|
||||
}
|
||||
logger.debug("Map is " + namespacesMap);
|
||||
httpSession.setAttribute(sessionKey, namespacesMap);
|
||||
return namespacesMap;
|
||||
} catch (Exception e) {
|
||||
logger.error("Error while trying to fetch applicationProfile profile from the infrastructure", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the extras' keys if needed
|
||||
* @param customFields
|
||||
* @param namespaces
|
||||
* @return
|
||||
*/
|
||||
public static Map<String, String> replaceFieldsKey(Map<String, String> customFields,
|
||||
Map<String, String> namespaces) {
|
||||
|
||||
Map<String, String> toReturn = new HashMap<String, String>();
|
||||
|
||||
Iterator<Entry<String, String>> iterator = customFields.entrySet().iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
Map.Entry<java.lang.String, java.lang.String> entry = (Map.Entry<java.lang.String, java.lang.String>) iterator
|
||||
.next();
|
||||
if(namespaces.containsKey(entry.getKey()))
|
||||
toReturn.put(namespaces.get(entry.getKey()), entry.getValue());
|
||||
else
|
||||
toReturn.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package org.gcube.datacatalogue.grsf_manage_widget.shared;
|
||||
|
||||
public class Constants {
|
||||
|
||||
// info of the record to be shown at client-side
|
||||
public static final String STATUS_CUSTOM_FIELD_KEY = "Status of the GRSF record";
|
||||
public static final String KB_UUID_FIELD_KEY = "GRSF UUID";
|
||||
public static final String SEMANTIC_IDENTIFIER = "GRSF Semantic identifier";
|
||||
public static final String GRSF_TYPE_FIELD_KEY = "GRSF Type";
|
||||
public static final String SHORT_NAME_FIELD_KEY = "Short Name";
|
||||
public static final String STOCK_GRSF_NAME = "Stock Name";
|
||||
public static final String FISHERY_GRSF_NAME = "Fishery Name";
|
||||
public static final String SOURCES_TITLE_FIELD_KEY = "Sources";
|
||||
public static final String GRSF_DOMAIN = "GRSF Domain";
|
||||
public static final String TRACEABILITY_FLAG = "Traceability Flag";
|
||||
|
||||
public static final String ANNOTATION_KEY = "Annotation on update";
|
||||
|
||||
// stock or fishery
|
||||
public static final String STOCK = "Stock";
|
||||
public static final String FISHERY = "Fishery";
|
||||
|
||||
// request post fields FORTH Service
|
||||
public static final String CATALOGUE_ID = "catalog_id";
|
||||
public static final String KB_ID = "record_id";
|
||||
public static final String PRODUCT_TYPE = "type";
|
||||
public static final String STATUS = "status";
|
||||
public static final String ANNOTATION = "annotation_msg";
|
||||
public static final String ERROR = "error";
|
||||
|
||||
// discover the endpoint of the grsf updater on IS
|
||||
public static final String GRSF_UPDATER_SERVICE = "GRSFUpdaterEndPoint";
|
||||
public static final String SERVICE_POST_METHOD = "/service/updater/post";
|
||||
|
||||
// the error of the update on success
|
||||
public static final int STATUS_SUCCESS = 200;
|
||||
|
||||
// GRSF update service information
|
||||
public static final String SERVICE_NAME = "GRSF Updater";
|
||||
public static final String SERVICE_CATEGORY = "Service";
|
||||
|
||||
// request url
|
||||
public static final String GCUBE_REQUEST_URL = "gcube-request-url";
|
||||
|
||||
// session info for user
|
||||
public static final String GRSF_ADMIN_SESSION_KEY = "IS_GRSF_ADMIN";
|
||||
public static final String GRSF_CATALOGUE_MANAGER_ROLE = "Catalogue Manager"; // managed as Team Role
|
||||
public static final String SYSTEM_TYPE = "system:type";
|
||||
public static final String GRSF = "GRSF";
|
||||
public static final String FIRMS = "FIRMS";
|
||||
public static final String RAM = "RAM";
|
||||
public static final String FISHSOURCE = "FishSource";
|
||||
|
||||
|
||||
}
|
|
@ -10,21 +10,23 @@ import java.util.Map;
|
|||
public class ManageProductBean implements Serializable{
|
||||
|
||||
private static final long serialVersionUID = -4882608487467259326L;
|
||||
private String itemTitle;
|
||||
// private String semanticId; // Stock id or Fishery id
|
||||
// private String shortTitle;
|
||||
private String catalogueIdentifier;
|
||||
private String knowledgeBaseIdentifier;
|
||||
// private String type; // Fishery or Stock type (e.g., Assessment_Unit, Marine Resource and so on)
|
||||
private String grsfType; // fishery/stock
|
||||
// private String source; // the current source
|
||||
private Map<String, String> extrasIfAvailable;
|
||||
private String itemTitle; // title
|
||||
private String semanticId; // Stock id or Fishery id
|
||||
private String catalogueIdentifier; // catalogue id
|
||||
private String knowledgeBaseIdentifier; // GRSF UUID
|
||||
private String grsfType; // Fishery or Stock type (e.g., Assessment_Unit, Marine Resource and so on)
|
||||
private String grsfDomain; // fishery/stock
|
||||
private String sources; // sources for this record
|
||||
private String description;
|
||||
private String grsfName; // Fishery name or stock name
|
||||
private Map<String, String> extrasIfAvailable; // read from GRSFManageEntries resource
|
||||
|
||||
// info that could change
|
||||
private GRSFStatus currentStatus;
|
||||
private GRSFStatus newStatus;
|
||||
private String annotation; // added by the administrator
|
||||
private String shortTitle;
|
||||
private boolean traceabilityFlag; //from false to true etc
|
||||
|
||||
public ManageProductBean() {
|
||||
super();
|
||||
|
@ -32,37 +34,60 @@ public class ManageProductBean implements Serializable{
|
|||
|
||||
/**
|
||||
* @param itemTitle
|
||||
* @param semanticId
|
||||
* @param catalogueIdentifier
|
||||
* @param knowledgeBaseIdentifier
|
||||
* @param grsfType
|
||||
* @param extrasIfAvailable
|
||||
* @param grsfDomain
|
||||
* @param sources
|
||||
* @param description
|
||||
* @param grsfName
|
||||
* @param extrasIfAvailable
|
||||
* @param currentStatus
|
||||
* @param newStatus
|
||||
* @param annotation
|
||||
* @param shortTitle
|
||||
* @param traceabilityFlag
|
||||
*/
|
||||
public ManageProductBean(String itemTitle, String catalogueIdentifier,
|
||||
String knowledgeBaseIdentifier, String grsfType,
|
||||
Map<String, String> extrasIfAvailable, String description,
|
||||
GRSFStatus currentStatus, GRSFStatus newStatus, String annotation) {
|
||||
public ManageProductBean(String itemTitle, String semanticId,
|
||||
String catalogueIdentifier, String knowledgeBaseIdentifier,
|
||||
String grsfType, String grsfDomain, String sources,
|
||||
String description, String grsfName,
|
||||
Map<String, String> extrasIfAvailable, GRSFStatus currentStatus,
|
||||
GRSFStatus newStatus, String annotation, String shortTitle,
|
||||
boolean traceabilityFlag) {
|
||||
super();
|
||||
this.itemTitle = itemTitle;
|
||||
this.semanticId = semanticId;
|
||||
this.catalogueIdentifier = catalogueIdentifier;
|
||||
this.knowledgeBaseIdentifier = knowledgeBaseIdentifier;
|
||||
this.grsfType = grsfType;
|
||||
this.extrasIfAvailable = extrasIfAvailable;
|
||||
this.grsfDomain = grsfDomain;
|
||||
this.sources = sources;
|
||||
this.description = description;
|
||||
this.grsfName = grsfName;
|
||||
this.extrasIfAvailable = extrasIfAvailable;
|
||||
this.currentStatus = currentStatus;
|
||||
this.newStatus = newStatus;
|
||||
this.annotation = annotation;
|
||||
this.shortTitle = shortTitle;
|
||||
this.traceabilityFlag = traceabilityFlag;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
public String getItemTitle() {
|
||||
return itemTitle;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
public void setItemTitle(String itemTitle) {
|
||||
this.itemTitle = itemTitle;
|
||||
}
|
||||
|
||||
public String getSemanticId() {
|
||||
return semanticId;
|
||||
}
|
||||
|
||||
public void setSemanticId(String semanticId) {
|
||||
this.semanticId = semanticId;
|
||||
}
|
||||
|
||||
public String getCatalogueIdentifier() {
|
||||
|
@ -81,6 +106,54 @@ public class ManageProductBean implements Serializable{
|
|||
this.knowledgeBaseIdentifier = knowledgeBaseIdentifier;
|
||||
}
|
||||
|
||||
public String getGrsfType() {
|
||||
return grsfType;
|
||||
}
|
||||
|
||||
public void setGrsfType(String grsfType) {
|
||||
this.grsfType = grsfType;
|
||||
}
|
||||
|
||||
public String getGrsfDomain() {
|
||||
return grsfDomain;
|
||||
}
|
||||
|
||||
public void setGrsfDomain(String grsfDomain) {
|
||||
this.grsfDomain = grsfDomain;
|
||||
}
|
||||
|
||||
public String getSources() {
|
||||
return sources;
|
||||
}
|
||||
|
||||
public void setSources(String sources) {
|
||||
this.sources = sources;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getGrsfName() {
|
||||
return grsfName;
|
||||
}
|
||||
|
||||
public void setGrsfName(String grsfName) {
|
||||
this.grsfName = grsfName;
|
||||
}
|
||||
|
||||
public Map<String, String> getExtrasIfAvailable() {
|
||||
return extrasIfAvailable;
|
||||
}
|
||||
|
||||
public void setExtrasIfAvailable(Map<String, String> extrasIfAvailable) {
|
||||
this.extrasIfAvailable = extrasIfAvailable;
|
||||
}
|
||||
|
||||
public GRSFStatus getCurrentStatus() {
|
||||
return currentStatus;
|
||||
}
|
||||
|
@ -100,42 +173,39 @@ public class ManageProductBean implements Serializable{
|
|||
public String getAnnotation() {
|
||||
return annotation;
|
||||
}
|
||||
|
||||
public void setAnnotation(String annotation) {
|
||||
this.annotation = annotation;
|
||||
}
|
||||
|
||||
public String getItemTitle() {
|
||||
return itemTitle;
|
||||
public String getShortTitle() {
|
||||
return shortTitle;
|
||||
}
|
||||
|
||||
public void setItemTitle(String itemTitle) {
|
||||
this.itemTitle = itemTitle;
|
||||
public void setShortTitle(String shortTitle) {
|
||||
this.shortTitle = shortTitle;
|
||||
}
|
||||
|
||||
public String getGrsfType() {
|
||||
return grsfType;
|
||||
public boolean isTraceabilityFlag() {
|
||||
return traceabilityFlag;
|
||||
}
|
||||
|
||||
public void setGrsfType(String grsfType) {
|
||||
this.grsfType = grsfType;
|
||||
}
|
||||
|
||||
public Map<String, String> getExtrasIfAvailable() {
|
||||
return extrasIfAvailable;
|
||||
}
|
||||
|
||||
public void setExtrasIfAvailable(Map<String, String> extrasIfAvailable) {
|
||||
this.extrasIfAvailable = extrasIfAvailable;
|
||||
public void setTraceabilityFlag(boolean traceabilityFlag) {
|
||||
this.traceabilityFlag = traceabilityFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ManageProductBean [itemTitle=" + itemTitle
|
||||
+ ", catalogueIdentifier=" + catalogueIdentifier
|
||||
return "ManageProductBean [itemTitle=" + itemTitle + ", semanticId="
|
||||
+ semanticId + ", catalogueIdentifier=" + catalogueIdentifier
|
||||
+ ", knowledgeBaseIdentifier=" + knowledgeBaseIdentifier
|
||||
+ ", grsfType=" + grsfType + ", extrasIfAvailable="
|
||||
+ extrasIfAvailable + ", description=" + description
|
||||
+ ", currentStatus=" + currentStatus + ", newStatus="
|
||||
+ newStatus + ", annotation=" + annotation + "]";
|
||||
+ ", grsfType=" + grsfType + ", grsfDomain=" + grsfDomain
|
||||
+ ", sources=" + sources + ", description=" + description
|
||||
+ ", grsfName=" + grsfName + ", extrasIfAvailable="
|
||||
+ extrasIfAvailable + ", currentStatus=" + currentStatus
|
||||
+ ", newStatus=" + newStatus + ", annotation=" + annotation
|
||||
+ ", shortTitle=" + shortTitle + ", traceabilityFlag="
|
||||
+ traceabilityFlag + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
package org.gcube.datacatalogue.grsf_manage_widget.client;
|
||||
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.datacatalogue.grsf_manage_widget.server.manage.GenericResourceReaderExtras;
|
||||
|
||||
public class TestClass {
|
||||
|
||||
//@Test
|
||||
public void test() {
|
||||
ScopeProvider.instance.set("/gcube/devNext/NextNext");
|
||||
GenericResourceReaderExtras entries = new GenericResourceReaderExtras();
|
||||
System.out.println(entries.getLookedUpExtrasKeys());
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue