Started implementing some features reported in ticket #6967
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/widgets/grsf-manage-widget@142722 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
e5c98eebb8
commit
d3d96333d4
|
@ -141,9 +141,9 @@ public class ManageProductWidget extends Composite{
|
||||||
bean = result;
|
bean = result;
|
||||||
annotationArea.setText("");
|
annotationArea.setText("");
|
||||||
infoBlock.setVisible(false);
|
infoBlock.setVisible(false);
|
||||||
nameTextArea.setText(bean.getProductName());
|
nameTextArea.setText(bean.getItemTitle());
|
||||||
currentStatus.setText(bean.getCurrentStatus().toString());
|
currentStatus.setText(bean.getCurrentStatus().toString());
|
||||||
productType.setText(bean.getProductType());
|
productType.setText(bean.getGrsfType());
|
||||||
List<GRSFStatus> statusToShow = new ArrayList<GRSFStatus>(STATUS);
|
List<GRSFStatus> statusToShow = new ArrayList<GRSFStatus>(STATUS);
|
||||||
statusToShow.remove(bean.getCurrentStatus());
|
statusToShow.remove(bean.getCurrentStatus());
|
||||||
listBoxStatus.addItem("Select the new status");
|
listBoxStatus.addItem("Select the new status");
|
||||||
|
|
|
@ -57,20 +57,22 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
|
||||||
|
|
||||||
private static final long serialVersionUID = -4534905087994875893L;
|
private static final long serialVersionUID = -4534905087994875893L;
|
||||||
private static final Log logger = LogFactoryUtil.getLog(GRSFNotificationService.class);
|
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 String ANNOTATION_KEY = "Annotation on update";
|
||||||
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
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 String STATUS_CUSTOM_FIELD_KEY = "Status";
|
||||||
private static final int MAX_TRIAL = 5;
|
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 FORTH Service
|
||||||
// request post fields
|
|
||||||
private static final String CATALOGUE_ID = "catalog_id";
|
private static final String CATALOGUE_ID = "catalog_id";
|
||||||
private static final String KB_ID = "record_id";
|
private static final String KB_ID = "record_id";
|
||||||
private static final String PRODUCT_TYPE = "type";
|
private static final String PRODUCT_TYPE = "type";
|
||||||
private static final String STATUS = "status";
|
private static final String STATUS = "status";
|
||||||
private static final String ANNOTATION = "annotation_msg";
|
private static final String ANNOTATION = "annotation_msg";
|
||||||
private static final String ERROR = "error";
|
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
|
// the error of the update on success
|
||||||
private static final int STATUS_SUCCESS = 200;
|
private static final int STATUS_SUCCESS = 200;
|
||||||
|
@ -84,6 +86,7 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
|
||||||
|
|
||||||
// session info for user
|
// session info for user
|
||||||
public static final String GRSF_ADMIN_SESSION_KEY = "IS_GRSF_ADMIN";
|
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.
|
* Instanciate the ckan util library.
|
||||||
|
@ -104,7 +107,6 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String notifyProductUpdate(ManageProductBean bean) {
|
public String notifyProductUpdate(ManageProductBean bean) {
|
||||||
|
|
||||||
|
@ -160,8 +162,8 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
|
||||||
toReturn.setCatalogueIdentifier(productIdentifier);
|
toReturn.setCatalogueIdentifier(productIdentifier);
|
||||||
toReturn.setCurrentStatus(GRSFStatus.fromString(status));
|
toReturn.setCurrentStatus(GRSFStatus.fromString(status));
|
||||||
toReturn.setKnowledgeBaseIdentifier(uuidKB);
|
toReturn.setKnowledgeBaseIdentifier(uuidKB);
|
||||||
toReturn.setProductName(title);
|
toReturn.setItemTitle(title);
|
||||||
toReturn.setProductType(productType);
|
toReturn.setGrsfType(productType);
|
||||||
|
|
||||||
logger.info("Returning item bean " + toReturn);
|
logger.info("Returning item bean " + toReturn);
|
||||||
|
|
||||||
|
@ -237,7 +239,7 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
|
||||||
JSONObject obj = new JSONObject();
|
JSONObject obj = new JSONObject();
|
||||||
obj.put(CATALOGUE_ID, bean.getCatalogueIdentifier());
|
obj.put(CATALOGUE_ID, bean.getCatalogueIdentifier());
|
||||||
obj.put(KB_ID, bean.getKnowledgeBaseIdentifier());
|
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());
|
obj.put(STATUS, bean.getNewStatus().toString().toLowerCase());
|
||||||
|
|
||||||
String annotation = bean.getAnnotation();
|
String annotation = bean.getAnnotation();
|
||||||
|
@ -430,6 +432,7 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
|
||||||
|
|
||||||
return httpServletRequest.getHeader(GCUBE_REQUEST_URL);
|
return httpServletRequest.getHeader(GCUBE_REQUEST_URL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the current scope by using the portal manager
|
* Retrieve the current scope by using the portal manager
|
||||||
* @param b
|
* @param b
|
||||||
|
|
|
@ -6,11 +6,12 @@ package org.gcube.datacatalogue.grsf_manage_widget.shared;
|
||||||
*/
|
*/
|
||||||
public enum GRSFStatus {
|
public enum GRSFStatus {
|
||||||
|
|
||||||
APPROVED("Approved"),
|
Pending("Pending"),
|
||||||
REJECTED("Rejected"),
|
Approved("Approved"),
|
||||||
PENDING("Pending"),
|
Rejected("Rejected"),
|
||||||
ARCHIVED("Archived"),
|
Archived("Archived"),
|
||||||
HIDDEN("Hidden");
|
Hidden("Hidden"),
|
||||||
|
Merged("Merged");
|
||||||
|
|
||||||
private String asString;
|
private String asString;
|
||||||
|
|
||||||
|
|
|
@ -9,37 +9,54 @@ import java.io.Serializable;
|
||||||
public class ManageProductBean implements Serializable{
|
public class ManageProductBean implements Serializable{
|
||||||
|
|
||||||
private static final long serialVersionUID = -4882608487467259326L;
|
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 catalogueIdentifier;
|
||||||
private String knowledgeBaseIdentifier;
|
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 currentStatus;
|
||||||
private GRSFStatus newStatus;
|
private GRSFStatus newStatus;
|
||||||
private String annotation;
|
private String annotation; // added by the administrator
|
||||||
private String productType; // fishery/stock
|
|
||||||
|
|
||||||
public ManageProductBean() {
|
public ManageProductBean() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param productName
|
* @param itemTitle
|
||||||
|
* @param semanticId
|
||||||
|
* @param shortTitle
|
||||||
* @param catalogueIdentifier
|
* @param catalogueIdentifier
|
||||||
* @param knowledgeBaseIdentifier
|
* @param knowledgeBaseIdentifier
|
||||||
* @param statusOld
|
* @param type
|
||||||
|
* @param grsfType
|
||||||
|
* @param source
|
||||||
|
* @param currentStatus
|
||||||
* @param newStatus
|
* @param newStatus
|
||||||
* @param annotation
|
* @param annotation
|
||||||
*/
|
*/
|
||||||
public ManageProductBean(String productName, String catalogueIdentifier,
|
public ManageProductBean(String itemTitle, String semanticId,
|
||||||
String knowledgeBaseIdentifier, GRSFStatus currentStatus, GRSFStatus newStatus,
|
String shortTitle, String catalogueIdentifier,
|
||||||
String annotation, String productType) {
|
String knowledgeBaseIdentifier, String type, String grsfType,
|
||||||
|
String source, GRSFStatus currentStatus, GRSFStatus newStatus,
|
||||||
|
String annotation) {
|
||||||
super();
|
super();
|
||||||
this.productName = productName;
|
this.itemTitle = itemTitle;
|
||||||
|
this.semanticId = semanticId;
|
||||||
|
this.shortTitle = shortTitle;
|
||||||
this.catalogueIdentifier = catalogueIdentifier;
|
this.catalogueIdentifier = catalogueIdentifier;
|
||||||
this.knowledgeBaseIdentifier = knowledgeBaseIdentifier;
|
this.knowledgeBaseIdentifier = knowledgeBaseIdentifier;
|
||||||
|
this.type = type;
|
||||||
|
this.grsfType = grsfType;
|
||||||
|
this.source = source;
|
||||||
this.currentStatus = currentStatus;
|
this.currentStatus = currentStatus;
|
||||||
this.newStatus = newStatus;
|
this.newStatus = newStatus;
|
||||||
this.annotation = annotation;
|
this.annotation = annotation;
|
||||||
this.productType = productType;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCatalogueIdentifier() {
|
public String getCatalogueIdentifier() {
|
||||||
|
@ -81,30 +98,63 @@ public class ManageProductBean implements Serializable{
|
||||||
this.annotation = annotation;
|
this.annotation = annotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getProductName() {
|
public String getItemTitle() {
|
||||||
return productName;
|
return itemTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProductName(String productName) {
|
public void setItemTitle(String itemTitle) {
|
||||||
this.productName = productName;
|
this.itemTitle = itemTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getProductType() {
|
public String getType() {
|
||||||
return productType;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProductType(String productType) {
|
public void setType(String type) {
|
||||||
this.productType = productType;
|
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
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ManageProductBean [productName=" + productName
|
return "ManageProductBean [itemTitle=" + itemTitle + ", semanticId="
|
||||||
|
+ semanticId + ", shortTitle=" + shortTitle
|
||||||
+ ", catalogueIdentifier=" + catalogueIdentifier
|
+ ", catalogueIdentifier=" + catalogueIdentifier
|
||||||
+ ", knowledgeBaseIdentifier=" + knowledgeBaseIdentifier
|
+ ", knowledgeBaseIdentifier=" + knowledgeBaseIdentifier
|
||||||
+ ", currentStatus=" + currentStatus + ", newStatus="
|
+ ", type=" + type + ", grsfType=" + grsfType + ", source="
|
||||||
+ newStatus + ", annotation=" + annotation + ", productType="
|
+ source + ", currentStatus=" + currentStatus + ", newStatus="
|
||||||
+ productType + "]";
|
+ newStatus + ", annotation=" + annotation + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue