edit of Reference Reports in progress
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/reports@86113 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
fba76628e0
commit
17e5838657
|
@ -11,6 +11,7 @@ import org.gcube.portlets.user.reportgenerator.client.dialog.ImporterDialog;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.dialog.PagePropertiesDialog;
|
import org.gcube.portlets.user.reportgenerator.client.dialog.PagePropertiesDialog;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.model.ExportManifestationType;
|
import org.gcube.portlets.user.reportgenerator.client.model.ExportManifestationType;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.model.TemplateModel;
|
import org.gcube.portlets.user.reportgenerator.client.model.TemplateModel;
|
||||||
|
import org.gcube.portlets.user.reportgenerator.shared.VMETypeIdentifier;
|
||||||
import org.gcube.portlets.widgets.lighttree.client.ItemType;
|
import org.gcube.portlets.widgets.lighttree.client.ItemType;
|
||||||
import org.gcube.portlets.widgets.lighttree.client.event.PopupEvent;
|
import org.gcube.portlets.widgets.lighttree.client.event.PopupEvent;
|
||||||
import org.gcube.portlets.widgets.lighttree.client.event.PopupHandler;
|
import org.gcube.portlets.widgets.lighttree.client.event.PopupHandler;
|
||||||
|
@ -51,6 +52,7 @@ public class Headerbar extends Composite{
|
||||||
private static final String EXPORT_FIMES = "Export to FiMES XML";
|
private static final String EXPORT_FIMES = "Export to FiMES XML";
|
||||||
private static final String EXPORT_XML = "Export to XML";
|
private static final String EXPORT_XML = "Export to XML";
|
||||||
private static final String IMPORT_VME = "Import VME Report";
|
private static final String IMPORT_VME = "Import VME Report";
|
||||||
|
private static final String IMPORT_VME_REF = "Import VME Reference Report";
|
||||||
// private static final String EXPORT_ENCRYPTED_REPORT = "Save an Encrypted Version to Desktop";
|
// private static final String EXPORT_ENCRYPTED_REPORT = "Save an Encrypted Version to Desktop";
|
||||||
|
|
||||||
private static final String VIEW_USER_COMMENTS = "View user comments";
|
private static final String VIEW_USER_COMMENTS = "View user comments";
|
||||||
|
@ -100,6 +102,8 @@ public class Headerbar extends Composite{
|
||||||
|
|
||||||
private MenuItem importVME;
|
private MenuItem importVME;
|
||||||
|
|
||||||
|
private MenuItem importVMERef;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MenuBar menuBar = new MenuBar();
|
MenuBar menuBar = new MenuBar();
|
||||||
|
@ -354,8 +358,23 @@ public class Headerbar extends Composite{
|
||||||
|
|
||||||
importVME = new MenuItem(IMPORT_VME, true, importVMEReport);
|
importVME = new MenuItem(IMPORT_VME, true, importVMEReport);
|
||||||
|
|
||||||
|
MenuBar importVMERef = new MenuBar(true);
|
||||||
|
MenuItem importVMERefItem = new MenuItem(IMPORT_VME_REF, importVMERef);
|
||||||
|
|
||||||
|
//add the submenu items for report refs
|
||||||
|
for (final VMETypeIdentifier type : VMETypeIdentifier.values()) {
|
||||||
|
if (type != VMETypeIdentifier.Vme) {
|
||||||
|
MenuItem item = new MenuItem(type.getId(), true, new Command() {
|
||||||
|
public void execute() {
|
||||||
|
presenter.showVMERefAssociateDialog(type);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
importVMERef.addItem(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
importMenu.addItem(importVME);
|
importMenu.addItem(importVME);
|
||||||
|
importMenu.addItem(importVMERefItem);
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package org.gcube.portlets.user.reportgenerator.client.Presenter;
|
package org.gcube.portlets.user.reportgenerator.client.Presenter;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -11,7 +10,6 @@ import org.gcube.portlets.d4sreporting.common.shared.Metadata;
|
||||||
import org.gcube.portlets.d4sreporting.common.shared.Model;
|
import org.gcube.portlets.d4sreporting.common.shared.Model;
|
||||||
import org.gcube.portlets.d4sreporting.common.shared.ReportReferences;
|
import org.gcube.portlets.d4sreporting.common.shared.ReportReferences;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.Headerbar;
|
import org.gcube.portlets.user.reportgenerator.client.Headerbar;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.ReportConstants;
|
|
||||||
import org.gcube.portlets.user.reportgenerator.client.ReportGenerator;
|
import org.gcube.portlets.user.reportgenerator.client.ReportGenerator;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.ReportService;
|
import org.gcube.portlets.user.reportgenerator.client.ReportService;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.ReportServiceAsync;
|
import org.gcube.portlets.user.reportgenerator.client.ReportServiceAsync;
|
||||||
|
@ -65,8 +63,6 @@ import org.gcube.portlets.widgets.exporter.client.event.ReportExporterEvent;
|
||||||
import org.gcube.portlets.widgets.exporter.client.event.ReportExporterEventHandler;
|
import org.gcube.portlets.widgets.exporter.client.event.ReportExporterEventHandler;
|
||||||
import org.gcube.portlets.widgets.exporter.shared.TypeExporter;
|
import org.gcube.portlets.widgets.exporter.shared.TypeExporter;
|
||||||
import org.gcube.portlets.widgets.userselection.client.UserSelectionDialog;
|
import org.gcube.portlets.widgets.userselection.client.UserSelectionDialog;
|
||||||
import org.gcube.portlets.widgets.userselection.client.events.UsersFetchedEvent;
|
|
||||||
import org.gcube.portlets.widgets.userselection.shared.ItemSelectableBean;
|
|
||||||
|
|
||||||
import com.extjs.gxt.ui.client.widget.MessageBox;
|
import com.extjs.gxt.ui.client.widget.MessageBox;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
|
@ -1252,7 +1248,7 @@ public class Presenter {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void showVMEImportDialog() {
|
public void showVMEImportDialog() {
|
||||||
ImportVMEReportDialog dlg = new ImportVMEReportDialog(getEventBus());
|
ImportVMEReportDialog dlg = new ImportVMEReportDialog(getEventBus(), VMETypeIdentifier.Vme);
|
||||||
dlg.show();
|
dlg.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1260,23 +1256,8 @@ public class Presenter {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void showVMERefAssociateDialog(VMETypeIdentifier refType) {
|
public void showVMERefAssociateDialog(VMETypeIdentifier refType) {
|
||||||
itemSelectionDialog = new UserSelectionDialog("Associate " + refType.toString() + ": Please select one ", eventBus);
|
ImportVMEReportDialog dlg = new ImportVMEReportDialog(getEventBus(), refType);
|
||||||
itemSelectionDialog.center();
|
dlg.show();
|
||||||
itemSelectionDialog.show();
|
|
||||||
reportService.listVMEReportRefByType(refType, new AsyncCallback<ArrayList<ItemSelectableBean>>() {
|
|
||||||
@Override
|
|
||||||
public void onFailure(Throwable caught) {
|
|
||||||
//handled by the Widget
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(ArrayList<ItemSelectableBean> result) {
|
|
||||||
for (ItemSelectableBean item : result) {
|
|
||||||
item.setIconURL(ReportConstants.REPORT_REF_ICON);
|
|
||||||
}
|
|
||||||
eventBus.fireEvent(new UsersFetchedEvent(result));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void importVMEReport(String reportId) {
|
private void importVMEReport(String reportId) {
|
||||||
|
@ -1298,7 +1279,9 @@ public class Presenter {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void associateVMRReportRef (VMETypeIdentifier type, String reportId) throws Exception {
|
private void associateVMRReportRef(VMETypeIdentifier type, String reportId) throws Exception {
|
||||||
|
GWT.log("Type="+type);
|
||||||
|
GWT.log("Id"+reportId);
|
||||||
reportService.importVMEReportRef(reportId, type, new AsyncCallback<Model>() {
|
reportService.importVMEReportRef(reportId, type, new AsyncCallback<Model>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,13 +5,12 @@ import java.util.ArrayList;
|
||||||
import org.gcube.portlets.d4sreporting.common.shared.Model;
|
import org.gcube.portlets.d4sreporting.common.shared.Model;
|
||||||
import org.gcube.portlets.d4sreporting.common.shared.RepTimeSeries;
|
import org.gcube.portlets.d4sreporting.common.shared.RepTimeSeries;
|
||||||
import org.gcube.portlets.d4sreporting.common.shared.Table;
|
import org.gcube.portlets.d4sreporting.common.shared.Table;
|
||||||
import org.gcube.portlets.widgets.exporter.shared.SaveReportFileException;
|
|
||||||
import org.gcube.portlets.widgets.exporter.shared.SaveReportFileExistException;
|
|
||||||
import org.gcube.portlets.widgets.exporter.shared.TypeExporter;
|
|
||||||
import org.gcube.portlets.widgets.userselection.shared.ItemSelectableBean;
|
|
||||||
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.widgets.exporter.shared.SaveReportFileException;
|
||||||
|
import org.gcube.portlets.widgets.exporter.shared.SaveReportFileExistException;
|
||||||
|
import org.gcube.portlets.widgets.exporter.shared.TypeExporter;
|
||||||
|
|
||||||
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;
|
||||||
|
@ -24,7 +23,7 @@ public interface ReportService extends RemoteService{
|
||||||
|
|
||||||
ArrayList<VMEReportBean> listVMEReports();
|
ArrayList<VMEReportBean> listVMEReports();
|
||||||
|
|
||||||
ArrayList<ItemSelectableBean> listVMEReportRefByType(VMETypeIdentifier refType);
|
ArrayList<VMEReportBean> listVMEReportRefByType(VMETypeIdentifier refType);
|
||||||
|
|
||||||
Model importVMEReport(String id);
|
Model importVMEReport(String id);
|
||||||
|
|
||||||
|
|
|
@ -5,11 +5,10 @@ import java.util.ArrayList;
|
||||||
import org.gcube.portlets.d4sreporting.common.shared.Model;
|
import org.gcube.portlets.d4sreporting.common.shared.Model;
|
||||||
import org.gcube.portlets.d4sreporting.common.shared.RepTimeSeries;
|
import org.gcube.portlets.d4sreporting.common.shared.RepTimeSeries;
|
||||||
import org.gcube.portlets.d4sreporting.common.shared.Table;
|
import org.gcube.portlets.d4sreporting.common.shared.Table;
|
||||||
import org.gcube.portlets.widgets.exporter.shared.TypeExporter;
|
|
||||||
import org.gcube.portlets.widgets.userselection.shared.ItemSelectableBean;
|
|
||||||
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.widgets.exporter.shared.TypeExporter;
|
||||||
|
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
/**
|
/**
|
||||||
|
@ -80,7 +79,8 @@ public interface ReportServiceAsync {
|
||||||
|
|
||||||
void importVMEReport(String id, AsyncCallback<Model> callback);
|
void importVMEReport(String id, AsyncCallback<Model> callback);
|
||||||
|
|
||||||
void listVMEReportRefByType(VMETypeIdentifier refType, AsyncCallback<ArrayList<ItemSelectableBean>> callback);
|
void listVMEReportRefByType(VMETypeIdentifier refType,
|
||||||
|
AsyncCallback<ArrayList<VMEReportBean>> callback);
|
||||||
|
|
||||||
void importVMEReportRef(String id, VMETypeIdentifier refType, AsyncCallback<Model> callback);
|
void importVMEReportRef(String id, VMETypeIdentifier refType, AsyncCallback<Model> callback);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import org.gcube.portlets.user.reportgenerator.shared.VMETypeIdentifier;
|
||||||
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
||||||
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.Html;
|
import com.extjs.gxt.ui.client.widget.Html;
|
||||||
|
@ -39,14 +40,15 @@ public class ImportVMEReportDialog extends Window {
|
||||||
private HandlerManager eventBus;
|
private HandlerManager eventBus;
|
||||||
private HorizontalPanel hp = new HorizontalPanel();
|
private HorizontalPanel hp = new HorizontalPanel();
|
||||||
private StoreFilterField<VMEReportBean> filter;
|
private StoreFilterField<VMEReportBean> filter;
|
||||||
|
private VMETypeIdentifier type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param eventBus the bus to fire events into
|
* @param eventBus the bus to fire events into
|
||||||
*/
|
*/
|
||||||
public ImportVMEReportDialog(final HandlerManager eventBus) {
|
public ImportVMEReportDialog(final HandlerManager eventBus, VMETypeIdentifier type) {
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
|
this.type = type;
|
||||||
mainPanel.setHeaderVisible(false);
|
mainPanel.setHeaderVisible(false);
|
||||||
setWidth(WIDTH);
|
setWidth(WIDTH);
|
||||||
setHeight(HEIGHT);
|
setHeight(HEIGHT);
|
||||||
|
@ -76,6 +78,7 @@ public class ImportVMEReportDialog extends Window {
|
||||||
add(hp);
|
add(hp);
|
||||||
add(mainPanel);
|
add(mainPanel);
|
||||||
showLoading();
|
showLoading();
|
||||||
|
if (type == VMETypeIdentifier.Vme)
|
||||||
reportService.listVMEReports(new AsyncCallback<ArrayList<VMEReportBean>>() {
|
reportService.listVMEReports(new AsyncCallback<ArrayList<VMEReportBean>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
|
@ -85,18 +88,92 @@ public class ImportVMEReportDialog extends Window {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(ArrayList<VMEReportBean> reports) {
|
public void onSuccess(ArrayList<VMEReportBean> reports) {
|
||||||
mainPanel.unmask();
|
mainPanel.unmask();
|
||||||
for (VMEReportBean vmeReportBean : reports) {
|
showAvailableReports(reports);
|
||||||
GWT.log(vmeReportBean.getName());
|
|
||||||
}
|
|
||||||
showCollections(reports);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
else {
|
||||||
|
reportService.listVMEReportRefByType(type, new AsyncCallback<ArrayList<VMEReportBean>>() {
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
mainPanel.unmask();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(ArrayList<VMEReportBean> refReports) {
|
||||||
|
mainPanel.unmask();
|
||||||
|
showAvailableReferenceReports(refReports);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param reports
|
||||||
|
*/
|
||||||
|
public void showAvailableReferenceReports(List<VMEReportBean> reports) {
|
||||||
|
|
||||||
|
ColumnModel cm = null;
|
||||||
|
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
|
||||||
|
ColumnConfig column = new ColumnConfig();
|
||||||
|
column.setId("id");
|
||||||
|
column.setHeader("ID");
|
||||||
|
column.setHidden(false);
|
||||||
|
column.setWidth(50);
|
||||||
|
column.setRowHeader(true);
|
||||||
|
configs.add(column);
|
||||||
|
|
||||||
|
column = new ColumnConfig();
|
||||||
|
column.setId("name");
|
||||||
|
column.setHeader("Name");
|
||||||
|
column.setWidth(150);
|
||||||
|
configs.add(column);
|
||||||
|
|
||||||
|
cm = new ColumnModel(configs);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* load the grid data
|
||||||
|
*/
|
||||||
|
ListStore<VMEReportBean> store = new ListStore <VMEReportBean>();
|
||||||
|
store.add(reports);
|
||||||
|
|
||||||
|
filter.bind(store);
|
||||||
|
|
||||||
|
final Grid<VMEReportBean> grid = new Grid<VMEReportBean>(store, cm);
|
||||||
|
|
||||||
|
grid.getElement().getStyle().setBorderWidth(0, Unit.PX);
|
||||||
|
grid.setAutoExpandColumn("name");
|
||||||
|
grid.setBorders(false);
|
||||||
|
grid.setStripeRows(true);
|
||||||
|
|
||||||
|
ContentPanel gridPanel = new ContentPanel(new FitLayout());
|
||||||
|
gridPanel.setHeaderVisible(false);
|
||||||
|
gridPanel.add(grid);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
gridPanel.addButton(new Button("Cancel", new SelectionListener<ButtonEvent>() {
|
||||||
|
@Override
|
||||||
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
gridPanel.addButton(new Button("Edit Selected", new SelectionListener<ButtonEvent>() {
|
||||||
|
@Override
|
||||||
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
hide();
|
||||||
|
eventBus.fireEvent(new SelectedReportEvent(grid.getSelectionModel().getSelectedItem().getId(), type));
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
mainPanel.add(gridPanel);
|
||||||
|
mainPanel.setLayout(new FitLayout());
|
||||||
|
mainPanel.layout();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* view for collections step
|
* view for collections step
|
||||||
* @param vDesc
|
* @param vDesc
|
||||||
*/
|
*/
|
||||||
public void showCollections(List<VMEReportBean> reports) {
|
public void showAvailableReports(List<VMEReportBean> reports) {
|
||||||
|
|
||||||
ColumnModel cm = null;
|
ColumnModel cm = null;
|
||||||
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
|
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
|
||||||
|
@ -143,7 +220,7 @@ public class ImportVMEReportDialog extends Window {
|
||||||
|
|
||||||
grid.getElement().getStyle().setBorderWidth(0, Unit.PX);
|
grid.getElement().getStyle().setBorderWidth(0, Unit.PX);
|
||||||
grid.setAutoExpandColumn("name");
|
grid.setAutoExpandColumn("name");
|
||||||
grid.setBorders(true);
|
grid.setBorders(false);
|
||||||
grid.setStripeRows(true);
|
grid.setStripeRows(true);
|
||||||
|
|
||||||
|
|
||||||
|
@ -168,17 +245,13 @@ public class ImportVMEReportDialog extends Window {
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
hide();
|
hide();
|
||||||
fireEvent(grid.getSelectionModel().getSelectedItem());
|
eventBus.fireEvent(new SelectedReportEvent(grid.getSelectionModel().getSelectedItem().getId(), VMETypeIdentifier.Vme));
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
mainPanel.add(gridPanel);
|
mainPanel.add(gridPanel);
|
||||||
mainPanel.setLayout(new FitLayout());
|
mainPanel.setLayout(new FitLayout());
|
||||||
mainPanel.layout();
|
mainPanel.layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fireEvent(VMEReportBean toFire) {
|
|
||||||
eventBus.fireEvent(new SelectedReportEvent(toFire.getId(), VMETypeIdentifier.Vme));
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1492,19 +1492,20 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ArrayList<ItemSelectableBean> listVMEReportRefByType(VMETypeIdentifier refType) {
|
public ArrayList<VMEReportBean> listVMEReportRefByType(VMETypeIdentifier refType) {
|
||||||
if (refType == VMETypeIdentifier.Vme)
|
if (refType == VMETypeIdentifier.Vme)
|
||||||
throw new IllegalArgumentException("VME Type is not a reference");
|
throw new IllegalArgumentException("VME Type is not a reference");
|
||||||
try {
|
try {
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
}
|
}
|
||||||
ArrayList<ItemSelectableBean> toReturn = new ArrayList<ItemSelectableBean>();
|
ArrayList<VMEReportBean> toReturn = new ArrayList<VMEReportBean>();
|
||||||
ReportType type = new ReportType();
|
ReportType type = new ReportType();
|
||||||
type.setTypeIdentifier(refType.toString());
|
type.setTypeIdentifier(refType.toString());
|
||||||
|
|
||||||
for (ReportEntry re : getFakeReports(type)) {
|
for (ReportEntry re : getFakeReports(type)) {
|
||||||
toReturn.add(new ItemSelectableBean(""+re.getId(), re.getNameValueList().get(0).getValue(), "", refType.toString()));
|
String name = re.getNameValueList().get(0).getValue();
|
||||||
|
toReturn.add(new VMEReportBean(""+re.getId(), "", name, -1));
|
||||||
}
|
}
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
@ -1545,6 +1546,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
|
||||||
List<NameValue> namesValues = new ArrayList<NameValue>();
|
List<NameValue> namesValues = new ArrayList<NameValue>();
|
||||||
NameValue name = new NameValue();
|
NameValue name = new NameValue();
|
||||||
name.setName(type.getTypeIdentifier() + "-" + i);
|
name.setName(type.getTypeIdentifier() + "-" + i);
|
||||||
|
name.setValue(type.getTypeIdentifier() + "-" + generateRandomWord());
|
||||||
namesValues.add(name);
|
namesValues.add(name);
|
||||||
re.setNameValueList(namesValues);
|
re.setNameValueList(namesValues);
|
||||||
toReturn.add(re);
|
toReturn.add(re);
|
||||||
|
@ -1594,7 +1596,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
|
||||||
|
|
||||||
|
|
||||||
public Model importVMEReportRef(String id, VMETypeIdentifier refType) {
|
public Model importVMEReportRef(String id, VMETypeIdentifier refType) {
|
||||||
String reportName = "Sample VME Report imported with id: " + id;
|
String reportName = "Sample Reference Report: " + id;
|
||||||
ReportsModeler rm = new ReportsModeler(
|
ReportsModeler rm = new ReportsModeler(
|
||||||
UUID.randomUUID().toString(),
|
UUID.randomUUID().toString(),
|
||||||
reportName,
|
reportName,
|
||||||
|
@ -1620,7 +1622,9 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
|
||||||
dBTableRows.add(new DBTableRow("primaryKey", md));
|
dBTableRows.add(new DBTableRow("primaryKey", md));
|
||||||
rm.add(new ReferenceReport(ReferenceReportType.InformationSource, dBTableRows));
|
rm.add(new ReferenceReport(ReferenceReportType.InformationSource, dBTableRows));
|
||||||
try {
|
try {
|
||||||
return rm.getReportInstance();
|
Model toReturn = rm.getReportInstance();
|
||||||
|
ReportsReader.readReportStructure(toReturn);
|
||||||
|
return toReturn;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package org.gcube.portlets.user.reportgenerator.shared;
|
package org.gcube.portlets.user.reportgenerator.shared;
|
||||||
|
|
||||||
public enum VMETypeIdentifier {
|
public enum VMETypeIdentifier {
|
||||||
Vme("GeneralMeasure"),
|
Vme("Vme"),
|
||||||
GeneralMeasure("GeneralMeasure"),
|
GeneralMeasure("GeneralMeasure"),
|
||||||
InformationSource("InformationSource"),
|
InformationSource("InformationSource"),
|
||||||
FisheryAreasHistory("FisheryAreasHistory"),
|
FisheryAreasHistory("FisheryAreasHistory"),
|
||||||
|
|
Reference in New Issue