use of org.pentaho.mantle.client.events.SolutionFileActionEvent in project pentaho-platform by pentaho.
the class ShareFileCommand method performOperation.
public void performOperation() {
final SolutionFileActionEvent event = new SolutionFileActionEvent();
event.setAction(this.getClass().getName());
if (selectedList != null && selectedList.size() == 1) {
final RepositoryFile item = selectedList.get(0);
// Checking if the user has access to manage permissions
String url = contextURL + "api/repo/files/" + SolutionBrowserPanel.pathToId(item.getPath()) + "/canAccess?permissions=" + // $NON-NLS-1$ //$NON-NLS-2$
MANAGE_ACLS;
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url);
try {
builder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
builder.sendRequest(null, new RequestCallback() {
public void onError(Request request, Throwable exception) {
FilePropertiesDialog dialog = new FilePropertiesDialog(item, new PentahoTabPanel(), null, defaultTab, false);
dialog.showTab(defaultTab);
dialog.center();
event.setMessage(exception.getMessage());
EventBusUtil.EVENT_BUS.fireEvent(event);
}
public void onResponseReceived(Request request, Response response) {
FilePropertiesDialog dialog = new FilePropertiesDialog(item, new PentahoTabPanel(), null, defaultTab, Boolean.parseBoolean(response.getText()));
dialog.showTab(FilePropertiesDialog.Tabs.PERMISSION);
dialog.center();
event.setMessage("Success");
EventBusUtil.EVENT_BUS.fireEvent(event);
}
});
} catch (RequestException e) {
FilePropertiesDialog dialog = new FilePropertiesDialog(item, new PentahoTabPanel(), null, defaultTab, false);
dialog.showTab(FilePropertiesDialog.Tabs.PERMISSION);
dialog.center();
event.setMessage(e.getMessage());
EventBusUtil.EVENT_BUS.fireEvent(event);
}
}
}
Aggregations