added sdg management, grsf type can be changed. Semantic identifier is reported for connected records and records to be merge. Width and height of the panel have been increased.
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/widgets/grsf-manage-widget@164586 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
fc9650fb4e
commit
a34fd17b74
|
@ -6,7 +6,10 @@ import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.gcube.datacatalogue.common.enums.Fishery_Type;
|
||||||
|
import org.gcube.datacatalogue.common.enums.Product_Type;
|
||||||
import org.gcube.datacatalogue.common.enums.Status;
|
import org.gcube.datacatalogue.common.enums.Status;
|
||||||
|
import org.gcube.datacatalogue.common.enums.Stock_Type;
|
||||||
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.EnableConfirmButtonEvent;
|
import org.gcube.datacatalogue.grsf_manage_widget.client.events.EnableConfirmButtonEvent;
|
||||||
|
@ -39,6 +42,7 @@ import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
||||||
import com.github.gwtbootstrap.client.ui.event.HiddenEvent;
|
import com.github.gwtbootstrap.client.ui.event.HiddenEvent;
|
||||||
import com.github.gwtbootstrap.client.ui.event.HiddenHandler;
|
import com.github.gwtbootstrap.client.ui.event.HiddenHandler;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.dom.client.Element;
|
||||||
import com.google.gwt.dom.client.SelectElement;
|
import com.google.gwt.dom.client.SelectElement;
|
||||||
import com.google.gwt.dom.client.Style.Unit;
|
import com.google.gwt.dom.client.Style.Unit;
|
||||||
import com.google.gwt.event.dom.client.ChangeEvent;
|
import com.google.gwt.event.dom.client.ChangeEvent;
|
||||||
|
@ -84,10 +88,13 @@ public class ManageProductWidget extends Composite{
|
||||||
TextArea shortNameTextBox;
|
TextArea shortNameTextBox;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
TextBox productGrsfType;
|
ListBox productGrsfTypeListbox;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
CheckBox traceabilityFlag;
|
CheckBox traceabilityFlag;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
CheckBox sdgFlag;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
TextArea GRSFNameTexBox;
|
TextArea GRSFNameTexBox;
|
||||||
|
@ -189,7 +196,7 @@ public class ManageProductWidget extends Composite{
|
||||||
|
|
||||||
// show modal
|
// show modal
|
||||||
manageProductModal.addStyleName("management-metadata-modal-style");
|
manageProductModal.addStyleName("management-metadata-modal-style");
|
||||||
// manageProductModal.getElement().getStyle().setWidth(60, Unit.PCT);
|
((Element)manageProductModal.getElement().getChildNodes().getItem(1)).addClassName("modal-body-custom");
|
||||||
manageProductModal.show();
|
manageProductModal.show();
|
||||||
|
|
||||||
manageProductModal.addHiddenHandler(new HiddenHandler() {
|
manageProductModal.addHiddenHandler(new HiddenHandler() {
|
||||||
|
@ -275,12 +282,31 @@ public class ManageProductWidget extends Composite{
|
||||||
});
|
});
|
||||||
|
|
||||||
semanticIdentifierTextBox.setText(bean.getSemanticIdentifier());
|
semanticIdentifierTextBox.setText(bean.getSemanticIdentifier());
|
||||||
productGrsfType.setText(bean.getGrsfType());
|
|
||||||
|
// update product type listbox.. get the available types for the record under management
|
||||||
|
List<String> types = getTypesForRecord(bean.getDomain());
|
||||||
|
productGrsfTypeListbox.addItem(bean.getCurrentGrsfType(), bean.getCurrentGrsfType());
|
||||||
|
|
||||||
|
for (String type : types) {
|
||||||
|
productGrsfTypeListbox.addItem(type, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
//select the current
|
||||||
|
productGrsfTypeListbox.setSelectedValue(bean.getCurrentGrsfType());
|
||||||
|
|
||||||
|
productGrsfTypeListbox.addChangeHandler(new ChangeHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChange(ChangeEvent event) {
|
||||||
|
eventBus.fireEvent(new EnableConfirmButtonEvent());
|
||||||
|
}
|
||||||
|
});
|
||||||
currentStatus.setText(bean.getCurrentStatus().toString());
|
currentStatus.setText(bean.getCurrentStatus().toString());
|
||||||
|
|
||||||
|
// traceability flag
|
||||||
traceabilityFlag.setValue(bean.isTraceabilityFlag());
|
traceabilityFlag.setValue(bean.isTraceabilityFlag());
|
||||||
traceabilityFlag.setText("Traceability");
|
traceabilityFlag.setText("Traceability");
|
||||||
traceabilityFlag.setTitle("Current value for this flag in the Knowledge Base is " + bean.isTraceabilityFlag());
|
traceabilityFlag.setTitle("Current value for this flag is " + bean.isTraceabilityFlag());
|
||||||
|
|
||||||
traceabilityFlag.addClickHandler(new ClickHandler() {
|
traceabilityFlag.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -288,7 +314,19 @@ public class ManageProductWidget extends Composite{
|
||||||
eventBus.fireEvent(new EnableConfirmButtonEvent());
|
eventBus.fireEvent(new EnableConfirmButtonEvent());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// sdg flag
|
||||||
|
sdgFlag.setValue(bean.isSdgFlag());
|
||||||
|
sdgFlag.setText("Sustainable Development Goals");
|
||||||
|
sdgFlag.setTitle("Current value for this flag is " + bean.isSdgFlag());
|
||||||
|
sdgFlag.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
eventBus.fireEvent(new EnableConfirmButtonEvent());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// manage sources
|
// manage sources
|
||||||
List<SourceRecord> availableSources = bean.getSources();
|
List<SourceRecord> availableSources = bean.getSources();
|
||||||
panelForSourceItems.add(new SourceWidget(availableSources));
|
panelForSourceItems.add(new SourceWidget(availableSources));
|
||||||
|
@ -312,7 +350,9 @@ public class ManageProductWidget extends Composite{
|
||||||
// check for new status box
|
// 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());
|
||||||
statusToShow.remove(Status.To_be_Merged); // it cannot be set by a user
|
|
||||||
|
// remove to be merged, since it cannot be set by a user
|
||||||
|
statusToShow.remove(Status.To_be_Merged);
|
||||||
|
|
||||||
// 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))
|
||||||
|
@ -395,9 +435,19 @@ public class ManageProductWidget extends Composite{
|
||||||
bean.setShortNameUpdated(shortNameTextBox.getText());
|
bean.setShortNameUpdated(shortNameTextBox.getText());
|
||||||
|
|
||||||
if(!bean.getShortName().equals(bean.getShortNameUpdated())){
|
if(!bean.getShortName().equals(bean.getShortNameUpdated())){
|
||||||
report += "\n- The GRSF Short Name has been changed to '" + bean.getShortNameUpdated() + "', from '" + bean.getShortName() + "'";
|
report += "\n- The GRSF Short Name has been changed to '" + bean.getShortNameUpdated() + "' from '" + bean.getShortName() + "';";
|
||||||
hashtags.add(HashTagsOnUpdate.SHORTNAME_UPDATED.getString());
|
hashtags.add(HashTagsOnUpdate.SHORTNAME_UPDATED.getString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// status
|
||||||
|
bean.setNewGrsfType(productGrsfTypeListbox.getSelectedItemText());
|
||||||
|
if(bean.getNewGrsfType().equalsIgnoreCase(bean.getCurrentGrsfType())){
|
||||||
|
report += "\n- The GRSF Type is unchanged;";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
report += "\n- The GRSF Type has been changed to '" + bean.getNewGrsfType() + "' from '" + bean.getCurrentGrsfType() + "';";
|
||||||
|
hashtags.add(HashTagsOnUpdate.GRSF_TYPE_CHANGED.getString());
|
||||||
|
}
|
||||||
|
|
||||||
// evaluate the connections and the actions on them
|
// evaluate the connections and the actions on them
|
||||||
bean.setConnections(connectWidget.getConnectList());
|
bean.setConnections(connectWidget.getConnectList());
|
||||||
|
@ -464,6 +514,20 @@ public class ManageProductWidget extends Composite{
|
||||||
// update the traceability flag
|
// update the traceability flag
|
||||||
bean.setTraceabilityFlag(traceabilityNewValue);
|
bean.setTraceabilityFlag(traceabilityNewValue);
|
||||||
|
|
||||||
|
// sdg flag
|
||||||
|
Boolean sdgNewValue = sdgFlag.getValue();
|
||||||
|
boolean currentSdgFlag = bean.isSdgFlag();
|
||||||
|
if(!sdgNewValue.equals(currentSdgFlag)){
|
||||||
|
report += "\n- SDG flag has been changed to: '" + sdgNewValue + "';";
|
||||||
|
if(sdgNewValue)
|
||||||
|
hashtags.add(HashTagsOnUpdate.SDG_FLAG_SET.getString());
|
||||||
|
else
|
||||||
|
hashtags.add(HashTagsOnUpdate.SDG_FLAG_UNSET.getString());
|
||||||
|
}
|
||||||
|
|
||||||
|
// update the traceability flag
|
||||||
|
bean.setSdgFlag(sdgNewValue);
|
||||||
|
|
||||||
// force the new status in the listbox
|
// force the new status in the listbox
|
||||||
if(bean.isMergesInvolved()){
|
if(bean.isMergesInvolved()){
|
||||||
bean.setNewStatus(Status.To_be_Merged);
|
bean.setNewStatus(Status.To_be_Merged);
|
||||||
|
@ -533,5 +597,17 @@ public class ManageProductWidget extends Composite{
|
||||||
infoBlock.setType(type);
|
infoBlock.setType(type);
|
||||||
infoBlock.setVisible(true);
|
infoBlock.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the list of types for stocks and fisheries, given the domain
|
||||||
|
* @param domain
|
||||||
|
* @return a list of types
|
||||||
|
*/
|
||||||
|
private List<String> getTypesForRecord(
|
||||||
|
String domain) {
|
||||||
|
if(domain == null)
|
||||||
|
throw new RuntimeException("GRSF Domain is missing!");
|
||||||
|
return domain.equalsIgnoreCase(Product_Type.FISHERY.getOrigName()) ? Fishery_Type.getTypesAsListString() : Stock_Type.getTypesAsListString();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,9 +58,8 @@
|
||||||
<b>GRSF Type:</b>
|
<b>GRSF Type:</b>
|
||||||
</b:ControlLabel>
|
</b:ControlLabel>
|
||||||
<b:Controls>
|
<b:Controls>
|
||||||
<b:TextBox b:id="productGrsfType" alternateSize="LARGE"
|
<b:ListBox b:id="productGrsfType" alternateSize="LARGE"
|
||||||
placeholder="GRSF Type" width="97%" title="GRSF Type" readOnly="true"
|
enabled="true" width="97%" title="GRSF Type" ui:field="productGrsfTypeListbox"></b:ListBox>
|
||||||
ui:field="productGrsfType"></b:TextBox>
|
|
||||||
</b:Controls>
|
</b:Controls>
|
||||||
</b:ControlGroup>
|
</b:ControlGroup>
|
||||||
|
|
||||||
|
@ -131,6 +130,16 @@
|
||||||
</b:Controls>
|
</b:Controls>
|
||||||
</b:ControlGroup>
|
</b:ControlGroup>
|
||||||
|
|
||||||
|
<b:ControlGroup ui:field="sdgFlagGroup">
|
||||||
|
<b:ControlLabel for="sdgflag" title="SDG Flag">
|
||||||
|
<b>SDG Flag:</b>
|
||||||
|
</b:ControlLabel>
|
||||||
|
<b:Controls>
|
||||||
|
<b:CheckBox b:id="sdgflag" title="SDG Flag"
|
||||||
|
ui:field="sdgFlag"></b:CheckBox>
|
||||||
|
</b:Controls>
|
||||||
|
</b:ControlGroup>
|
||||||
|
|
||||||
<b:ControlGroup ui:field="traceabilityFlagGroup">
|
<b:ControlGroup ui:field="traceabilityFlagGroup">
|
||||||
<b:ControlLabel for="traceabilityflag" title="Traceability Flag">
|
<b:ControlLabel for="traceabilityflag" title="Traceability Flag">
|
||||||
<b>Traceability Flag:</b>
|
<b>Traceability Flag:</b>
|
||||||
|
|
|
@ -128,15 +128,15 @@ public class ConnectToWidget extends Composite{
|
||||||
leftPanel.getElement().getStyle().setMarginLeft(20, Unit.PX);
|
leftPanel.getElement().getStyle().setMarginLeft(20, Unit.PX);
|
||||||
Paragraph name = new Paragraph("Record Name: " + (connected.getTitle() != null? connected.getTitle() : "Unavailable"));
|
Paragraph name = new Paragraph("Record Name: " + (connected.getTitle() != null? connected.getTitle() : "Unavailable"));
|
||||||
leftPanel.add(name);
|
leftPanel.add(name);
|
||||||
|
|
||||||
|
Paragraph identifier = new Paragraph("UUID: " +
|
||||||
|
connected.getKnowledgeBaseId());
|
||||||
|
leftPanel.add(identifier);
|
||||||
|
|
||||||
Paragraph semanticIdentifier = new Paragraph("Semantic Identifier: " +
|
Paragraph semanticIdentifier = new Paragraph("Semantic Identifier: " +
|
||||||
connected.getSemanticIdentifier());
|
connected.getSemanticIdentifier());
|
||||||
leftPanel.add(semanticIdentifier);
|
leftPanel.add(semanticIdentifier);
|
||||||
|
|
||||||
Paragraph identifier = new Paragraph("Record UUID: " +
|
|
||||||
connected.getKnowledgeBaseId());
|
|
||||||
leftPanel.add(identifier);
|
|
||||||
|
|
||||||
Anchor view = new Anchor();
|
Anchor view = new Anchor();
|
||||||
view.setHref(connected.getUrl());
|
view.setHref(connected.getUrl());
|
||||||
view.setText("View");
|
view.setText("View");
|
||||||
|
@ -198,7 +198,7 @@ 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 identifier = new Paragraph("Record UUID:");
|
Paragraph identifier = new Paragraph("UUID:");
|
||||||
|
|
||||||
// view link
|
// view link
|
||||||
final Anchor view = new Anchor();
|
final Anchor view = new Anchor();
|
||||||
|
|
|
@ -130,6 +130,13 @@ public class SimilarGRSFRecordWidget extends Composite {
|
||||||
leftPanel.getElement().getStyle().setMarginLeft(20, Unit.PX);
|
leftPanel.getElement().getStyle().setMarginLeft(20, Unit.PX);
|
||||||
Paragraph name = new Paragraph("Record Name: " + (similarGRSFRecord.getTitle() != null? similarGRSFRecord.getTitle() : "Unavailable"));
|
Paragraph name = new Paragraph("Record Name: " + (similarGRSFRecord.getTitle() != null? similarGRSFRecord.getTitle() : "Unavailable"));
|
||||||
leftPanel.add(name);
|
leftPanel.add(name);
|
||||||
|
Paragraph identifier = new Paragraph("UUID: " +
|
||||||
|
similarGRSFRecord.getKnowledgeBaseId());
|
||||||
|
leftPanel.add(identifier);
|
||||||
|
|
||||||
|
Paragraph semanticIdentifier = new Paragraph("Semantic Identifier: " +
|
||||||
|
similarGRSFRecord.getSemanticIdentifier());
|
||||||
|
leftPanel.add(semanticIdentifier);
|
||||||
if(similarGRSFRecord.getDescription() != null){
|
if(similarGRSFRecord.getDescription() != null){
|
||||||
String shortDescrption = similarGRSFRecord.getDescription().length() > 45 ?
|
String shortDescrption = similarGRSFRecord.getDescription().length() > 45 ?
|
||||||
similarGRSFRecord.getDescription().substring(0, 45) + " ... " :
|
similarGRSFRecord.getDescription().substring(0, 45) + " ... " :
|
||||||
|
@ -139,9 +146,6 @@ public class SimilarGRSFRecordWidget extends Composite {
|
||||||
description.setTitle("Description: " + similarGRSFRecord.getDescription());
|
description.setTitle("Description: " + similarGRSFRecord.getDescription());
|
||||||
leftPanel.add(description);
|
leftPanel.add(description);
|
||||||
}
|
}
|
||||||
Paragraph identifier = new Paragraph("UUID: " +
|
|
||||||
similarGRSFRecord.getKnowledgeBaseId());
|
|
||||||
leftPanel.add(identifier);
|
|
||||||
|
|
||||||
Anchor view = new Anchor();
|
Anchor view = new Anchor();
|
||||||
view.setHref(similarGRSFRecord.getUrl());
|
view.setHref(similarGRSFRecord.getUrl());
|
||||||
|
|
|
@ -84,6 +84,7 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
|
||||||
if(httpSession.getAttribute(sessionProductKey) != null)
|
if(httpSession.getAttribute(sessionProductKey) != null)
|
||||||
return (ManageProductBean) httpSession.getAttribute(sessionProductKey);
|
return (ManageProductBean) httpSession.getAttribute(sessionProductKey);
|
||||||
|
|
||||||
|
// testing case...
|
||||||
if(!Utils.isIntoPortal()){
|
if(!Utils.isIntoPortal()){
|
||||||
|
|
||||||
Thread.sleep(2000);
|
Thread.sleep(2000);
|
||||||
|
@ -116,7 +117,7 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
|
||||||
));
|
));
|
||||||
toReturn.setSuggestedByKnowledgeBaseConnections(suggestionsForConnections);
|
toReturn.setSuggestedByKnowledgeBaseConnections(suggestionsForConnections);
|
||||||
toReturn.setDomain("Stock");
|
toReturn.setDomain("Stock");
|
||||||
toReturn.setGrsfType("Assessment Unit");
|
toReturn.setCurrentGrsfType("Assessment Unit");
|
||||||
toReturn.setKnowledgeBaseId("91f1e413-dc9f-3b4e-b1c5-0e8560177253");
|
toReturn.setKnowledgeBaseId("91f1e413-dc9f-3b4e-b1c5-0e8560177253");
|
||||||
toReturn.setShortName("Widow rockfish - US West Coast");
|
toReturn.setShortName("Widow rockfish - US West Coast");
|
||||||
toReturn.setShortNameUpdated("Widow rockfish - US West Coast");
|
toReturn.setShortNameUpdated("Widow rockfish - US West Coast");
|
||||||
|
@ -217,7 +218,6 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
|
||||||
|
|
||||||
// get extras as pairs
|
// get extras as pairs
|
||||||
List<CkanPair> extrasAsPairs = record.getExtras();
|
List<CkanPair> extrasAsPairs = record.getExtras();
|
||||||
|
|
||||||
Map<String, List<String>> extrasWithoutNamespaces = Utils.replaceFieldsKey(extrasAsPairs, fieldsNamespacesMap);
|
Map<String, List<String>> extrasWithoutNamespaces = Utils.replaceFieldsKey(extrasAsPairs, fieldsNamespacesMap);
|
||||||
String catalogueIdentifier = record.getId();
|
String catalogueIdentifier = record.getId();
|
||||||
String description = record.getNotes();
|
String description = record.getNotes();
|
||||||
|
@ -236,6 +236,14 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
|
||||||
logger.warn("Unable to fetch traceability flag. Setting it to false", e);
|
logger.warn("Unable to fetch traceability flag. Setting it to false", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean sdgFlag = false;
|
||||||
|
try{
|
||||||
|
sdgFlag = extrasWithoutNamespaces.get(Constants.SDG_FLAG_CUSTOM_KEY).get(0).equalsIgnoreCase("true");
|
||||||
|
}catch(Exception e){
|
||||||
|
logger.warn("Unable to fetch sdg flag. Setting it to false", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO, remove
|
||||||
if(status.equals(Status.To_be_Merged) || status.equals(Status.Rejected))
|
if(status.equals(Status.To_be_Merged) || status.equals(Status.Rejected))
|
||||||
throw new Exception("Records under merging activity or rejected cannot be managed!");
|
throw new Exception("Records under merging activity or rejected cannot be managed!");
|
||||||
|
|
||||||
|
@ -246,7 +254,7 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
|
||||||
if(similarGrsfRecordsAsStrings != null && !similarGrsfRecordsAsStrings.isEmpty()){
|
if(similarGrsfRecordsAsStrings != null && !similarGrsfRecordsAsStrings.isEmpty()){
|
||||||
if(!similarGrsfRecordsAsStrings.get(0).equals(Constants.NO_SIMILAR_GRSF_RECORDS)){
|
if(!similarGrsfRecordsAsStrings.get(0).equals(Constants.NO_SIMILAR_GRSF_RECORDS)){
|
||||||
for (String similarGRSFRecord : similarGrsfRecordsAsStrings) {
|
for (String similarGRSFRecord : similarGrsfRecordsAsStrings) {
|
||||||
similarRecords.add(Utils.similarGRSFRecordFromJson(similarGRSFRecord, catalogue, apiKey));
|
similarRecords.add(Utils.similarGRSFRecordFromJson(similarGRSFRecord, catalogue, apiKey, httpSession));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -299,7 +307,7 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
|
||||||
// set the values
|
// set the values
|
||||||
toReturn = new ManageProductBean(
|
toReturn = new ManageProductBean(
|
||||||
semanticId, catalogueIdentifier, uuidKB, grsfType,
|
semanticId, catalogueIdentifier, uuidKB, grsfType,
|
||||||
grsfDomain, shortName, description, grsfName,traceabilityFlag,
|
grsfDomain, shortName, description, grsfName,traceabilityFlag, sdgFlag,
|
||||||
status, recordUrl, sources, similarRecords,
|
status, recordUrl, sources, similarRecords,
|
||||||
connectedBeans, suggestedConnectionsByKnowledgeBase);
|
connectedBeans, suggestedConnectionsByKnowledgeBase);
|
||||||
|
|
||||||
|
|
|
@ -102,6 +102,9 @@ public class GRSFUpdaterServiceClient {
|
||||||
obj.put(Constants.NEW_STATUS, bean.getNewStatus().toString().toLowerCase());
|
obj.put(Constants.NEW_STATUS, bean.getNewStatus().toString().toLowerCase());
|
||||||
obj.put(Constants.OLD_STATUS, bean.getCurrentStatus().toString().toLowerCase());
|
obj.put(Constants.OLD_STATUS, bean.getCurrentStatus().toString().toLowerCase());
|
||||||
obj.put(Constants.TRACEABILITY_FLAG, bean.isTraceabilityFlag());
|
obj.put(Constants.TRACEABILITY_FLAG, bean.isTraceabilityFlag());
|
||||||
|
obj.put(Constants.SDG_FLAG, bean.isSdgFlag());
|
||||||
|
obj.put(Constants.GRSF_TYPE_OLD, bean.getCurrentGrsfType());
|
||||||
|
obj.put(Constants.GRSF_TYPE_NEW, bean.getNewGrsfType());
|
||||||
|
|
||||||
String annotation = bean.getAnnotation() != null ? bean.getAnnotation(): "";
|
String annotation = bean.getAnnotation() != null ? bean.getAnnotation(): "";
|
||||||
obj.put(Constants.ANNOTATION, annotation.replaceAll("\"", ""));
|
obj.put(Constants.ANNOTATION, annotation.replaceAll("\"", ""));
|
||||||
|
|
|
@ -451,7 +451,7 @@ public class Utils {
|
||||||
* @return {@link SimilarGRSFRecord}
|
* @return {@link SimilarGRSFRecord}
|
||||||
* @throws ParseException
|
* @throws ParseException
|
||||||
*/
|
*/
|
||||||
public static SimilarGRSFRecord similarGRSFRecordFromJson(String json, DataCatalogue ctl, String apiKey) throws ParseException{
|
public static SimilarGRSFRecord similarGRSFRecordFromJson(String json, DataCatalogue ctl, String apiKey, HttpSession httpSession) throws ParseException{
|
||||||
|
|
||||||
if(json == null)
|
if(json == null)
|
||||||
return null;
|
return null;
|
||||||
|
@ -461,6 +461,12 @@ public class Utils {
|
||||||
|
|
||||||
String uuid = getDatasetKnowledgeBaseIdFromUrl((String)object.get(Constants.SIMILAR_RECORDS_BEAN_FIELD_URL));
|
String uuid = getDatasetKnowledgeBaseIdFromUrl((String)object.get(Constants.SIMILAR_RECORDS_BEAN_FIELD_URL));
|
||||||
CkanDataset dataset = ctl.getDataset(uuid, apiKey);
|
CkanDataset dataset = ctl.getDataset(uuid, apiKey);
|
||||||
|
|
||||||
|
boolean isStock = dataset.getExtrasAsHashMap().get(Constants.DOMAIN_CUSTOM_KEY).contains(Product_Type.STOCK.getOrigName());
|
||||||
|
Map<String, String> fieldsNamespacesMap =
|
||||||
|
Utils.getFieldToFieldNameSpaceMapping(httpSession, isStock ?
|
||||||
|
Constants.GENERIC_RESOURCE_NAME_MAP_KEY_NAMESPACES_STOCK : Constants.GENERIC_RESOURCE_NAME_MAP_KEY_NAMESPACES_FISHERY);
|
||||||
|
Map<String, List<String>> extrasWithoutNamespaces = Utils.replaceFieldsKey(dataset.getExtras(), fieldsNamespacesMap);
|
||||||
|
|
||||||
return new SimilarGRSFRecord(
|
return new SimilarGRSFRecord(
|
||||||
uuid,
|
uuid,
|
||||||
|
@ -468,8 +474,8 @@ public class Utils {
|
||||||
(String)object.get(Constants.SIMILAR_RECORDS_BEAN_FIELD_NAME),
|
(String)object.get(Constants.SIMILAR_RECORDS_BEAN_FIELD_NAME),
|
||||||
dataset.getTitle(),
|
dataset.getTitle(),
|
||||||
(String)object.get(Constants.SIMILAR_RECORDS_BEAN_FIELD_URL),
|
(String)object.get(Constants.SIMILAR_RECORDS_BEAN_FIELD_URL),
|
||||||
(String)object.get(Constants.SIMILAR_RECORDS_BEAN_FIELD_IDENTIFIER),
|
extrasWithoutNamespaces.get(Constants.GRSF_SEMANTIC_IDENTIFIER_CUSTOM_KEY).get(0),
|
||||||
dataset.getExtrasAsHashMap().get(Constants.DOMAIN_CUSTOM_KEY)
|
extrasWithoutNamespaces.get(Constants.DOMAIN_CUSTOM_KEY).get(0)
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,10 @@ public enum HashTagsOnUpdate {
|
||||||
CONNECT("connect"),
|
CONNECT("connect"),
|
||||||
SHORTNAME_UPDATED("shortname_updated"),
|
SHORTNAME_UPDATED("shortname_updated"),
|
||||||
TRACEABILITY_FLAG_SET("traceability_flag_set"),
|
TRACEABILITY_FLAG_SET("traceability_flag_set"),
|
||||||
TRACEABILITY_FLAG_UNSET("traceability_flag_unset");
|
TRACEABILITY_FLAG_UNSET("traceability_flag_unset"),
|
||||||
|
SDG_FLAG_SET("sdg_flag_set"),
|
||||||
|
SDG_FLAG_UNSET("sdg_flag_unset"),
|
||||||
|
GRSF_TYPE_CHANGED("grsf_type_changed");
|
||||||
|
|
||||||
private String string;
|
private String string;
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,11 @@ public class ManageProductBean extends GenericRecord{
|
||||||
|
|
||||||
private static final long serialVersionUID = -4882608487467259326L;
|
private static final long serialVersionUID = -4882608487467259326L;
|
||||||
private String catalogueIdentifier; // Catalogue id
|
private String catalogueIdentifier; // Catalogue id
|
||||||
private String grsfType; // Fishery or Stock type (e.g., Assessment_Unit, Marine Resource and so on)
|
private String currentGrsfType; // Fishery or Stock type (e.g., Assessment_Unit, Marine Resource and so on)
|
||||||
|
private String newGrsfType;
|
||||||
private String shortNameUpdated; // the updated one, if any
|
private String shortNameUpdated; // the updated one, if any
|
||||||
private boolean traceabilityFlag; //from false to true etc
|
private boolean traceabilityFlag; //from false to true etc
|
||||||
|
private boolean sdgFlag;
|
||||||
private Status currentStatus;
|
private Status currentStatus;
|
||||||
private Status newStatus;
|
private Status newStatus;
|
||||||
private String annotation; // added by the administrator
|
private String annotation; // added by the administrator
|
||||||
|
@ -44,6 +46,7 @@ public class ManageProductBean extends GenericRecord{
|
||||||
String description,
|
String description,
|
||||||
String title,
|
String title,
|
||||||
boolean traceabilityFlag,
|
boolean traceabilityFlag,
|
||||||
|
boolean sdgFlag,
|
||||||
Status currentStatus,
|
Status currentStatus,
|
||||||
String recordUrl,
|
String recordUrl,
|
||||||
List<SourceRecord> sources,
|
List<SourceRecord> sources,
|
||||||
|
@ -53,7 +56,7 @@ public class ManageProductBean extends GenericRecord{
|
||||||
) {
|
) {
|
||||||
super(knowledgeBaseIdentifier, description, shortName, title, recordUrl, semanticIdentifier, grsfDomain);
|
super(knowledgeBaseIdentifier, description, shortName, title, recordUrl, semanticIdentifier, grsfDomain);
|
||||||
this.catalogueIdentifier = catalogueIdentifier;
|
this.catalogueIdentifier = catalogueIdentifier;
|
||||||
this.grsfType = grsfType;
|
this.currentGrsfType = grsfType;
|
||||||
this.shortNameUpdated = shortName;
|
this.shortNameUpdated = shortName;
|
||||||
this.traceabilityFlag = traceabilityFlag;
|
this.traceabilityFlag = traceabilityFlag;
|
||||||
this.currentStatus = currentStatus;
|
this.currentStatus = currentStatus;
|
||||||
|
@ -61,6 +64,7 @@ public class ManageProductBean extends GenericRecord{
|
||||||
this.similarGrsfRecords = similarGrsfRecords;
|
this.similarGrsfRecords = similarGrsfRecords;
|
||||||
this.currentConnections = currentConnections;
|
this.currentConnections = currentConnections;
|
||||||
this.suggestedByKnowledgeBaseConnections = suggestedByKnowledgeBaseConnections;
|
this.suggestedByKnowledgeBaseConnections = suggestedByKnowledgeBaseConnections;
|
||||||
|
this.sdgFlag = sdgFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SourceRecord> getSources() {
|
public List<SourceRecord> getSources() {
|
||||||
|
@ -87,12 +91,22 @@ public class ManageProductBean extends GenericRecord{
|
||||||
this.catalogueIdentifier = catalogueIdentifier;
|
this.catalogueIdentifier = catalogueIdentifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getGrsfType() {
|
|
||||||
return grsfType;
|
|
||||||
|
public String getCurrentGrsfType() {
|
||||||
|
return currentGrsfType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGrsfType(String grsfType) {
|
public void setCurrentGrsfType(String currentGrsfType) {
|
||||||
this.grsfType = grsfType;
|
this.currentGrsfType = currentGrsfType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNewGrsfType() {
|
||||||
|
return newGrsfType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNewGrsfType(String newGrsfType) {
|
||||||
|
this.newGrsfType = newGrsfType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Status getCurrentStatus() {
|
public Status getCurrentStatus() {
|
||||||
|
@ -193,11 +207,21 @@ public class ManageProductBean extends GenericRecord{
|
||||||
this.hashtags = hashtags;
|
this.hashtags = hashtags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isSdgFlag() {
|
||||||
|
return sdgFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSdgFlag(boolean sdgFlag) {
|
||||||
|
this.sdgFlag = sdgFlag;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ManageProductBean [catalogueIdentifier=" + catalogueIdentifier
|
return "ManageProductBean [catalogueIdentifier=" + catalogueIdentifier
|
||||||
+ ", grsfType=" + grsfType + ", shortNameUpdated="
|
+ ", currentGrsfType=" + currentGrsfType + ", newGrsfType=" + newGrsfType +
|
||||||
|
", shortNameUpdated="
|
||||||
+ shortNameUpdated + ", traceabilityFlag=" + traceabilityFlag
|
+ shortNameUpdated + ", traceabilityFlag=" + traceabilityFlag
|
||||||
|
+ ", sdgFlag=" + sdgFlag
|
||||||
+ ", currentStatus=" + currentStatus + ", newStatus="
|
+ ", currentStatus=" + currentStatus + ", newStatus="
|
||||||
+ newStatus + ", annotation=" + annotation + ", sources="
|
+ newStatus + ", annotation=" + annotation + ", sources="
|
||||||
+ sources + ", similarGrsfRecords=" + similarGrsfRecords
|
+ sources + ", similarGrsfRecords=" + similarGrsfRecords
|
||||||
|
|
|
@ -7,7 +7,7 @@ package org.gcube.datacatalogue.grsf_manage_widget.shared;
|
||||||
public class SourceRecord extends GenericRecord{
|
public class SourceRecord extends GenericRecord{
|
||||||
|
|
||||||
private static final long serialVersionUID = -5144710283443577518L;
|
private static final long serialVersionUID = -5144710283443577518L;
|
||||||
private String name;
|
private String name; // one of RAM, FIRMS, FishSource
|
||||||
|
|
||||||
public SourceRecord() {
|
public SourceRecord() {
|
||||||
super();
|
super();
|
||||||
|
|
Loading…
Reference in New Issue