git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/widgets/grsf-manage-widget@157754 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
a6719f7c44
commit
c312c1dbbb
|
@ -7,9 +7,9 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import org.gcube.datacatalogue.common.enums.Status;
|
||||||
import org.gcube.datacatalogue.grsf_manage_widget.client.GRSFManageWidgetService;
|
import org.gcube.datacatalogue.grsf_manage_widget.client.GRSFManageWidgetService;
|
||||||
import org.gcube.datacatalogue.grsf_manage_widget.client.GRSFManageWidgetServiceAsync;
|
import org.gcube.datacatalogue.grsf_manage_widget.client.GRSFManageWidgetServiceAsync;
|
||||||
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.ManageProductBean;
|
||||||
import org.gcube.datacatalogue.grsf_manage_widget.shared.ex.NoGRSFRecordException;
|
import org.gcube.datacatalogue.grsf_manage_widget.shared.ex.NoGRSFRecordException;
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ public class ManageProductWidget extends Composite{
|
||||||
Image loadingImage;
|
Image loadingImage;
|
||||||
|
|
||||||
public static final String LOADING_IMAGE_URL = GWT.getModuleBaseURL() + "../images/loader.gif";
|
public static final String LOADING_IMAGE_URL = GWT.getModuleBaseURL() + "../images/loader.gif";
|
||||||
private final static List<GRSFStatus> STATUS = new ArrayList<GRSFStatus>(Arrays.asList(GRSFStatus.values()));
|
private final static List<Status> STATUS = new ArrayList<Status>(Arrays.asList(Status.values()));
|
||||||
private final static String STATUS_UPDATE_SUCCESS = "The item has been correctly updated. Thanks for your collaboration!";
|
private final static String STATUS_UPDATE_SUCCESS = "The item has been correctly updated. Thanks for your collaboration!";
|
||||||
private final static String STATUS_UPDATE_ERROR = "Sorry, there was a problem while trying to update the status of this item";
|
private final static String STATUS_UPDATE_ERROR = "Sorry, there was a problem while trying to update the status of this item";
|
||||||
protected static final String ERROR_ON_RETRIEVING_BEAN = "It seems there was a problem while contacting the service...";
|
protected static final String ERROR_ON_RETRIEVING_BEAN = "It seems there was a problem while contacting the service...";
|
||||||
|
@ -176,16 +176,16 @@ public class ManageProductWidget extends Composite{
|
||||||
if(bean.getExtrasIfAvailable() != null && !bean.getExtrasIfAvailable().isEmpty())
|
if(bean.getExtrasIfAvailable() != null && !bean.getExtrasIfAvailable().isEmpty())
|
||||||
addExtrasAfter(bean, productGrsfTypeGroup);
|
addExtrasAfter(bean, productGrsfTypeGroup);
|
||||||
|
|
||||||
List<GRSFStatus> statusToShow = new ArrayList<GRSFStatus>(STATUS);
|
List<Status> statusToShow = new ArrayList<Status>(STATUS);
|
||||||
statusToShow.remove(bean.getCurrentStatus());
|
statusToShow.remove(bean.getCurrentStatus());
|
||||||
|
|
||||||
// if the record isn't approved, then remove also archived
|
// if the record isn't approved, then remove also archived
|
||||||
if(!bean.getCurrentStatus().equals(GRSFStatus.Approved))
|
if(!bean.getCurrentStatus().equals(Status.Approved))
|
||||||
statusToShow.remove(GRSFStatus.Archived);
|
statusToShow.remove(Status.Archived);
|
||||||
|
|
||||||
listBoxStatus.addItem("Select the new status");
|
listBoxStatus.addItem("Select the new status");
|
||||||
listBoxStatus.getElement().<SelectElement>cast().getOptions().getItem(0).setDisabled(true);
|
listBoxStatus.getElement().<SelectElement>cast().getOptions().getItem(0).setDisabled(true);
|
||||||
for (GRSFStatus availableStatus : statusToShow) {
|
for (Status availableStatus : statusToShow) {
|
||||||
listBoxStatus.addItem(availableStatus.toString());
|
listBoxStatus.addItem(availableStatus.toString());
|
||||||
}
|
}
|
||||||
listBoxStatus.setSelectedIndex(0);
|
listBoxStatus.setSelectedIndex(0);
|
||||||
|
@ -288,7 +288,7 @@ public class ManageProductWidget extends Composite{
|
||||||
|
|
||||||
// set new values
|
// set new values
|
||||||
bean.setAnnotation(new HTML(annotationArea.getText().trim()).getText());
|
bean.setAnnotation(new HTML(annotationArea.getText().trim()).getText());
|
||||||
bean.setNewStatus(GRSFStatus.fromString(listBoxStatus.getSelectedItemText()));
|
bean.setNewStatus(Status.fromString(listBoxStatus.getSelectedItemText()));
|
||||||
|
|
||||||
service.notifyProductUpdate(bean, new AsyncCallback<String>() {
|
service.notifyProductUpdate(bean, new AsyncCallback<String>() {
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@ package org.gcube.datacatalogue.grsf_manage_widget.shared;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.gcube.datacatalogue.common.enums.Status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The bean to be managed by some people (e.g., GRSF).
|
* The bean to be managed by some people (e.g., GRSF).
|
||||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||||
|
@ -18,8 +20,8 @@ public class ManageProductBean implements Serializable{
|
||||||
private String sources; // sources for this record
|
private String sources; // sources for this record
|
||||||
private String grsfName; // Fishery name or stock name
|
private String grsfName; // Fishery name or stock name
|
||||||
private boolean traceabilityFlag; //from false to true etc
|
private boolean traceabilityFlag; //from false to true etc
|
||||||
private GRSFStatus currentStatus;
|
private Status currentStatus;
|
||||||
private GRSFStatus newStatus;
|
private Status newStatus;
|
||||||
private String annotation; // added by the administrator
|
private String annotation; // added by the administrator
|
||||||
private String shortName;
|
private String shortName;
|
||||||
private Map<String, String> extrasIfAvailable; // read from GRSFManageEntries resource
|
private Map<String, String> extrasIfAvailable; // read from GRSFManageEntries resource
|
||||||
|
@ -46,7 +48,7 @@ public class ManageProductBean implements Serializable{
|
||||||
public ManageProductBean(String semanticId, String catalogueIdentifier,
|
public ManageProductBean(String semanticId, String catalogueIdentifier,
|
||||||
String knowledgeBaseIdentifier, String grsfType, String grsfDomain,
|
String knowledgeBaseIdentifier, String grsfType, String grsfDomain,
|
||||||
String sources, String grsfName, boolean traceabilityFlag,
|
String sources, String grsfName, boolean traceabilityFlag,
|
||||||
GRSFStatus currentStatus, GRSFStatus newStatus, String annotation,
|
Status currentStatus, Status newStatus, String annotation,
|
||||||
String shortName, Map<String, String> extrasIfAvailable) {
|
String shortName, Map<String, String> extrasIfAvailable) {
|
||||||
super();
|
super();
|
||||||
this.semanticId = semanticId;
|
this.semanticId = semanticId;
|
||||||
|
@ -128,19 +130,19 @@ public class ManageProductBean implements Serializable{
|
||||||
this.extrasIfAvailable = extrasIfAvailable;
|
this.extrasIfAvailable = extrasIfAvailable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GRSFStatus getCurrentStatus() {
|
public Status getCurrentStatus() {
|
||||||
return currentStatus;
|
return currentStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCurrentStatus(GRSFStatus currentStatus) {
|
public void setCurrentStatus(Status currentStatus) {
|
||||||
this.currentStatus = currentStatus;
|
this.currentStatus = currentStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GRSFStatus getNewStatus() {
|
public Status getNewStatus() {
|
||||||
return newStatus;
|
return newStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNewStatus(GRSFStatus newStatus) {
|
public void setNewStatus(Status newStatus) {
|
||||||
this.newStatus = newStatus;
|
this.newStatus = newStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,7 @@ package org.gcube.datacatalogue.grsf_manage_widget.shared.ex;
|
||||||
/**
|
/**
|
||||||
* This is thrown when the Manage product is pushed on a product that has
|
* This is thrown when the Manage product is pushed on a product that has
|
||||||
* a Record Type field of Source or none.
|
* a Record Type field of Source or none.
|
||||||
* @author Costantino Perciante at ISTI-CNR
|
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||||
* (costantino.perciante@isti.cnr.it)
|
|
||||||
*/
|
*/
|
||||||
public class NoGRSFRecordException extends Exception {
|
public class NoGRSFRecordException extends Exception {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue