report improved by adding more details about the record managed and the one merged/connected.
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/widgets/grsf-manage-widget@164605 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
12d22bfa9b
commit
8cce894064
|
@ -297,7 +297,7 @@ public class ManageProductWidget extends Composite{
|
|||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
showInfo("Unable to perform this operation. " + (caught != null ? "Error was " + caught : ""), AlertType.ERROR);
|
||||
showInfo("Unable to perform this operation. " + (caught != null ? "Error was " + caught.getMessage() : ""), AlertType.ERROR);
|
||||
formUpdate.setVisible(false);
|
||||
loadingImage.setVisible(false);
|
||||
}
|
||||
|
@ -490,7 +490,7 @@ public class ManageProductWidget extends Composite{
|
|||
if(caught instanceof NoGRSFRecordException)
|
||||
showInfo(NO_GRSF_RECORD_BEAN, AlertType.WARNING);
|
||||
else
|
||||
showInfo("Error is " + caught, AlertType.ERROR);
|
||||
showInfo("Error is " + caught.getMessage(), AlertType.ERROR);
|
||||
|
||||
// hide the form and disable the send button
|
||||
formUpdate.setVisible(false);
|
||||
|
@ -526,6 +526,7 @@ public class ManageProductWidget extends Composite{
|
|||
|
||||
if(isRevertingMerge && listBoxStatus.getSelectedIndex() <= 0){
|
||||
listBoxStatusGroup.setType(ControlGroupType.ERROR);
|
||||
listBoxStatus.setFocus(true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -533,8 +534,9 @@ public class ManageProductWidget extends Composite{
|
|||
Status selectedStatus = Status.fromString(listBoxStatus.getSelectedItemText());
|
||||
if(selectedStatus.equals(Status.Reject_Merge) || selectedStatus.equals(Status.Rejected)){
|
||||
if(annotationArea.getText() == null || annotationArea.getText().isEmpty()){
|
||||
annotationArea.setPlaceholder("In case of reject operations you must specify this field");
|
||||
annotationArea.setPlaceholder("In case of reject operations you must specify an annotation message.");
|
||||
annotationAreaGroup.setType(ControlGroupType.ERROR);
|
||||
annotationArea.setFocus(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -596,6 +598,11 @@ public class ManageProductWidget extends Composite{
|
|||
|
||||
// get short name
|
||||
bean.setShortNameUpdated(shortNameTextBox.getText());
|
||||
report += "\n-Information of the record managed:";
|
||||
report += "\n\t- GRSF Name '" + bean.getTitle() + "';";
|
||||
report += "\n\t- Short Name '" + bean.getShortName() + "';";
|
||||
report += "\n\t- URL '" + bean.getUrl() + "';";
|
||||
report += "\n\t- Semantic Identifier '" + bean.getSemanticIdentifier() + "';";
|
||||
|
||||
if(!bean.getShortName().equals(bean.getShortNameUpdated())){
|
||||
report += "\n- The GRSF Short Name has been changed to '" + bean.getShortNameUpdated() + "' from '" + bean.getShortName() + "';";
|
||||
|
@ -619,16 +626,22 @@ public class ManageProductWidget extends Composite{
|
|||
if(!bean.getConnections().isEmpty()){
|
||||
report += "\n- Suggested connections:";
|
||||
boolean addConnectionHashtag = false;
|
||||
boolean removeConnectionHashtag = false;
|
||||
for(ConnectedBean cb: bean.getConnections()){
|
||||
if(cb.isRemove())
|
||||
report += "\n\t - remove connection with record " + cb.getKnowledgeBaseId() + ";";
|
||||
if(cb.isRemove()){
|
||||
removeConnectionHashtag = true;
|
||||
report += "\n\t - remove connection with record " + cb.getUrl() + ";";
|
||||
}
|
||||
else if(cb.isConnect()){
|
||||
addConnectionHashtag = true;
|
||||
report += "\n\t - add connection with record " + cb.getKnowledgeBaseId() + ";";
|
||||
report += "\n\t - add connection with record " + cb.getUrl() + ";";
|
||||
}else
|
||||
report += "\n\t - keep this suggestion " + cb.getKnowledgeBaseId() + ";";
|
||||
report += "\n\t - keep this suggestion " + cb.getUrl() + ";";
|
||||
}
|
||||
|
||||
|
||||
if(removeConnectionHashtag)
|
||||
hashtags.add(HashTagsOnUpdate.DISCONNECT.getString());
|
||||
|
||||
if(addConnectionHashtag)
|
||||
hashtags.add(HashTagsOnUpdate.CONNECT.getString());
|
||||
}
|
||||
|
@ -648,7 +661,11 @@ public class ManageProductWidget extends Composite{
|
|||
for(SimilarGRSFRecord sR: bean.getSimilarGrsfRecords()){
|
||||
if(sR.isSuggestedMerge()){
|
||||
bean.setMergesInvolved(true);
|
||||
report += "\n\t - merge the current record with record " + sR.getKnowledgeBaseId() + ";";
|
||||
report += "\n\t - merge the current record with record '" + sR.getTitle()+ ";";
|
||||
report += "\n\t\t- GRSF Name '" + bean.getTitle() + "';";
|
||||
report += "\n\t\t- Short Name '" + bean.getShortName() + "';";
|
||||
report += "\n\t\t- URL '" + bean.getUrl() + "';";
|
||||
report += "\n\t\t- Semantic Identifier '" + bean.getSemanticIdentifier() + "';";
|
||||
}
|
||||
}
|
||||
if(bean.isMergesInvolved()){
|
||||
|
@ -758,6 +775,7 @@ public class ManageProductWidget extends Composite{
|
|||
infoBlock.setText(statusUpdateError);
|
||||
infoBlock.setType(type);
|
||||
infoBlock.setVisible(true);
|
||||
infoBlock.getElement().focus();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -419,7 +419,7 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
|
|||
boolean isReviewer = isReviewer(username, teamRolesByUser);
|
||||
|
||||
if(!(isEditor | isReviewer))
|
||||
throw new Exception("You are not allowed to perform this operation!");
|
||||
throw new Exception("You are not allowed to perform this operation. You must be an editor or a reviewer!");
|
||||
|
||||
// decrypt the url
|
||||
RevertOperationUrl decryptedUrl = new RevertOperationUrl(encryptedUrl);
|
||||
|
@ -436,13 +436,14 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
|
|||
throw new Exception("This operation can no longer be reverted (link expired)!");
|
||||
|
||||
DataCatalogue catalogue = getCatalogue(context);
|
||||
Map<String, String> extras = catalogue.getDataset(uuid, catalogue.getApiKeyFromUsername(username)).getExtrasAsHashMap();
|
||||
CkanDataset dataset = catalogue.getDataset(uuid, catalogue.getApiKeyFromUsername(username));
|
||||
Map<String, String> extras = dataset.getExtrasAsHashMap();
|
||||
String recordUrl = extras.get(Constants.ITEM_URL_FIELD);
|
||||
String currentStatus = extras.get(Constants.STATUS_OF_THE_GRSF_RECORD_CUSTOM_KEY);
|
||||
|
||||
// check current record status
|
||||
if(!currentStatus.equals(Status.To_be_Merged.getOrigName()))
|
||||
throw new Exception("This record is no longer involved in a merge operation!");
|
||||
throw new Exception("Record '" + dataset.getTitle() + "' (" + recordUrl + ") is no longer involved in a merge operation!");
|
||||
|
||||
// check if it is a reviewer, than he can do what he wants (no matter the admin)
|
||||
if(isReviewer){
|
||||
|
|
|
@ -158,8 +158,13 @@ public class GRSFUpdaterServiceClient {
|
|||
logger.debug("Response code is " + response.getStatusLine().getStatusCode() + " and response message is " + response.getStatusLine().getReasonPhrase());
|
||||
|
||||
String result = EntityUtils.toString(response.getEntity());
|
||||
JSONParser parser = new JSONParser();
|
||||
JSONObject parsedJSON = (JSONObject)parser.parse(result);
|
||||
JSONObject parsedJSON = null;
|
||||
try{
|
||||
JSONParser parser = new JSONParser();
|
||||
parsedJSON = (JSONObject)parser.parse(result);
|
||||
}catch(Exception e){
|
||||
logger.error("Failed to parse response from knowledge base", e);
|
||||
}
|
||||
|
||||
if(parsedJSON == null)
|
||||
throw new Exception("There was a problem while performing this operation at knowledge base side");
|
||||
|
@ -201,12 +206,17 @@ public class GRSFUpdaterServiceClient {
|
|||
response.getStatusLine().getReasonPhrase());
|
||||
|
||||
String result = EntityUtils.toString(response.getEntity());
|
||||
JSONParser parser = new JSONParser();
|
||||
JSONObject parsedJSON = (JSONObject)parser.parse(result);
|
||||
JSONObject parsedJSON = null;
|
||||
try{
|
||||
JSONParser parser = new JSONParser();
|
||||
parsedJSON = (JSONObject)parser.parse(result);
|
||||
}catch(Exception e){
|
||||
logger.error("Failed to parse response from knowledge base", e);
|
||||
}
|
||||
|
||||
if(parsedJSON == null)
|
||||
throw new Exception("There was a problem while performing this operation at knowledge base side");
|
||||
|
||||
|
||||
if(response.getStatusLine().getStatusCode() == 200){
|
||||
logger.info("Request has been submitted");
|
||||
}else if(!(boolean) parsedJSON.get(Constants.UPDATE_RESULT))
|
||||
|
|
|
@ -8,6 +8,7 @@ public enum HashTagsOnUpdate {
|
|||
|
||||
MERGE("merge"),
|
||||
REVERTED_MERGE("reverted_merge"),
|
||||
DISCONNECT("disconnect"),
|
||||
CONNECT("connect"),
|
||||
SHORTNAME_UPDATED("shortname_updated"),
|
||||
TRACEABILITY_FLAG_SET("traceability_flag_set"),
|
||||
|
|
Loading…
Reference in New Issue