diff --git a/src/main/java/org/gcube/datacatalogue/grsf_manage_widget/client/view/ManageProductWidget.java b/src/main/java/org/gcube/datacatalogue/grsf_manage_widget/client/view/ManageProductWidget.java index 7a88860..12b5cbd 100644 --- a/src/main/java/org/gcube/datacatalogue/grsf_manage_widget/client/view/ManageProductWidget.java +++ b/src/main/java/org/gcube/datacatalogue/grsf_manage_widget/client/view/ManageProductWidget.java @@ -141,9 +141,9 @@ public class ManageProductWidget extends Composite{ bean = result; annotationArea.setText(""); infoBlock.setVisible(false); - nameTextArea.setText(bean.getProductName()); + nameTextArea.setText(bean.getItemTitle()); currentStatus.setText(bean.getCurrentStatus().toString()); - productType.setText(bean.getProductType()); + productType.setText(bean.getGrsfType()); List statusToShow = new ArrayList(STATUS); statusToShow.remove(bean.getCurrentStatus()); listBoxStatus.addItem("Select the new status"); diff --git a/src/main/java/org/gcube/datacatalogue/grsf_manage_widget/server/manage/GRSFNotificationService.java b/src/main/java/org/gcube/datacatalogue/grsf_manage_widget/server/manage/GRSFNotificationService.java index 94b32fd..e9e3f60 100644 --- a/src/main/java/org/gcube/datacatalogue/grsf_manage_widget/server/manage/GRSFNotificationService.java +++ b/src/main/java/org/gcube/datacatalogue/grsf_manage_widget/server/manage/GRSFNotificationService.java @@ -57,20 +57,22 @@ 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 SERVICE_POST_METHOD = "/service/updater/post"; 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 String STATUS_CUSTOM_FIELD_KEY = "Status"; private static final int MAX_TRIAL = 5; - public static final String GRSF_UPDATER_SERVICE = "GRSFUpdaterEndPoint"; - private static final String GRSF_ADMIN_ROLE = "GRSF-Admin"; - // request post fields + + // 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; @@ -84,6 +86,7 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS // session info for user public static final String GRSF_ADMIN_SESSION_KEY = "IS_GRSF_ADMIN"; + private static final String GRSF_ADMIN_ROLE = "GRSF-Admin"; /** * Instanciate the ckan util library. @@ -104,7 +107,6 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS return instance; } - @Override public String notifyProductUpdate(ManageProductBean bean) { @@ -160,8 +162,8 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS toReturn.setCatalogueIdentifier(productIdentifier); toReturn.setCurrentStatus(GRSFStatus.fromString(status)); toReturn.setKnowledgeBaseIdentifier(uuidKB); - toReturn.setProductName(title); - toReturn.setProductType(productType); + toReturn.setItemTitle(title); + toReturn.setGrsfType(productType); logger.info("Returning item bean " + toReturn); @@ -237,7 +239,7 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS JSONObject obj = new JSONObject(); obj.put(CATALOGUE_ID, bean.getCatalogueIdentifier()); obj.put(KB_ID, bean.getKnowledgeBaseIdentifier()); - obj.put(PRODUCT_TYPE, bean.getProductType().toLowerCase()); + obj.put(PRODUCT_TYPE, bean.getGrsfType().toLowerCase()); obj.put(STATUS, bean.getNewStatus().toString().toLowerCase()); String annotation = bean.getAnnotation(); @@ -430,6 +432,7 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS return httpServletRequest.getHeader(GCUBE_REQUEST_URL); } + /** * Retrieve the current scope by using the portal manager * @param b diff --git a/src/main/java/org/gcube/datacatalogue/grsf_manage_widget/shared/GRSFStatus.java b/src/main/java/org/gcube/datacatalogue/grsf_manage_widget/shared/GRSFStatus.java index da3e994..ce21d14 100644 --- a/src/main/java/org/gcube/datacatalogue/grsf_manage_widget/shared/GRSFStatus.java +++ b/src/main/java/org/gcube/datacatalogue/grsf_manage_widget/shared/GRSFStatus.java @@ -6,11 +6,12 @@ package org.gcube.datacatalogue.grsf_manage_widget.shared; */ public enum GRSFStatus { - APPROVED("Approved"), - REJECTED("Rejected"), - PENDING("Pending"), - ARCHIVED("Archived"), - HIDDEN("Hidden"); + Pending("Pending"), + Approved("Approved"), + Rejected("Rejected"), + Archived("Archived"), + Hidden("Hidden"), + Merged("Merged"); private String asString; diff --git a/src/main/java/org/gcube/datacatalogue/grsf_manage_widget/shared/ManageProductBean.java b/src/main/java/org/gcube/datacatalogue/grsf_manage_widget/shared/ManageProductBean.java index d2e9f43..301a78f 100644 --- a/src/main/java/org/gcube/datacatalogue/grsf_manage_widget/shared/ManageProductBean.java +++ b/src/main/java/org/gcube/datacatalogue/grsf_manage_widget/shared/ManageProductBean.java @@ -9,37 +9,54 @@ import java.io.Serializable; public class ManageProductBean implements Serializable{ private static final long serialVersionUID = -4882608487467259326L; - private String productName; + 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 + + // info that could change private GRSFStatus currentStatus; private GRSFStatus newStatus; - private String annotation; - private String productType; // fishery/stock + private String annotation; // added by the administrator public ManageProductBean() { super(); } /** - * @param productName + * @param itemTitle + * @param semanticId + * @param shortTitle * @param catalogueIdentifier * @param knowledgeBaseIdentifier - * @param statusOld + * @param type + * @param grsfType + * @param source + * @param currentStatus * @param newStatus * @param annotation */ - public ManageProductBean(String productName, String catalogueIdentifier, - String knowledgeBaseIdentifier, GRSFStatus currentStatus, GRSFStatus newStatus, - String annotation, String productType) { + public ManageProductBean(String itemTitle, String semanticId, + String shortTitle, String catalogueIdentifier, + String knowledgeBaseIdentifier, String type, String grsfType, + String source, GRSFStatus currentStatus, GRSFStatus newStatus, + String annotation) { super(); - this.productName = productName; + this.itemTitle = itemTitle; + this.semanticId = semanticId; + this.shortTitle = shortTitle; this.catalogueIdentifier = catalogueIdentifier; this.knowledgeBaseIdentifier = knowledgeBaseIdentifier; + this.type = type; + this.grsfType = grsfType; + this.source = source; this.currentStatus = currentStatus; this.newStatus = newStatus; this.annotation = annotation; - this.productType = productType; } public String getCatalogueIdentifier() { @@ -81,30 +98,63 @@ public class ManageProductBean implements Serializable{ this.annotation = annotation; } - public String getProductName() { - return productName; + public String getItemTitle() { + return itemTitle; } - public void setProductName(String productName) { - this.productName = productName; + public void setItemTitle(String itemTitle) { + this.itemTitle = itemTitle; } - public String getProductType() { - return productType; + public String getType() { + return type; } - public void setProductType(String productType) { - this.productType = productType; + public void setType(String type) { + this.type = type; + } + + public String getGrsfType() { + return grsfType; + } + + public void setGrsfType(String grsfType) { + this.grsfType = grsfType; + } + + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + + public String getSemanticId() { + return semanticId; + } + + public void setSemanticId(String semanticId) { + this.semanticId = semanticId; + } + + public String getShortTitle() { + return shortTitle; + } + + public void setShortTitle(String shortTitle) { + this.shortTitle = shortTitle; } @Override public String toString() { - return "ManageProductBean [productName=" + productName + return "ManageProductBean [itemTitle=" + itemTitle + ", semanticId=" + + semanticId + ", shortTitle=" + shortTitle + ", catalogueIdentifier=" + catalogueIdentifier + ", knowledgeBaseIdentifier=" + knowledgeBaseIdentifier - + ", currentStatus=" + currentStatus + ", newStatus=" - + newStatus + ", annotation=" + annotation + ", productType=" - + productType + "]"; + + ", type=" + type + ", grsfType=" + grsfType + ", source=" + + source + ", currentStatus=" + currentStatus + ", newStatus=" + + newStatus + ", annotation=" + annotation + "]"; } }