added the method updateDescriptionForItem

task/19600
Francesco Mangiacrapa 4 years ago
parent b86510ee92
commit ed37efe568

@ -4,17 +4,18 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v6.31.0] [r4.25.0] - 2020-07-08
## [v6.31.0] [r4.25.0] - 2020-07-16
#### Enhancements
[#19600] revisit the "Get Info" Dialog in a modern view
## [v6.30.1] [r4.24.0] - 2020-06-25
#### Fixes
[Task #19544] update the unsharing messages in the accounting history
[#19544] update the unsharing messages in the accounting history
## [v6.30.0] [r4.23.0] - 2020-05-18

@ -218,7 +218,7 @@
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>storagehub-client-wrapper</artifactId>
<version>[0.6.2, 1.0.0-SNAPSHOT)</version>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>compile</scope>
</dependency>

@ -28,6 +28,7 @@ import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingField;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
// TODO: Auto-generated Javadoc
/**
* The Interface GWTWorkspaceService.
*
@ -676,4 +677,15 @@ public interface GWTWorkspaceService extends RemoteService {
*/
FileModel getItemForFileTree(String itemId) throws Exception;
/**
* Update description for item.
*
* @param itemId the item id
* @param newDescription the new description
* @return the description updated on the server
* @throws Exception the exception
*/
String updateDescriptionForItem(String itemId, String newDescription) throws Exception;
}

@ -612,5 +612,15 @@ public interface GWTWorkspaceServiceAsync {
* @return the link for send to switch board
*/
void getLinkForSendToSwitchBoard(String itemId, AsyncCallback<String> callback);
/**
* Update description for item.
*
* @param itemId the item id
* @param newDescription the new description
* @param callback the callback
*/
void updateDescriptionForItem(String itemId, String newDescription, AsyncCallback<String> callback);
}

@ -304,21 +304,6 @@ public class DialogGetInfoBootstrap extends Composite {
}
});
// txtAreaDescription.addKeyPressHandler(new KeyPressHandler() {
//
// @Override
// public void onKeyPress(KeyPressEvent event) {
//
// GWT.log(event.getUnicodeCharCode() + "");
//
// if (event.getUnicodeCharCode() == 13) {
// txtAreaDescription.setReadOnly(true);
// Window.alert("Updating description");
// }
//
// }
// });
buttonUpdateDescription.addClickHandler(new ClickHandler() {
@Override
@ -335,7 +320,20 @@ public class DialogGetInfoBootstrap extends Composite {
public void onClick(ClickEvent event) {
buttonSaveDescription.setVisible(false);
txtAreaDescription.setReadOnly(true);
Window.alert("To be implemented");
AppControllerExplorer.rpcWorkspaceService.updateDescriptionForItem(fileModel.getIdentifier(), txtAreaDescription.getValue(), new AsyncCallback<String>() {
@Override
public void onFailure(Throwable caught) {
new MessageBoxAlert("Error on updating description...", caught.getMessage(), null);
}
@Override
public void onSuccess(String result) {
GWT.log("Updated the description as: "+result);
txtAreaDescription.setValue(result);
}
});
}
});

@ -3075,5 +3075,30 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
throw new Exception(error);
}
}
@Override
public String updateDescriptionForItem(String itemId, String newDescription) throws Exception {
workspaceLogger.info("Called updateDescriptionForItem for itemID: " + itemId);
if (itemId == null || itemId.isEmpty())
throw new Exception("I can't update the description, the itemId is null");
workspaceLogger.debug("New description is: " + newDescription);
try {
org.gcube.common.storagehubwrapper.server.tohl.Workspace workspace = getWorkspaceFromStorageHub();
newDescription = workspace.updateDescriptionForItem(itemId, newDescription);
} catch (Exception e) {
workspaceLogger.error("Error on updating the description for item: " + itemId, e);
String error = ConstantsExplorer.SERVER_ERROR + " updating the description for item with id: "
+ "" + itemId+". Error reported: "+e.getMessage();
throw new Exception(error);
}
return newDescription;
}
}

Loading…
Cancel
Save