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
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
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);
|
formUpdate.setVisible(false);
|
||||||
loadingImage.setVisible(false);
|
loadingImage.setVisible(false);
|
||||||
}
|
}
|
||||||
|
@ -490,7 +490,7 @@ 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("Error is " + caught, AlertType.ERROR);
|
showInfo("Error is " + caught.getMessage(), AlertType.ERROR);
|
||||||
|
|
||||||
// hide the form and disable the send button
|
// hide the form and disable the send button
|
||||||
formUpdate.setVisible(false);
|
formUpdate.setVisible(false);
|
||||||
|
@ -526,6 +526,7 @@ public class ManageProductWidget extends Composite{
|
||||||
|
|
||||||
if(isRevertingMerge && listBoxStatus.getSelectedIndex() <= 0){
|
if(isRevertingMerge && listBoxStatus.getSelectedIndex() <= 0){
|
||||||
listBoxStatusGroup.setType(ControlGroupType.ERROR);
|
listBoxStatusGroup.setType(ControlGroupType.ERROR);
|
||||||
|
listBoxStatus.setFocus(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -533,8 +534,9 @@ public class ManageProductWidget extends Composite{
|
||||||
Status selectedStatus = Status.fromString(listBoxStatus.getSelectedItemText());
|
Status selectedStatus = Status.fromString(listBoxStatus.getSelectedItemText());
|
||||||
if(selectedStatus.equals(Status.Reject_Merge) || selectedStatus.equals(Status.Rejected)){
|
if(selectedStatus.equals(Status.Reject_Merge) || selectedStatus.equals(Status.Rejected)){
|
||||||
if(annotationArea.getText() == null || annotationArea.getText().isEmpty()){
|
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);
|
annotationAreaGroup.setType(ControlGroupType.ERROR);
|
||||||
|
annotationArea.setFocus(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -596,6 +598,11 @@ public class ManageProductWidget extends Composite{
|
||||||
|
|
||||||
// get short name
|
// get short name
|
||||||
bean.setShortNameUpdated(shortNameTextBox.getText());
|
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())){
|
if(!bean.getShortName().equals(bean.getShortNameUpdated())){
|
||||||
report += "\n- The GRSF Short Name has been changed to '" + bean.getShortNameUpdated() + "' from '" + bean.getShortName() + "';";
|
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()){
|
if(!bean.getConnections().isEmpty()){
|
||||||
report += "\n- Suggested connections:";
|
report += "\n- Suggested connections:";
|
||||||
boolean addConnectionHashtag = false;
|
boolean addConnectionHashtag = false;
|
||||||
|
boolean removeConnectionHashtag = false;
|
||||||
for(ConnectedBean cb: bean.getConnections()){
|
for(ConnectedBean cb: bean.getConnections()){
|
||||||
if(cb.isRemove())
|
if(cb.isRemove()){
|
||||||
report += "\n\t - remove connection with record " + cb.getKnowledgeBaseId() + ";";
|
removeConnectionHashtag = true;
|
||||||
|
report += "\n\t - remove connection with record " + cb.getUrl() + ";";
|
||||||
|
}
|
||||||
else if(cb.isConnect()){
|
else if(cb.isConnect()){
|
||||||
addConnectionHashtag = true;
|
addConnectionHashtag = true;
|
||||||
report += "\n\t - add connection with record " + cb.getKnowledgeBaseId() + ";";
|
report += "\n\t - add connection with record " + cb.getUrl() + ";";
|
||||||
}else
|
}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)
|
if(addConnectionHashtag)
|
||||||
hashtags.add(HashTagsOnUpdate.CONNECT.getString());
|
hashtags.add(HashTagsOnUpdate.CONNECT.getString());
|
||||||
}
|
}
|
||||||
|
@ -648,7 +661,11 @@ public class ManageProductWidget extends Composite{
|
||||||
for(SimilarGRSFRecord sR: bean.getSimilarGrsfRecords()){
|
for(SimilarGRSFRecord sR: bean.getSimilarGrsfRecords()){
|
||||||
if(sR.isSuggestedMerge()){
|
if(sR.isSuggestedMerge()){
|
||||||
bean.setMergesInvolved(true);
|
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()){
|
if(bean.isMergesInvolved()){
|
||||||
|
@ -758,6 +775,7 @@ public class ManageProductWidget extends Composite{
|
||||||
infoBlock.setText(statusUpdateError);
|
infoBlock.setText(statusUpdateError);
|
||||||
infoBlock.setType(type);
|
infoBlock.setType(type);
|
||||||
infoBlock.setVisible(true);
|
infoBlock.setVisible(true);
|
||||||
|
infoBlock.getElement().focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -419,7 +419,7 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
|
||||||
boolean isReviewer = isReviewer(username, teamRolesByUser);
|
boolean isReviewer = isReviewer(username, teamRolesByUser);
|
||||||
|
|
||||||
if(!(isEditor | isReviewer))
|
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
|
// decrypt the url
|
||||||
RevertOperationUrl decryptedUrl = new RevertOperationUrl(encryptedUrl);
|
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)!");
|
throw new Exception("This operation can no longer be reverted (link expired)!");
|
||||||
|
|
||||||
DataCatalogue catalogue = getCatalogue(context);
|
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 recordUrl = extras.get(Constants.ITEM_URL_FIELD);
|
||||||
String currentStatus = extras.get(Constants.STATUS_OF_THE_GRSF_RECORD_CUSTOM_KEY);
|
String currentStatus = extras.get(Constants.STATUS_OF_THE_GRSF_RECORD_CUSTOM_KEY);
|
||||||
|
|
||||||
// check current record status
|
// check current record status
|
||||||
if(!currentStatus.equals(Status.To_be_Merged.getOrigName()))
|
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)
|
// check if it is a reviewer, than he can do what he wants (no matter the admin)
|
||||||
if(isReviewer){
|
if(isReviewer){
|
||||||
|
|
|
@ -158,8 +158,13 @@ public class GRSFUpdaterServiceClient {
|
||||||
logger.debug("Response code is " + response.getStatusLine().getStatusCode() + " and response message is " + response.getStatusLine().getReasonPhrase());
|
logger.debug("Response code is " + response.getStatusLine().getStatusCode() + " and response message is " + response.getStatusLine().getReasonPhrase());
|
||||||
|
|
||||||
String result = EntityUtils.toString(response.getEntity());
|
String result = EntityUtils.toString(response.getEntity());
|
||||||
JSONParser parser = new JSONParser();
|
JSONObject parsedJSON = null;
|
||||||
JSONObject parsedJSON = (JSONObject)parser.parse(result);
|
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)
|
if(parsedJSON == null)
|
||||||
throw new Exception("There was a problem while performing this operation at knowledge base side");
|
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());
|
response.getStatusLine().getReasonPhrase());
|
||||||
|
|
||||||
String result = EntityUtils.toString(response.getEntity());
|
String result = EntityUtils.toString(response.getEntity());
|
||||||
JSONParser parser = new JSONParser();
|
JSONObject parsedJSON = null;
|
||||||
JSONObject parsedJSON = (JSONObject)parser.parse(result);
|
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)
|
if(parsedJSON == null)
|
||||||
throw new Exception("There was a problem while performing this operation at knowledge base side");
|
throw new Exception("There was a problem while performing this operation at knowledge base side");
|
||||||
|
|
||||||
if(response.getStatusLine().getStatusCode() == 200){
|
if(response.getStatusLine().getStatusCode() == 200){
|
||||||
logger.info("Request has been submitted");
|
logger.info("Request has been submitted");
|
||||||
}else if(!(boolean) parsedJSON.get(Constants.UPDATE_RESULT))
|
}else if(!(boolean) parsedJSON.get(Constants.UPDATE_RESULT))
|
||||||
|
|
|
@ -8,6 +8,7 @@ public enum HashTagsOnUpdate {
|
||||||
|
|
||||||
MERGE("merge"),
|
MERGE("merge"),
|
||||||
REVERTED_MERGE("reverted_merge"),
|
REVERTED_MERGE("reverted_merge"),
|
||||||
|
DISCONNECT("disconnect"),
|
||||||
CONNECT("connect"),
|
CONNECT("connect"),
|
||||||
SHORTNAME_UPDATED("shortname_updated"),
|
SHORTNAME_UPDATED("shortname_updated"),
|
||||||
TRACEABILITY_FLAG_SET("traceability_flag_set"),
|
TRACEABILITY_FLAG_SET("traceability_flag_set"),
|
||||||
|
|
Loading…
Reference in New Issue