needs to be finished.. preparing for release 4.8
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/widgets/grsf-manage-widget@158344 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
c21a7b1fbc
commit
e54d2c1a4f
|
@ -11,7 +11,13 @@ 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.client.events.HideManagementPanelEvent;
|
import org.gcube.datacatalogue.grsf_manage_widget.client.events.HideManagementPanelEvent;
|
||||||
|
import org.gcube.datacatalogue.grsf_manage_widget.client.view.subwidgets.ConnectToWidget;
|
||||||
|
import org.gcube.datacatalogue.grsf_manage_widget.client.view.subwidgets.FormEntryModel;
|
||||||
|
import org.gcube.datacatalogue.grsf_manage_widget.client.view.subwidgets.SimilarGRSFRecordWidget;
|
||||||
|
import org.gcube.datacatalogue.grsf_manage_widget.client.view.subwidgets.SourceWidget;
|
||||||
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.SimilarGRSFRecord;
|
||||||
|
import org.gcube.datacatalogue.grsf_manage_widget.shared.SourceRecord;
|
||||||
import org.gcube.datacatalogue.grsf_manage_widget.shared.ex.NoGRSFRecordException;
|
import org.gcube.datacatalogue.grsf_manage_widget.shared.ex.NoGRSFRecordException;
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.AlertBlock;
|
import com.github.gwtbootstrap.client.ui.AlertBlock;
|
||||||
|
@ -37,8 +43,14 @@ import com.google.gwt.uibinder.client.UiHandler;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.google.gwt.user.client.ui.Composite;
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
import com.google.gwt.user.client.ui.HTML;
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
|
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Management widget main panel.
|
||||||
|
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||||
|
*/
|
||||||
public class ManageProductWidget extends Composite{
|
public class ManageProductWidget extends Composite{
|
||||||
|
|
||||||
private static GRSFManageWidgetServiceAsync service = GWT.create(GRSFManageWidgetService.class);
|
private static GRSFManageWidgetServiceAsync service = GWT.create(GRSFManageWidgetService.class);
|
||||||
|
@ -61,18 +73,24 @@ public class ManageProductWidget extends Composite{
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
TextBox productGrsfType;
|
TextBox productGrsfType;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
CheckBox traceabilityFlag;
|
CheckBox traceabilityFlag;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
TextArea GRSFNameTexBox;
|
TextArea GRSFNameTexBox;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
TextArea semanticIdentifierTextBox;
|
TextArea semanticIdentifierTextBox;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
TextBox sources;
|
VerticalPanel panelForSourceItems;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
VerticalPanel panelForSimilarGRSFRecords;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
VerticalPanel panelForConnectOtherRecords;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
TextBox currentStatus;
|
TextBox currentStatus;
|
||||||
|
@ -108,7 +126,8 @@ 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<Status> STATUS = new ArrayList<Status>(Arrays.asList(Status.values()));
|
|
||||||
|
// messages used here and there
|
||||||
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...";
|
||||||
|
@ -116,31 +135,47 @@ public class ManageProductWidget extends Composite{
|
||||||
|
|
||||||
protected static final String NO_ADMIN_ROLE = "Sorry but it seems you do not have the rights to manage items."
|
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 with this";
|
+ " You are suggested to contact the VRE Manager if something is wrong with this";
|
||||||
private ManageProductBean bean;
|
|
||||||
|
|
||||||
|
// event bus shared with the portlet
|
||||||
private HandlerManager eventBus = null;
|
private HandlerManager eventBus = null;
|
||||||
|
|
||||||
|
// the objects to be managed
|
||||||
|
private ManageProductBean bean;
|
||||||
|
private final static List<Status> STATUS = new ArrayList<Status>(Arrays.asList(Status.values()));
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build a ManageProduct widget for the product with the specified id.
|
||||||
|
* @param productIdentifier
|
||||||
|
* @param eventBus
|
||||||
|
*/
|
||||||
public ManageProductWidget(String productIdentifier, HandlerManager eventBus) {
|
public ManageProductWidget(String productIdentifier, HandlerManager eventBus) {
|
||||||
initWidget(uiBinder.createAndBindUi(this));
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
|
|
||||||
if(productIdentifier == null || productIdentifier.isEmpty()){
|
|
||||||
GWT.log("The received item identifier is null..");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
GWT.log("item identifier is " + productIdentifier);
|
GWT.log("item identifier is " + productIdentifier);
|
||||||
|
|
||||||
|
if(productIdentifier == null || productIdentifier.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
// start loader service
|
// start loader service
|
||||||
loadingImage.setUrl(LOADING_IMAGE_URL);
|
loadingImage.setUrl(LOADING_IMAGE_URL);
|
||||||
loadingImage.setVisible(true);
|
loadingImage.setVisible(true);
|
||||||
formUpdate.setVisible(false);
|
formUpdate.setVisible(false);
|
||||||
|
|
||||||
|
// show modal
|
||||||
manageProductModal.show();
|
manageProductModal.show();
|
||||||
|
manageProductModal.setWidth("50%");
|
||||||
|
|
||||||
// async request to fetch the product
|
// async request to fetch the product
|
||||||
retrieveProductBean(productIdentifier);
|
retrieveProductBean(productIdentifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Actually builds the widget... asks for details about the record
|
||||||
|
* @param productIdentifier
|
||||||
|
*/
|
||||||
private void retrieveProductBean(final String productIdentifier) {
|
private void retrieveProductBean(final String productIdentifier) {
|
||||||
|
|
||||||
// check if it is an administrator
|
// check if it is an administrator
|
||||||
|
@ -157,9 +192,10 @@ public class ManageProductWidget extends Composite{
|
||||||
formUpdate.setVisible(false);
|
formUpdate.setVisible(false);
|
||||||
confirmButton.setEnabled(false);
|
confirmButton.setEnabled(false);
|
||||||
loadingImage.setVisible(false);
|
loadingImage.setVisible(false);
|
||||||
|
|
||||||
// ask to hide management panel
|
// ask to hide management panel
|
||||||
eventBus.fireEvent(new HideManagementPanelEvent());
|
if(eventBus != null)
|
||||||
|
eventBus.fireEvent(new HideManagementPanelEvent());
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
service.getProductBeanById(productIdentifier, new AsyncCallback<ManageProductBean>() {
|
service.getProductBeanById(productIdentifier, new AsyncCallback<ManageProductBean>() {
|
||||||
|
@ -167,41 +203,54 @@ public class ManageProductWidget extends Composite{
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(ManageProductBean result) {
|
public void onSuccess(ManageProductBean result) {
|
||||||
|
|
||||||
if(result != null){
|
if(result == null){
|
||||||
|
showInfo(ERROR_ON_RETRIEVING_BEAN, AlertType.ERROR);
|
||||||
|
formUpdate.setVisible(false);
|
||||||
|
confirmButton.setEnabled(false);
|
||||||
|
}else{
|
||||||
bean = result;
|
bean = result;
|
||||||
annotationArea.setText("");
|
|
||||||
infoBlock.setVisible(false);
|
infoBlock.setVisible(false);
|
||||||
formUpdate.setVisible(true);
|
|
||||||
shortNameTextBox.setText(bean.getShortName());
|
// top: more or less fixed information
|
||||||
currentStatus.setText(bean.getCurrentStatus().toString());
|
|
||||||
productGrsfType.setText(bean.getGrsfType());
|
|
||||||
GRSFNameTexBox.setText(bean.getGrsfName());
|
GRSFNameTexBox.setText(bean.getGrsfName());
|
||||||
semanticIdentifierTextBox.setText(bean.getSemanticId());
|
shortNameTextBox.setText(bean.getShortName());
|
||||||
sources.setText(bean.getSources());
|
semanticIdentifierTextBox.setText(bean.getSemanticIdentifier());
|
||||||
|
productGrsfType.setText(bean.getGrsfType());
|
||||||
|
currentStatus.setText(bean.getCurrentStatus().toString());
|
||||||
traceabilityFlag.setValue(bean.isTraceabilityFlag());
|
traceabilityFlag.setValue(bean.isTraceabilityFlag());
|
||||||
|
traceabilityFlag.setTitle("Current value for the record is " + bean.isTraceabilityFlag());
|
||||||
|
|
||||||
|
// manage sources
|
||||||
|
List<SourceRecord> availableSources = bean.getSources();
|
||||||
|
panelForSourceItems.add(new SourceWidget(availableSources));
|
||||||
|
|
||||||
|
// manage similar GRSF records, if any
|
||||||
|
List<SimilarGRSFRecord> availableGRSFSimilarRecords = bean.getSimilarGrsfRecords();
|
||||||
|
panelForSimilarGRSFRecords.add(new SimilarGRSFRecordWidget(availableGRSFSimilarRecords));
|
||||||
|
|
||||||
|
// prepare "connect" panel
|
||||||
|
panelForConnectOtherRecords.add(new ConnectToWidget());
|
||||||
|
|
||||||
// check if we need to show more
|
// check if we need to show more
|
||||||
if(bean.getExtrasIfAvailable() != null && !bean.getExtrasIfAvailable().isEmpty())
|
if(bean.getExtrasIfAvailable() != null && !bean.getExtrasIfAvailable().isEmpty())
|
||||||
addExtrasAfter(bean, productGrsfTypeGroup);
|
addExtrasAfter(bean, productGrsfTypeGroup);
|
||||||
|
|
||||||
|
// check for new status box
|
||||||
List<Status> statusToShow = new ArrayList<Status>(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(Status.Approved))
|
if(!bean.getCurrentStatus().equals(Status.Approved))
|
||||||
statusToShow.remove(Status.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 (Status availableStatus : statusToShow) {
|
for (Status availableStatus : statusToShow) {
|
||||||
listBoxStatus.addItem(availableStatus.toString());
|
listBoxStatus.addItem(availableStatus.toString());
|
||||||
}
|
}
|
||||||
listBoxStatus.setSelectedIndex(0);
|
listBoxStatus.setSelectedIndex(0);
|
||||||
}
|
|
||||||
else{
|
formUpdate.setVisible(true);
|
||||||
showInfo(ERROR_ON_RETRIEVING_BEAN, AlertType.ERROR);
|
|
||||||
formUpdate.setVisible(false);
|
|
||||||
confirmButton.setEnabled(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
loadingImage.setVisible(false);
|
loadingImage.setVisible(false);
|
||||||
|
@ -263,17 +312,9 @@ public class ManageProductWidget extends Composite{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@UiHandler("cancelButton")
|
|
||||||
void onCancelButton(ClickEvent ce){
|
|
||||||
manageProductModal.hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
@UiHandler("confirmButton")
|
@UiHandler("confirmButton")
|
||||||
void onSaveButton(ClickEvent ce){
|
void onSaveButton(ClickEvent ce){
|
||||||
|
|
||||||
if(bean == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
listBoxStatusGroup.setType(ControlGroupType.NONE);
|
listBoxStatusGroup.setType(ControlGroupType.NONE);
|
||||||
|
|
||||||
if(listBoxStatus.getSelectedIndex() <= 0){
|
if(listBoxStatus.getSelectedIndex() <= 0){
|
||||||
|
@ -330,6 +371,12 @@ public class ManageProductWidget extends Composite{
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@UiHandler("cancelButton")
|
||||||
|
void onCancelButton(ClickEvent ce){
|
||||||
|
// just hide the panel
|
||||||
|
manageProductModal.hide();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show information
|
* Show information
|
||||||
|
|
|
@ -34,13 +34,14 @@
|
||||||
</b:Controls>
|
</b:Controls>
|
||||||
</b:ControlGroup>
|
</b:ControlGroup>
|
||||||
|
|
||||||
|
<!-- SHORT NAME IS EDITABLE -->
|
||||||
<b:ControlGroup ui:field="productShortNameGroup">
|
<b:ControlGroup ui:field="productShortNameGroup">
|
||||||
<b:ControlLabel for="shortname" title="Short Name">
|
<b:ControlLabel for="shortname" title="Short Name">
|
||||||
<b>GRSF Short Name:</b>
|
<b>GRSF Short Name:</b>
|
||||||
</b:ControlLabel>
|
</b:ControlLabel>
|
||||||
<b:Controls>
|
<b:Controls>
|
||||||
<b:TextArea alternateSize="LARGE" placeholder="GRSF Short Name"
|
<b:TextArea alternateSize="LARGE" placeholder="GRSF Short Name"
|
||||||
visibleLines="2" readOnly="true" width="97%" b:id="shortname"
|
visibleLines="2" readOnly="false" width="97%" b:id="shortname"
|
||||||
title="GRSF Short Name" ui:field="shortNameTextBox" />
|
title="GRSF Short Name" ui:field="shortNameTextBox" />
|
||||||
</b:Controls>
|
</b:Controls>
|
||||||
</b:ControlGroup>
|
</b:ControlGroup>
|
||||||
|
@ -67,27 +68,6 @@
|
||||||
</b:Controls>
|
</b:Controls>
|
||||||
</b:ControlGroup>
|
</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%"
|
|
||||||
placeholder="Sources of the GRSF record" title="Sources"
|
|
||||||
readOnly="true" ui:field="sources"></b:TextBox>
|
|
||||||
</b:Controls>
|
|
||||||
</b:ControlGroup>
|
|
||||||
|
|
||||||
<b:ControlGroup ui:field="traceabilityFlagGroup">
|
|
||||||
<b:ControlLabel for="traceabilityflag" title="Traceability Flag">
|
|
||||||
<b>Traceability Flag:</b>
|
|
||||||
</b:ControlLabel>
|
|
||||||
<b:Controls>
|
|
||||||
<b:CheckBox b:id="traceabilityflag" title="Traceability Flag"
|
|
||||||
ui:field="traceabilityFlag"></b:CheckBox>
|
|
||||||
</b:Controls>
|
|
||||||
</b:ControlGroup>
|
|
||||||
|
|
||||||
<b:ControlGroup ui:field="currentStatusGroup">
|
<b:ControlGroup ui:field="currentStatusGroup">
|
||||||
<b:ControlLabel for="currentStatus"
|
<b:ControlLabel for="currentStatus"
|
||||||
title="The current status of this Item">
|
title="The current status of this Item">
|
||||||
|
@ -101,6 +81,36 @@
|
||||||
</b:Controls>
|
</b:Controls>
|
||||||
</b:ControlGroup>
|
</b:ControlGroup>
|
||||||
|
|
||||||
|
<b:ControlGroup ui:field="sourcesGroup">
|
||||||
|
<b:ControlLabel title="Sources">
|
||||||
|
<b>Source(s):</b>
|
||||||
|
</b:ControlLabel>
|
||||||
|
<b:Controls>
|
||||||
|
<g:VerticalPanel ui:field="panelForSourceItems">
|
||||||
|
</g:VerticalPanel>
|
||||||
|
</b:Controls>
|
||||||
|
</b:ControlGroup>
|
||||||
|
|
||||||
|
<b:ControlGroup ui:field="similarGRSFRecordGroup">
|
||||||
|
<b:ControlLabel title="Similar GRSF Records">
|
||||||
|
<b>Similar GRSF Records:</b>
|
||||||
|
</b:ControlLabel>
|
||||||
|
<b:Controls>
|
||||||
|
<g:VerticalPanel ui:field="panelForSimilarGRSFRecords">
|
||||||
|
</g:VerticalPanel>
|
||||||
|
</b:Controls>
|
||||||
|
</b:ControlGroup>
|
||||||
|
|
||||||
|
<b:ControlGroup ui:field="connectToOtherRecordsGroup">
|
||||||
|
<b:ControlLabel title="Connect to other Records">
|
||||||
|
<b>Suggest connections with other records:</b>
|
||||||
|
</b:ControlLabel>
|
||||||
|
<b:Controls>
|
||||||
|
<g:VerticalPanel ui:field="panelForConnectOtherRecords">
|
||||||
|
</g:VerticalPanel>
|
||||||
|
</b:Controls>
|
||||||
|
</b:ControlGroup>
|
||||||
|
|
||||||
<b:ControlGroup ui:field="listBoxStatusGroup">
|
<b:ControlGroup ui:field="listBoxStatusGroup">
|
||||||
<b:ControlLabel for="listboxStatus" title="The new status of this record">
|
<b:ControlLabel for="listboxStatus" title="The new status of this record">
|
||||||
<b>New Status:</b>
|
<b>New Status:</b>
|
||||||
|
@ -111,6 +121,16 @@
|
||||||
</b:Controls>
|
</b:Controls>
|
||||||
</b:ControlGroup>
|
</b:ControlGroup>
|
||||||
|
|
||||||
|
<b:ControlGroup ui:field="traceabilityFlagGroup">
|
||||||
|
<b:ControlLabel for="traceabilityflag" title="Traceability Flag">
|
||||||
|
<b>Traceability Flag:</b>
|
||||||
|
</b:ControlLabel>
|
||||||
|
<b:Controls>
|
||||||
|
<b:CheckBox b:id="traceabilityflag" title="Traceability Flag"
|
||||||
|
ui:field="traceabilityFlag"></b:CheckBox>
|
||||||
|
</b:Controls>
|
||||||
|
</b:ControlGroup>
|
||||||
|
|
||||||
<b:ControlGroup ui:field="annotationAreaGroup">
|
<b:ControlGroup ui:field="annotationAreaGroup">
|
||||||
<b:ControlLabel for="annotation"
|
<b:ControlLabel for="annotation"
|
||||||
title="An annotation message to send along the update">
|
title="An annotation message to send along the update">
|
||||||
|
@ -130,7 +150,7 @@
|
||||||
<b:Icon type="GEAR" spin="true" ui:field="loaderIcon"
|
<b:Icon type="GEAR" spin="true" ui:field="loaderIcon"
|
||||||
visible="false" />
|
visible="false" />
|
||||||
<b:Button ui:field="cancelButton">Cancel</b:Button>
|
<b:Button ui:field="cancelButton">Cancel</b:Button>
|
||||||
<b:Button icon="FILE" type="PRIMARY" ui:field="confirmButton">Apply</b:Button>
|
<b:Button icon="FILE" type="PRIMARY" ui:field="confirmButton">Confirm</b:Button>
|
||||||
</b:ModalFooter>
|
</b:ModalFooter>
|
||||||
</b:Modal>
|
</b:Modal>
|
||||||
</g:HTMLPanel>
|
</g:HTMLPanel>
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
package org.gcube.datacatalogue.grsf_manage_widget.client.view.subwidgets;
|
||||||
|
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.uibinder.client.UiBinder;
|
||||||
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
public class ConnectToWidget extends Composite{
|
||||||
|
|
||||||
|
private static ConnectToWidgetUiBinder uiBinder = GWT
|
||||||
|
.create(ConnectToWidgetUiBinder.class);
|
||||||
|
|
||||||
|
interface ConnectToWidgetUiBinder extends UiBinder<Widget, ConnectToWidget> {
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConnectToWidget() {
|
||||||
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConnectToWidget(String firstName) {
|
||||||
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||||
|
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||||
|
xmlns:g="urn:import:com.google.gwt.user.client.ui">
|
||||||
|
<ui:style>
|
||||||
|
.important {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
</ui:style>
|
||||||
|
<g:HTMLPanel>
|
||||||
|
<g:VerticalPanel ui:field="connectPanel"></g:VerticalPanel>
|
||||||
|
</g:HTMLPanel>
|
||||||
|
</ui:UiBinder>
|
|
@ -1,4 +1,4 @@
|
||||||
package org.gcube.datacatalogue.grsf_manage_widget.client.view;
|
package org.gcube.datacatalogue.grsf_manage_widget.client.view.subwidgets;
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.ControlLabel;
|
import com.github.gwtbootstrap.client.ui.ControlLabel;
|
||||||
import com.github.gwtbootstrap.client.ui.TextBox;
|
import com.github.gwtbootstrap.client.ui.TextBox;
|
|
@ -0,0 +1,237 @@
|
||||||
|
package org.gcube.datacatalogue.grsf_manage_widget.client.view.subwidgets;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.datacatalogue.grsf_manage_widget.shared.SimilarGRSFRecord;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.Button;
|
||||||
|
import com.github.gwtbootstrap.client.ui.CheckBox;
|
||||||
|
import com.github.gwtbootstrap.client.ui.ControlLabel;
|
||||||
|
import com.github.gwtbootstrap.client.ui.HelpBlock;
|
||||||
|
import com.github.gwtbootstrap.client.ui.Paragraph;
|
||||||
|
import com.github.gwtbootstrap.client.ui.TextBox;
|
||||||
|
import com.github.gwtbootstrap.client.ui.base.ComplexWidget;
|
||||||
|
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.dom.client.Style.Float;
|
||||||
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
|
import com.google.gwt.uibinder.client.UiBinder;
|
||||||
|
import com.google.gwt.uibinder.client.UiField;
|
||||||
|
import com.google.gwt.user.client.ui.Anchor;
|
||||||
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
|
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||||
|
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||||
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
public class SimilarGRSFRecordWidget extends Composite {
|
||||||
|
|
||||||
|
private static SimilarGRSFRecordWidgetUiBinder uiBinder = GWT
|
||||||
|
.create(SimilarGRSFRecordWidgetUiBinder.class);
|
||||||
|
|
||||||
|
interface SimilarGRSFRecordWidgetUiBinder extends
|
||||||
|
UiBinder<Widget, SimilarGRSFRecordWidget> {
|
||||||
|
}
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
VerticalPanel similarGrsfRecordsPanel;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
VerticalPanel similarGrsfRecordsSuggestedPanel;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
Button addSimilarRecord;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class of Pairs
|
||||||
|
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||||
|
*/
|
||||||
|
class Pair {
|
||||||
|
private SimilarGRSFRecord s;
|
||||||
|
private Widget w;
|
||||||
|
public Pair(SimilarGRSFRecord s, Widget w){
|
||||||
|
this.s = s;
|
||||||
|
this.w = w;
|
||||||
|
}
|
||||||
|
public SimilarGRSFRecord getS(){ return s; }
|
||||||
|
public Widget getW(){ return w; }
|
||||||
|
public void setS(SimilarGRSFRecord s){ this.s = s; }
|
||||||
|
public void setW(Widget w){ this.w = w; }
|
||||||
|
}
|
||||||
|
|
||||||
|
protected List<Pair> extraSimilarRecordsList = new ArrayList<Pair>(0);
|
||||||
|
private List<SimilarGRSFRecord> availableGRSFSimilarRecords;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get widget for available similar grsf records
|
||||||
|
* @param availableGRSFSimilarRecords
|
||||||
|
*/
|
||||||
|
public SimilarGRSFRecordWidget(List<SimilarGRSFRecord> availableGRSFSimilarRecords) {
|
||||||
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
|
|
||||||
|
this.availableGRSFSimilarRecords = availableGRSFSimilarRecords;
|
||||||
|
similarGrsfRecordsPanel.setWidth("100%");
|
||||||
|
similarGrsfRecordsSuggestedPanel.setWidth("100%");
|
||||||
|
|
||||||
|
// add the existing ones, if any
|
||||||
|
for (final SimilarGRSFRecord similarGRSFRecord : availableGRSFSimilarRecords) {
|
||||||
|
Widget widget = buildWidgetForSimilarRecord(similarGRSFRecord);
|
||||||
|
similarGrsfRecordsPanel.add(widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
// manage the "suggest button"
|
||||||
|
addSimilarRecord.setIcon(IconType.PLUS_SIGN);
|
||||||
|
addSimilarRecord.getElement().getStyle().setFloat(Float.RIGHT);
|
||||||
|
addSimilarRecord.setTitle("Suggest a Similar Record by using its GRSF UUID");
|
||||||
|
|
||||||
|
addSimilarRecord.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent arg0) {
|
||||||
|
|
||||||
|
Widget w = new Widget();
|
||||||
|
SimilarGRSFRecord s = new SimilarGRSFRecord(true);
|
||||||
|
buildWidgetForExtraSimilarRecord(w, s);
|
||||||
|
extraSimilarRecordsList.add(new Pair(s, w));
|
||||||
|
similarGrsfRecordsSuggestedPanel.add(w);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds widget for already present similar GRSF records
|
||||||
|
* @param similarGRSFRecord
|
||||||
|
* @return a Widget (actually a VerticalPanel)
|
||||||
|
*/
|
||||||
|
public static Widget buildWidgetForSimilarRecord(final SimilarGRSFRecord similarGRSFRecord){
|
||||||
|
|
||||||
|
VerticalPanel subPanel = new VerticalPanel();
|
||||||
|
Paragraph name = new Paragraph("Record name: " + similarGRSFRecord.getShortName());
|
||||||
|
subPanel.add(name);
|
||||||
|
if(similarGRSFRecord.getDescription() != null){
|
||||||
|
String shortDescrption = similarGRSFRecord.getDescription().length() > 30 ?
|
||||||
|
similarGRSFRecord.getDescription().substring(0, 30) + " ... " :
|
||||||
|
similarGRSFRecord.getDescription();
|
||||||
|
Paragraph description = new Paragraph(
|
||||||
|
"Description: " + shortDescrption);
|
||||||
|
description.setTitle("Description: " + similarGRSFRecord.getDescription());
|
||||||
|
subPanel.add(description);
|
||||||
|
}
|
||||||
|
Paragraph semanticIdentifier = new Paragraph("Semantic Identifier " +
|
||||||
|
similarGRSFRecord.getSemanticIdentifier());
|
||||||
|
subPanel.add(semanticIdentifier);
|
||||||
|
|
||||||
|
Anchor view = new Anchor();
|
||||||
|
view.setHref(similarGRSFRecord.getUrl());
|
||||||
|
view.setText("View");
|
||||||
|
view.setTarget("_blank");
|
||||||
|
subPanel.add(view);
|
||||||
|
subPanel.setWidth("100%");
|
||||||
|
|
||||||
|
// add merge checkbox
|
||||||
|
final CheckBox mergeSuggested = new CheckBox("Merge");
|
||||||
|
mergeSuggested.setValue(false);
|
||||||
|
|
||||||
|
mergeSuggested.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent arg0) {
|
||||||
|
|
||||||
|
similarGRSFRecord.setSuggestedMerge(mergeSuggested.getValue());
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
subPanel.add(mergeSuggested);
|
||||||
|
return subPanel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds up a widget for suggested similar grsf records. Changes are performed in place with respect to w and s.
|
||||||
|
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||||
|
* @param w the widget
|
||||||
|
* @param s the similar record.
|
||||||
|
*/
|
||||||
|
private void buildWidgetForExtraSimilarRecord(Widget w, final SimilarGRSFRecord s){
|
||||||
|
|
||||||
|
w = new HorizontalPanel();
|
||||||
|
w.setWidth("100%");
|
||||||
|
|
||||||
|
VerticalPanel vp = new VerticalPanel();
|
||||||
|
vp.setWidth("70%");
|
||||||
|
ControlLabel cLabel = new ControlLabel("Semantic Identifier");
|
||||||
|
TextBox box = new TextBox();
|
||||||
|
box.setPlaceholder("Insert the Semantic Identifier of the suggested record");
|
||||||
|
HelpBlock hb = new HelpBlock();
|
||||||
|
hb.setVisible(false);
|
||||||
|
|
||||||
|
// TODO add handler for remote GRSF semantic id check
|
||||||
|
|
||||||
|
vp.add(cLabel);
|
||||||
|
vp.add(box);
|
||||||
|
vp.add(hb);
|
||||||
|
|
||||||
|
// add merge checkbox
|
||||||
|
final CheckBox mergeSuggested = new CheckBox("Merge");
|
||||||
|
mergeSuggested.setValue(false);
|
||||||
|
|
||||||
|
mergeSuggested.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent arg0) {
|
||||||
|
|
||||||
|
s.setSuggestedMerge(mergeSuggested.getValue());
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
vp.add(mergeSuggested);
|
||||||
|
|
||||||
|
Button removeExtra = new Button();
|
||||||
|
removeExtra.setIcon(IconType.MINUS);
|
||||||
|
removeExtra.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent arg0) {
|
||||||
|
|
||||||
|
// remove this object from the pairs list
|
||||||
|
Iterator<Pair> iterator = extraSimilarRecordsList.iterator();
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
SimilarGRSFRecordWidget.Pair pair = (SimilarGRSFRecordWidget.Pair) iterator
|
||||||
|
.next();
|
||||||
|
if(pair.getS().equals(s)){
|
||||||
|
pair.getW().removeFromParent();
|
||||||
|
iterator.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
((ComplexWidget) w).add(vp);
|
||||||
|
((ComplexWidget) w).add(removeExtra);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the whole of similar records
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<SimilarGRSFRecord> getSuggestedRecords(){
|
||||||
|
|
||||||
|
if(availableGRSFSimilarRecords == null)
|
||||||
|
availableGRSFSimilarRecords = new ArrayList<SimilarGRSFRecord>();
|
||||||
|
|
||||||
|
|
||||||
|
for (Pair p : extraSimilarRecordsList) {
|
||||||
|
availableGRSFSimilarRecords.add(p.getS());
|
||||||
|
}
|
||||||
|
|
||||||
|
return availableGRSFSimilarRecords;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||||
|
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||||
|
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||||
|
|
||||||
|
<g:HTMLPanel width="100%">
|
||||||
|
<g:VerticalPanel ui:field="similarGrsfRecordsPanel"></g:VerticalPanel>
|
||||||
|
<g:VerticalPanel ui:field="similarGrsfRecordsSuggestedPanel"></g:VerticalPanel>
|
||||||
|
<b:Button ui:field="addSimilarRecord"></b:Button>
|
||||||
|
</g:HTMLPanel>
|
||||||
|
</ui:UiBinder>
|
|
@ -0,0 +1,55 @@
|
||||||
|
package org.gcube.datacatalogue.grsf_manage_widget.client.view.subwidgets;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.datacatalogue.grsf_manage_widget.shared.SourceRecord;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.Paragraph;
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.uibinder.client.UiBinder;
|
||||||
|
import com.google.gwt.uibinder.client.UiField;
|
||||||
|
import com.google.gwt.user.client.ui.Anchor;
|
||||||
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
|
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||||
|
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||||
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
public class SourceWidget extends Composite {
|
||||||
|
|
||||||
|
private static SourceWidgetUiBinder uiBinder = GWT
|
||||||
|
.create(SourceWidgetUiBinder.class);
|
||||||
|
|
||||||
|
interface SourceWidgetUiBinder extends UiBinder<Widget, SourceWidget> {
|
||||||
|
}
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
VerticalPanel sourcesInnerPanel;
|
||||||
|
|
||||||
|
public SourceWidget(List<SourceRecord> availableSources) {
|
||||||
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
|
|
||||||
|
int counter = 1;
|
||||||
|
sourcesInnerPanel.setWidth("90%");
|
||||||
|
for (SourceRecord sourceRecord : availableSources) {
|
||||||
|
|
||||||
|
VerticalPanel subPanel = new VerticalPanel();
|
||||||
|
String sourceNumber = "Source " + counter + ":";
|
||||||
|
String name = sourceRecord.getName();
|
||||||
|
Anchor url = new Anchor();
|
||||||
|
url.setHref(sourceRecord.getUrl());
|
||||||
|
url.setText("View");
|
||||||
|
url.setTarget("_blank");
|
||||||
|
subPanel.add(new Paragraph(sourceNumber));
|
||||||
|
HorizontalPanel hPanel = new HorizontalPanel();
|
||||||
|
hPanel.add(new Paragraph(name + " - "));
|
||||||
|
hPanel.add(url);
|
||||||
|
subPanel.add(hPanel);
|
||||||
|
subPanel.setWidth("100%");
|
||||||
|
sourcesInnerPanel.add(subPanel);
|
||||||
|
counter++;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||||
|
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||||
|
xmlns:g="urn:import:com.google.gwt.user.client.ui">
|
||||||
|
<ui:style>
|
||||||
|
.important {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
</ui:style>
|
||||||
|
<g:HTMLPanel>
|
||||||
|
<g:VerticalPanel ui:field="sourcesInnerPanel"></g:VerticalPanel>
|
||||||
|
</g:HTMLPanel>
|
||||||
|
</ui:UiBinder>
|
|
@ -19,7 +19,8 @@ public class ManageProductBean implements Serializable{
|
||||||
private String grsfType; // Fishery or Stock type (e.g., Assessment_Unit, Marine Resource and so on)
|
private String grsfType; // Fishery or Stock type (e.g., Assessment_Unit, Marine Resource and so on)
|
||||||
private String grsfDomain; // fishery/stock
|
private String grsfDomain; // fishery/stock
|
||||||
private String grsfName; // Fishery name or stock name
|
private String grsfName; // Fishery name or stock name
|
||||||
private String shortName;
|
private String shortName; // it is editable ...
|
||||||
|
private String shortNameUpdated;
|
||||||
private boolean traceabilityFlag; //from false to true etc
|
private boolean traceabilityFlag; //from false to true etc
|
||||||
private Status currentStatus;
|
private Status currentStatus;
|
||||||
private Status newStatus;
|
private Status newStatus;
|
||||||
|
@ -47,6 +48,7 @@ public class ManageProductBean implements Serializable{
|
||||||
this.grsfDomain = grsfDomain;
|
this.grsfDomain = grsfDomain;
|
||||||
this.grsfName = grsfName;
|
this.grsfName = grsfName;
|
||||||
this.shortName = shortName;
|
this.shortName = shortName;
|
||||||
|
this.shortNameUpdated = shortName;
|
||||||
this.traceabilityFlag = traceabilityFlag;
|
this.traceabilityFlag = traceabilityFlag;
|
||||||
this.currentStatus = currentStatus;
|
this.currentStatus = currentStatus;
|
||||||
this.newStatus = newStatus;
|
this.newStatus = newStatus;
|
||||||
|
@ -170,6 +172,14 @@ public class ManageProductBean implements Serializable{
|
||||||
this.shortName = shortName;
|
this.shortName = shortName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getShortNameUpdated() {
|
||||||
|
return shortNameUpdated;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShortNameUpdated(String shortNameUpdated) {
|
||||||
|
this.shortNameUpdated = shortNameUpdated;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ManageProductBean [semanticIdentifier=" + semanticIdentifier
|
return "ManageProductBean [semanticIdentifier=" + semanticIdentifier
|
||||||
|
@ -177,6 +187,7 @@ public class ManageProductBean implements Serializable{
|
||||||
+ ", knowledgeBaseIdentifier=" + knowledgeBaseIdentifier
|
+ ", knowledgeBaseIdentifier=" + knowledgeBaseIdentifier
|
||||||
+ ", grsfType=" + grsfType + ", grsfDomain=" + grsfDomain
|
+ ", grsfType=" + grsfType + ", grsfDomain=" + grsfDomain
|
||||||
+ ", grsfName=" + grsfName + ", shortName=" + shortName
|
+ ", grsfName=" + grsfName + ", shortName=" + shortName
|
||||||
|
+ ", shortNameUpdated=" + shortNameUpdated
|
||||||
+ ", traceabilityFlag=" + traceabilityFlag + ", currentStatus="
|
+ ", traceabilityFlag=" + traceabilityFlag + ", currentStatus="
|
||||||
+ currentStatus + ", newStatus=" + newStatus + ", annotation="
|
+ currentStatus + ", newStatus=" + newStatus + ", annotation="
|
||||||
+ annotation + ", extrasIfAvailable=" + extrasIfAvailable
|
+ annotation + ", extrasIfAvailable=" + extrasIfAvailable
|
||||||
|
|
|
@ -9,22 +9,28 @@ import org.json.simple.parser.ParseException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A similar grsf record
|
* A similar grsf record.
|
||||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||||
*/
|
*/
|
||||||
public class SimilarGRSFRecord implements Serializable{
|
public class SimilarGRSFRecord implements Serializable{
|
||||||
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 6501670015333073045L;
|
private static final long serialVersionUID = 6501670015333073045L;
|
||||||
private String description;
|
private String description;
|
||||||
private String semanticIdentifier;
|
private String semanticIdentifier;
|
||||||
private String shortName;
|
private String shortName;
|
||||||
private String url; // within the catalogue
|
private String url;
|
||||||
|
private boolean suggestedMerge;
|
||||||
|
private boolean isExtra;
|
||||||
|
|
||||||
public SimilarGRSFRecord() {
|
public SimilarGRSFRecord() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SimilarGRSFRecord(boolean isExtra) {
|
||||||
|
this.isExtra = isExtra;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param description
|
* @param description
|
||||||
* @param semanticIdentifier
|
* @param semanticIdentifier
|
||||||
|
@ -63,13 +69,39 @@ public class SimilarGRSFRecord implements Serializable{
|
||||||
public void setUrl(String url) {
|
public void setUrl(String url) {
|
||||||
this.url = url;
|
this.url = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSuggestedMerge() {
|
||||||
|
return suggestedMerge;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSuggestedMerge(boolean suggestedMerge) {
|
||||||
|
this.suggestedMerge = suggestedMerge;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isExtra() {
|
||||||
|
return isExtra;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExtra(boolean isExtra) {
|
||||||
|
this.isExtra = isExtra;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "SimilarGRSFRecord [description=" + description
|
return "SimilarGRSFRecord [description=" + description
|
||||||
+ ", semanticIdentifier=" + semanticIdentifier + ", shortName="
|
+ ", semanticIdentifier=" + semanticIdentifier + ", shortName="
|
||||||
+ shortName + ", url=" + url + "]";
|
+ shortName + ", url=" + url + ", suggestedMerge="
|
||||||
|
+ suggestedMerge + ", isExtra=" + isExtra + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a {@link SimilarGRSFRecord} from a json string
|
* Get a {@link SimilarGRSFRecord} from a json string
|
||||||
* @param json
|
* @param json
|
||||||
|
@ -77,20 +109,20 @@ public class SimilarGRSFRecord implements Serializable{
|
||||||
* @throws ParseException
|
* @throws ParseException
|
||||||
*/
|
*/
|
||||||
public static SimilarGRSFRecord fromJson(String json) throws ParseException{
|
public static SimilarGRSFRecord fromJson(String json) throws ParseException{
|
||||||
|
|
||||||
if(json == null)
|
if(json == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
JSONParser parser = new JSONParser();
|
JSONParser parser = new JSONParser();
|
||||||
JSONObject object = (JSONObject)parser.parse(json);
|
JSONObject object = (JSONObject)parser.parse(json);
|
||||||
|
|
||||||
return new SimilarGRSFRecord(
|
return new SimilarGRSFRecord(
|
||||||
(String)object.get(Constants.SIMILAR_RECORDS_BEAN_FIELD_DESCRIPTION),
|
(String)object.get(Constants.SIMILAR_RECORDS_BEAN_FIELD_DESCRIPTION),
|
||||||
(String)object.get(Constants.SIMILAR_RECORDS_BEAN_FIELD_IDENTIFIER),
|
(String)object.get(Constants.SIMILAR_RECORDS_BEAN_FIELD_IDENTIFIER),
|
||||||
(String)object.get(Constants.SIMILAR_RECORDS_BEAN_FIELD_NAME),
|
(String)object.get(Constants.SIMILAR_RECORDS_BEAN_FIELD_NAME),
|
||||||
(String)object.get(Constants.SIMILAR_RECORDS_BEAN_FIELD_URL)
|
(String)object.get(Constants.SIMILAR_RECORDS_BEAN_FIELD_URL)
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue