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