VME delete completed, not working for GeneralMeasure case but is on the webservice. Fixed bug of show structure when openeing new VMEs
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/reports@90658 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
e3d900c9dd
commit
03ee613822
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" output="target/reports-4.7.3-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
<classpathentry kind="src" output="target/reports-4.7.6-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
@ -31,5 +31,5 @@
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="output" path="target/reports-4.7.3-SNAPSHOT/WEB-INF/classes"/>
|
<classpathentry kind="output" path="target/reports-4.7.6-SNAPSHOT/WEB-INF/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
<<<<<<<=.mine
|
<<<<<<<=.mine
|
||||||
>>>>>>>=.r71295
|
>>>>>>>=.r71295
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
lastWarOutDir=/Users/massi/Documents/workspace/reports/target/reports-4.7.3-SNAPSHOT
|
lastWarOutDir=/Users/massi/Documents/workspace/reports/target/reports-4.7.6-SNAPSHOT
|
||||||
warSrcDir=src/main/webapp
|
warSrcDir=src/main/webapp
|
||||||
warSrcDirIsOutput=false
|
warSrcDirIsOutput=false
|
||||||
|
|
4
pom.xml
4
pom.xml
|
@ -12,7 +12,7 @@
|
||||||
<groupId>org.gcube.portlets.user</groupId>
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
<artifactId>reports</artifactId>
|
<artifactId>reports</artifactId>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
<version>4.7.3-SNAPSHOT</version>
|
<version>4.7.6-SNAPSHOT</version>
|
||||||
<name>gCube Reports Manager</name>
|
<name>gCube Reports Manager</name>
|
||||||
<description>
|
<description>
|
||||||
gCube Reports Portlet.
|
gCube Reports Portlet.
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
cersion -->
|
cersion -->
|
||||||
<setScope>provided</setScope>
|
<setScope>provided</setScope>
|
||||||
<setClassifier>online</setClassifier>
|
<setClassifier>online</setClassifier>
|
||||||
<!-- GWT needs at least java 1.6 -->
|
|
||||||
<maven.compiler.source>1.7</maven.compiler.source>
|
<maven.compiler.source>1.7</maven.compiler.source>
|
||||||
<maven.compiler.target>1.7</maven.compiler.target>
|
<maven.compiler.target>1.7</maven.compiler.target>
|
||||||
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
|
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
|
||||||
|
|
|
@ -191,7 +191,7 @@ public class Headerbar extends Composite{
|
||||||
|
|
||||||
separator4 = menuBar.addSeparator();
|
separator4 = menuBar.addSeparator();
|
||||||
|
|
||||||
MenuItem vmeMenuDelete = getVMEMenuFake("Delete");
|
MenuItem vmeMenuDelete = getVMEMenuDelete();
|
||||||
menuBar.addItem(vmeMenuDelete);
|
menuBar.addItem(vmeMenuDelete);
|
||||||
|
|
||||||
menuBar.addSeparator();
|
menuBar.addSeparator();
|
||||||
|
@ -332,24 +332,44 @@ public class Headerbar extends Composite{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private MenuItem getVMEMenuFake(String fakeOption) {
|
private MenuItem getVMEMenuDelete() {
|
||||||
MenuBar createMenu = new MenuBar(true);
|
MenuBar createMenu = new MenuBar(true);
|
||||||
|
|
||||||
createMenu.setAnimationEnabled(true);
|
createMenu.setAnimationEnabled(true);
|
||||||
MenuItem toReturn = new MenuItem(fakeOption+" VME-DB", createMenu);
|
MenuItem toReturn = new MenuItem("Delete VME-DB", createMenu);
|
||||||
toReturn.getElement().getStyle().setWhiteSpace(WhiteSpace.NOWRAP);
|
toReturn.getElement().getStyle().setWhiteSpace(WhiteSpace.NOWRAP);
|
||||||
|
|
||||||
MenuItem item = new MenuItem("<font color=\"gray\">"+fakeOption+" VME</font>", true, getNullCommand());
|
MenuItem item = new MenuItem("Delete VME", true, new Command() {
|
||||||
|
public void execute() {
|
||||||
|
presenter.showVMEDeleteDialog(VMETypeIdentifier.Vme);
|
||||||
|
}
|
||||||
|
});
|
||||||
createMenu.addItem(item);
|
createMenu.addItem(item);
|
||||||
createMenu.addSeparator();
|
createMenu.addSeparator();
|
||||||
|
|
||||||
item = new MenuItem("<font color=\"gray\">"+fakeOption+" VME General Measure</font>", true, getNullCommand());
|
item = new MenuItem("Delete VME General Measure", true, new Command() {
|
||||||
|
public void execute() {
|
||||||
|
presenter.showVMEDeleteDialog(VMETypeIdentifier.GeneralMeasure);
|
||||||
|
}
|
||||||
|
});
|
||||||
createMenu.addItem(item);
|
createMenu.addItem(item);
|
||||||
item = new MenuItem("<font color=\"gray\">"+fakeOption+" Information Source</font>", true, getNullCommand());
|
item = new MenuItem("Delete Information Source", true, new Command() {
|
||||||
|
public void execute() {
|
||||||
|
presenter.showVMEDeleteDialog(VMETypeIdentifier.InformationSource);
|
||||||
|
}
|
||||||
|
});
|
||||||
createMenu.addItem(item);
|
createMenu.addItem(item);
|
||||||
item = new MenuItem("<font color=\"gray\">"+fakeOption+" Fishing footprint</font>", true, getNullCommand());
|
item = new MenuItem("Delete Fishing footprint", true, new Command() {
|
||||||
|
public void execute() {
|
||||||
|
presenter.showVMEDeleteDialog(VMETypeIdentifier.FisheryAreasHistory);
|
||||||
|
}
|
||||||
|
});
|
||||||
createMenu.addItem(item);
|
createMenu.addItem(item);
|
||||||
item = new MenuItem("<font color=\"gray\">"+fakeOption+" Regional History of VMEs</font>", true, getNullCommand());
|
item = new MenuItem("Delete Regional History of VMEs", true, new Command() {
|
||||||
|
public void execute() {
|
||||||
|
presenter.showVMEDeleteDialog(VMETypeIdentifier.VMEsHistory);
|
||||||
|
}
|
||||||
|
});
|
||||||
createMenu.addItem(item);
|
createMenu.addItem(item);
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,9 +80,7 @@ public class CommonCommands {
|
||||||
};
|
};
|
||||||
newTemplate = new Command() {
|
newTemplate = new Command() {
|
||||||
public void execute() {
|
public void execute() {
|
||||||
presenter.changeTemplateName(TemplateModel.DEFAULT_NAME);
|
presenter.newDoc();
|
||||||
presenter.cleanAll();
|
|
||||||
presenter.showOpenOptions();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,8 @@ import org.gcube.portlets.user.reportgenerator.client.ToolboxPanel;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.WorkspacePanel;
|
import org.gcube.portlets.user.reportgenerator.client.WorkspacePanel;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.dialog.AddBiblioEntryDialog;
|
import org.gcube.portlets.user.reportgenerator.client.dialog.AddBiblioEntryDialog;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.dialog.DeleteCitationsDialog;
|
import org.gcube.portlets.user.reportgenerator.client.dialog.DeleteCitationsDialog;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.dialog.ImportVMEReportDialog;
|
import org.gcube.portlets.user.reportgenerator.client.dialog.SelectVMEReportDialog;
|
||||||
|
import org.gcube.portlets.user.reportgenerator.client.dialog.SelectVMEReportDialog.Action;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.dialog.WaitingOperationDialog;
|
import org.gcube.portlets.user.reportgenerator.client.dialog.WaitingOperationDialog;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.events.AddBiblioEvent;
|
import org.gcube.portlets.user.reportgenerator.client.events.AddBiblioEvent;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.events.AddBiblioEventHandler;
|
import org.gcube.portlets.user.reportgenerator.client.events.AddBiblioEventHandler;
|
||||||
|
@ -56,6 +57,8 @@ import org.gcube.portlets.user.reportgenerator.client.uibinder.ExportOptions;
|
||||||
import org.gcube.portlets.user.reportgenerator.shared.SessionInfo;
|
import org.gcube.portlets.user.reportgenerator.shared.SessionInfo;
|
||||||
import org.gcube.portlets.user.reportgenerator.shared.UserBean;
|
import org.gcube.portlets.user.reportgenerator.shared.UserBean;
|
||||||
import org.gcube.portlets.user.reportgenerator.shared.VMETypeIdentifier;
|
import org.gcube.portlets.user.reportgenerator.shared.VMETypeIdentifier;
|
||||||
|
import org.gcube.portlets.user.reportgenerator.shared.VmeExportResponse;
|
||||||
|
import org.gcube.portlets.user.reportgenerator.shared.VmeResponseEntry;
|
||||||
import org.gcube.portlets.widgets.exporter.client.ReportExporterPopup;
|
import org.gcube.portlets.widgets.exporter.client.ReportExporterPopup;
|
||||||
import org.gcube.portlets.widgets.exporter.client.event.ExportingCompletedEvent;
|
import org.gcube.portlets.widgets.exporter.client.event.ExportingCompletedEvent;
|
||||||
import org.gcube.portlets.widgets.exporter.client.event.ExportingCompletedEventHandler;
|
import org.gcube.portlets.widgets.exporter.client.event.ExportingCompletedEventHandler;
|
||||||
|
@ -117,6 +120,8 @@ public class Presenter {
|
||||||
*/
|
*/
|
||||||
private ClientSequence clientSeqSelected = null;
|
private ClientSequence clientSeqSelected = null;
|
||||||
|
|
||||||
|
private boolean isShowingStructure = false;
|
||||||
|
|
||||||
RichTextToolbar currentSelectedToolbar;
|
RichTextToolbar currentSelectedToolbar;
|
||||||
|
|
||||||
RichTextArea areaForBiblio;
|
RichTextArea areaForBiblio;
|
||||||
|
@ -129,6 +134,10 @@ public class Presenter {
|
||||||
private boolean menuForWorkflowDocument = false;
|
private boolean menuForWorkflowDocument = false;
|
||||||
|
|
||||||
private boolean isVME = false;
|
private boolean isVME = false;
|
||||||
|
/**
|
||||||
|
* by default is set to Type VME, because refs can only be imported and not opened from WorkSpace
|
||||||
|
*/
|
||||||
|
private VMETypeIdentifier currentVmeType = VMETypeIdentifier.Vme;
|
||||||
/**
|
/**
|
||||||
* eventbus events handler
|
* eventbus events handler
|
||||||
*/
|
*/
|
||||||
|
@ -144,16 +153,21 @@ public class Presenter {
|
||||||
eventBus.addHandler(SelectedReportEvent.TYPE, new SelectedReportEventHandler() {
|
eventBus.addHandler(SelectedReportEvent.TYPE, new SelectedReportEventHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void onReportSelected(SelectedReportEvent event) {
|
public void onReportSelected(SelectedReportEvent event) {
|
||||||
if (event.isAssociation()) {
|
switch (event.getAction()) {
|
||||||
|
case SELECT:
|
||||||
|
importVMEReport(event.getId(), event.getName(), event.getType());
|
||||||
|
break;
|
||||||
|
case ASSOCIATE:
|
||||||
try {
|
try {
|
||||||
associateVMRReportRef(event.getType(), event.getId());
|
associateVMEReportRef(event.getType(), event.getId());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
else {
|
case DELETE:
|
||||||
importVMEReport(event.getId(), event.getName(), event.getType());
|
deleteVMEReport(event.getId(), event.getName(), event.getType());
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -305,7 +319,7 @@ public class Presenter {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showOpenOptions() {
|
public void showOpenOptions() {
|
||||||
wp.showOpenOptions(isVME);
|
wp.showOpenOptions(isVME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showLoading() {
|
public void showLoading() {
|
||||||
|
@ -529,20 +543,35 @@ public class Presenter {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void exportReportToRSG() {
|
public void exportReportToRSG() {
|
||||||
dlg.center();
|
if (Window.confirm("Are you sure you want to commit the " + model.getTemplateName() + " into the VME Database?")) {
|
||||||
dlg.show();
|
dlg.center();
|
||||||
Model toSave = model.getSerializableModel();
|
dlg.show();
|
||||||
reportService.exportReportToRSG(toSave, new AsyncCallback<Void>() {
|
Model toSave = model.getSerializableModel();
|
||||||
public void onFailure(Throwable caught) {
|
reportService.exportReportToRSG(currentVmeType, toSave, new AsyncCallback<VmeExportResponse>() {
|
||||||
dlg.hide();
|
public void onFailure(Throwable caught) {
|
||||||
MessageBox.alert("Warning","Report Not Exported: " + caught.getMessage(), null);
|
dlg.hide();
|
||||||
}
|
MessageBox.alert("Warning","Report Not Exported: " + caught.getMessage(), null);
|
||||||
public void onSuccess(Void result) {
|
}
|
||||||
dlg.hide();
|
public void onSuccess(VmeExportResponse response) {
|
||||||
MessageBox.info("Exporting to RSG Operation","Report Exported Successfully", null);
|
dlg.hide();
|
||||||
refreshWorkspace();
|
//write ok
|
||||||
}
|
if (response.isGloballySucceded())
|
||||||
});
|
MessageBox.info("Exporting to RSG Operation","Report Exported Successfully", null);
|
||||||
|
//runtime exception
|
||||||
|
else if (response.getResponseMessageList().size() == 1 && response.getResponseMessageList().get(0).getResponseEntryCode().equals("RUNTIME_EXCEPTION")) {
|
||||||
|
MessageBox.alert("Exporting to RSG Operation Failed","Report Exporting has failed for the following reason: <br/> " + response.getResponseMessageList().get(0).getResponseMessage(), null);
|
||||||
|
}
|
||||||
|
//user report compile exception
|
||||||
|
else {
|
||||||
|
String failReasons = "";
|
||||||
|
for (VmeResponseEntry entry : response.getResponseMessageList()) {
|
||||||
|
failReasons += entry.getResponseMessage() + "<br/>";
|
||||||
|
}
|
||||||
|
MessageBox.alert("Exporting to RSG Operation Failed","Report Exporting has failed for the following reasons: <br/> " + failReasons, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Save the current report in a given folder
|
* Save the current report in a given folder
|
||||||
|
@ -829,7 +858,9 @@ public class Presenter {
|
||||||
if (currPage > 1)
|
if (currPage > 1)
|
||||||
titleBar.getSectionSwitchPanel().showPrevButton();
|
titleBar.getSectionSwitchPanel().showPrevButton();
|
||||||
|
|
||||||
|
if (isShowingStructure)
|
||||||
|
showStructure();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1149,18 +1180,23 @@ public class Presenter {
|
||||||
/**
|
/**
|
||||||
* show/hide the structure view
|
* show/hide the structure view
|
||||||
*/
|
*/
|
||||||
boolean hidden = true;
|
|
||||||
public void toggleReportStructure() {
|
public void toggleReportStructure() {
|
||||||
if (hidden) {
|
if (!isShowingStructure) {
|
||||||
toolBoxPanel.showStructure(new ReportStructurePanel(eventBus, model.getSerializableModel(), ToolboxPanel.TOOLBOX_WIDTH+"px", ToolboxPanel.TOOLBOX_HEIGHT+"px"));
|
showStructure();
|
||||||
hidden = false;
|
isShowingStructure = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
toolBoxPanel.collapse();
|
toolBoxPanel.collapse();
|
||||||
hidden = true;
|
isShowingStructure = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void showStructure() {
|
||||||
|
toolBoxPanel.showStructure(new ReportStructurePanel(eventBus, model.getSerializableModel(), ToolboxPanel.TOOLBOX_WIDTH+"px", ToolboxPanel.TOOLBOX_HEIGHT+"px"));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public HorizontalPanel getExportsPanel() {
|
public HorizontalPanel getExportsPanel() {
|
||||||
return exportsPanel;
|
return exportsPanel;
|
||||||
}
|
}
|
||||||
|
@ -1215,11 +1251,17 @@ public class Presenter {
|
||||||
exportsPanel.clear();
|
exportsPanel.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void newDoc() {
|
||||||
|
changeTemplateName(TemplateModel.DEFAULT_NAME);
|
||||||
|
cleanAll();
|
||||||
|
showOpenOptions();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void showVMEImportDialog() {
|
public void showVMEImportDialog() {
|
||||||
ImportVMEReportDialog dlg = new ImportVMEReportDialog(getEventBus(), VMETypeIdentifier.Vme, false);
|
SelectVMEReportDialog dlg = new SelectVMEReportDialog(getEventBus(), VMETypeIdentifier.Vme, Action.SELECT);
|
||||||
dlg.show();
|
dlg.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1227,14 +1269,21 @@ public class Presenter {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void showVMEReportRefImportDialog(VMETypeIdentifier refType) {
|
public void showVMEReportRefImportDialog(VMETypeIdentifier refType) {
|
||||||
ImportVMEReportDialog dlg = new ImportVMEReportDialog(getEventBus(), refType, false);
|
SelectVMEReportDialog dlg = new SelectVMEReportDialog(getEventBus(), refType, Action.SELECT);
|
||||||
dlg.show();
|
dlg.show();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void showVMERefAssociateDialog(VMETypeIdentifier refType) {
|
public void showVMERefAssociateDialog(VMETypeIdentifier refType) {
|
||||||
ImportVMEReportDialog dlg = new ImportVMEReportDialog(getEventBus(), refType, true);
|
SelectVMEReportDialog dlg = new SelectVMEReportDialog(getEventBus(), refType, Action.ASSOCIATE);
|
||||||
|
dlg.show();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void showVMEDeleteDialog(VMETypeIdentifier refType) {
|
||||||
|
SelectVMEReportDialog dlg = new SelectVMEReportDialog(getEventBus(), refType, Action.DELETE);
|
||||||
dlg.show();
|
dlg.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1257,7 +1306,42 @@ public class Presenter {
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void deleteVMEReport(String reportId, String name, final VMETypeIdentifier type) {
|
||||||
|
if (Window.confirm("Are you sure you want to delete " + name + " from the VME Database? (This action is Undoable)")) {
|
||||||
|
showLoading();
|
||||||
|
reportService.deleteReportFromRSG(type, reportId, new AsyncCallback<VmeExportResponse>() {
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
dlg.hide();
|
||||||
|
Window.alert("Could not Delete, error on server.: " + caught.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(VmeExportResponse response) {
|
||||||
|
dlg.hide();
|
||||||
|
//delete ok
|
||||||
|
if (response.getResponseMessageList().size() == 1 && response.getResponseMessageList().get(0).getResponseEntryCode().equalsIgnoreCase("SUCCEEDED"))
|
||||||
|
MessageBox.info("Delete VME Report Operation","Report Deleted Successfully", null);
|
||||||
|
//runtime exception
|
||||||
|
else if (response.getResponseMessageList().size() == 1 && response.getResponseMessageList().get(0).getResponseEntryCode().equals("RUNTIME_EXCEPTION")) {
|
||||||
|
MessageBox.alert("Delete VME Report Operation Failed","Report Delete has failed for the following reason: <br/> " + response.getResponseMessageList().get(0).getResponseMessage(), null);
|
||||||
|
}
|
||||||
|
//user report compile exception
|
||||||
|
else {
|
||||||
|
String failReasons = "";
|
||||||
|
for (VmeResponseEntry entry : response.getResponseMessageList()) {
|
||||||
|
failReasons += entry.getResponseMessage() + "<br/>";
|
||||||
|
}
|
||||||
|
MessageBox.alert("Deleting Operation Failed","Report Deletion has failed for the following reasons: <br/> " + failReasons, null);
|
||||||
|
}
|
||||||
|
newDoc();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void importVMEReport(String reportId, String name, final VMETypeIdentifier type) {
|
private void importVMEReport(String reportId, String name, final VMETypeIdentifier type) {
|
||||||
showLoading();
|
showLoading();
|
||||||
reportService.importVMEReport(reportId, name, type, new AsyncCallback<Model>() {
|
reportService.importVMEReport(reportId, name, type, new AsyncCallback<Model>() {
|
||||||
|
@ -1270,15 +1354,15 @@ public class Presenter {
|
||||||
public void onSuccess(Model toLoad) {
|
public void onSuccess(Model toLoad) {
|
||||||
if (toLoad != null) {
|
if (toLoad != null) {
|
||||||
loadModel(toLoad, type == VMETypeIdentifier.Vme);
|
loadModel(toLoad, type == VMETypeIdentifier.Vme);
|
||||||
|
currentVmeType = type;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Window.alert("Could not Load Report Model, error on server.");
|
Window.alert("Could not Load Report Model, error on server.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void associateVMRReportRef(VMETypeIdentifier type, String reportId) throws Exception {
|
private void associateVMEReportRef(VMETypeIdentifier type, String reportId) throws Exception {
|
||||||
GWT.log("Type="+type);
|
GWT.log("Type="+type);
|
||||||
GWT.log("Id"+reportId);
|
GWT.log("Id"+reportId);
|
||||||
reportService.getVMEReportRef2Associate(reportId, type, new AsyncCallback<Model>() {
|
reportService.getVMEReportRef2Associate(reportId, type, new AsyncCallback<Model>() {
|
||||||
|
|
|
@ -8,6 +8,7 @@ import org.gcube.portlets.d4sreporting.common.shared.Table;
|
||||||
import org.gcube.portlets.user.reportgenerator.shared.SessionInfo;
|
import org.gcube.portlets.user.reportgenerator.shared.SessionInfo;
|
||||||
import org.gcube.portlets.user.reportgenerator.shared.VMEReportBean;
|
import org.gcube.portlets.user.reportgenerator.shared.VMEReportBean;
|
||||||
import org.gcube.portlets.user.reportgenerator.shared.VMETypeIdentifier;
|
import org.gcube.portlets.user.reportgenerator.shared.VMETypeIdentifier;
|
||||||
|
import org.gcube.portlets.user.reportgenerator.shared.VmeExportResponse;
|
||||||
import org.gcube.portlets.widgets.exporter.shared.SaveReportFileException;
|
import org.gcube.portlets.widgets.exporter.shared.SaveReportFileException;
|
||||||
import org.gcube.portlets.widgets.exporter.shared.SaveReportFileExistException;
|
import org.gcube.portlets.widgets.exporter.shared.SaveReportFileExistException;
|
||||||
import org.gcube.portlets.widgets.exporter.shared.TypeExporter;
|
import org.gcube.portlets.widgets.exporter.shared.TypeExporter;
|
||||||
|
@ -88,7 +89,10 @@ public interface ReportService extends RemoteService{
|
||||||
/**
|
/**
|
||||||
* @param toSave the report instance to save
|
* @param toSave the report instance to save
|
||||||
*/
|
*/
|
||||||
void exportReportToRSG(Model toSave);
|
VmeExportResponse exportReportToRSG(VMETypeIdentifier refType, Model toSave);
|
||||||
|
|
||||||
|
VmeExportResponse deleteReportFromRSG(VMETypeIdentifier refType, String idToDelete);
|
||||||
|
|
||||||
|
|
||||||
Model getWorkflowDocumentFromDocumentLibrary();
|
Model getWorkflowDocumentFromDocumentLibrary();
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ import org.gcube.portlets.d4sreporting.common.shared.Table;
|
||||||
import org.gcube.portlets.user.reportgenerator.shared.SessionInfo;
|
import org.gcube.portlets.user.reportgenerator.shared.SessionInfo;
|
||||||
import org.gcube.portlets.user.reportgenerator.shared.VMEReportBean;
|
import org.gcube.portlets.user.reportgenerator.shared.VMEReportBean;
|
||||||
import org.gcube.portlets.user.reportgenerator.shared.VMETypeIdentifier;
|
import org.gcube.portlets.user.reportgenerator.shared.VMETypeIdentifier;
|
||||||
|
import org.gcube.portlets.user.reportgenerator.shared.VmeExportResponse;
|
||||||
import org.gcube.portlets.widgets.exporter.shared.TypeExporter;
|
import org.gcube.portlets.widgets.exporter.shared.TypeExporter;
|
||||||
|
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
@ -86,5 +87,8 @@ public interface ReportServiceAsync {
|
||||||
void getVMEReportRef2Associate(String id, VMETypeIdentifier refType, AsyncCallback<Model> callback);
|
void getVMEReportRef2Associate(String id, VMETypeIdentifier refType, AsyncCallback<Model> callback);
|
||||||
void importVMETemplate(VMETypeIdentifier refType,
|
void importVMETemplate(VMETypeIdentifier refType,
|
||||||
AsyncCallback<Model> callback);
|
AsyncCallback<Model> callback);
|
||||||
void exportReportToRSG(Model toSave, AsyncCallback<Void> callback);
|
void exportReportToRSG(VMETypeIdentifier refType, Model toSave,
|
||||||
|
AsyncCallback<VmeExportResponse> callback);
|
||||||
|
void deleteReportFromRSG(VMETypeIdentifier refType, String idToDelete,
|
||||||
|
AsyncCallback<VmeExportResponse> callback);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@ import com.extjs.gxt.ui.client.event.GridEvent;
|
||||||
import com.extjs.gxt.ui.client.event.Listener;
|
import com.extjs.gxt.ui.client.event.Listener;
|
||||||
import com.extjs.gxt.ui.client.event.SelectionListener;
|
import com.extjs.gxt.ui.client.event.SelectionListener;
|
||||||
import com.extjs.gxt.ui.client.store.GroupingStore;
|
import com.extjs.gxt.ui.client.store.GroupingStore;
|
||||||
import com.extjs.gxt.ui.client.store.ListStore;
|
|
||||||
import com.extjs.gxt.ui.client.store.Store;
|
import com.extjs.gxt.ui.client.store.Store;
|
||||||
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
||||||
import com.extjs.gxt.ui.client.widget.Window;
|
import com.extjs.gxt.ui.client.widget.Window;
|
||||||
|
@ -24,11 +23,10 @@ import com.extjs.gxt.ui.client.widget.form.StoreFilterField;
|
||||||
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
|
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
|
||||||
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
|
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
|
||||||
import com.extjs.gxt.ui.client.widget.grid.Grid;
|
import com.extjs.gxt.ui.client.widget.grid.Grid;
|
||||||
import com.extjs.gxt.ui.client.widget.grid.GridSelectionModel;
|
import com.extjs.gxt.ui.client.widget.grid.GridGroupRenderer;
|
||||||
|
import com.extjs.gxt.ui.client.widget.grid.GroupColumnData;
|
||||||
import com.extjs.gxt.ui.client.widget.grid.GroupingView;
|
import com.extjs.gxt.ui.client.widget.grid.GroupingView;
|
||||||
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
||||||
import com.extjs.gxt.ui.client.widget.tips.QuickTip;
|
|
||||||
import com.extjs.gxt.ui.client.widget.tips.ToolTipConfig;
|
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.dom.client.Style.Unit;
|
import com.google.gwt.dom.client.Style.Unit;
|
||||||
import com.google.gwt.event.shared.HandlerManager;
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
|
@ -36,7 +34,7 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.google.gwt.user.client.ui.HasVerticalAlignment;
|
import com.google.gwt.user.client.ui.HasVerticalAlignment;
|
||||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||||
|
|
||||||
public class ImportVMEReportDialog extends Window {
|
public class SelectVMEReportDialog extends Window {
|
||||||
private static final int WIDTH = 700;
|
private static final int WIDTH = 700;
|
||||||
private static final int HEIGHT = 450;
|
private static final int HEIGHT = 450;
|
||||||
|
|
||||||
|
@ -47,11 +45,13 @@ public class ImportVMEReportDialog extends Window {
|
||||||
private StoreFilterField<VMEReportBean> filter;
|
private StoreFilterField<VMEReportBean> filter;
|
||||||
private VMETypeIdentifier type;
|
private VMETypeIdentifier type;
|
||||||
|
|
||||||
|
public enum Action {SELECT, ASSOCIATE, DELETE }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param eventBus the bus to fire events into
|
* @param eventBus the bus to fire events into
|
||||||
*/
|
*/
|
||||||
public ImportVMEReportDialog(final HandlerManager eventBus, VMETypeIdentifier type, final boolean isAssociation) {
|
public SelectVMEReportDialog(final HandlerManager eventBus, VMETypeIdentifier type, final Action action) {
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
setModal(true);
|
setModal(true);
|
||||||
|
@ -86,7 +86,7 @@ public class ImportVMEReportDialog extends Window {
|
||||||
add(mainPanel);
|
add(mainPanel);
|
||||||
showLoading();
|
showLoading();
|
||||||
|
|
||||||
setHeading(getHeading(type, isAssociation));
|
setHeading(getHeading(type, action));
|
||||||
if (type == VMETypeIdentifier.Vme) {
|
if (type == VMETypeIdentifier.Vme) {
|
||||||
reportService.listVMEReports(new AsyncCallback<ArrayList<VMEReportBean>>() {
|
reportService.listVMEReports(new AsyncCallback<ArrayList<VMEReportBean>>() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -97,7 +97,7 @@ public class ImportVMEReportDialog extends Window {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(ArrayList<VMEReportBean> refReports) {
|
public void onSuccess(ArrayList<VMEReportBean> refReports) {
|
||||||
mainPanel.unmask();
|
mainPanel.unmask();
|
||||||
showAvailableReports(refReports, isAssociation);
|
showAvailableReports(refReports, action);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -110,17 +110,18 @@ public class ImportVMEReportDialog extends Window {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(ArrayList<VMEReportBean> refReports) {
|
public void onSuccess(ArrayList<VMEReportBean> refReports) {
|
||||||
mainPanel.unmask();
|
mainPanel.unmask();
|
||||||
showAvailableReports(refReports, isAssociation);
|
showAvailableReports(refReports, action);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* view for collections step
|
*
|
||||||
* @param vDesc
|
* @param reports
|
||||||
|
* @param isAssociation
|
||||||
*/
|
*/
|
||||||
public void showAvailableReports(List<VMEReportBean> reports, final boolean isAssociation) {
|
public void showAvailableReports(List<VMEReportBean> reports, final Action theAction) {
|
||||||
|
|
||||||
ColumnModel cm = null;
|
ColumnModel cm = null;
|
||||||
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
|
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
|
||||||
|
@ -186,14 +187,30 @@ public class ImportVMEReportDialog extends Window {
|
||||||
public void handleEvent(GridEvent<VMEReportBean> ge) {
|
public void handleEvent(GridEvent<VMEReportBean> ge) {
|
||||||
if (ge != null && ge.getModel() != null) {
|
if (ge != null && ge.getModel() != null) {
|
||||||
hide();
|
hide();
|
||||||
if (isAssociation)
|
switch (theAction) {
|
||||||
associateSelected(grid.getSelectionModel().getSelectedItem(), type);
|
case SELECT:
|
||||||
else
|
openSelected(grid.getSelectionModel().getSelectedItem(), type, theAction);
|
||||||
openSelected(grid.getSelectionModel().getSelectedItem(), type);
|
break;
|
||||||
|
case ASSOCIATE:
|
||||||
|
associateSelected(grid.getSelectionModel().getSelectedItem(), type, theAction);
|
||||||
|
break;
|
||||||
|
case DELETE:
|
||||||
|
deleteSelected(grid.getSelectionModel().getSelectedItem(), type, theAction);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
final ColumnModel finalCM = cm;
|
||||||
|
view.setGroupRenderer(new GridGroupRenderer() {
|
||||||
|
public String render(GroupColumnData data) {
|
||||||
|
String f = finalCM.getColumnById(data.field).getHeader();
|
||||||
|
String l = data.models.size() == 1 ? "Item" : "Items";
|
||||||
|
return f + ": " + data.group + " (" + data.models.size() + " " + l + ")";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
view.setForceFit(true);
|
view.setForceFit(true);
|
||||||
ContentPanel gridPanel = new ContentPanel(new FitLayout());
|
ContentPanel gridPanel = new ContentPanel(new FitLayout());
|
||||||
gridPanel.setHeaderVisible(false);
|
gridPanel.setHeaderVisible(false);
|
||||||
|
@ -208,33 +225,47 @@ public class ImportVMEReportDialog extends Window {
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if (isAssociation) {
|
switch (theAction) {
|
||||||
|
case SELECT:
|
||||||
|
gridPanel.addButton(new Button("Open Selected", new SelectionListener<ButtonEvent>() {
|
||||||
|
@Override
|
||||||
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
openSelected(grid.getSelectionModel().getSelectedItem(), type, theAction);
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
break;
|
||||||
|
case ASSOCIATE:
|
||||||
gridPanel.addButton(new Button("Associate Selected", new SelectionListener<ButtonEvent>() {
|
gridPanel.addButton(new Button("Associate Selected", new SelectionListener<ButtonEvent>() {
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
hide();
|
hide();
|
||||||
associateSelected(grid.getSelectionModel().getSelectedItem(), type);
|
associateSelected(grid.getSelectionModel().getSelectedItem(), type, theAction);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
break;
|
||||||
else {
|
case DELETE:
|
||||||
gridPanel.addButton(new Button("Open Selected", new SelectionListener<ButtonEvent>() {
|
gridPanel.addButton(new Button("Delete Selected from VME-DB", new SelectionListener<ButtonEvent>() {
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
openSelected(grid.getSelectionModel().getSelectedItem(), type);
|
hide();
|
||||||
hide();
|
deleteSelected(grid.getSelectionModel().getSelectedItem(), type, theAction);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
mainPanel.add(gridPanel);
|
mainPanel.add(gridPanel);
|
||||||
mainPanel.setLayout(new FitLayout());
|
mainPanel.setLayout(new FitLayout());
|
||||||
mainPanel.layout();
|
mainPanel.layout();
|
||||||
}
|
}
|
||||||
private void associateSelected(VMEReportBean selectedItem, VMETypeIdentifier type) {
|
private void associateSelected(VMEReportBean selectedItem, VMETypeIdentifier type, Action theAction) {
|
||||||
eventBus.fireEvent(new SelectedReportEvent(selectedItem.getId(), selectedItem.getName(), type, true));
|
eventBus.fireEvent(new SelectedReportEvent(selectedItem.getId(), selectedItem.getName(), type, theAction));
|
||||||
}
|
}
|
||||||
private void openSelected(VMEReportBean selectedItem, VMETypeIdentifier type) {
|
private void openSelected(VMEReportBean selectedItem, VMETypeIdentifier type, Action theAction) {
|
||||||
eventBus.fireEvent(new SelectedReportEvent(selectedItem.getId(), selectedItem.getName(), type, false));
|
eventBus.fireEvent(new SelectedReportEvent(selectedItem.getId(), selectedItem.getName(), type, theAction));
|
||||||
|
}
|
||||||
|
private void deleteSelected(VMEReportBean selectedItem, VMETypeIdentifier type, Action theAction) {
|
||||||
|
eventBus.fireEvent(new SelectedReportEvent(selectedItem.getId(), selectedItem.getName(), type, theAction));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -248,7 +279,7 @@ public class ImportVMEReportDialog extends Window {
|
||||||
* @param isAssociation
|
* @param isAssociation
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private String getHeading(VMETypeIdentifier type, boolean isAssociation) {
|
private String getHeading(VMETypeIdentifier type, Action theAction) {
|
||||||
String toReturn = "";
|
String toReturn = "";
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Vme:
|
case Vme:
|
||||||
|
@ -273,8 +304,18 @@ public class ImportVMEReportDialog extends Window {
|
||||||
toReturn = "Unknown Category!";
|
toReturn = "Unknown Category!";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
toReturn = isAssociation ? "Associate " + toReturn : "Edit " + toReturn;
|
|
||||||
|
|
||||||
|
switch (theAction) {
|
||||||
|
case SELECT:
|
||||||
|
toReturn = "Edit " + toReturn;
|
||||||
|
break;
|
||||||
|
case ASSOCIATE:
|
||||||
|
toReturn = "Associate " + toReturn;
|
||||||
|
break;
|
||||||
|
case DELETE:
|
||||||
|
toReturn = "Delete " + toReturn;
|
||||||
|
break;
|
||||||
|
}
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
package org.gcube.portlets.user.reportgenerator.client.events;
|
package org.gcube.portlets.user.reportgenerator.client.events;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.reportgenerator.client.dialog.SelectVMEReportDialog.Action;
|
||||||
import org.gcube.portlets.user.reportgenerator.shared.VMETypeIdentifier;
|
import org.gcube.portlets.user.reportgenerator.shared.VMETypeIdentifier;
|
||||||
|
|
||||||
import com.google.gwt.event.shared.GwtEvent;
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
@ -9,14 +10,14 @@ public class SelectedReportEvent extends GwtEvent<SelectedReportEventHandler>{
|
||||||
private final String id;
|
private final String id;
|
||||||
private final String name;
|
private final String name;
|
||||||
private final VMETypeIdentifier type;
|
private final VMETypeIdentifier type;
|
||||||
private final boolean isAssociation;
|
private final Action theAction;
|
||||||
|
|
||||||
public SelectedReportEvent(String id, String name, VMETypeIdentifier type, boolean isAssociation) {
|
public SelectedReportEvent(String id, String name, VMETypeIdentifier type, Action theAction) {
|
||||||
super();
|
super();
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.isAssociation = isAssociation;
|
this.theAction = theAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
|
@ -31,8 +32,8 @@ public class SelectedReportEvent extends GwtEvent<SelectedReportEventHandler>{
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAssociation() {
|
public Action getAction() {
|
||||||
return isAssociation;
|
return theAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -36,7 +36,6 @@ import org.gcube.portlets.user.reportgenerator.client.targets.TextTableImage;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.dom.client.Style.Unit;
|
import com.google.gwt.dom.client.Style.Unit;
|
||||||
import com.google.gwt.user.client.ui.HTML;
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
import com.google.gwt.user.client.ui.Hidden;
|
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
|
||||||
|
@ -274,7 +273,7 @@ public class TemplateComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//is it is saved as a Report is an instance of this class else is a simple text in a template
|
//if it is saved as a Report is an instance of this class else is a simple text in a template
|
||||||
if (sc.getPossibleContent() instanceof AttributeArea) {
|
if (sc.getPossibleContent() instanceof AttributeArea) {
|
||||||
AttributeArea sata = (AttributeArea) sc.getPossibleContent();
|
AttributeArea sata = (AttributeArea) sc.getPossibleContent();
|
||||||
//in the metadata in this case there an attribute for diplayType
|
//in the metadata in this case there an attribute for diplayType
|
||||||
|
@ -371,6 +370,7 @@ public class TemplateComponent {
|
||||||
RepeatableSequence repeatableSequence = (RepeatableSequence) sc.getPossibleContent();
|
RepeatableSequence repeatableSequence = (RepeatableSequence) sc.getPossibleContent();
|
||||||
ClientRepeatableSequence rps = new ClientRepeatableSequence(presenter, repeatableSequence);
|
ClientRepeatableSequence rps = new ClientRepeatableSequence(presenter, repeatableSequence);
|
||||||
rps.setMetadata(sc.getMetadata());
|
rps.setMetadata(sc.getMetadata());
|
||||||
|
rps.setId(sc.getId());
|
||||||
this.content = rps;
|
this.content = rps;
|
||||||
break;
|
break;
|
||||||
case BODY_TABLE_IMAGE:
|
case BODY_TABLE_IMAGE:
|
||||||
|
@ -380,6 +380,7 @@ public class TemplateComponent {
|
||||||
} else {
|
} else {
|
||||||
RepeatableSequence seq = (RepeatableSequence) sc.getPossibleContent();
|
RepeatableSequence seq = (RepeatableSequence) sc.getPossibleContent();
|
||||||
tti = new TextTableImage(presenter, seq);
|
tti = new TextTableImage(presenter, seq);
|
||||||
|
tti.setId(sc.getId());
|
||||||
}
|
}
|
||||||
this.content = tti;
|
this.content = tti;
|
||||||
break;
|
break;
|
||||||
|
@ -521,13 +522,17 @@ public class TemplateComponent {
|
||||||
break;
|
break;
|
||||||
case REPEAT_SEQUENCE:
|
case REPEAT_SEQUENCE:
|
||||||
ClientRepeatableSequence repSeq = (ClientRepeatableSequence) this.content;
|
ClientRepeatableSequence repSeq = (ClientRepeatableSequence) this.content;
|
||||||
metas = repSeq.getMetadata();
|
id = repSeq.getId();
|
||||||
RepeatableSequence toStore = new RepeatableSequence(getSerializableSequence(repSeq), repSeq.getIdentifier(), height);
|
metas = repSeq.getMetadata();
|
||||||
|
RepeatableSequence toStore = new RepeatableSequence(getSerializableSequence(repSeq), repSeq.getKey(), height);
|
||||||
|
|
||||||
content = toStore;
|
content = toStore;
|
||||||
break;
|
break;
|
||||||
case BODY_TABLE_IMAGE:
|
case BODY_TABLE_IMAGE:
|
||||||
TextTableImage tti = (TextTableImage) this.content;
|
TextTableImage tti = (TextTableImage) this.content;
|
||||||
RepeatableSequence toSave = new RepeatableSequence(getSerializableSequence(tti), height);
|
id = tti.getId();
|
||||||
|
metas = tti.getMetadata();
|
||||||
|
RepeatableSequence toSave = new RepeatableSequence(getSerializableSequence(tti), height);
|
||||||
content = toSave;
|
content = toSave;
|
||||||
break;
|
break;
|
||||||
case REPORT_REFERENCE:
|
case REPORT_REFERENCE:
|
||||||
|
@ -551,7 +556,7 @@ public class TemplateComponent {
|
||||||
GWT.log("Serializing sequence ... ");
|
GWT.log("Serializing sequence ... ");
|
||||||
ArrayList<BasicComponent> sComps = new ArrayList<BasicComponent>();
|
ArrayList<BasicComponent> sComps = new ArrayList<BasicComponent>();
|
||||||
for (TemplateComponent tc : repSeq.getGroupedComponents()) {
|
for (TemplateComponent tc : repSeq.getGroupedComponents()) {
|
||||||
GWT.log(" Got " + tc.getType());
|
//GWT.log(" Got " + tc.getType());
|
||||||
sComps.add(tc.getSerializable());
|
sComps.add(tc.getSerializable());
|
||||||
}
|
}
|
||||||
return sComps;
|
return sComps;
|
||||||
|
|
|
@ -52,7 +52,10 @@ public class TemplateModel {
|
||||||
public static final String BIBLIO_SECTION = "isBibliography";
|
public static final String BIBLIO_SECTION = "isBibliography";
|
||||||
public static final String USER_COMMENT = "isComment";
|
public static final String USER_COMMENT = "isComment";
|
||||||
public static final String USER_COMMENT_HEIGHT = "isCommentHeight";
|
public static final String USER_COMMENT_HEIGHT = "isCommentHeight";
|
||||||
|
/**
|
||||||
|
* The id of the model
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
/**
|
/**
|
||||||
* The name of the template
|
* The name of the template
|
||||||
*/
|
*/
|
||||||
|
@ -275,6 +278,7 @@ public class TemplateModel {
|
||||||
public void loadModel(Model toLoad, Presenter presenter) {
|
public void loadModel(Model toLoad, Presenter presenter) {
|
||||||
//loading template from disk
|
//loading template from disk
|
||||||
|
|
||||||
|
this.id = toLoad.getUniqueID();
|
||||||
this.author = toLoad.getAuthor();
|
this.author = toLoad.getAuthor();
|
||||||
this.dateCreated = toLoad.getDateCreated();
|
this.dateCreated = toLoad.getDateCreated();
|
||||||
this.lastEdit = toLoad.getLastEdit();
|
this.lastEdit = toLoad.getLastEdit();
|
||||||
|
@ -405,29 +409,12 @@ public class TemplateModel {
|
||||||
|
|
||||||
}
|
}
|
||||||
Model toReturn =
|
Model toReturn =
|
||||||
new Model("UniqueID", author, dateCreated, lastEdit, lastEditBy, templateName, columnWidth, currentPage, marginBottom, marginLeft, marginRight, marginTop,
|
new Model(id, author, dateCreated, lastEdit, lastEditBy, templateName, columnWidth, currentPage, marginBottom, marginLeft, marginRight, marginTop,
|
||||||
pageHeight, pageWidth, serializedsections, totalPages, metadata);
|
pageHeight, pageWidth, serializedsections, totalPages, metadata);
|
||||||
|
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param folderid .
|
|
||||||
* @param name .
|
|
||||||
*/
|
|
||||||
public void saveReport (Model toSave, String folderid, String name) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void saveReport (Model toSave) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* look for the model in the current page and edits its size
|
* look for the model in the current page and edits its size
|
||||||
* @param toResize .
|
* @param toResize .
|
||||||
|
|
|
@ -94,6 +94,7 @@ public class AttributeMultiSelection extends Composite {
|
||||||
CheckBox toAdd = new CheckBox(attr.getName());
|
CheckBox toAdd = new CheckBox(attr.getName());
|
||||||
toAdd.setStyleName("checkAttribute");
|
toAdd.setStyleName("checkAttribute");
|
||||||
toAdd.setValue(attr.getValue());
|
toAdd.setValue(attr.getValue());
|
||||||
|
toAdd.setTitle(attr.getOptionalValue());
|
||||||
boxes[j] = toAdd;
|
boxes[j] = toAdd;
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
|
@ -163,7 +164,7 @@ public class AttributeMultiSelection extends Composite {
|
||||||
public AttributeArea getSerializable() {
|
public AttributeArea getSerializable() {
|
||||||
ArrayList<Attribute> values = new ArrayList<Attribute>();
|
ArrayList<Attribute> values = new ArrayList<Attribute>();
|
||||||
for (CheckBox box : getBoxes()) {
|
for (CheckBox box : getBoxes()) {
|
||||||
values.add(new Attribute(box.getText().trim(), box.getValue()));
|
values.add(new Attribute(box.getText().trim(), box.getValue(), box.getTitle()));
|
||||||
}
|
}
|
||||||
return new AttributeArea(getAttrName().trim(), values);
|
return new AttributeArea(getAttrName().trim(), values);
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,6 +96,7 @@ public class AttributeSingleSelection extends Composite {
|
||||||
RadioButton toAdd = new RadioButton(RADIO_NAME, attr.getName());
|
RadioButton toAdd = new RadioButton(RADIO_NAME, attr.getName());
|
||||||
toAdd.setStyleName("checkAttribute");
|
toAdd.setStyleName("checkAttribute");
|
||||||
toAdd.setValue(attr.getValue());
|
toAdd.setValue(attr.getValue());
|
||||||
|
toAdd.setTitle(attr.getOptionalValue());
|
||||||
boxes[j] = toAdd;
|
boxes[j] = toAdd;
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
|
@ -164,7 +165,7 @@ public class AttributeSingleSelection extends Composite {
|
||||||
public AttributeArea getSerializable() {
|
public AttributeArea getSerializable() {
|
||||||
ArrayList<Attribute> singlevalues = new ArrayList<Attribute>();
|
ArrayList<Attribute> singlevalues = new ArrayList<Attribute>();
|
||||||
for (RadioButton box : getBoxes()) {
|
for (RadioButton box : getBoxes()) {
|
||||||
singlevalues.add(new Attribute(box.getText().trim(), box.getValue()));
|
singlevalues.add(new Attribute(box.getText().trim(), box.getValue(), box.getTitle()));
|
||||||
}
|
}
|
||||||
return new AttributeArea(getAttrName().trim(), singlevalues);
|
return new AttributeArea(getAttrName().trim(), singlevalues);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,6 @@ import org.gcube.portlets.d4sreporting.common.shared.BasicComponent;
|
||||||
import org.gcube.portlets.d4sreporting.common.shared.ComponentType;
|
import org.gcube.portlets.d4sreporting.common.shared.ComponentType;
|
||||||
import org.gcube.portlets.d4sreporting.common.shared.Metadata;
|
import org.gcube.portlets.d4sreporting.common.shared.Metadata;
|
||||||
import org.gcube.portlets.d4sreporting.common.shared.RepeatableSequence;
|
import org.gcube.portlets.d4sreporting.common.shared.RepeatableSequence;
|
||||||
import org.gcube.portlets.d4sreporting.common.shared.ReportReferences;
|
|
||||||
import org.gcube.portlets.d4sreporting.common.shared.Tuple;
|
|
||||||
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
|
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.model.TemplateComponent;
|
import org.gcube.portlets.user.reportgenerator.client.model.TemplateComponent;
|
||||||
|
|
||||||
|
@ -19,10 +17,11 @@ import com.google.gwt.user.client.ui.VerticalPanel;
|
||||||
public class ClientRepeatableSequence extends Composite implements ClientSequence {
|
public class ClientRepeatableSequence extends Composite implements ClientSequence {
|
||||||
protected ArrayList<TemplateComponent> groupedComponents = new ArrayList<TemplateComponent>();
|
protected ArrayList<TemplateComponent> groupedComponents = new ArrayList<TemplateComponent>();
|
||||||
|
|
||||||
|
private String id;
|
||||||
private List<Metadata> metas;
|
private List<Metadata> metas;
|
||||||
private VerticalPanel myPanel = new VerticalPanel();
|
private VerticalPanel myPanel = new VerticalPanel();
|
||||||
private Presenter p;
|
private Presenter p;
|
||||||
private String identifier;
|
private String key;
|
||||||
protected RepeatableSequence repSequence;
|
protected RepeatableSequence repSequence;
|
||||||
|
|
||||||
protected RepeatableSequence originalSequence = new RepeatableSequence();
|
protected RepeatableSequence originalSequence = new RepeatableSequence();
|
||||||
|
@ -34,7 +33,7 @@ public class ClientRepeatableSequence extends Composite implements ClientSequenc
|
||||||
public ClientRepeatableSequence(Presenter p, RepeatableSequence sRS) {
|
public ClientRepeatableSequence(Presenter p, RepeatableSequence sRS) {
|
||||||
this.p = p;
|
this.p = p;
|
||||||
this.repSequence = sRS;
|
this.repSequence = sRS;
|
||||||
this.identifier = sRS.getKey();
|
this.key = sRS.getKey();
|
||||||
this.originalSequence = extractOriginalSequence(sRS);
|
this.originalSequence = extractOriginalSequence(sRS);
|
||||||
SequenceWidget seqW = new SequenceWidget(p, this, originalSequence, true, false);
|
SequenceWidget seqW = new SequenceWidget(p, this, originalSequence, true, false);
|
||||||
myPanel.add(seqW);
|
myPanel.add(seqW);
|
||||||
|
@ -245,8 +244,8 @@ public class ClientRepeatableSequence extends Composite implements ClientSequenc
|
||||||
add("not needed", sequence, false);
|
add("not needed", sequence, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getIdentifier() {
|
public String getKey() {
|
||||||
return identifier;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Metadata> getMetadata() {
|
public List<Metadata> getMetadata() {
|
||||||
|
@ -256,6 +255,16 @@ public class ClientRepeatableSequence extends Composite implements ClientSequenc
|
||||||
public void setMetadata(List<Metadata> metas) {
|
public void setMetadata(List<Metadata> metas) {
|
||||||
this.metas = metas;
|
this.metas = metas;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
if (id == null)
|
||||||
|
return "-1";
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -148,6 +148,7 @@ public class ClientReportReference extends Composite implements ClientSequence,
|
||||||
myPanel.add(seqW);
|
myPanel.add(seqW);
|
||||||
first.hideClearAssociationButton();
|
first.hideClearAssociationButton();
|
||||||
}
|
}
|
||||||
|
this.id = id;
|
||||||
//needed for the model
|
//needed for the model
|
||||||
Tuple toAdd = new Tuple(id, sequence.getGroupedComponents());
|
Tuple toAdd = new Tuple(id, sequence.getGroupedComponents());
|
||||||
tupleList.add(toAdd);
|
tupleList.add(toAdd);
|
||||||
|
@ -179,7 +180,7 @@ public class ClientReportReference extends Composite implements ClientSequence,
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
p.showVMERefAssociateDialog(type2Pass);
|
p.showVMERefAssociateDialog(type2Pass);
|
||||||
p.setClientSequenceSelected(this); //important!
|
p.setClientSequenceSelected(this); //important!
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRefType() {
|
public String getRefType() {
|
||||||
|
@ -209,7 +210,10 @@ public class ClientReportReference extends Composite implements ClientSequence,
|
||||||
public void setMetadata(List<Metadata> metas) {
|
public void setMetadata(List<Metadata> metas) {
|
||||||
this.metas = metas;
|
this.metas = metas;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
|
if (id == null)
|
||||||
|
return "-1";
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,9 @@ public class TextTableImage extends Composite {
|
||||||
|
|
||||||
public static final int DEFAULT_HEIGHT = 100;
|
public static final int DEFAULT_HEIGHT = 100;
|
||||||
public static final int DEFAULT_WIDTH = 700;
|
public static final int DEFAULT_WIDTH = 700;
|
||||||
|
|
||||||
|
public String id;
|
||||||
|
private List<Metadata> metas;
|
||||||
private FocusPanel focusPanel = new FocusPanel();
|
private FocusPanel focusPanel = new FocusPanel();
|
||||||
private VerticalPanel mainPanel = new VerticalPanel();
|
private VerticalPanel mainPanel = new VerticalPanel();
|
||||||
private HorizontalPanel controlPanel;
|
private HorizontalPanel controlPanel;
|
||||||
|
@ -210,7 +212,23 @@ public class TextTableImage extends Composite {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Metadata> getMetadata() {
|
||||||
|
return metas;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setMetadata(List<Metadata> metas) {
|
||||||
|
this.metas = metas;
|
||||||
|
}
|
||||||
|
public String getId() {
|
||||||
|
if (id == null)
|
||||||
|
return "-1";
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package org.gcube.portlets.user.reportgenerator.client.uibinder;
|
||||||
|
|
||||||
import org.gcube.portlets.user.reportgenerator.client.Presenter.CommonCommands;
|
import org.gcube.portlets.user.reportgenerator.client.Presenter.CommonCommands;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
|
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.uibinder.ExportOptions.ExportMode;
|
|
||||||
import org.gcube.portlets.user.reportgenerator.shared.VMETypeIdentifier;
|
import org.gcube.portlets.user.reportgenerator.shared.VMETypeIdentifier;
|
||||||
|
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
|
@ -10,7 +9,6 @@ import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
import com.google.gwt.uibinder.client.UiBinder;
|
import com.google.gwt.uibinder.client.UiBinder;
|
||||||
import com.google.gwt.uibinder.client.UiField;
|
import com.google.gwt.uibinder.client.UiField;
|
||||||
import com.google.gwt.uibinder.client.UiHandler;
|
import com.google.gwt.uibinder.client.UiHandler;
|
||||||
import com.google.gwt.user.client.Command;
|
|
||||||
import com.google.gwt.user.client.Window;
|
import com.google.gwt.user.client.Window;
|
||||||
import com.google.gwt.user.client.ui.Composite;
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
import com.google.gwt.user.client.ui.HTML;
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
|
@ -24,7 +22,7 @@ public class OpenOptionsVME extends Composite {
|
||||||
|
|
||||||
interface OpenOptionsUiBinder extends UiBinder<Widget, OpenOptionsVME> {
|
interface OpenOptionsUiBinder extends UiBinder<Widget, OpenOptionsVME> {
|
||||||
}
|
}
|
||||||
enum OpenMode {OPEN_REPORT, OPEN_TEMPLATE, UPLOAD }
|
enum OpenMode {EDIT_VME, NEW_VME, DELETE_VME }
|
||||||
|
|
||||||
@UiField HTML editVME;
|
@UiField HTML editVME;
|
||||||
@UiField HTML createVME;
|
@UiField HTML createVME;
|
||||||
|
@ -45,30 +43,30 @@ public class OpenOptionsVME extends Composite {
|
||||||
@UiHandler("editVME")
|
@UiHandler("editVME")
|
||||||
void onEditVMEClick(ClickEvent e) {
|
void onEditVMEClick(ClickEvent e) {
|
||||||
GWT.log("editVME");
|
GWT.log("editVME");
|
||||||
doAction(OpenMode.OPEN_REPORT);
|
doAction(OpenMode.EDIT_VME);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UiHandler("createVME")
|
@UiHandler("createVME")
|
||||||
void onOpenTemplateClick(ClickEvent e) {
|
void onOpenTemplateClick(ClickEvent e) {
|
||||||
doAction(OpenMode.OPEN_TEMPLATE);
|
doAction(OpenMode.NEW_VME);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UiHandler("deleteVME")
|
@UiHandler("deleteVME")
|
||||||
void unUploadClick(ClickEvent e) {
|
void unUploadClick(ClickEvent e) {
|
||||||
doAction(OpenMode.UPLOAD);
|
doAction(OpenMode.DELETE_VME);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doAction(OpenMode mode) {
|
private void doAction(OpenMode mode) {
|
||||||
CommonCommands cmd = new CommonCommands(p);
|
CommonCommands cmd = new CommonCommands(p);
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case OPEN_REPORT:
|
case EDIT_VME:
|
||||||
p.showVMEImportDialog();
|
p.showVMEImportDialog();
|
||||||
break;
|
break;
|
||||||
case OPEN_TEMPLATE:
|
case NEW_VME:
|
||||||
p.importVMETemplate(VMETypeIdentifier.Vme);
|
p.importVMETemplate(VMETypeIdentifier.Vme);
|
||||||
break;
|
break;
|
||||||
case UPLOAD:
|
case DELETE_VME:
|
||||||
Window.alert("Not yet available");
|
p.showVMEDeleteDialog(VMETypeIdentifier.Vme);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -41,6 +41,8 @@ import org.gcube.application.rsg.client.RsgClient;
|
||||||
import org.gcube.application.rsg.service.RsgService;
|
import org.gcube.application.rsg.service.RsgService;
|
||||||
import org.gcube.application.rsg.service.dto.ReportEntry;
|
import org.gcube.application.rsg.service.dto.ReportEntry;
|
||||||
import org.gcube.application.rsg.service.dto.ReportType;
|
import org.gcube.application.rsg.service.dto.ReportType;
|
||||||
|
import org.gcube.application.rsg.service.dto.response.Response;
|
||||||
|
import org.gcube.application.rsg.service.dto.response.ResponseEntry;
|
||||||
import org.gcube.application.rsg.support.builder.exceptions.ReportBuilderException;
|
import org.gcube.application.rsg.support.builder.exceptions.ReportBuilderException;
|
||||||
import org.gcube.application.rsg.support.builder.impl.ReportManagerReportBuilder;
|
import org.gcube.application.rsg.support.builder.impl.ReportManagerReportBuilder;
|
||||||
import org.gcube.application.rsg.support.model.components.impl.CompiledReport;
|
import org.gcube.application.rsg.support.model.components.impl.CompiledReport;
|
||||||
|
@ -91,6 +93,8 @@ import org.gcube.portlets.user.reportgenerator.shared.SessionInfo;
|
||||||
import org.gcube.portlets.user.reportgenerator.shared.UserBean;
|
import org.gcube.portlets.user.reportgenerator.shared.UserBean;
|
||||||
import org.gcube.portlets.user.reportgenerator.shared.VMEReportBean;
|
import org.gcube.portlets.user.reportgenerator.shared.VMEReportBean;
|
||||||
import org.gcube.portlets.user.reportgenerator.shared.VMETypeIdentifier;
|
import org.gcube.portlets.user.reportgenerator.shared.VMETypeIdentifier;
|
||||||
|
import org.gcube.portlets.user.reportgenerator.shared.VmeExportResponse;
|
||||||
|
import org.gcube.portlets.user.reportgenerator.shared.VmeResponseEntry;
|
||||||
import org.gcube.portlets.widgets.exporter.shared.SaveReportFileException;
|
import org.gcube.portlets.widgets.exporter.shared.SaveReportFileException;
|
||||||
import org.gcube.portlets.widgets.exporter.shared.SaveReportFileExistException;
|
import org.gcube.portlets.widgets.exporter.shared.SaveReportFileExistException;
|
||||||
import org.gcube.portlets.widgets.exporter.shared.TypeExporter;
|
import org.gcube.portlets.widgets.exporter.shared.TypeExporter;
|
||||||
|
@ -1607,26 +1611,60 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exportReportToRSG(Model model) {
|
public VmeExportResponse exportReportToRSG(VMETypeIdentifier refType, Model model) {
|
||||||
System.out.println(new ModelReader(model).toString());
|
System.out.println(new ModelReader(model).toString());
|
||||||
|
|
||||||
RsgService rsgClient = new RsgClient(getRSGWSAddress());
|
RsgService rsgClient = new RsgClient(getRSGWSAddress());
|
||||||
|
|
||||||
//Use the RSG client to get a template for the report whose type is the last token (i.e. the corresponding class' 'simple name')
|
//Use the RSG client to get a template for the report whose type is the last token (i.e. the corresponding class' 'simple name')
|
||||||
//appearing in the VME model class name as stored in the 'type' metadata
|
//appearing in the VME model class name as stored in the 'type' metadata
|
||||||
|
|
||||||
//If you're updating a 'report':
|
CompiledReport template = rsgClient.getTemplate(new ReportType(refType.getId()));
|
||||||
CompiledReport template = rsgClient.getTemplate(new ReportType(VMETypeIdentifier.Vme.getId()));
|
|
||||||
CompiledReport toSend = null;
|
CompiledReport toSend = null;
|
||||||
try {
|
try {
|
||||||
toSend = new ReportManagerReportBuilder().extract(template, model);
|
toSend = new ReportManagerReportBuilder().extract(template, model);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
//Actual RSG client interface exposes different methods (publish / publishDelta etc.) that need to be updated
|
try {
|
||||||
rsgClient.update(toSend);
|
//Actual RSG client interface exposes different methods (publish / publishDelta etc.) that need to be updated
|
||||||
|
Response res = null;
|
||||||
|
if (refType == VMETypeIdentifier.Vme) {
|
||||||
|
_log.info("Exporting VME Report");
|
||||||
|
res = rsgClient.update(toSend);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_log.info("Exporting Ref type= " + refType.getId());
|
||||||
|
res = rsgClient.updateRef(toSend);
|
||||||
|
}
|
||||||
|
return getClientResponse(res);
|
||||||
|
} catch (RuntimeException ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
return new VmeExportResponse(new VmeResponseEntry("RUNTIME_EXCEPTION", "Sorry, there was an error on the Server, please try again in few minutes or report an Issue."));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VmeExportResponse deleteReportFromRSG(VMETypeIdentifier refType, String idToDelete) {
|
||||||
|
RsgService rsgClient = new RsgClient(getRSGWSAddress());
|
||||||
|
|
||||||
|
try {
|
||||||
|
Response res = null;
|
||||||
|
if (refType == VMETypeIdentifier.Vme) {
|
||||||
|
_log.info("Deleting VME Report id = " + idToDelete);
|
||||||
|
res = rsgClient.deleteById(new ReportType(refType.getId()), idToDelete);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_log.info("Deleting VME Reference Report of Type " + refType + " having id = " + idToDelete);
|
||||||
|
res = rsgClient.deleteReferenceById(new ReportType(refType.getId()), idToDelete);
|
||||||
|
}
|
||||||
|
return getClientResponse(res);
|
||||||
|
} catch (RuntimeException ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
return new VmeExportResponse(new VmeResponseEntry("RUNTIME_EXCEPTION", "Sorry, there was an error on the Server, we could not delete. Please try again in few minutes or report an Issue."));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* this method look for a ReportsStoreGateway WS available in the infrastructure
|
* this method look for a ReportsStoreGateway WS available in the infrastructure
|
||||||
* @return true if an instance of the ReportsStoreGateway is available in the infrastructure
|
* @return true if an instance of the ReportsStoreGateway is available in the infrastructure
|
||||||
|
@ -1659,6 +1697,18 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private VmeExportResponse getClientResponse(Response rsgResponse) {
|
||||||
|
VmeExportResponse toReturn = new VmeExportResponse();
|
||||||
|
for (ResponseEntry entry : rsgResponse.getResponseMessageList()) {
|
||||||
|
String entryCode = entry.getResponseCode() == null ? "no-code" : entry.getResponseCode().toString();
|
||||||
|
String entryMessage = entry.getResponseMessage() == null ? "no response message" : entry.getResponseMessage();
|
||||||
|
toReturn.getResponseMessageList().add(new VmeResponseEntry(entryCode, entryMessage));
|
||||||
|
}
|
||||||
|
toReturn.setGloballySucceded(rsgResponse.isGloballySucceeded());
|
||||||
|
return toReturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
package org.gcube.portlets.user.reportgenerator.shared;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simply wraps the Response clases of the RSG WS for sending them to the client
|
||||||
|
* @author Massimiliano Assante, ISTI-CNR
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public class VmeExportResponse implements Serializable {
|
||||||
|
private boolean globallySucceded;
|
||||||
|
|
||||||
|
private ArrayList<VmeResponseEntry> responseMessageList;
|
||||||
|
|
||||||
|
public VmeExportResponse() {
|
||||||
|
super();
|
||||||
|
responseMessageList = new ArrayList<VmeResponseEntry>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public VmeExportResponse(VmeResponseEntry singleResponse) {
|
||||||
|
responseMessageList = new ArrayList<VmeResponseEntry>();
|
||||||
|
responseMessageList.add(singleResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
public VmeExportResponse(ArrayList<VmeResponseEntry> responseMessageList) {
|
||||||
|
super();
|
||||||
|
this.responseMessageList = responseMessageList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<VmeResponseEntry> getResponseMessageList() {
|
||||||
|
if (responseMessageList == null)
|
||||||
|
responseMessageList = new ArrayList<VmeResponseEntry>();
|
||||||
|
return responseMessageList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResponseMessageList(ArrayList<VmeResponseEntry> responseMessageList) {
|
||||||
|
this.responseMessageList = responseMessageList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isGloballySucceded() {
|
||||||
|
return globallySucceded;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGloballySucceded(boolean globallySucceded) {
|
||||||
|
this.globallySucceded = globallySucceded;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
package org.gcube.portlets.user.reportgenerator.shared;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simply wraps the ResponseEntry class of the RSG WS for sending them to the client
|
||||||
|
* @author Massimiliano Assante, ISTI-CNR
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public class VmeResponseEntry implements Serializable {
|
||||||
|
private String responseEntryCode;
|
||||||
|
private String responseMessage;
|
||||||
|
|
||||||
|
public VmeResponseEntry() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public VmeResponseEntry(String responseEntryCode, String responseMessage) {
|
||||||
|
super();
|
||||||
|
this.responseEntryCode = responseEntryCode;
|
||||||
|
this.responseMessage = responseMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getResponseMessage() {
|
||||||
|
return responseMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResponseMessage(String responseMessage) {
|
||||||
|
this.responseMessage = responseMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getResponseEntryCode() {
|
||||||
|
return responseEntryCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResponseEntryCode(String responseEntryCode) {
|
||||||
|
this.responseEntryCode = responseEntryCode;
|
||||||
|
}
|
||||||
|
}
|
|
@ -57,7 +57,6 @@
|
||||||
|
|
||||||
.optionDeleteVME {
|
.optionDeleteVME {
|
||||||
background: url('images/deleteVME.png') 55% 25px no-repeat;
|
background: url('images/deleteVME.png') 55% 25px no-repeat;
|
||||||
opacity: 0.5;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.exportPanel {
|
.exportPanel {
|
||||||
|
|
Reference in New Issue