integration started

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/reports@86578 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2013-12-04 22:21:12 +00:00
parent 1c18910a01
commit 2679e47978
15 changed files with 181 additions and 200 deletions

View File

@ -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.6.8-SNAPSHOT/WEB-INF/classes" path="src/main/java"> <classpathentry kind="src" output="target/reports-4.6.9-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 @@
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/> <classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
<classpathentry kind="output" path="target/reports-4.6.8-SNAPSHOT/WEB-INF/classes"/> <classpathentry kind="output" path="target/reports-4.6.9-SNAPSHOT/WEB-INF/classes"/>
</classpath> </classpath>

View File

@ -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.6.8-SNAPSHOT lastWarOutDir=/Users/massi/Documents/workspace/reports/target/reports-4.6.9-SNAPSHOT
warSrcDir=src/main/webapp warSrcDir=src/main/webapp
warSrcDirIsOutput=false warSrcDirIsOutput=false

View File

@ -8,6 +8,27 @@
<dependent-module archiveName="gcube-reporting-modeler-1.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/gcube-reporting-modeler/gcube-reporting-modeler"> <dependent-module archiveName="gcube-reporting-modeler-1.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/gcube-reporting-modeler/gcube-reporting-modeler">
<dependency-type>uses</dependency-type> <dependency-type>uses</dependency-type>
</dependent-module> </dependent-module>
<dependent-module archiveName="reports-store-gateway-client-0.0.3-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/reports-store-gateway-client/reports-store-gateway-client">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="reports-store-gateway-support-model-0.0.3-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/reports-store-gateway-support-model/reports-store-gateway-support-model">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="reports-store-gateway-interface-dto-0.0.3-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/reports-store-gateway-interface-dto/reports-store-gateway-interface-dto">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="reports-store-gateway-web-base-0.0.3-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/reports-store-gateway-web-base/reports-store-gateway-web-base">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="reports-store-gateway-support-compiler-0.0.3-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/reports-store-gateway-support-compiler/reports-store-gateway-support-compiler">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="reports-store-gateway-support-compiler-bridge-0.0.3-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/reports-store-gateway-support-compiler-bridge/reports-store-gateway-support-compiler-bridge">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="reports-store-gateway-support-builder-0.0.3-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/reports-store-gateway-support-builder/reports-store-gateway-support-builder">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="document-workflow-library-1.4.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/document-workflow-library/document-workflow-library"> <dependent-module archiveName="document-workflow-library-1.4.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/document-workflow-library/document-workflow-library">
<dependency-type>uses</dependency-type> <dependency-type>uses</dependency-type>
</dependent-module> </dependent-module>

12
pom.xml
View File

@ -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.6.8-SNAPSHOT</version> <version>4.6.9-SNAPSHOT</version>
<name>gCube Reports Manager</name> <name>gCube Reports Manager</name>
<description> <description>
gCube Reports Portlet. gCube Reports Portlet.
@ -119,7 +119,7 @@
<dependency> <dependency>
<groupId>com.allen-sauer.gwt.log</groupId> <groupId>com.allen-sauer.gwt.log</groupId>
<artifactId>gwt-log</artifactId> <artifactId>gwt-log</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.gcube.application</groupId> <groupId>org.gcube.application</groupId>
<artifactId>gcube-reporting-modeler</artifactId> <artifactId>gcube-reporting-modeler</artifactId>
@ -128,7 +128,13 @@
<dependency> <dependency>
<groupId>org.gcube.application.rsg</groupId> <groupId>org.gcube.application.rsg</groupId>
<artifactId>reports-store-gateway-client</artifactId> <artifactId>reports-store-gateway-client</artifactId>
<version>[0.0.1-SNAPSHOT,)</version> <version>[0.0.3-SNAPSHOT, 1.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.el</groupId>
<artifactId>jboss-el-api_3.0_spec</artifactId>
<version>[0.0.1-SNAPSHOT, )</version>
<scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.gcube.common</groupId> <groupId>org.gcube.common</groupId>

View File

@ -149,7 +149,7 @@ public class Presenter {
} }
} }
else { else {
importVMEReport(event.getId(), event.getType()); importVMEReport(event.getId(), event.getName(), event.getType());
} }
} }
}); });
@ -1198,9 +1198,9 @@ public class Presenter {
dlg.show(); dlg.show();
} }
private void importVMEReport(String reportId, final VMETypeIdentifier type) { private void importVMEReport(String reportId, String name, final VMETypeIdentifier type) {
showLoading(); showLoading();
reportService.importVMEReport(reportId, type, new AsyncCallback<Model>() { reportService.importVMEReport(reportId, name, type, new AsyncCallback<Model>() {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
Window.alert("Could not Load Report Model, error on server.: " + caught.getMessage()); Window.alert("Could not Load Report Model, error on server.: " + caught.getMessage());

View File

@ -25,7 +25,7 @@ public interface ReportService extends RemoteService{
ArrayList<VMEReportBean> listVMEReportRefByType(VMETypeIdentifier refType); ArrayList<VMEReportBean> listVMEReportRefByType(VMETypeIdentifier refType);
Model importVMEReport(String id, VMETypeIdentifier refType); Model importVMEReport(String id, String name, VMETypeIdentifier refType);
Model getVMEReportRef2Associate(String id, VMETypeIdentifier refType); Model getVMEReportRef2Associate(String id, VMETypeIdentifier refType);

View File

@ -77,7 +77,7 @@ public interface ReportServiceAsync {
void listVMEReports(AsyncCallback<ArrayList<VMEReportBean>> callback); void listVMEReports(AsyncCallback<ArrayList<VMEReportBean>> callback);
void importVMEReport(String id, VMETypeIdentifier refType, void importVMEReport(String id, String name, VMETypeIdentifier refType,
AsyncCallback<Model> callback); AsyncCallback<Model> callback);
void listVMEReportRefByType(VMETypeIdentifier refType, void listVMEReportRefByType(VMETypeIdentifier refType,

View File

@ -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.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.Window; import com.extjs.gxt.ui.client.widget.Window;
import com.extjs.gxt.ui.client.widget.button.Button; import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.form.StoreFilterField; import com.extjs.gxt.ui.client.widget.form.StoreFilterField;
@ -128,7 +127,7 @@ public class ImportVMEReportDialog extends Window {
column = new ColumnConfig(); column = new ColumnConfig();
column.setId("name"); column.setId("name");
column.setHeader("Name"); column.setHeader("Indentifier");
column.setWidth(150); column.setWidth(150);
configs.add(column); configs.add(column);
@ -141,7 +140,8 @@ public class ImportVMEReportDialog extends Window {
store.add(reports); store.add(reports);
filter.bind(store); filter.bind(store);
filter.setEmptyText("Filter by Identifier");
final Grid<VMEReportBean> grid = new Grid<VMEReportBean>(store, cm); final Grid<VMEReportBean> grid = new Grid<VMEReportBean>(store, cm);
grid.getElement().getStyle().setBorderWidth(0, Unit.PX); grid.getElement().getStyle().setBorderWidth(0, Unit.PX);
@ -167,7 +167,7 @@ public class ImportVMEReportDialog extends Window {
@Override @Override
public void componentSelected(ButtonEvent ce) { public void componentSelected(ButtonEvent ce) {
hide(); 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 @Override
public void componentSelected(ButtonEvent ce) { public void componentSelected(ButtonEvent ce) {
hide(); 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(); 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.setId("rfmo");
column.setHeader("RFMO"); column.setHeader("RFMO");
column.setWidth(150); column.setWidth(50);
configs.add(column); configs.add(column);
column = new ColumnConfig(); column = new ColumnConfig();
@ -215,11 +208,10 @@ public class ImportVMEReportDialog extends Window {
configs.add(column); configs.add(column);
column = new ColumnConfig(); column = new ColumnConfig();
column.setId("year"); column.setId("id");
column.setHeader("Year"); column.setHeader("ID");
column.setWidth(50); column.setWidth(30);
configs.add(column); configs.add(column);
cm = new ColumnModel(configs); cm = new ColumnModel(configs);
/** /**
@ -228,6 +220,8 @@ public class ImportVMEReportDialog extends Window {
GroupingStore<VMEReportBean> store = new GroupingStore<VMEReportBean>(); GroupingStore<VMEReportBean> store = new GroupingStore<VMEReportBean>();
store.add(reports); store.add(reports);
store.groupBy("rfmo"); store.groupBy("rfmo");
filter.bind(store); filter.bind(store);
@ -240,7 +234,8 @@ public class ImportVMEReportDialog extends Window {
GroupingView view = new GroupingView(); GroupingView view = new GroupingView();
view.setShowGroupedColumn(false); view.setShowGroupedColumn(true);
view.setStartCollapsed(true);
grid.setView(view); grid.setView(view);
view.setForceFit(true); view.setForceFit(true);
ContentPanel gridPanel = new ContentPanel(new FitLayout()); ContentPanel gridPanel = new ContentPanel(new FitLayout());
@ -260,7 +255,7 @@ public class ImportVMEReportDialog extends Window {
@Override @Override
public void componentSelected(ButtonEvent ce) { public void componentSelected(ButtonEvent ce) {
hide(); 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); mainPanel.add(gridPanel);

View File

@ -7,12 +7,14 @@ import com.google.gwt.event.shared.GwtEvent;
public class SelectedReportEvent extends GwtEvent<SelectedReportEventHandler>{ public class SelectedReportEvent extends GwtEvent<SelectedReportEventHandler>{
public static Type<SelectedReportEventHandler> TYPE = new Type<SelectedReportEventHandler>(); public static Type<SelectedReportEventHandler> TYPE = new Type<SelectedReportEventHandler>();
private final String id; private final String id;
private final String name;
private final VMETypeIdentifier type; private final VMETypeIdentifier type;
private final boolean isAssociation; private final boolean isAssociation;
public SelectedReportEvent(String id, VMETypeIdentifier type, boolean isAssociation) { public SelectedReportEvent(String id, String name, VMETypeIdentifier type, boolean isAssociation) {
super(); super();
this.id = id; this.id = id;
this.name = name;
this.type = type; this.type = type;
this.isAssociation = isAssociation; this.isAssociation = isAssociation;
} }
@ -21,6 +23,10 @@ public class SelectedReportEvent extends GwtEvent<SelectedReportEventHandler>{
return id; return id;
} }
public String getName() {
return name;
}
public VMETypeIdentifier getType() { public VMETypeIdentifier getType() {
return type; return type;
} }

View File

@ -169,7 +169,7 @@ public class TemplateComponent {
this.doubleColLayout = sc.isDoubleColLayout(); this.doubleColLayout = sc.isDoubleColLayout();
this.locked = sc.isLocked(); this.locked = sc.isLocked();
this.metadata = sc.getMetadata(); this.metadata = sc.getMetadata();
//Log.debug("TemplateComponent found type: " + sc.getType()); //Log.debug("TemplateComponent found type: " + sc.getType());
switch (sc.getType()) { switch (sc.getType()) {
@ -207,7 +207,8 @@ public class TemplateComponent {
//area.addStyleName(getStyle(sc.getType())); //area.addStyleName(getStyle(sc.getType()));
area.getElement().getStyle().setMarginTop(5, Unit.PX); area.getElement().getStyle().setMarginTop(5, Unit.PX);
area.setWidth(width+"px"); area.setWidth(width+"px");
area.setText((String) sc.getPossibleContent()); String content = (String) sc.getPossibleContent();
area.setText(preserveLineBreaks(content));
this.content = area; this.content = area;
} }
else { else {
@ -302,30 +303,25 @@ public class TemplateComponent {
} }
this.content = atu; this.content = atu;
break; break;
case COMMENT: case COMMENT: {
HTML comment = new HTML(); HTML comment = new HTML();
comment.setStyleName("commentArea"); comment.setStyleName("commentArea");
String contentC = (String) sc.getPossibleContent(); String content = (String) sc.getPossibleContent();
if (contentC == null) { if (content == null) {
contentC = "Empty Comment"; content = "Empty Comment";
} }
// replace all the line braks by <br/>, and all the double spaces by the html version &nbsp; comment.setHTML(preserveLineBreaks(content));
String htmlPreservedLineBreaks2 = contentC.replaceAll("(\r\n|\n)","<br />");
htmlPreservedLineBreaks2 = htmlPreservedLineBreaks2.replaceAll("\\s\\s","&nbsp;&nbsp;");
comment.setHTML(htmlPreservedLineBreaks2);
this.content = comment; this.content = comment;
break; break;
}
case INSTRUCTION: case INSTRUCTION:
String content = (String) sc.getPossibleContent(); String content = (String) sc.getPossibleContent();
if (content == null) { if (content == null) {
content = "Empty Instruction"; content = "Empty Instruction";
} }
// replace all the line braks by <br/>, and all the double spaces by the html version &nbsp;
String htmlPreservedLineBreaks = content.replaceAll("(\r\n|\n)","<br />");
htmlPreservedLineBreaks = htmlPreservedLineBreaks.replaceAll("\\s\\s","&nbsp;&nbsp;");
HTML instr = new HTML(); HTML instr = new HTML();
instr.setStyleName("instructionArea"); instr.setStyleName("instructionArea");
instr.setHTML(htmlPreservedLineBreaks); instr.setHTML(preserveLineBreaks(content));
this.content = instr; this.content = instr;
break; break;
@ -408,6 +404,19 @@ public class TemplateComponent {
return ""; return "";
} }
} }
/**
* replace all the line braks by <br/>, and all the double spaces by the html version &nbsp
* @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)","<br />"); //line breaks
htmlPreservedLineBreaks = htmlPreservedLineBreaks.replaceAll("\\s\\s","&nbsp;&nbsp;"); //spaces
return htmlPreservedLineBreaks;
}
return toPreserve;
}
/** /**
* return a template Component which is serializable * return a template Component which is serializable
* @return . * @return .
@ -459,7 +468,7 @@ public class TemplateComponent {
content = ((BasicTextArea) this.content).getText(); content = ((BasicTextArea) this.content).getText();
id = ((BasicTextArea) this.content).getId(); id = ((BasicTextArea) this.content).getId();
metas = ((BasicTextArea) this.content).getMetadata(); metas = ((BasicTextArea) this.content).getMetadata();
} }
break; break;
case TIME_SERIES: case TIME_SERIES:

View File

@ -143,12 +143,14 @@ public class SequenceWidget extends Composite {
bc.setMetadata(new ArrayList<Metadata>()); bc.setMetadata(new ArrayList<Metadata>());
} }
} }
//in the VIEW //in the VIEW
for (TemplateComponent tc : seqGroupedComponents) { for (TemplateComponent tc : seqGroupedComponents) {
if (tc.getType() == ComponentType.BODY_NOT_FORMATTED) { if (tc.getType() == ComponentType.BODY_NOT_FORMATTED || tc.getType() == ComponentType.HEADING_2) {
((HTML) tc.getContent()).setText(""); myPanel.remove(tc.getContent());
} }
} }
buttonsWrapperPanel.clear(); buttonsWrapperPanel.clear();
selectNewB.getElement().getStyle().setWidth(130, Unit.PX); selectNewB.getElement().getStyle().setWidth(130, Unit.PX);
selectNewB.getElement().getStyle().setMargin(10, Unit.PX); selectNewB.getElement().getStyle().setMargin(10, Unit.PX);

View File

@ -18,6 +18,7 @@ import java.util.Random;
import java.util.UUID; import java.util.UUID;
import java.util.Vector; import java.util.Vector;
import javax.inject.Inject;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
import javax.xml.bind.DatatypeConverter; 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.DBTableRow;
import org.gcube.application.reporting.reference.ReferenceReport; import org.gcube.application.reporting.reference.ReferenceReport;
import org.gcube.application.reporting.reference.ReferenceReportType; 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.NameValue;
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.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.ApplicationNotificationsManager;
import org.gcube.applicationsupportlayer.social.NotificationsManager; import org.gcube.applicationsupportlayer.social.NotificationsManager;
import org.gcube.common.homelibrary.home.HomeLibrary; import org.gcube.common.homelibrary.home.HomeLibrary;
@ -1484,11 +1491,18 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
ReportType type = new ReportType(); ReportType type = new ReportType();
type.setTypeIdentifier("Vme"); type.setTypeIdentifier("Vme");
for (ReportEntry re : getFakeReports(type)) { RsgService rsgClient = new RsgClient();
String rfmo = re.getNameValueList().get(0).getValue();
String name = re.getNameValueList().get(1).getValue(); for (ReportEntry re : rsgClient.listReports(type)) {
int year = Integer.parseInt(re.getNameValueList().get(2).getValue()); String rfmo = "unknown RFMO";
toReturn.add(new VMEReportBean(""+re.getId(), rfmo, name, year)); 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; return toReturn;
@ -1505,158 +1519,94 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
ArrayList<VMEReportBean> toReturn = new ArrayList<VMEReportBean>(); ArrayList<VMEReportBean> toReturn = new ArrayList<VMEReportBean>();
ReportType type = new ReportType(); ReportType type = new ReportType();
type.setTypeIdentifier(refType.toString()); type.setTypeIdentifier(refType.toString());
RsgService rsgClient = new RsgClient();
for (ReportEntry re : getFakeReports(type)) {
String name = re.getNameValueList().get(0).getValue(); for (ReportEntry re :rsgClient.listReports(new ReportType(refType.getId()))) {
toReturn.add(new VMEReportBean(""+re.getId(), "", name, -1)); 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; return toReturn;
} }
private List<ReportEntry> getFakeReports(ReportType type, NameValue... filters) {
Random generator = new Random();
int n = generator.nextInt(15) + 5;
ArrayList<ReportEntry> toReturn = new ArrayList<ReportEntry>();
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<NameValue> namesValues = new ArrayList<NameValue>();
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<NameValue> namesValues = new ArrayList<NameValue>();
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 @Override
public Model importVMEReport(String id, VMETypeIdentifier refType) { public Model importVMEReport(String id, String name, VMETypeIdentifier refType) {
ReportsModeler rm = null; RsgService rsgClient = new RsgClient();
CompiledReport cr = null;
if (refType == VMETypeIdentifier.Vme) { if (refType == VMETypeIdentifier.Vme) {
String reportName = "Sample VME Report imported with id: " + id; _log.info("Importing VME id=" + id + " name=" + name);
rm = new ReportsModeler( cr = rsgClient.getReportById(new ReportType(refType.getId()), id);
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);
}
else { else {
String reportName = refType.getId() + " VME Reference Report with id: " + id; _log.info("Importing Ref type= " + refType.getId() + " id=" + id + " name=" + name);
rm = new ReportsModeler( cr = rsgClient.getReferenceReportById(new ReportType(refType.getId()), id);
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!"));
} }
Model model = null;
try { 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) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
return null; return model;
} }
@Override @Override
public Model getVMEReportRef2Associate(String id, VMETypeIdentifier refType) { public Model getVMEReportRef2Associate(String id, VMETypeIdentifier refType) {
String reportName = "Sample Reference Report: " + id; RsgService rsgClient = new RsgClient();
ReportsModeler rm = new ReportsModeler( _log.info("Importing Ref type= " + refType.getId() + " id=" + id);
UUID.randomUUID().toString(), CompiledReport cr = rsgClient.getReferenceReportById(new ReportType(refType.getId()), id);
reportName, Model model = null;
getASLSession().getUsername(),
new Date(),
new Date(),
getASLSession().getUsername()
);
//construct the options (the references)
ArrayList<DBTableRow> dBTableRows = new ArrayList<DBTableRow>();
ArrayList<Column> md = new ArrayList<Column>();
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));
try { try {
Model toReturn = rm.getReportInstance(); model = new ReportManagerReportBuilder().buildReport(cr, id, "", "unknown author", new Date(), new Date(), "uknown last editor").getReportInstance();
//ReportsReader.readReportStructure(toReturn); } catch (ReportBuilderException e) {
return toReturn; e.printStackTrace();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
return null; return model;
} }
private ReportsModeler addSection2(ReportsModeler rm) { private ReportsModeler addSection2(ReportsModeler rm) {
rm.add(new Heading(1, "Specific Measure")); rm.add(new Heading(1, "Specific Measure"));
ReportSequence seq = new ReportSequence(UUID.randomUUID().toString()); ReportSequence seq = new ReportSequence(UUID.randomUUID().toString());

View File

@ -7,12 +7,11 @@ public class VMEReportBean extends BaseModel {
public VMEReportBean() {} public VMEReportBean() {}
public VMEReportBean(String id, String rfmo, String name, int year) { public VMEReportBean(String id, String rfmo, String name) {
super(); super();
set("id", id); set("id", id);
set("rfmo", rfmo); set("rfmo", rfmo);
set("name", name); set("name", name);
set("year", year);
} }
public String getId() { public String getId() {
@ -26,8 +25,4 @@ public class VMEReportBean extends BaseModel {
public String getName() { public String getName() {
return (String) get("name"); return (String) get("name");
} }
public int getYear() {
return (Integer) get("year");
}
} }

View File

@ -15,3 +15,4 @@ log4j.logger.org.gcube.resources.discovery.icclient=ERROR
log4j.logger.org.gcube.common.clients=ERROR log4j.logger.org.gcube.common.clients=ERROR
log4j.logger.org.gcube.common.homelibrary.jcr=ERROR log4j.logger.org.gcube.common.homelibrary.jcr=ERROR
log4j.logger.org.gcube.application.framework.accesslogger=ERROR log4j.logger.org.gcube.application.framework.accesslogger=ERROR
log4j.logger.org.gcube.application.rsg.support.builder.impl=ERROR

View File

@ -585,18 +585,14 @@ tableBorder td {
} }
.readOnlyText { .readOnlyText {
border: 1px solid #CCC !important; font-size: 12px;
-webkit-border-radius: 5px; color: #333;
-moz-border-radius: 5px; text-align:justify;
border-radius: 5px; text-justify:inter-word;
background-color: white; padding-left: 5px;
margin-top: 5px;
padding: 5px;
font-size: 13px;
color: #AAA;
} }
.bodyArea { .bodyArea {
background-image: none; background-image: none;
} }