minor fixes for GRSF manage form
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/gcube-ckan-datacatalog@139842 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
933bd6fde3
commit
a124da9f3c
|
@ -79,7 +79,7 @@ public class ManageProductWidget extends Composite{
|
|||
|
||||
@UiField
|
||||
TextBox productType;
|
||||
|
||||
|
||||
@UiField
|
||||
Image loadingImage;
|
||||
|
||||
|
@ -104,7 +104,7 @@ public class ManageProductWidget extends Composite{
|
|||
// start loader service
|
||||
loadingImage.setUrl(LOADING_IMAGE_URL);
|
||||
loadingImage.setVisible(true);
|
||||
|
||||
|
||||
// async request to fetch the product
|
||||
retrieveProductBean(productIdentifier);
|
||||
manageProductModal.show();
|
||||
|
@ -135,8 +135,10 @@ public class ManageProductWidget extends Composite{
|
|||
}
|
||||
else{
|
||||
showInfo(ERROR_ON_RETRIEVING_BEAN, AlertType.ERROR);
|
||||
formUpdate.setVisible(false);
|
||||
confirmButton.setEnabled(false);
|
||||
}
|
||||
|
||||
|
||||
loadingImage.setVisible(false);
|
||||
}
|
||||
|
||||
|
@ -146,7 +148,11 @@ public class ManageProductWidget extends Composite{
|
|||
if(caught instanceof NoGRSFRecordException)
|
||||
showInfo(NO_GRSF_RECORD_BEAN, AlertType.WARNING);
|
||||
else
|
||||
showInfo(caught.getMessage(), AlertType.ERROR);
|
||||
showInfo(caught.getMessage(), AlertType.ERROR);
|
||||
|
||||
// hide the form and disable the send button
|
||||
formUpdate.setVisible(false);
|
||||
confirmButton.setEnabled(false);
|
||||
loadingImage.setVisible(false);
|
||||
}
|
||||
});
|
||||
|
@ -163,7 +169,7 @@ public class ManageProductWidget extends Composite{
|
|||
|
||||
if(bean == null)
|
||||
return;
|
||||
|
||||
|
||||
listBoxStatusGroup.setType(ControlGroupType.NONE);
|
||||
|
||||
if(listBoxStatus.getSelectedIndex() <= 0){
|
||||
|
|
|
@ -24,11 +24,11 @@
|
|||
|
||||
<b:ControlGroup ui:field="productTitleGroup">
|
||||
<b:ControlLabel for="name" title="Product name">
|
||||
Product Name:
|
||||
<b>Product Name:</b>
|
||||
</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox alternateSize="LARGE" placeholder="Product name"
|
||||
enabled="false" width="90%" b:id="name" title="Product name"
|
||||
enabled="false" width="97%" b:id="name" title="Product name"
|
||||
ui:field="nameTextBox" />
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
@ -36,10 +36,10 @@
|
|||
<b:ControlGroup ui:field="currentStatusGroup">
|
||||
<b:ControlLabel for="currentStatus"
|
||||
title="The current status of this product">
|
||||
Product Current Status:</b:ControlLabel>
|
||||
<b>Product Current Status:</b></b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox b:id="currentStatus" alternateSize="LARGE"
|
||||
enabled="false" width="91%" title="The current status of this product"
|
||||
enabled="false" width="97%" title="The current status of this product"
|
||||
ui:field="currentStatus">
|
||||
</b:TextBox>
|
||||
</b:Controls>
|
||||
|
@ -48,10 +48,10 @@
|
|||
<b:ControlGroup ui:field="listBoxStatusGroup">
|
||||
<b:ControlLabel for="listboxStatus"
|
||||
title="The new status of this product">
|
||||
Product New Status:</b:ControlLabel>
|
||||
<b>Product New Status:</b></b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:ListBox b:id="listboxStatus" alternateSize="LARGE"
|
||||
width="91%" title="Select a new status" enabled="true"
|
||||
width="97%" title="Select a new status" enabled="true"
|
||||
ui:field="listBoxStatus"></b:ListBox>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
@ -59,20 +59,20 @@
|
|||
<b:ControlGroup ui:field="productTypeGroup">
|
||||
<b:ControlLabel for="productType"
|
||||
title="The product type">
|
||||
Product Type:</b:ControlLabel>
|
||||
<b>Product Type:</b></b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox b:id="productType" alternateSize="LARGE"
|
||||
width="91%" title="The product type" enabled="false" ui:field="productType"></b:TextBox>
|
||||
width="97%" title="The product type" enabled="false" ui:field="productType"></b:TextBox>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
||||
<b:ControlGroup ui:field="annotationAreaGroup">
|
||||
<b:ControlLabel for="annotation"
|
||||
title="An annotation message to send along the update">
|
||||
Annotation:</b:ControlLabel>
|
||||
<b>Annotation:</b></b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextArea b:id="annotation" alternateSize="LARGE"
|
||||
placeholder="Add an annotation message" enabled="true" width="91%"
|
||||
placeholder="Add an annotation message" enabled="true" width="97%"
|
||||
title="An annotation message to send along the update" ui:field="annotationArea"></b:TextArea>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
|
|
@ -52,7 +52,7 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
|
|||
private static final String HTTP = "http";
|
||||
public static String CKANCONNECTORCONTEXT = "CkanConnectorContext";
|
||||
public static String CKANCONNECTORLOGOUT = "CkanConnectorLogout";
|
||||
public static String GRSFUPDATERSERVICE = "GRSFUpdaterEndPoint";
|
||||
public static final String GRSF_UPDATER_SERVICE = "GRSFUpdaterEndPoint";
|
||||
private static Logger logger = LoggerFactory.getLogger(GcubeCkanDataCatalogServiceImpl.class);
|
||||
|
||||
/**
|
||||
|
@ -534,7 +534,7 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
|
|||
DataCatalogue catalogue = getCatalogue(context);
|
||||
|
||||
// check if the base url of the service is in session
|
||||
String keyPerContext = UtilMethods.concatenateSessionKeyScope(GRSFUPDATERSERVICE, context);
|
||||
String keyPerContext = UtilMethods.concatenateSessionKeyScope(GRSF_UPDATER_SERVICE, context);
|
||||
String baseUrl = (String)getThreadLocalRequest().getSession().getAttribute(keyPerContext);
|
||||
if(baseUrl == null || baseUrl.isEmpty()){
|
||||
baseUrl = GRSFNotificationService.discoverEndPoint(context);
|
||||
|
@ -546,7 +546,7 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
|
|||
return true;
|
||||
|
||||
}catch(Exception e){
|
||||
logger.error("Unable to update the product..", e);
|
||||
logger.error("Unable to update the product.." + e.getMessage());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -556,42 +556,37 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
|
|||
|
||||
ManageProductBean toReturn = null;
|
||||
|
||||
try{
|
||||
// retrieve scope per current portlet url
|
||||
String scopePerCurrentUrl = SessionUtil.getScopeFromClientUrl(getThreadLocalRequest());
|
||||
DataCatalogue catalogue = getCatalogue(scopePerCurrentUrl);
|
||||
String username = SessionUtil.getCurrentUser(getThreadLocalRequest()).getUsername();
|
||||
CkanDataset product = catalogue.getDataset(productIdentifier, catalogue.getApiKeyFromUsername(username));
|
||||
// retrieve scope per current portlet url
|
||||
String scopePerCurrentUrl = SessionUtil.getScopeFromClientUrl(getThreadLocalRequest());
|
||||
DataCatalogue catalogue = getCatalogue(scopePerCurrentUrl);
|
||||
String username = SessionUtil.getCurrentUser(getThreadLocalRequest()).getUsername();
|
||||
CkanDataset product = catalogue.getDataset(productIdentifier, catalogue.getApiKeyFromUsername(username));
|
||||
|
||||
// get extras
|
||||
Map<String, String> extras = product.getExtrasAsHashMap();
|
||||
String status = extras.get("Status");
|
||||
String uuidKB = extras.get("UUID Knowledge Base");
|
||||
String productType = extras.get("Product type");
|
||||
String recordType = extras.get("Record type");
|
||||
String title = product.getTitle();
|
||||
// get extras
|
||||
Map<String, String> extras = product.getExtrasAsHashMap();
|
||||
String status = extras.get("Status");
|
||||
String uuidKB = extras.get("UUID Knowledge Base");
|
||||
String productType = extras.get("Product type");
|
||||
String recordType = extras.get("Record type");
|
||||
String title = product.getTitle();
|
||||
|
||||
// it cannot be enabled in this case ...
|
||||
if(recordType == null || recordType.equals("Source"))
|
||||
throw new NoGRSFRecordException();
|
||||
// it cannot be enabled in this case ...
|
||||
if(recordType == null || recordType.equals("Source"))
|
||||
throw new NoGRSFRecordException("This is not a GRSF record");
|
||||
|
||||
if(status == null || uuidKB == null || productType == null)
|
||||
throw new Exception("Some information is missing in this record: Status = " + status + ", knowledge_base_uuid = " + uuidKB +
|
||||
", and product type is = " + productType);
|
||||
if(status == null || uuidKB == null || productType == null)
|
||||
throw new Exception("Some information is missing in this record: Status = " + status + ", knowledge_base_uuid = " + uuidKB +
|
||||
", and product type is = " + productType);
|
||||
|
||||
toReturn = new ManageProductBean();
|
||||
toReturn.setCatalogueIdentifier(productIdentifier);
|
||||
toReturn.setCurrentStatus(GRSFStatus.fromString(status));
|
||||
toReturn.setKnowledgeBaseIdentifier(uuidKB);
|
||||
toReturn.setProductName(title);
|
||||
toReturn.setProductType(productType);
|
||||
toReturn = new ManageProductBean();
|
||||
toReturn.setCatalogueIdentifier(productIdentifier);
|
||||
toReturn.setCurrentStatus(GRSFStatus.fromString(status));
|
||||
toReturn.setKnowledgeBaseIdentifier(uuidKB);
|
||||
toReturn.setProductName(title);
|
||||
toReturn.setProductType(productType);
|
||||
|
||||
logger.info("Returning product bean " + toReturn);
|
||||
logger.info("Returning product bean " + toReturn);
|
||||
|
||||
}catch(Exception e){
|
||||
logger.error("Failed to retrieve the information for the product with identifier " + productIdentifier, e);
|
||||
throw new Exception("Failed to retrieve the information for the product with identifier " + productIdentifier + ". " + e.getMessage());
|
||||
}
|
||||
|
||||
return toReturn;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue