From 2679e47978fec9e7bc594ca0a86d8114202f38eb Mon Sep 17 00:00:00 2001 From: Massimiliano Assante Date: Wed, 4 Dec 2013 22:21:12 +0000 Subject: [PATCH] integration started git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/reports@86578 82a268e6-3cf1-43bd-a215-b396298e98cf --- .classpath | 4 +- .settings/com.google.gdt.eclipse.core.prefs | 2 +- .settings/org.eclipse.wst.common.component | 21 ++ pom.xml | 12 +- .../client/Presenter/Presenter.java | 6 +- .../reportgenerator/client/ReportService.java | 2 +- .../client/ReportServiceAsync.java | 2 +- .../client/dialog/ImportVMEReportDialog.java | 35 ++- .../client/events/SelectedReportEvent.java | 8 +- .../client/model/TemplateComponent.java | 39 ++-- .../client/targets/SequenceWidget.java | 8 +- .../server/servlet/ReportServiceImpl.java | 218 +++++++----------- .../reportgenerator/shared/VMEReportBean.java | 7 +- src/main/resources/clientlog4j.properties | 1 + src/main/webapp/ReportGenerator.css | 16 +- 15 files changed, 181 insertions(+), 200 deletions(-) diff --git a/.classpath b/.classpath index d6526b8..d572b0e 100644 --- a/.classpath +++ b/.classpath @@ -1,6 +1,6 @@ - + @@ -31,5 +31,5 @@ - + diff --git a/.settings/com.google.gdt.eclipse.core.prefs b/.settings/com.google.gdt.eclipse.core.prefs index 4d68cd6..f498b39 100644 --- a/.settings/com.google.gdt.eclipse.core.prefs +++ b/.settings/com.google.gdt.eclipse.core.prefs @@ -2,6 +2,6 @@ <<<<<<<=.mine >>>>>>>=.r71295 eclipse.preferences.version=1 -lastWarOutDir=/Users/massi/Documents/workspace/reports/target/reports-4.6.8-SNAPSHOT +lastWarOutDir=/Users/massi/Documents/workspace/reports/target/reports-4.6.9-SNAPSHOT warSrcDir=src/main/webapp warSrcDirIsOutput=false diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index 400921f..42ca8d9 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -8,6 +8,27 @@ uses + + uses + + + uses + + + uses + + + uses + + + uses + + + uses + + + uses + uses diff --git a/pom.xml b/pom.xml index 99d9c62..4022cfb 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ org.gcube.portlets.user reports war - 4.6.8-SNAPSHOT + 4.6.9-SNAPSHOT gCube Reports Manager gCube Reports Portlet. @@ -119,7 +119,7 @@ com.allen-sauer.gwt.log gwt-log - + org.gcube.application gcube-reporting-modeler @@ -128,7 +128,13 @@ org.gcube.application.rsg reports-store-gateway-client - [0.0.1-SNAPSHOT,) + [0.0.3-SNAPSHOT, 1.0.0-SNAPSHOT) + + + org.jboss.spec.javax.el + jboss-el-api_3.0_spec + [0.0.1-SNAPSHOT, ) + provided org.gcube.common diff --git a/src/main/java/org/gcube/portlets/user/reportgenerator/client/Presenter/Presenter.java b/src/main/java/org/gcube/portlets/user/reportgenerator/client/Presenter/Presenter.java index b879c99..bda3d6e 100644 --- a/src/main/java/org/gcube/portlets/user/reportgenerator/client/Presenter/Presenter.java +++ b/src/main/java/org/gcube/portlets/user/reportgenerator/client/Presenter/Presenter.java @@ -149,7 +149,7 @@ public class Presenter { } } else { - importVMEReport(event.getId(), event.getType()); + importVMEReport(event.getId(), event.getName(), event.getType()); } } }); @@ -1198,9 +1198,9 @@ public class Presenter { dlg.show(); } - private void importVMEReport(String reportId, final VMETypeIdentifier type) { + private void importVMEReport(String reportId, String name, final VMETypeIdentifier type) { showLoading(); - reportService.importVMEReport(reportId, type, new AsyncCallback() { + reportService.importVMEReport(reportId, name, type, new AsyncCallback() { @Override public void onFailure(Throwable caught) { Window.alert("Could not Load Report Model, error on server.: " + caught.getMessage()); diff --git a/src/main/java/org/gcube/portlets/user/reportgenerator/client/ReportService.java b/src/main/java/org/gcube/portlets/user/reportgenerator/client/ReportService.java index 9218b62..8208836 100644 --- a/src/main/java/org/gcube/portlets/user/reportgenerator/client/ReportService.java +++ b/src/main/java/org/gcube/portlets/user/reportgenerator/client/ReportService.java @@ -25,7 +25,7 @@ public interface ReportService extends RemoteService{ ArrayList listVMEReportRefByType(VMETypeIdentifier refType); - Model importVMEReport(String id, VMETypeIdentifier refType); + Model importVMEReport(String id, String name, VMETypeIdentifier refType); Model getVMEReportRef2Associate(String id, VMETypeIdentifier refType); diff --git a/src/main/java/org/gcube/portlets/user/reportgenerator/client/ReportServiceAsync.java b/src/main/java/org/gcube/portlets/user/reportgenerator/client/ReportServiceAsync.java index c881d61..b1b42c6 100644 --- a/src/main/java/org/gcube/portlets/user/reportgenerator/client/ReportServiceAsync.java +++ b/src/main/java/org/gcube/portlets/user/reportgenerator/client/ReportServiceAsync.java @@ -77,7 +77,7 @@ public interface ReportServiceAsync { void listVMEReports(AsyncCallback> callback); - void importVMEReport(String id, VMETypeIdentifier refType, + void importVMEReport(String id, String name, VMETypeIdentifier refType, AsyncCallback callback); void listVMEReportRefByType(VMETypeIdentifier refType, diff --git a/src/main/java/org/gcube/portlets/user/reportgenerator/client/dialog/ImportVMEReportDialog.java b/src/main/java/org/gcube/portlets/user/reportgenerator/client/dialog/ImportVMEReportDialog.java index c3659ef..69b3313 100644 --- a/src/main/java/org/gcube/portlets/user/reportgenerator/client/dialog/ImportVMEReportDialog.java +++ b/src/main/java/org/gcube/portlets/user/reportgenerator/client/dialog/ImportVMEReportDialog.java @@ -15,7 +15,6 @@ 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.widget.ContentPanel; -import com.extjs.gxt.ui.client.widget.Html; import com.extjs.gxt.ui.client.widget.Window; import com.extjs.gxt.ui.client.widget.button.Button; import com.extjs.gxt.ui.client.widget.form.StoreFilterField; @@ -128,7 +127,7 @@ public class ImportVMEReportDialog extends Window { column = new ColumnConfig(); column.setId("name"); - column.setHeader("Name"); + column.setHeader("Indentifier"); column.setWidth(150); configs.add(column); @@ -141,7 +140,8 @@ public class ImportVMEReportDialog extends Window { store.add(reports); filter.bind(store); - + filter.setEmptyText("Filter by Identifier"); + final Grid grid = new Grid(store, cm); grid.getElement().getStyle().setBorderWidth(0, Unit.PX); @@ -167,7 +167,7 @@ public class ImportVMEReportDialog extends Window { @Override public void componentSelected(ButtonEvent ce) { hide(); - eventBus.fireEvent(new SelectedReportEvent(grid.getSelectionModel().getSelectedItem().getId(), type, true)); + eventBus.fireEvent(new SelectedReportEvent(grid.getSelectionModel().getSelectedItem().getId(), grid.getSelectionModel().getSelectedItem().getName(), type, true)); } })); } @@ -176,7 +176,7 @@ public class ImportVMEReportDialog extends Window { @Override public void componentSelected(ButtonEvent ce) { hide(); - eventBus.fireEvent(new SelectedReportEvent(grid.getSelectionModel().getSelectedItem().getId(), type, false)); + eventBus.fireEvent(new SelectedReportEvent(grid.getSelectionModel().getSelectedItem().getId(), grid.getSelectionModel().getSelectedItem().getName(), type, false)); } })); } @@ -195,17 +195,10 @@ public class ImportVMEReportDialog extends Window { ColumnConfig column = new ColumnConfig(); - column.setId("id"); - column.setHeader("ID"); - column.setHidden(true); - column.setWidth(50); - column.setRowHeader(true); - configs.add(column); - - column = new ColumnConfig(); + column.setId("rfmo"); column.setHeader("RFMO"); - column.setWidth(150); + column.setWidth(50); configs.add(column); column = new ColumnConfig(); @@ -215,11 +208,10 @@ public class ImportVMEReportDialog extends Window { configs.add(column); column = new ColumnConfig(); - column.setId("year"); - column.setHeader("Year"); - column.setWidth(50); + column.setId("id"); + column.setHeader("ID"); + column.setWidth(30); configs.add(column); - cm = new ColumnModel(configs); /** @@ -228,6 +220,8 @@ public class ImportVMEReportDialog extends Window { GroupingStore store = new GroupingStore(); store.add(reports); store.groupBy("rfmo"); + + filter.bind(store); @@ -240,7 +234,8 @@ public class ImportVMEReportDialog extends Window { GroupingView view = new GroupingView(); - view.setShowGroupedColumn(false); + view.setShowGroupedColumn(true); + view.setStartCollapsed(true); grid.setView(view); view.setForceFit(true); ContentPanel gridPanel = new ContentPanel(new FitLayout()); @@ -260,7 +255,7 @@ public class ImportVMEReportDialog extends Window { @Override public void componentSelected(ButtonEvent ce) { hide(); - eventBus.fireEvent(new SelectedReportEvent(grid.getSelectionModel().getSelectedItem().getId(), VMETypeIdentifier.Vme, false)); + eventBus.fireEvent(new SelectedReportEvent(grid.getSelectionModel().getSelectedItem().getId(), grid.getSelectionModel().getSelectedItem().getName(), VMETypeIdentifier.Vme, false)); } })); mainPanel.add(gridPanel); diff --git a/src/main/java/org/gcube/portlets/user/reportgenerator/client/events/SelectedReportEvent.java b/src/main/java/org/gcube/portlets/user/reportgenerator/client/events/SelectedReportEvent.java index 1451e33..187ddb0 100644 --- a/src/main/java/org/gcube/portlets/user/reportgenerator/client/events/SelectedReportEvent.java +++ b/src/main/java/org/gcube/portlets/user/reportgenerator/client/events/SelectedReportEvent.java @@ -7,12 +7,14 @@ import com.google.gwt.event.shared.GwtEvent; public class SelectedReportEvent extends GwtEvent{ public static Type TYPE = new Type(); private final String id; + private final String name; private final VMETypeIdentifier type; private final boolean isAssociation; - public SelectedReportEvent(String id, VMETypeIdentifier type, boolean isAssociation) { + public SelectedReportEvent(String id, String name, VMETypeIdentifier type, boolean isAssociation) { super(); this.id = id; + this.name = name; this.type = type; this.isAssociation = isAssociation; } @@ -21,6 +23,10 @@ public class SelectedReportEvent extends GwtEvent{ return id; } + public String getName() { + return name; + } + public VMETypeIdentifier getType() { return type; } diff --git a/src/main/java/org/gcube/portlets/user/reportgenerator/client/model/TemplateComponent.java b/src/main/java/org/gcube/portlets/user/reportgenerator/client/model/TemplateComponent.java index a0834e7..086f945 100644 --- a/src/main/java/org/gcube/portlets/user/reportgenerator/client/model/TemplateComponent.java +++ b/src/main/java/org/gcube/portlets/user/reportgenerator/client/model/TemplateComponent.java @@ -169,7 +169,7 @@ public class TemplateComponent { this.doubleColLayout = sc.isDoubleColLayout(); this.locked = sc.isLocked(); this.metadata = sc.getMetadata(); - + //Log.debug("TemplateComponent found type: " + sc.getType()); switch (sc.getType()) { @@ -207,7 +207,8 @@ public class TemplateComponent { //area.addStyleName(getStyle(sc.getType())); area.getElement().getStyle().setMarginTop(5, Unit.PX); area.setWidth(width+"px"); - area.setText((String) sc.getPossibleContent()); + String content = (String) sc.getPossibleContent(); + area.setText(preserveLineBreaks(content)); this.content = area; } else { @@ -302,30 +303,25 @@ public class TemplateComponent { } this.content = atu; break; - case COMMENT: + case COMMENT: { HTML comment = new HTML(); comment.setStyleName("commentArea"); - String contentC = (String) sc.getPossibleContent(); - if (contentC == null) { - contentC = "Empty Comment"; + String content = (String) sc.getPossibleContent(); + if (content == null) { + content = "Empty Comment"; } - // replace all the line braks by
, and all the double spaces by the html version   - String htmlPreservedLineBreaks2 = contentC.replaceAll("(\r\n|\n)","
"); - htmlPreservedLineBreaks2 = htmlPreservedLineBreaks2.replaceAll("\\s\\s","  "); - comment.setHTML(htmlPreservedLineBreaks2); + comment.setHTML(preserveLineBreaks(content)); this.content = comment; break; + } case INSTRUCTION: String content = (String) sc.getPossibleContent(); if (content == null) { content = "Empty Instruction"; } - // replace all the line braks by
, and all the double spaces by the html version   - String htmlPreservedLineBreaks = content.replaceAll("(\r\n|\n)","
"); - htmlPreservedLineBreaks = htmlPreservedLineBreaks.replaceAll("\\s\\s","  "); HTML instr = new HTML(); instr.setStyleName("instructionArea"); - instr.setHTML(htmlPreservedLineBreaks); + instr.setHTML(preserveLineBreaks(content)); this.content = instr; break; @@ -408,6 +404,19 @@ public class TemplateComponent { return ""; } } + /** + * replace all the line braks by
, and all the double spaces by the html version   + * @param toPreserve + * @return an HTML with preserved line breaks and spaces + */ + private String preserveLineBreaks(String toPreserve) { + if (toPreserve != null) { + String htmlPreservedLineBreaks = toPreserve.replaceAll("(\r\n|\n)","
"); //line breaks + htmlPreservedLineBreaks = htmlPreservedLineBreaks.replaceAll("\\s\\s","  "); //spaces + return htmlPreservedLineBreaks; + } + return toPreserve; + } /** * return a template Component which is serializable * @return . @@ -459,7 +468,7 @@ public class TemplateComponent { content = ((BasicTextArea) this.content).getText(); id = ((BasicTextArea) this.content).getId(); metas = ((BasicTextArea) this.content).getMetadata(); - + } break; case TIME_SERIES: diff --git a/src/main/java/org/gcube/portlets/user/reportgenerator/client/targets/SequenceWidget.java b/src/main/java/org/gcube/portlets/user/reportgenerator/client/targets/SequenceWidget.java index 9ef7cee..c9071e5 100644 --- a/src/main/java/org/gcube/portlets/user/reportgenerator/client/targets/SequenceWidget.java +++ b/src/main/java/org/gcube/portlets/user/reportgenerator/client/targets/SequenceWidget.java @@ -143,12 +143,14 @@ public class SequenceWidget extends Composite { bc.setMetadata(new ArrayList()); } } + //in the VIEW for (TemplateComponent tc : seqGroupedComponents) { - if (tc.getType() == ComponentType.BODY_NOT_FORMATTED) { - ((HTML) tc.getContent()).setText(""); - } + if (tc.getType() == ComponentType.BODY_NOT_FORMATTED || tc.getType() == ComponentType.HEADING_2) { + myPanel.remove(tc.getContent()); + } } + buttonsWrapperPanel.clear(); selectNewB.getElement().getStyle().setWidth(130, Unit.PX); selectNewB.getElement().getStyle().setMargin(10, Unit.PX); diff --git a/src/main/java/org/gcube/portlets/user/reportgenerator/server/servlet/ReportServiceImpl.java b/src/main/java/org/gcube/portlets/user/reportgenerator/server/servlet/ReportServiceImpl.java index 534c758..9102f99 100644 --- a/src/main/java/org/gcube/portlets/user/reportgenerator/server/servlet/ReportServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/reportgenerator/server/servlet/ReportServiceImpl.java @@ -18,6 +18,7 @@ import java.util.Random; import java.util.UUID; import java.util.Vector; +import javax.inject.Inject; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import javax.xml.bind.DatatypeConverter; @@ -43,9 +44,15 @@ import org.gcube.application.reporting.reference.Column; import org.gcube.application.reporting.reference.DBTableRow; import org.gcube.application.reporting.reference.ReferenceReport; import org.gcube.application.reporting.reference.ReferenceReportType; +import org.gcube.application.rsg.client.RsgClient; +import org.gcube.application.rsg.service.RsgService; import org.gcube.application.rsg.service.dto.NameValue; import org.gcube.application.rsg.service.dto.ReportEntry; import org.gcube.application.rsg.service.dto.ReportType; +import org.gcube.application.rsg.support.builder.annotations.Builder; +import org.gcube.application.rsg.support.builder.exceptions.ReportBuilderException; +import org.gcube.application.rsg.support.builder.impl.ReportManagerReportBuilder; +import org.gcube.application.rsg.support.model.components.impl.CompiledReport; import org.gcube.applicationsupportlayer.social.ApplicationNotificationsManager; import org.gcube.applicationsupportlayer.social.NotificationsManager; import org.gcube.common.homelibrary.home.HomeLibrary; @@ -1484,11 +1491,18 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe ReportType type = new ReportType(); type.setTypeIdentifier("Vme"); - for (ReportEntry re : getFakeReports(type)) { - String rfmo = re.getNameValueList().get(0).getValue(); - String name = re.getNameValueList().get(1).getValue(); - int year = Integer.parseInt(re.getNameValueList().get(2).getValue()); - toReturn.add(new VMEReportBean(""+re.getId(), rfmo, name, year)); + RsgService rsgClient = new RsgClient(); + + for (ReportEntry re : rsgClient.listReports(type)) { + String rfmo = "unknown RFMO"; + String name = "unknown name"; + for (NameValue nv : re.getNameValueList()) { + if (nv.getName().equals("RFMO")) + rfmo = nv.getValue(); + if (nv.getName().equals("Name")) + name = nv.getValue(); + } + toReturn.add(new VMEReportBean(""+re.getId(), rfmo, name)); } return toReturn; @@ -1505,158 +1519,94 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe ArrayList toReturn = new ArrayList(); ReportType type = new ReportType(); type.setTypeIdentifier(refType.toString()); - - for (ReportEntry re : getFakeReports(type)) { - String name = re.getNameValueList().get(0).getValue(); - toReturn.add(new VMEReportBean(""+re.getId(), "", name, -1)); + RsgService rsgClient = new RsgClient(); + + for (ReportEntry re :rsgClient.listReports(new ReportType(refType.getId()))) { + String name = "unknown identifier"; + switch (refType) { + case InformationSource: + for (NameValue nv : re.getNameValueList()) { + if (nv.getName().equals("Citation")) { + name = nv.getValue(); + break; + } + } + break; + case GeneralMeasure: + for (NameValue nv : re.getNameValueList()) { + if (nv.getName().equals("Rfmo")) { + name = nv.getValue(); + break; + } + } + case Rfmo: + for (NameValue nv : re.getNameValueList()) { + if (nv.getName().equals("Name")) { + name = nv.getValue(); + break; + } + } + case FisheryAreasHistory: + case VMEsHistory: + for (NameValue nv : re.getNameValueList()) { + if (nv.getName().equals("Year")) { + name = nv.getValue(); + break; + } + } + default: + break; + } + + toReturn.add(new VMEReportBean(""+re.getId(), "", name)); } return toReturn; } - private List getFakeReports(ReportType type, NameValue... filters) { - Random generator = new Random(); - int n = generator.nextInt(15) + 5; - ArrayList toReturn = new ArrayList(); - if (type.getTypeIdentifier().equals("Vme")) { - ReportEntry re = new ReportEntry(); - for (int i = 0; i < n; i++) { - re = new ReportEntry(); - re.setId(i); - - NameValue rfmo = new NameValue(); - rfmo.setName("Rfmo"); - rfmo.setValue(i % 2 == 0 ? "NAFO" : "NEAFC"); - NameValue name = new NameValue(); - name.setName("Vme"); - name.setValue("VME " + generateRandomWord()); - NameValue year = new NameValue(); - year.setName("Year"); - year.setValue(""+(2000+generator.nextInt(15))); - List namesValues = new ArrayList(); - namesValues.add(rfmo); - namesValues.add(name); - namesValues.add(year); - - re.setNameValueList(namesValues); - toReturn.add(re); - } - } else { - ReportEntry re = new ReportEntry(); - for (int i = 0; i < n; i++) { - re = new ReportEntry(); - re.setId(i); - List namesValues = new ArrayList(); - NameValue name = new NameValue(); - name.setName(type.getTypeIdentifier() + "-" + i); - name.setValue(type.getTypeIdentifier() + "-" + generateRandomWord()); - namesValues.add(name); - re.setNameValueList(namesValues); - toReturn.add(re); - } - } - return toReturn; - } - @Override - public Model importVMEReport(String id, VMETypeIdentifier refType) { - ReportsModeler rm = null; + public Model importVMEReport(String id, String name, VMETypeIdentifier refType) { + RsgService rsgClient = new RsgClient(); + + CompiledReport cr = null; if (refType == VMETypeIdentifier.Vme) { - String reportName = "Sample VME Report imported with id: " + id; - rm = new ReportsModeler( - UUID.randomUUID().toString(), - reportName, - getASLSession().getUsername(), - new Date(), - new Date(), - getASLSession().getUsername() - ); - rm.add(new Instruction(null)); - rm.add(new Title("Name for id " + id, false)); - rm.add(new Heading(1, "VME Name (Non Editable) ")); - rm.add(new TextInput("Corner Rise Seamounts")); - rm.add(new Heading(2, "This is a Heading of Level 2 that is editable")); - rm.add(new TextInput("Corner Rise Seamounts again")); - rm.add(new TextInput()); - rm.nextSection(); - rm = addSection2(rm); - rm.nextSection(); - ReportComponent rp = new TextInput("With props and id"); - rp.setId(UUID.randomUUID().toString()); - rp.setProperties(new Property("theId", "theValue")); - rm.add(rp); - - rp = new Heading(1, "Ciao!"); - rp.setId(UUID.randomUUID().toString()); - rp.setProperties(new Property("theId", "theValue")); - rm.add(rp); - } + _log.info("Importing VME id=" + id + " name=" + name); + cr = rsgClient.getReportById(new ReportType(refType.getId()), id); + } else { - String reportName = refType.getId() + " VME Reference Report with id: " + id; - rm = new ReportsModeler( - UUID.randomUUID().toString(), - reportName, - getASLSession().getUsername(), - new Date(), - new Date(), - getASLSession().getUsername() - ); - rm.add(new Title("Test" + refType.getId())); - rm.add(new Heading(2, "Year")); - rm.add(new TextInput()); - rm.add(new Heading(2, "Validity Period - Start")); - rm.add(new TextInput()); - rm.add(new Heading(2, "Validity Period - End")); - rm.add(new TextInput()); - rm.add(getTestReference(ReferenceReportType.InformationSource, false)); - rm.add(new Heading(1, "Ciao!")); + _log.info("Importing Ref type= " + refType.getId() + " id=" + id + " name=" + name); + cr = rsgClient.getReferenceReportById(new ReportType(refType.getId()), id); + } + Model model = null; try { - return rm.getReportInstance(); + model = new ReportManagerReportBuilder().buildReport(cr, id, name, "unknown author", new Date(), new Date(), "uknown last editor").getReportInstance(); + } catch (ReportBuilderException e) { + e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } - return null; + return model; } - + @Override public Model getVMEReportRef2Associate(String id, VMETypeIdentifier refType) { - String reportName = "Sample Reference Report: " + id; - ReportsModeler rm = new ReportsModeler( - UUID.randomUUID().toString(), - reportName, - getASLSession().getUsername(), - new Date(), - new Date(), - getASLSession().getUsername() - ); - //construct the options (the references) - ArrayList dBTableRows = new ArrayList(); - - ArrayList md = new ArrayList(); - - Random generator = new Random(); - int year = generator.nextInt(15) + 2000; - //construct the references - md.add(new Column("Meeting Date", ""+year)); - md.add(new Column("Report Summary", "Aenean vulputate ac dui eu interdum. Nullam tincidunt hendrerit sollicitudin.")); - md.add(new Column("Committee", "Lorem ipsum dolor sit amet, consectetur adipiscing elit")); - md.add(new Column("URL", "http://archive.nafo.int/open/fc/2012/fcdoc12-01.pdf")); - md.add(new Column("Citation", "(Rossi et Al) adipiscing elit oekfha lfkahjf lakjfha lkfahjf alkjdfh ")); - md.add(new Column("Type", "The type")); - dBTableRows.add(new DBTableRow("primaryKey", md)); - rm.add(new ReferenceReport(ReferenceReportType.InformationSource, dBTableRows)); + RsgService rsgClient = new RsgClient(); + _log.info("Importing Ref type= " + refType.getId() + " id=" + id); + CompiledReport cr = rsgClient.getReferenceReportById(new ReportType(refType.getId()), id); + Model model = null; try { - Model toReturn = rm.getReportInstance(); - //ReportsReader.readReportStructure(toReturn); - return toReturn; + model = new ReportManagerReportBuilder().buildReport(cr, id, "", "unknown author", new Date(), new Date(), "uknown last editor").getReportInstance(); + } catch (ReportBuilderException e) { + e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } - return null; + return model; } + private ReportsModeler addSection2(ReportsModeler rm) { rm.add(new Heading(1, "Specific Measure")); ReportSequence seq = new ReportSequence(UUID.randomUUID().toString()); diff --git a/src/main/java/org/gcube/portlets/user/reportgenerator/shared/VMEReportBean.java b/src/main/java/org/gcube/portlets/user/reportgenerator/shared/VMEReportBean.java index 8b941f0..da3c569 100644 --- a/src/main/java/org/gcube/portlets/user/reportgenerator/shared/VMEReportBean.java +++ b/src/main/java/org/gcube/portlets/user/reportgenerator/shared/VMEReportBean.java @@ -7,12 +7,11 @@ public class VMEReportBean extends BaseModel { public VMEReportBean() {} - public VMEReportBean(String id, String rfmo, String name, int year) { + public VMEReportBean(String id, String rfmo, String name) { super(); set("id", id); set("rfmo", rfmo); set("name", name); - set("year", year); } public String getId() { @@ -26,8 +25,4 @@ public class VMEReportBean extends BaseModel { public String getName() { return (String) get("name"); } - - public int getYear() { - return (Integer) get("year"); - } } diff --git a/src/main/resources/clientlog4j.properties b/src/main/resources/clientlog4j.properties index 2248fe1..75e9964 100644 --- a/src/main/resources/clientlog4j.properties +++ b/src/main/resources/clientlog4j.properties @@ -15,3 +15,4 @@ log4j.logger.org.gcube.resources.discovery.icclient=ERROR log4j.logger.org.gcube.common.clients=ERROR log4j.logger.org.gcube.common.homelibrary.jcr=ERROR log4j.logger.org.gcube.application.framework.accesslogger=ERROR +log4j.logger.org.gcube.application.rsg.support.builder.impl=ERROR diff --git a/src/main/webapp/ReportGenerator.css b/src/main/webapp/ReportGenerator.css index d87c47f..feb4a4e 100644 --- a/src/main/webapp/ReportGenerator.css +++ b/src/main/webapp/ReportGenerator.css @@ -585,18 +585,14 @@ tableBorder td { } .readOnlyText { - border: 1px solid #CCC !important; - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - border-radius: 5px; - background-color: white; - margin-top: 5px; - padding: 5px; - - font-size: 13px; - color: #AAA; + font-size: 12px; + color: #333; + text-align:justify; + text-justify:inter-word; + padding-left: 5px; } + .bodyArea { background-image: none; }