added the method updateDescriptionForItem

This commit is contained in:
Francesco Mangiacrapa 2020-07-16 12:01:36 +02:00
parent b86510ee92
commit ed37efe568
6 changed files with 65 additions and 19 deletions

View File

@ -4,17 +4,18 @@
All notable changes to this project will be documented in this file. 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). 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 #### Enhancements
[#19600] revisit the "Get Info" Dialog in a modern view [#19600] revisit the "Get Info" Dialog in a modern view
## [v6.30.1] [r4.24.0] - 2020-06-25 ## [v6.30.1] [r4.24.0] - 2020-06-25
#### Fixes #### 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 ## [v6.30.0] [r4.23.0] - 2020-05-18

View File

@ -218,7 +218,7 @@
<dependency> <dependency>
<groupId>org.gcube.common</groupId> <groupId>org.gcube.common</groupId>
<artifactId>storagehub-client-wrapper</artifactId> <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> <scope>compile</scope>
</dependency> </dependency>

View File

@ -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.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
// TODO: Auto-generated Javadoc
/** /**
* The Interface GWTWorkspaceService. * The Interface GWTWorkspaceService.
* *
@ -676,4 +677,15 @@ public interface GWTWorkspaceService extends RemoteService {
*/ */
FileModel getItemForFileTree(String itemId) throws Exception; 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;
} }

View File

@ -612,5 +612,15 @@ public interface GWTWorkspaceServiceAsync {
* @return the link for send to switch board * @return the link for send to switch board
*/ */
void getLinkForSendToSwitchBoard(String itemId, AsyncCallback<String> callback); 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);
} }

View File

@ -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() { buttonUpdateDescription.addClickHandler(new ClickHandler() {
@Override @Override
@ -335,7 +320,20 @@ public class DialogGetInfoBootstrap extends Composite {
public void onClick(ClickEvent event) { public void onClick(ClickEvent event) {
buttonSaveDescription.setVisible(false); buttonSaveDescription.setVisible(false);
txtAreaDescription.setReadOnly(true); 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);
}
});
} }
}); });

View File

@ -3075,5 +3075,30 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
throw new Exception(error); 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;
}
} }