minor fixes

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/widgets/grsf-manage-widget@152418 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2017-08-02 12:09:02 +00:00
parent f8870d85db
commit 57096696ac
5 changed files with 62 additions and 143 deletions

View File

@ -54,18 +54,12 @@ public class ManageProductWidget extends Composite{
@UiField
AlertBlock infoBlock;
@UiField
TextArea titleTextArea;
@UiField
TextBox shortNameTextBox;
@UiField
TextBox productGrsfType;
@UiField
TextArea descriptionTextArea;
@UiField
CheckBox traceabilityFlag;
@ -170,14 +164,12 @@ public class ManageProductWidget extends Composite{
annotationArea.setText("");
infoBlock.setVisible(false);
titleTextArea.setText(bean.getItemTitle());
shortNameTextBox.setText(bean.getShortTitle());
shortNameTextBox.setText(bean.getShortName());
currentStatus.setText(bean.getCurrentStatus().toString());
productGrsfType.setText(bean.getGrsfType());
GRSFNameTexBox.setText(bean.getGrsfName());
semanticIdentifierTextBox.setText(bean.getSemanticId());
sources.setText(bean.getSources());
descriptionTextArea.setText(bean.getDescription());
traceabilityFlag.setValue(bean.isTraceabilityFlag());
// check if we need to show more

View File

@ -23,38 +23,6 @@
<b:Form type="VERTICAL" visible="true" ui:field="formUpdate"
width="100%">
<b:ControlGroup ui:field="productTitleGroup">
<b:ControlLabel for="title" title="Title">
<b>Title:</b>
</b:ControlLabel>
<b:Controls>
<b:TextArea alternateSize="LARGE" placeholder="Title"
readOnly="true" width="97%" b:id="title" title="Title" ui:field="titleTextArea" />
</b:Controls>
</b:ControlGroup>
<b:ControlGroup ui:field="productDescriptionGroup">
<b:ControlLabel for="description" title="Description">
<b>Description:</b>
</b:ControlLabel>
<b:Controls>
<b:TextArea alternateSize="LARGE" placeholder="Description"
readOnly="true" width="97%" b:id="description" title="Description"
ui:field="descriptionTextArea" />
</b:Controls>
</b:ControlGroup>
<b:ControlGroup ui:field="productShortNameGroup">
<b:ControlLabel for="shortname" title="Short Name">
<b>Short Name:</b>
</b:ControlLabel>
<b:Controls>
<b:TextBox alternateSize="LARGE" placeholder="Short Name"
readOnly="true" width="97%" b:id="shortname" title="Short Name"
ui:field="shortNameTextBox" />
</b:Controls>
</b:ControlGroup>
<b:ControlGroup ui:field="productGRSFNameGroup">
<b:ControlLabel for="grsfname" title="GRSF Name">
<b>GRSF Name:</b>
@ -66,13 +34,24 @@
</b:Controls>
</b:ControlGroup>
<b:ControlGroup ui:field="productSemanticIdentifierGroup">
<b:ControlLabel for="semanticidentifier" title="Semantic Identifier">
<b>Semantic Identifier:</b>
<b:ControlGroup ui:field="productShortNameGroup">
<b:ControlLabel for="shortname" title="Short Name">
<b>GRSF Short Name:</b>
</b:ControlLabel>
<b:Controls>
<b:TextBox alternateSize="LARGE" placeholder="Item GRSF Name"
readOnly="true" width="97%" b:id="semanticidentifier" title="Semantic Identifier"
<b:TextBox alternateSize="LARGE" placeholder="Short Name"
readOnly="true" width="97%" b:id="shortname" title="Short Name"
ui:field="shortNameTextBox" />
</b:Controls>
</b:ControlGroup>
<b:ControlGroup ui:field="productSemanticIdentifierGroup">
<b:ControlLabel for="semanticidentifier" title="GRSF Semantic Identifier">
<b>GRSF Semantic Identifier:</b>
</b:ControlLabel>
<b:Controls>
<b:TextBox alternateSize="LARGE" placeholder="GRSF Semantic Identifier"
readOnly="true" width="97%" b:id="semanticidentifier" title="GRSF Semantic Identifier"
ui:field="semanticIdentifierTextBox" />
</b:Controls>
</b:ControlGroup>
@ -83,7 +62,8 @@
</b:ControlLabel>
<b:Controls>
<b:TextBox b:id="productGrsfType" alternateSize="LARGE"
width="97%" title="GRSF type" readOnly="true" ui:field="productGrsfType"></b:TextBox>
placeholder="GRSF Type" width="97%" title="GRSF Type" readOnly="true"
ui:field="productGrsfType"></b:TextBox>
</b:Controls>
</b:ControlGroup>
@ -102,7 +82,8 @@
<b>Traceability Flag:</b>
</b:ControlLabel>
<b:Controls>
<b:CheckBox b:id="traceabilityflag" title="Traceability Flag" ui:field="traceabilityFlag"></b:CheckBox>
<b:CheckBox b:id="traceabilityflag" title="Traceability Flag"
ui:field="traceabilityFlag"></b:CheckBox>
</b:Controls>
</b:ControlGroup>
@ -140,7 +121,6 @@
title="An annotation message to send along the update" ui:field="annotationArea"></b:TextArea>
</b:Controls>
</b:ControlGroup>
</b:Form>
</g:VerticalPanel>
@ -149,7 +129,7 @@
<b:Icon type="GEAR" spin="true" ui:field="loaderIcon"
visible="false" />
<b:Button ui:field="cancelButton">Cancel</b:Button>
<b:Button icon="FILE" type="PRIMARY" ui:field="confirmButton">Send</b:Button>
<b:Button icon="FILE" type="PRIMARY" ui:field="confirmButton">Apply</b:Button>
</b:ModalFooter>
</b:Modal>
</g:HTMLPanel>

View File

@ -163,18 +163,15 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
String grsfDomain = extrasWithoutNamespaces.get(Constants.GRSF_DOMAIN);
String grsfName = extrasWithoutNamespaces.get(grsfDomain.equals(Constants.STOCK) ? Constants.STOCK_GRSF_NAME : Constants.FISHERY_GRSF_NAME);
String traceabilityFlag = extrasWithoutNamespaces.get(Constants.TRACEABILITY_FLAG);
String title = record.getTitle();
String description = record.getNotes();
String sources = extrasWithoutNamespaces.get(Constants.GRSF_DATABASE_SOURCE);
if(status == null || uuidKB == null)
throw new Exception("Some information is missing in this record: Status = " + status + ", knowledge base uuid = " + uuidKB +
", and grsf domain is = " + grsfDomain);
String sources = getSourcesFromGroups(record);
// set the values
toReturn = new ManageProductBean(title, semanticId, productIdentifier,
uuidKB, grsfType, grsfDomain, sources, description, grsfName, null, GRSFStatus.fromString(status), null, null, shortName, traceabilityFlag.equalsIgnoreCase("true"));
toReturn = new ManageProductBean(semanticId, productIdentifier, uuidKB,
grsfType, grsfDomain, sources, grsfName, traceabilityFlag.equalsIgnoreCase("true"), GRSFStatus.fromString(status), null, null, shortName, null);
logger.info("Returning item bean " + toReturn);
@ -182,28 +179,6 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
}
}
/**
* Get sources from record
* @param record
* @return
*/
private String getSourcesFromGroups(CkanDataset record) {
if(record == null)
return null;
else{
List<CkanGroup> groups = record.getGroups();
for (CkanGroup ckanGroup : groups) {
String title = ckanGroup.getTitle();
if(title.contains(Constants.RAM) || title.contains(Constants.FISHSOURCE) || title.contains(Constants.FIRMS))
return title;
}
}
return null;
}
/**
* Discover the service endpoint and return its url
* @param context

View File

@ -13,8 +13,13 @@ public class Constants {
public static final String SOURCES_TITLE_FIELD_KEY = "Sources";
public static final String GRSF_DOMAIN = "GRSF Domain";
public static final String TRACEABILITY_FLAG = "Traceability Flag";
public static final String SYSTEM_TYPE = "system:type";
public static final String GRSF = "GRSF";
public static final String FIRMS = "FIRMS";
public static final String RAM = "RAM";
public static final String FISHSOURCE = "FishSource";
public static final String ANNOTATION_KEY = "Annotation on update";
public static final String GRSF_DATABASE_SOURCE = "Database Source";
// stock or fishery
public static final String STOCK = "Stock";
@ -45,11 +50,5 @@ public class Constants {
// session info for user
public static final String GRSF_ADMIN_SESSION_KEY = "IS_GRSF_ADMIN";
public static final String GRSF_CATALOGUE_MANAGER_ROLE = "Catalogue Manager"; // managed as Team Role
public static final String SYSTEM_TYPE = "system:type";
public static final String GRSF = "GRSF";
public static final String FIRMS = "FIRMS";
public static final String RAM = "RAM";
public static final String FISHSOURCE = "FishSource";
}

View File

@ -10,76 +10,58 @@ import java.util.Map;
public class ManageProductBean implements Serializable{
private static final long serialVersionUID = -4882608487467259326L;
private String itemTitle; // title
private String semanticId; // Stock id or Fishery id
private String catalogueIdentifier; // catalogue id
private String knowledgeBaseIdentifier; // GRSF UUID
private String grsfType; // Fishery or Stock type (e.g., Assessment_Unit, Marine Resource and so on)
private String grsfDomain; // fishery/stock
private String sources; // sources for this record
private String description;
private String grsfName; // Fishery name or stock name
private Map<String, String> extrasIfAvailable; // read from GRSFManageEntries resource
// info that could change
private boolean traceabilityFlag; //from false to true etc
private GRSFStatus currentStatus;
private GRSFStatus newStatus;
private String annotation; // added by the administrator
private String shortTitle;
private boolean traceabilityFlag; //from false to true etc
private String shortName;
private Map<String, String> extrasIfAvailable; // read from GRSFManageEntries resource
public ManageProductBean() {
super();
}
/**
* @param itemTitle
* @param semanticId
* @param catalogueIdentifier
* @param knowledgeBaseIdentifier
* @param grsfType
* @param grsfDomain
* @param sources
* @param description
* @param grsfName
* @param extrasIfAvailable
* @param traceabilityFlag
* @param currentStatus
* @param newStatus
* @param annotation
* @param shortTitle
* @param traceabilityFlag
* @param shortName
* @param extrasIfAvailable
*/
public ManageProductBean(String itemTitle, String semanticId,
String catalogueIdentifier, String knowledgeBaseIdentifier,
String grsfType, String grsfDomain, String sources,
String description, String grsfName,
Map<String, String> extrasIfAvailable, GRSFStatus currentStatus,
GRSFStatus newStatus, String annotation, String shortTitle,
boolean traceabilityFlag) {
public ManageProductBean(String semanticId, String catalogueIdentifier,
String knowledgeBaseIdentifier, String grsfType, String grsfDomain,
String sources, String grsfName, boolean traceabilityFlag,
GRSFStatus currentStatus, GRSFStatus newStatus, String annotation,
String shortName, Map<String, String> extrasIfAvailable) {
super();
this.itemTitle = itemTitle;
this.semanticId = semanticId;
this.catalogueIdentifier = catalogueIdentifier;
this.knowledgeBaseIdentifier = knowledgeBaseIdentifier;
this.grsfType = grsfType;
this.grsfDomain = grsfDomain;
this.sources = sources;
this.description = description;
this.grsfName = grsfName;
this.extrasIfAvailable = extrasIfAvailable;
this.traceabilityFlag = traceabilityFlag;
this.currentStatus = currentStatus;
this.newStatus = newStatus;
this.annotation = annotation;
this.shortTitle = shortTitle;
this.traceabilityFlag = traceabilityFlag;
}
public String getItemTitle() {
return itemTitle;
}
public void setItemTitle(String itemTitle) {
this.itemTitle = itemTitle;
this.shortName = shortName;
this.extrasIfAvailable = extrasIfAvailable;
}
public String getSemanticId() {
@ -130,14 +112,6 @@ public class ManageProductBean implements Serializable{
this.sources = sources;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getGrsfName() {
return grsfName;
}
@ -177,15 +151,7 @@ public class ManageProductBean implements Serializable{
public void setAnnotation(String annotation) {
this.annotation = annotation;
}
public String getShortTitle() {
return shortTitle;
}
public void setShortTitle(String shortTitle) {
this.shortTitle = shortTitle;
}
public boolean isTraceabilityFlag() {
return traceabilityFlag;
}
@ -194,18 +160,25 @@ public class ManageProductBean implements Serializable{
this.traceabilityFlag = traceabilityFlag;
}
public String getShortName() {
return shortName;
}
public void setShortName(String shortName) {
this.shortName = shortName;
}
@Override
public String toString() {
return "ManageProductBean [itemTitle=" + itemTitle + ", semanticId="
+ semanticId + ", catalogueIdentifier=" + catalogueIdentifier
return "ManageProductBean [semanticId=" + semanticId
+ ", catalogueIdentifier=" + catalogueIdentifier
+ ", knowledgeBaseIdentifier=" + knowledgeBaseIdentifier
+ ", grsfType=" + grsfType + ", grsfDomain=" + grsfDomain
+ ", sources=" + sources + ", description=" + description
+ ", grsfName=" + grsfName + ", extrasIfAvailable="
+ extrasIfAvailable + ", currentStatus=" + currentStatus
+ ", newStatus=" + newStatus + ", annotation=" + annotation
+ ", shortTitle=" + shortTitle + ", traceabilityFlag="
+ traceabilityFlag + "]";
+ ", sources=" + sources + ", grsfName=" + grsfName
+ ", traceabilityFlag=" + traceabilityFlag + ", currentStatus="
+ currentStatus + ", newStatus=" + newStatus + ", annotation="
+ annotation + ", shortName=" + shortName
+ ", extrasIfAvailable=" + extrasIfAvailable + "]";
}
}