to be finished
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/widgets/grsf-manage-widget@160149 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
db0d9b057e
commit
bff7a59c55
Binary file not shown.
|
@ -43,4 +43,22 @@ public interface GRSFManageWidgetService extends RemoteService {
|
||||||
*/
|
*/
|
||||||
boolean checkSemanticIdentifierExistsInDomain(String semanticIdentifier, String domain) throws Exception;
|
boolean checkSemanticIdentifierExistsInDomain(String semanticIdentifier, String domain) throws Exception;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Identifier of the record (UUID)
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
boolean checkIdentifierExists(String id) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Identifier of the record (UUID)
|
||||||
|
* @param id
|
||||||
|
* @param domain (stock or fishery)
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
boolean checkIdentifierExistsInDomain(String id, String domain) throws Exception;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,4 +27,10 @@ public interface GRSFManageWidgetServiceAsync {
|
||||||
void checkSemanticIdentifierExistsInDomain(String semanticIdentifier,
|
void checkSemanticIdentifierExistsInDomain(String semanticIdentifier,
|
||||||
String domain, AsyncCallback<Boolean> callback);
|
String domain, AsyncCallback<Boolean> callback);
|
||||||
|
|
||||||
|
void checkIdentifierExists(String id,
|
||||||
|
AsyncCallback<Boolean> callback);
|
||||||
|
|
||||||
|
void checkIdentifierExistsInDomain(String id,
|
||||||
|
String domain, AsyncCallback<Boolean> callback);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,12 +128,12 @@ public class ManageProductWidget extends Composite{
|
||||||
public static final String LOADING_IMAGE_URL = GWT.getModuleBaseURL() + "../images/loader.gif";
|
public static final String LOADING_IMAGE_URL = GWT.getModuleBaseURL() + "../images/loader.gif";
|
||||||
|
|
||||||
// messages used here and there
|
// 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 record 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 record";
|
||||||
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...";
|
||||||
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_GRSF_RECORD_BEAN = "This record 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."
|
protected static final String NO_ADMIN_ROLE = "Sorry but it seems you do not have the rights to manage records."
|
||||||
+ " 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";
|
||||||
|
|
||||||
// event bus shared with the portlet
|
// event bus shared with the portlet
|
||||||
|
@ -143,7 +143,7 @@ public class ManageProductWidget extends Composite{
|
||||||
private ManageProductBean bean;
|
private ManageProductBean bean;
|
||||||
private final static List<Status> STATUS = new ArrayList<Status>(Arrays.asList(Status.values()));
|
private final static List<Status> STATUS = new ArrayList<Status>(Arrays.asList(Status.values()));
|
||||||
|
|
||||||
// similar records and to connect widgets
|
// similar records and to connect widgets references
|
||||||
private SimilarGRSFRecordWidget similarRecordPanel;
|
private SimilarGRSFRecordWidget similarRecordPanel;
|
||||||
private ConnectToWidget connectWidget;
|
private ConnectToWidget connectWidget;
|
||||||
|
|
||||||
|
@ -230,11 +230,11 @@ public class ManageProductWidget extends Composite{
|
||||||
|
|
||||||
// manage similar GRSF records, if any
|
// manage similar GRSF records, if any
|
||||||
List<SimilarGRSFRecord> availableGRSFSimilarRecords = bean.getSimilarGrsfRecords();
|
List<SimilarGRSFRecord> availableGRSFSimilarRecords = bean.getSimilarGrsfRecords();
|
||||||
similarRecordPanel = new SimilarGRSFRecordWidget(availableGRSFSimilarRecords, service);
|
similarRecordPanel = new SimilarGRSFRecordWidget(availableGRSFSimilarRecords/*, service*/);
|
||||||
panelForSimilarGRSFRecords.add(similarRecordPanel);
|
panelForSimilarGRSFRecords.add(similarRecordPanel);
|
||||||
|
|
||||||
// prepare "connect" panel
|
// prepare "connect" panel
|
||||||
connectWidget = new ConnectToWidget(bean, service);
|
connectWidget = new ConnectToWidget(bean /*,service*/);
|
||||||
panelForConnectOtherRecords.add(connectWidget);
|
panelForConnectOtherRecords.add(connectWidget);
|
||||||
|
|
||||||
// check if we need to show more
|
// check if we need to show more
|
||||||
|
@ -341,6 +341,9 @@ public class ManageProductWidget extends Composite{
|
||||||
confirmButton.setEnabled(false);
|
confirmButton.setEnabled(false);
|
||||||
loaderIcon.setVisible(true);
|
loaderIcon.setVisible(true);
|
||||||
|
|
||||||
|
// get short name
|
||||||
|
bean.setShortNameUpdated(shortNameTextBox.getText());
|
||||||
|
|
||||||
// update similar records and to connect
|
// update similar records and to connect
|
||||||
bean.setConnectTo(connectWidget.getConnectList());
|
bean.setConnectTo(connectWidget.getConnectList());
|
||||||
bean.setSimilarGrsfRecords(similarRecordPanel.getSimilarRecords());
|
bean.setSimilarGrsfRecords(similarRecordPanel.getSimilarRecords());
|
||||||
|
@ -349,6 +352,9 @@ public class ManageProductWidget extends Composite{
|
||||||
bean.setAnnotation(new HTML(annotationArea.getText().trim()).getText());
|
bean.setAnnotation(new HTML(annotationArea.getText().trim()).getText());
|
||||||
bean.setNewStatus(Status.fromString(listBoxStatus.getSelectedItemText()));
|
bean.setNewStatus(Status.fromString(listBoxStatus.getSelectedItemText()));
|
||||||
|
|
||||||
|
// traceability flag
|
||||||
|
bean.setTraceabilityFlag(traceabilityFlag.getValue());
|
||||||
|
|
||||||
service.notifyProductUpdate(bean, new AsyncCallback<String>() {
|
service.notifyProductUpdate(bean, new AsyncCallback<String>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -371,7 +377,6 @@ public class ManageProductWidget extends Composite{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
|
|
||||||
manageProductModal.setCloseVisible(true);
|
manageProductModal.setCloseVisible(true);
|
||||||
cancelButton.setEnabled(true);
|
cancelButton.setEnabled(true);
|
||||||
confirmButton.setEnabled(true);
|
confirmButton.setEnabled(true);
|
||||||
|
|
|
@ -4,7 +4,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.datacatalogue.grsf_manage_widget.client.GRSFManageWidgetServiceAsync;
|
import org.gcube.datacatalogue.common.enums.Product_Type;
|
||||||
import org.gcube.datacatalogue.grsf_manage_widget.shared.ConnectBean;
|
import org.gcube.datacatalogue.grsf_manage_widget.shared.ConnectBean;
|
||||||
import org.gcube.datacatalogue.grsf_manage_widget.shared.ManageProductBean;
|
import org.gcube.datacatalogue.grsf_manage_widget.shared.ManageProductBean;
|
||||||
|
|
||||||
|
@ -43,15 +43,14 @@ public class ConnectToWidget extends Composite{
|
||||||
@UiField
|
@UiField
|
||||||
Button suggestRecord;
|
Button suggestRecord;
|
||||||
|
|
||||||
private GRSFManageWidgetServiceAsync service;
|
//private GRSFManageWidgetServiceAsync service;
|
||||||
private List<Pair> connectList = new ArrayList<Pair>(0);
|
private List<Tuple> connectList = new ArrayList<Tuple>(0);
|
||||||
|
|
||||||
public ConnectToWidget(final ManageProductBean bean, GRSFManageWidgetServiceAsync service) {
|
public ConnectToWidget(final ManageProductBean bean/*, GRSFManageWidgetServiceAsync service*/) {
|
||||||
initWidget(uiBinder.createAndBindUi(this));
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
|
|
||||||
this.service = service;
|
//this.service = service;
|
||||||
|
String acceptedDomain = bean.getGrsfDomain().equalsIgnoreCase(Product_Type.STOCK.getOrigName()) ? Product_Type.FISHERY.getOrigName() : Product_Type.STOCK.getOrigName(); // inverted
|
||||||
String acceptedDomain = bean.getGrsfDomain().equalsIgnoreCase("stock") ? "Fishery" : "Stock";
|
|
||||||
suggestRecord.setTitle("Connect this " + bean.getGrsfDomain() + " record to a " + acceptedDomain + " record ");
|
suggestRecord.setTitle("Connect this " + bean.getGrsfDomain() + " record to a " + acceptedDomain + " record ");
|
||||||
suggestRecord.setIcon(IconType.PLUS_SIGN);
|
suggestRecord.setIcon(IconType.PLUS_SIGN);
|
||||||
suggestRecord.getElement().getStyle().setFloat(Float.RIGHT);
|
suggestRecord.getElement().getStyle().setFloat(Float.RIGHT);
|
||||||
|
@ -64,9 +63,9 @@ public class ConnectToWidget extends Composite{
|
||||||
|
|
||||||
ConnectBean cb = new ConnectBean();
|
ConnectBean cb = new ConnectBean();
|
||||||
cb.setSourceDomain(bean.getGrsfDomain());
|
cb.setSourceDomain(bean.getGrsfDomain());
|
||||||
Widget w = buildWidgetConnect(cb);
|
Tuple t = buildWidgetConnect(cb);
|
||||||
connectList.add(new Pair(cb, w));
|
connectList.add(t);
|
||||||
connectPanel.add(w);
|
connectPanel.add(t.getW());
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -78,7 +77,7 @@ public class ConnectToWidget extends Composite{
|
||||||
* @param w the widget
|
* @param w the widget
|
||||||
* @param cb the connectBean.
|
* @param cb the connectBean.
|
||||||
*/
|
*/
|
||||||
private Widget buildWidgetConnect(final ConnectBean cb){
|
private Tuple buildWidgetConnect(final ConnectBean cb){
|
||||||
|
|
||||||
VerticalPanel main = new VerticalPanel();
|
VerticalPanel main = new VerticalPanel();
|
||||||
main.setWidth("90%");
|
main.setWidth("90%");
|
||||||
|
@ -88,8 +87,9 @@ public class ConnectToWidget extends Composite{
|
||||||
VerticalPanel vpLeft = new VerticalPanel();
|
VerticalPanel vpLeft = new VerticalPanel();
|
||||||
vpLeft.getElement().getStyle().setMarginLeft(15, Unit.PX);
|
vpLeft.getElement().getStyle().setMarginLeft(15, Unit.PX);
|
||||||
vpLeft.setWidth("80%");
|
vpLeft.setWidth("80%");
|
||||||
Paragraph semanticIdentifier = new Paragraph("Semantic Identifier:");
|
Paragraph semanticIdentifier = new Paragraph("Record Identifier (UUID):");
|
||||||
final TextBox box = new TextBox();
|
final TextBox box = new TextBox();
|
||||||
|
box.setId("identifier-text");
|
||||||
box.addKeyPressHandler(new KeyPressHandler() {
|
box.addKeyPressHandler(new KeyPressHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -97,7 +97,7 @@ public class ConnectToWidget extends Composite{
|
||||||
|
|
||||||
String currentText = box.getText().trim();
|
String currentText = box.getText().trim();
|
||||||
GWT.log("Text changed to " + currentText);
|
GWT.log("Text changed to " + currentText);
|
||||||
cb.setDestSemanticIdentifier(currentText);
|
cb.setDestIdentifier(currentText);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -108,12 +108,12 @@ public class ConnectToWidget extends Composite{
|
||||||
|
|
||||||
String currentText = box.getText().trim();
|
String currentText = box.getText().trim();
|
||||||
GWT.log("Text changed to " + currentText);
|
GWT.log("Text changed to " + currentText);
|
||||||
cb.setDestSemanticIdentifier(currentText);
|
cb.setDestIdentifier(currentText);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
box.setWidth("512px");
|
box.setWidth("512px");
|
||||||
box.setPlaceholder("Insert the Semantic Identifier of the record to connect");
|
box.setPlaceholder("Insert the Identifier (UUID) of the record to connect");
|
||||||
|
|
||||||
vpLeft.add(semanticIdentifier);
|
vpLeft.add(semanticIdentifier);
|
||||||
vpLeft.add(box);
|
vpLeft.add(box);
|
||||||
|
@ -130,9 +130,9 @@ public class ConnectToWidget extends Composite{
|
||||||
public void onClick(ClickEvent arg0) {
|
public void onClick(ClickEvent arg0) {
|
||||||
|
|
||||||
// remove this object from the pairs list
|
// remove this object from the pairs list
|
||||||
Iterator<Pair> iterator = connectList.iterator();
|
Iterator<Tuple> iterator = connectList.iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
Pair pair = (Pair) iterator
|
Tuple pair = (Tuple) iterator
|
||||||
.next();
|
.next();
|
||||||
if(pair.getO().equals(cb)){
|
if(pair.getO().equals(cb)){
|
||||||
pair.getW().removeFromParent();
|
pair.getW().removeFromParent();
|
||||||
|
@ -149,15 +149,23 @@ public class ConnectToWidget extends Composite{
|
||||||
connectPanel.add(separator);
|
connectPanel.add(separator);
|
||||||
main.add(hp);
|
main.add(hp);
|
||||||
main.add(separator);
|
main.add(separator);
|
||||||
return main;
|
return new Tuple(cb, main, box);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the list of records to connect with this one
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public List<ConnectBean> getConnectList() {
|
public List<ConnectBean> getConnectList() {
|
||||||
|
|
||||||
List<ConnectBean> toReturn = new ArrayList<ConnectBean>(0);
|
List<ConnectBean> toReturn = new ArrayList<ConnectBean>(0);
|
||||||
|
|
||||||
for (Pair p : connectList) {
|
for (Tuple p : connectList) {
|
||||||
toReturn.add((ConnectBean) p.getO());
|
String suggestedIdentifier = ((ConnectBean)p.getO()).getDestIdentifier();
|
||||||
|
if(suggestedIdentifier == null || suggestedIdentifier.isEmpty())
|
||||||
|
continue;
|
||||||
|
else
|
||||||
|
toReturn.add((ConnectBean) p.getO());
|
||||||
}
|
}
|
||||||
|
|
||||||
return toReturn;
|
return toReturn;
|
||||||
|
|
|
@ -4,7 +4,6 @@ import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.datacatalogue.grsf_manage_widget.client.GRSFManageWidgetServiceAsync;
|
|
||||||
import org.gcube.datacatalogue.grsf_manage_widget.shared.SimilarGRSFRecord;
|
import org.gcube.datacatalogue.grsf_manage_widget.shared.SimilarGRSFRecord;
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.Button;
|
import com.github.gwtbootstrap.client.ui.Button;
|
||||||
|
@ -49,19 +48,18 @@ public class SimilarGRSFRecordWidget extends Composite {
|
||||||
@UiField
|
@UiField
|
||||||
Button addSimilarRecord;
|
Button addSimilarRecord;
|
||||||
|
|
||||||
private List<Pair> extraSimilarRecordsList = new ArrayList<Pair>(0);
|
private List<Tuple> extraSimilarRecordsList = new ArrayList<Tuple>(0);
|
||||||
private List<SimilarGRSFRecord> availableGRSFSimilarRecords;
|
private List<SimilarGRSFRecord> availableGRSFSimilarRecords;
|
||||||
|
//private GRSFManageWidgetServiceAsync service;
|
||||||
private GRSFManageWidgetServiceAsync service;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get widget for available similar grsf records
|
* Get widget for available similar grsf records
|
||||||
* @param availableGRSFSimilarRecords
|
* @param availableGRSFSimilarRecords
|
||||||
* @param service
|
* @param service
|
||||||
*/
|
*/
|
||||||
public SimilarGRSFRecordWidget(List<SimilarGRSFRecord> availableGRSFSimilarRecords, GRSFManageWidgetServiceAsync service) {
|
public SimilarGRSFRecordWidget(List<SimilarGRSFRecord> availableGRSFSimilarRecords/*, GRSFManageWidgetServiceAsync service*/) {
|
||||||
initWidget(uiBinder.createAndBindUi(this));
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
this.service = service;
|
//this.service = service;
|
||||||
this.availableGRSFSimilarRecords = availableGRSFSimilarRecords;
|
this.availableGRSFSimilarRecords = availableGRSFSimilarRecords;
|
||||||
addSimilarRecord.getElement().getStyle().setFloat(Float.RIGHT);
|
addSimilarRecord.getElement().getStyle().setFloat(Float.RIGHT);
|
||||||
|
|
||||||
|
@ -76,7 +74,7 @@ public class SimilarGRSFRecordWidget extends Composite {
|
||||||
// manage the "suggest button"
|
// manage the "suggest button"
|
||||||
addSimilarRecord.setIcon(IconType.PLUS_SIGN);
|
addSimilarRecord.setIcon(IconType.PLUS_SIGN);
|
||||||
addSimilarRecord.getElement().getStyle().setFloat(Float.RIGHT);
|
addSimilarRecord.getElement().getStyle().setFloat(Float.RIGHT);
|
||||||
addSimilarRecord.setTitle("Suggest a Similar Record by using its GRSF Semantic Identifier");
|
addSimilarRecord.setTitle("Suggest a Similar Record by using its Identifier (UUID)");
|
||||||
|
|
||||||
// add handler
|
// add handler
|
||||||
addSimilarRecord.addClickHandler(new ClickHandler() {
|
addSimilarRecord.addClickHandler(new ClickHandler() {
|
||||||
|
@ -86,7 +84,7 @@ public class SimilarGRSFRecordWidget extends Composite {
|
||||||
|
|
||||||
SimilarGRSFRecord s = new SimilarGRSFRecord(true);
|
SimilarGRSFRecord s = new SimilarGRSFRecord(true);
|
||||||
Widget w = buildWidgetForExtraSimilarRecord(s);
|
Widget w = buildWidgetForExtraSimilarRecord(s);
|
||||||
extraSimilarRecordsList.add(new Pair(s, w));
|
extraSimilarRecordsList.add(new Tuple(s, w, null));
|
||||||
similarGrsfRecordsSuggestedPanel.add(w);
|
similarGrsfRecordsSuggestedPanel.add(w);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -117,10 +115,9 @@ public class SimilarGRSFRecordWidget extends Composite {
|
||||||
description.setTitle("Description: " + similarGRSFRecord.getDescription());
|
description.setTitle("Description: " + similarGRSFRecord.getDescription());
|
||||||
leftPanel.add(description);
|
leftPanel.add(description);
|
||||||
}
|
}
|
||||||
Paragraph semanticIdentifier = new Paragraph("Semantic Identifier: " +
|
Paragraph identifier = new Paragraph("Record UUID: " +
|
||||||
similarGRSFRecord.getSemanticIdentifier());
|
similarGRSFRecord.getIdentifier());
|
||||||
leftPanel.add(semanticIdentifier);
|
leftPanel.add(identifier);
|
||||||
|
|
||||||
|
|
||||||
VerticalPanel rightPanel = new VerticalPanel();
|
VerticalPanel rightPanel = new VerticalPanel();
|
||||||
rightPanel.setWidth("20%");
|
rightPanel.setWidth("20%");
|
||||||
|
@ -172,7 +169,7 @@ public class SimilarGRSFRecordWidget extends Composite {
|
||||||
VerticalPanel vpLeft = new VerticalPanel();
|
VerticalPanel vpLeft = new VerticalPanel();
|
||||||
vpLeft.getElement().getStyle().setMarginLeft(15, Unit.PX);
|
vpLeft.getElement().getStyle().setMarginLeft(15, Unit.PX);
|
||||||
vpLeft.setWidth("80%");
|
vpLeft.setWidth("80%");
|
||||||
Paragraph semanticIdentifier = new Paragraph("Semantic Identifier:");
|
Paragraph identifier = new Paragraph("Identifier (UUID):");
|
||||||
final TextBox box = new TextBox();
|
final TextBox box = new TextBox();
|
||||||
box.addKeyPressHandler(new KeyPressHandler() {
|
box.addKeyPressHandler(new KeyPressHandler() {
|
||||||
|
|
||||||
|
@ -181,7 +178,7 @@ public class SimilarGRSFRecordWidget extends Composite {
|
||||||
|
|
||||||
String currentText = box.getText().trim();
|
String currentText = box.getText().trim();
|
||||||
GWT.log("Text changed to " + currentText);
|
GWT.log("Text changed to " + currentText);
|
||||||
s.setSemanticIdentifier(currentText);
|
s.setIdentifier(currentText);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -192,14 +189,14 @@ public class SimilarGRSFRecordWidget extends Composite {
|
||||||
|
|
||||||
String currentText = box.getText().trim();
|
String currentText = box.getText().trim();
|
||||||
GWT.log("Text changed to " + currentText);
|
GWT.log("Text changed to " + currentText);
|
||||||
s.setSemanticIdentifier(currentText);
|
s.setIdentifier(currentText);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
box.setWidth("511px");
|
box.setWidth("511px");
|
||||||
box.setPlaceholder("Insert the Semantic Identifier of the suggested record");
|
box.setPlaceholder("Insert the Identifier (UUID) of the suggested record");
|
||||||
|
|
||||||
vpLeft.add(semanticIdentifier);
|
vpLeft.add(identifier);
|
||||||
vpLeft.add(box);
|
vpLeft.add(box);
|
||||||
|
|
||||||
// add merge checkbox
|
// add merge checkbox
|
||||||
|
@ -231,9 +228,9 @@ public class SimilarGRSFRecordWidget extends Composite {
|
||||||
public void onClick(ClickEvent arg0) {
|
public void onClick(ClickEvent arg0) {
|
||||||
|
|
||||||
// remove this object from the pairs list
|
// remove this object from the pairs list
|
||||||
Iterator<Pair> iterator = extraSimilarRecordsList.iterator();
|
Iterator<Tuple> iterator = extraSimilarRecordsList.iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
Pair pair = (Pair) iterator
|
Tuple pair = (Tuple) iterator
|
||||||
.next();
|
.next();
|
||||||
if(pair.getO().equals(s)){
|
if(pair.getO().equals(s)){
|
||||||
pair.getW().removeFromParent();
|
pair.getW().removeFromParent();
|
||||||
|
@ -263,8 +260,10 @@ public class SimilarGRSFRecordWidget extends Composite {
|
||||||
if(availableGRSFSimilarRecords == null)
|
if(availableGRSFSimilarRecords == null)
|
||||||
availableGRSFSimilarRecords = new ArrayList<SimilarGRSFRecord>();
|
availableGRSFSimilarRecords = new ArrayList<SimilarGRSFRecord>();
|
||||||
|
|
||||||
|
for (Tuple p : extraSimilarRecordsList) {
|
||||||
for (Pair p : extraSimilarRecordsList) {
|
SimilarGRSFRecord similarRecord = ((SimilarGRSFRecord)p.getO());
|
||||||
|
if(similarRecord.isExtra() && similarRecord.getIdentifier() == null || similarRecord.getIdentifier().isEmpty())
|
||||||
|
continue;
|
||||||
availableGRSFSimilarRecords.add((SimilarGRSFRecord) p.getO());
|
availableGRSFSimilarRecords.add((SimilarGRSFRecord) p.getO());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,19 +7,27 @@ import com.google.gwt.user.client.ui.Widget;
|
||||||
* A class of pair: a widget and an object
|
* A class of pair: a widget and an object
|
||||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||||
*/
|
*/
|
||||||
public class Pair {
|
public class Tuple {
|
||||||
private Object o;
|
private Object o;
|
||||||
private Widget w;
|
private Widget w;
|
||||||
public Pair(Object o, Widget w){
|
private Widget w2;
|
||||||
|
public Tuple(Object o, Widget w, Widget w2){
|
||||||
this.o = o;
|
this.o = o;
|
||||||
this.w = w;
|
this.w = w;
|
||||||
|
this.w2 = w2;
|
||||||
}
|
}
|
||||||
public Object getO(){ return o; }
|
public Object getO(){ return o; }
|
||||||
public Widget getW(){ return w; }
|
public Widget getW(){ return w; }
|
||||||
public void setO(Object o){ this.o = o; }
|
public void setO(Object o){ this.o = o; }
|
||||||
public void setW(Widget w){ this.w = w; }
|
public void setW(Widget w){ this.w = w; }
|
||||||
|
public Widget getW2() {
|
||||||
|
return w2;
|
||||||
|
}
|
||||||
|
public void setW2(Widget w2) {
|
||||||
|
this.w2 = w2;
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Pair [o=" + o + ", w=" + w + "]";
|
return "Tuple [o=" + o + ", w=" + w + ", w2=" + w2 + "]";
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -63,7 +63,7 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String notifyProductUpdate(ManageProductBean bean) {
|
public String notifyProductUpdate(ManageProductBean bean) throws Exception{
|
||||||
|
|
||||||
logger.info("Creating notification for the bean " + bean + " to send to the knowledge base");
|
logger.info("Creating notification for the bean " + bean + " to send to the knowledge base");
|
||||||
try{
|
try{
|
||||||
|
@ -257,4 +257,35 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkIdentifierExists(String id)
|
||||||
|
throws Exception {
|
||||||
|
String scopePerCurrentUrl = Utils.getScopeFromClientUrl(getThreadLocalRequest());
|
||||||
|
DataCatalogue catalogue = getCatalogue(scopePerCurrentUrl);
|
||||||
|
String username = Utils.getCurrentUser(getThreadLocalRequest()).getUsername();
|
||||||
|
return catalogue.getDataset(id, catalogue.getApiKeyFromUsername(username)) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkIdentifierExistsInDomain(String id,
|
||||||
|
String domain) throws Exception {
|
||||||
|
String scopePerCurrentUrl = Utils.getScopeFromClientUrl(getThreadLocalRequest());
|
||||||
|
DataCatalogue catalogue = getCatalogue(scopePerCurrentUrl);
|
||||||
|
String username = Utils.getCurrentUser(getThreadLocalRequest()).getUsername();
|
||||||
|
CkanDataset dataset = catalogue.getDataset(id, catalogue.getApiKeyFromUsername(username));
|
||||||
|
if(dataset == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
List<CkanPair> extrasAsPairs = dataset.getExtras();
|
||||||
|
|
||||||
|
for (CkanPair ckanPair : extrasAsPairs) {
|
||||||
|
if(ckanPair.getKey().contains(Constants.DOMAIN_CUSTOM_KEY)){
|
||||||
|
return ckanPair.getValue().equalsIgnoreCase(domain);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,37 +9,30 @@ public class ConnectBean {
|
||||||
|
|
||||||
private String sourceIdentifier;
|
private String sourceIdentifier;
|
||||||
private String sourceDomain; // i.e. Stock or Fishery
|
private String sourceDomain; // i.e. Stock or Fishery
|
||||||
private String destSemanticIdentifier; // the dest semantic indentifier of a Fishery or Stock (the link is from a Stock to a Fishery and viceversa)
|
private String destIdentifier; // the dest indentifier of a Fishery or Stock (the link is from a Stock to a Fishery and viceversa)
|
||||||
|
|
||||||
public ConnectBean() {
|
public ConnectBean() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* @param sourceIdentifier
|
|
||||||
* @param sourceDomain
|
|
||||||
* @param destSemanticIdentifier
|
|
||||||
*/
|
|
||||||
public ConnectBean(String sourceIdentifier, String sourceDomain,
|
public ConnectBean(String sourceIdentifier, String sourceDomain,
|
||||||
String destSemanticIdentifier) {
|
String destIdentifier) {
|
||||||
super();
|
super();
|
||||||
this.sourceIdentifier = sourceIdentifier;
|
this.sourceIdentifier = sourceIdentifier;
|
||||||
this.sourceDomain = sourceDomain;
|
this.sourceDomain = sourceDomain;
|
||||||
this.destSemanticIdentifier = destSemanticIdentifier;
|
this.destIdentifier = destIdentifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSourceIdentifier() {
|
public String getSourceIdentifier() {
|
||||||
return sourceIdentifier;
|
return sourceIdentifier;
|
||||||
}
|
}
|
||||||
public void setSourceIdentifier(String sourceIdentifier) {
|
public void setSourceIdentifier(String sourceIdentifier) {
|
||||||
this.sourceIdentifier = sourceIdentifier;
|
this.sourceIdentifier = sourceIdentifier;
|
||||||
}
|
}
|
||||||
public String getDestSemanticIdentifier() {
|
public String getDestIdentifier() {
|
||||||
return destSemanticIdentifier;
|
return destIdentifier;
|
||||||
}
|
}
|
||||||
public void setDestSemanticIdentifier(String destSemanticIdentifier) {
|
public void setDestIdentifier(String destIdentifier) {
|
||||||
this.destSemanticIdentifier = destSemanticIdentifier;
|
this.destIdentifier = destIdentifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSourceDomain() {
|
public String getSourceDomain() {
|
||||||
return sourceDomain;
|
return sourceDomain;
|
||||||
}
|
}
|
||||||
|
@ -50,6 +43,6 @@ public class ConnectBean {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ConnectBean [sourceIdentifier=" + sourceIdentifier
|
return "ConnectBean [sourceIdentifier=" + sourceIdentifier
|
||||||
+ ", sourceDomain=" + sourceDomain
|
+ ", sourceDomain=" + sourceDomain
|
||||||
+ ", destSemanticIdentifier=" + destSemanticIdentifier + "]";
|
+ ", destIdentifier=" + destIdentifier + "]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ 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 identifier;
|
||||||
private String shortName;
|
private String shortName;
|
||||||
private String url;
|
private String url;
|
||||||
private boolean suggestedMerge;
|
private boolean suggestedMerge;
|
||||||
|
@ -27,30 +27,27 @@ public class SimilarGRSFRecord implements Serializable{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param description
|
* @param description
|
||||||
* @param semanticIdentifier
|
* @param identifier
|
||||||
* @param shortName
|
* @param shortName
|
||||||
* @param url
|
* @param url
|
||||||
*/
|
*/
|
||||||
public SimilarGRSFRecord(String description, String semanticIdentifier,
|
public SimilarGRSFRecord(String description, String identifier,
|
||||||
String shortName, String url) {
|
String shortName, String url) {
|
||||||
super();
|
super();
|
||||||
this.description = description;
|
this.description = description;
|
||||||
this.semanticIdentifier = semanticIdentifier;
|
this.identifier = identifier;
|
||||||
this.shortName = shortName;
|
this.shortName = shortName;
|
||||||
this.url = url;
|
this.url = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getIdentifier() {
|
public String getIdentifier() {
|
||||||
return description;
|
return identifier;
|
||||||
}
|
}
|
||||||
public void setIdentifier(String description) {
|
|
||||||
this.description = description;
|
public void setIdentifier(String identifier) {
|
||||||
}
|
this.identifier = identifier;
|
||||||
public String getSemanticIdentifier() {
|
|
||||||
return semanticIdentifier;
|
|
||||||
}
|
|
||||||
public void setSemanticIdentifier(String semanticIdentifier) {
|
|
||||||
this.semanticIdentifier = semanticIdentifier;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getShortName() {
|
public String getShortName() {
|
||||||
return shortName;
|
return shortName;
|
||||||
}
|
}
|
||||||
|
@ -91,7 +88,7 @@ public class SimilarGRSFRecord implements Serializable{
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "SimilarGRSFRecord [description=" + description
|
return "SimilarGRSFRecord [description=" + description
|
||||||
+ ", semanticIdentifier=" + semanticIdentifier + ", shortName="
|
+ ", identifier=" + identifier + ", shortName="
|
||||||
+ shortName + ", url=" + url + ", suggestedMerge="
|
+ shortName + ", url=" + url + ", suggestedMerge="
|
||||||
+ suggestedMerge + ", isExtra=" + isExtra + "]";
|
+ suggestedMerge + ", isExtra=" + isExtra + "]";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue