manage also repeated keys is now available

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/widgets/grsf-manage-widget@144096 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2017-02-22 11:21:10 +00:00
parent 957e07aaf2
commit 41413b80a6
3 changed files with 24 additions and 57 deletions

View File

@ -8,7 +8,7 @@
</b:ControlLabel>
<b:Controls>
<b:TextBox b:id="labelEntry" alternateSize="LARGE"
width="97%" enabled="false" ui:field="entryValue"></b:TextBox>
width="97%" readOnly="true" ui:field="entryValue"></b:TextBox>
</b:Controls>
</b:ControlGroup>
</g:HTMLPanel>

View File

@ -29,7 +29,7 @@
</b:ControlLabel>
<b:Controls>
<b:TextArea alternateSize="LARGE" placeholder="Item title"
enabled="false" width="97%" b:id="title" title="Item title"
readOnly="true" width="97%" b:id="title" title="Item title"
ui:field="titleTextArea" />
</b:Controls>
</b:ControlGroup>
@ -40,7 +40,7 @@
</b:ControlLabel>
<b:Controls>
<b:TextArea alternateSize="LARGE" placeholder="Item description"
enabled="false" width="97%" b:id="description" title="Item description"
readOnly="true" width="97%" b:id="description" title="Item description"
ui:field="descriptionTextArea" />
</b:Controls>
</b:ControlGroup>
@ -51,50 +51,11 @@
</b:ControlLabel>
<b:Controls>
<b:TextBox b:id="productGrsfType" alternateSize="LARGE"
width="97%" title="The GRSF Item type" enabled="false" ui:field="productGrsfType"></b:TextBox>
width="97%" title="The GRSF Item type" readOnly="true"
ui:field="productGrsfType"></b:TextBox>
</b:Controls>
</b:ControlGroup>
<!-- <b:ControlGroup ui:field="productSemanticIdGroup"> -->
<!-- <b:ControlLabel for="productSemanticId" title="The semantic id"> -->
<!-- <b>Item Semantic Id:</b> -->
<!-- </b:ControlLabel> -->
<!-- <b:Controls> -->
<!-- <b:TextBox b:id="productSemanticId" alternateSize="LARGE" -->
<!-- width="97%" title="The semantic id" enabled="false" ui:field="productSemanticId"></b:TextBox> -->
<!-- </b:Controls> -->
<!-- </b:ControlGroup> -->
<!-- <b:ControlGroup ui:field="productShortTitleGroup"> -->
<!-- <b:ControlLabel for="productShortTitle" title="The short title"> -->
<!-- <b>Item Short Title:</b> -->
<!-- </b:ControlLabel> -->
<!-- <b:Controls> -->
<!-- <b:TextBox b:id="productShortTitle" alternateSize="LARGE" -->
<!-- width="97%" title="The short title" enabled="false" ui:field="productShortTitle"></b:TextBox> -->
<!-- </b:Controls> -->
<!-- </b:ControlGroup> -->
<!-- <b:ControlGroup ui:field="productSourceGroup"> -->
<!-- <b:ControlLabel for="productSource" title="The sources"> -->
<!-- <b>Item Sources:</b> -->
<!-- </b:ControlLabel> -->
<!-- <b:Controls> -->
<!-- <b:TextBox b:id="productSource" alternateSize="LARGE" -->
<!-- width="97%" title="The sources" enabled="false" ui:field="productSource"></b:TextBox> -->
<!-- </b:Controls> -->
<!-- </b:ControlGroup> -->
<!-- <b:ControlGroup ui:field="productTypeGroup"> -->
<!-- <b:ControlLabel for="productType" title="The Item type"> -->
<!-- <b>Item Type:</b> -->
<!-- </b:ControlLabel> -->
<!-- <b:Controls> -->
<!-- <b:TextBox b:id="productType" alternateSize="LARGE" -->
<!-- width="97%" title="The Item type" enabled="false" ui:field="productType"></b:TextBox> -->
<!-- </b:Controls> -->
<!-- </b:ControlGroup> -->
<b:ControlGroup ui:field="currentStatusGroup">
<b:ControlLabel for="currentStatus"
title="The current status of this Item">
@ -102,7 +63,7 @@
</b:ControlLabel>
<b:Controls>
<b:TextBox b:id="currentStatus" alternateSize="LARGE"
enabled="false" width="97%" title="The current status of this Item"
readOnly="true" width="97%" title="The current status of this Item"
ui:field="currentStatus">
</b:TextBox>
</b:Controls>

View File

@ -174,11 +174,11 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
throw new NoGRSFRecordException("This is not a GRSF Item");
// get extras
Map<String, String> extras = product.getExtrasAsHashMap();
String status = extras.get(STATUS_CUSTOM_FIELD_KEY);
String uuidKB = extras.get(KB_UUID_FIELD_KEY);
Map<String, String> extrasAsHashMap = product.getExtrasAsHashMap();
String status = extrasAsHashMap.get(STATUS_CUSTOM_FIELD_KEY);
String uuidKB = extrasAsHashMap.get(KB_UUID_FIELD_KEY);
// String productType = extras.get(TYPE_FIELD_KEY);
String productGRSFType = extras.get(GRSF_TYPE_FIELD_KEY);
String productGRSFType = extrasAsHashMap.get(GRSF_TYPE_FIELD_KEY);
// String semanticId = extras.get(productGRSFType + " id"); // i.e "Stock id" or "Fishery id"
// String shortTitle = extras.get(SHORT_TITLE_FIELD_KEY);
// String sources = extras.get(SOURCES_TITLE_FIELD_KEY);
@ -188,12 +188,22 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
// fetch extras
GenericResourceReaderExtras entries = new GenericResourceReaderExtras();
Set<String> extrasToShow = entries.getLookedUpExtrasKeys();
if(extrasToShow != null && !extrasToShow.isEmpty()){
Map<String, String> extrasKeyValuePair = new HashMap<String, String>();
for (String entryKey : extrasToShow) {
String value = extras.get(entryKey);
if(value != null && !value.isEmpty())
extrasKeyValuePair.put(entryKey, value);
List<CkanPair> extrasAsPairs = product.getExtras();
for (CkanPair ckanPair : extrasAsPairs) {
String key = ckanPair.getKey();
String value = ckanPair.getValue();
if(extrasToShow.contains(key)){
String currentValueInMap = extrasKeyValuePair.get(key);
if(currentValueInMap == null)
currentValueInMap = value;
else
currentValueInMap += ", " + value;
extrasKeyValuePair.put(key, currentValueInMap);
}
}
toReturn.setExtrasIfAvailable(extrasKeyValuePair);
}
@ -208,10 +218,6 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
toReturn.setItemTitle(title);
toReturn.setGrsfType(productGRSFType);
toReturn.setDescription(description);
// toReturn.setType(productType);
// toReturn.setSemanticId(semanticId);
// toReturn.setShortTitle(shortTitle);
// toReturn.setSource(sources);
logger.info("Returning item bean " + toReturn);