added support for Sequences Having ReportRef inside.

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/reports@85650 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2013-11-18 17:25:49 +00:00
parent a1b2de0962
commit 01b512567b
9 changed files with 85 additions and 46 deletions

View File

@ -5,10 +5,19 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
<dependent-module archiveName="gcube-reporting-modeler-1.0.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/gcube-reporting-modeler/gcube-reporting-modeler">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="reports-store-gateway-client-0.0.1-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-interface-dto-0.0.1-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="report-exporter-widget-2.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/report-exporter-widget/report-exporter-widget">
<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>
</dependent-module>
<dependent-module archiveName="gcube-reporting-library-3.4.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/gcube-reporting-library/gcube-reporting-library">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>

View File

@ -146,7 +146,6 @@
<groupId>org.gcube.portlets.admin</groupId>
<artifactId>document-workflow-library</artifactId>
<version>[1.2.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>${setScope}</scope>
</dependency>
<dependency>
<groupId>org.gcube.portlets.widgets</groupId>
@ -157,7 +156,6 @@
<groupId>org.gcube.portal</groupId>
<artifactId>gcube-reporting-library</artifactId>
<version>[3.4.0-SNAPSHOT, 4.0.0-SNAPSHOT)</version>
<scope>${setScope}</scope>
</dependency>
<dependency>
<groupId>org.gcube.portlets.user</groupId>

View File

@ -9,9 +9,7 @@ import org.gcube.portlets.d4sreporting.common.shared.BasicSection;
import org.gcube.portlets.d4sreporting.common.shared.ComponentType;
import org.gcube.portlets.d4sreporting.common.shared.Metadata;
import org.gcube.portlets.d4sreporting.common.shared.Model;
import org.gcube.portlets.d4sreporting.common.shared.RepeatableSequence;
import org.gcube.portlets.d4sreporting.common.shared.ReportReference;
import org.gcube.portlets.d4sreporting.common.shared.Tuple;
import org.gcube.portlets.d4sreporting.common.shared.ReportReferences;
import org.gcube.portlets.user.reportgenerator.client.Headerbar;
import org.gcube.portlets.user.reportgenerator.client.ReportConstants;
import org.gcube.portlets.user.reportgenerator.client.ReportGenerator;
@ -43,8 +41,8 @@ import org.gcube.portlets.user.reportgenerator.client.targets.AttributeSingleSel
import org.gcube.portlets.user.reportgenerator.client.targets.BasicTextArea;
import org.gcube.portlets.user.reportgenerator.client.targets.ClientImage;
import org.gcube.portlets.user.reportgenerator.client.targets.ClientRepeatableSequence;
import org.gcube.portlets.user.reportgenerator.client.targets.ClientSequence;
import org.gcube.portlets.user.reportgenerator.client.targets.ClientReportReference;
import org.gcube.portlets.user.reportgenerator.client.targets.ClientSequence;
import org.gcube.portlets.user.reportgenerator.client.targets.Coords;
import org.gcube.portlets.user.reportgenerator.client.targets.D4sRichTextarea;
import org.gcube.portlets.user.reportgenerator.client.targets.GenericTable;
@ -948,8 +946,6 @@ public class Presenter {
List<TemplateComponent> pageElems = model.getSectionComponent(section);
for (TemplateComponent component : pageElems) {
//GWT.log("Reading component.. " + component.getType(), null);
int uiX = component.getX();
int uiY= component.getY();
switch (component.getType()) {
@ -1361,11 +1357,10 @@ public class Presenter {
@Override
public void onSuccess(Model reportRef) {
if (reportRef != null && reportRef.getSections().size() > 0) {
//the Repeatable Seq must be in the 1st Section, second component. (because ReportsModeler put it that way)
//the Repeatable Seq must be in the 1st Section, second component. (because ReportsModeler put it there)
BasicSection firstSection = reportRef.getSections().get(0);
if (firstSection.getComponents() != null && firstSection.getComponents().size()==2) {
ReportReference toPass = (ReportReference) firstSection.getComponents().get(1).getPossibleContent();
ReportReferences toPass = (ReportReferences) firstSection.getComponents().get(1).getPossibleContent();
clientSeqSelected.add(toPass.getTuples().get(0).getKey(), toPass.getTuples().get(0));
}
else {

View File

@ -8,20 +8,20 @@ import java.util.List;
import org.gcube.portlets.d4sreporting.common.shared.AttributeArea;
import org.gcube.portlets.d4sreporting.common.shared.BasicComponent;
import org.gcube.portlets.d4sreporting.common.shared.ComponentType;
import org.gcube.portlets.d4sreporting.common.shared.ReportReference;
import org.gcube.portlets.d4sreporting.common.shared.Tuple;
import org.gcube.portlets.d4sreporting.common.shared.Metadata;
import org.gcube.portlets.d4sreporting.common.shared.RepTimeSeries;
import org.gcube.portlets.d4sreporting.common.shared.RepeatableSequence;
import org.gcube.portlets.d4sreporting.common.shared.ReportReferences;
import org.gcube.portlets.d4sreporting.common.shared.Table;
import org.gcube.portlets.d4sreporting.common.shared.Tuple;
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
import org.gcube.portlets.user.reportgenerator.client.targets.AttributeMultiSelection;
import org.gcube.portlets.user.reportgenerator.client.targets.AttributeSingleSelection;
import org.gcube.portlets.user.reportgenerator.client.targets.BasicTextArea;
import org.gcube.portlets.user.reportgenerator.client.targets.ClientImage;
import org.gcube.portlets.user.reportgenerator.client.targets.ClientSequence;
import org.gcube.portlets.user.reportgenerator.client.targets.ClientReportReference;
import org.gcube.portlets.user.reportgenerator.client.targets.ClientRepeatableSequence;
import org.gcube.portlets.user.reportgenerator.client.targets.ClientReportReference;
import org.gcube.portlets.user.reportgenerator.client.targets.ClientSequence;
import org.gcube.portlets.user.reportgenerator.client.targets.D4sRichTextarea;
import org.gcube.portlets.user.reportgenerator.client.targets.DropTSListener;
import org.gcube.portlets.user.reportgenerator.client.targets.GenericTable;
@ -170,6 +170,8 @@ public class TemplateComponent {
this.locked = sc.isLocked();
this.metadata = sc.getMetadata();
//Log.debug("TemplateComponent found type: " + sc.getType());
switch (sc.getType()) {
case DYNA_IMAGE:
ClientImage dp = new ClientImage(sc, presenter, sc.getWidth(), sc.getHeight(), showClose, owner);
@ -346,7 +348,7 @@ public class TemplateComponent {
this.content = tsa;
break;
case REPEAT_SEQUENCE_DELIMITER:
GroupingDelimiterArea gp = new GroupingDelimiterArea();
GroupingDelimiterArea gp = new GroupingDelimiterArea(height);
this.content = gp;
break;
case REPEAT_SEQUENCE_INNER:
@ -354,7 +356,7 @@ public class TemplateComponent {
this.content = spacer;
break;
case REPEAT_SEQUENCE:
//GWT.log("FOUND SEQUENCE trying getGroup");
//Log.debug("FOUND SEQUENCE trying getGroup");
RepeatableSequence repeatableSequence = (RepeatableSequence) sc.getPossibleContent();
ClientRepeatableSequence rps = new ClientRepeatableSequence(presenter, repeatableSequence);
@ -371,9 +373,10 @@ public class TemplateComponent {
this.content = tti;
break;
case REPORT_REFERENCE:
//Log.debug("FOUND Master SEQUENCE trying getGroup");
GWT.log("FOUND Master SEQUENCE trying getGroup");
ReportReference ref = (ReportReference) sc.getPossibleContent();
ReportReferences ref = (ReportReferences) sc.getPossibleContent();
ArrayList<Tuple> tuple = ref.getTuples();
ClientReportReference cmSeq = new ClientReportReference(presenter, ref.getRefType(), tuple);
@ -476,7 +479,7 @@ public class TemplateComponent {
break;
case REPEAT_SEQUENCE:
ClientRepeatableSequence repSeq = (ClientRepeatableSequence) this.content;
RepeatableSequence toStore = new RepeatableSequence(getSerializableSequence(repSeq), height);
RepeatableSequence toStore = new RepeatableSequence(getSerializableSequence(repSeq), repSeq.getIdentifier(), height);
content = toStore;
break;
case BODY_TABLE_IMAGE:
@ -486,7 +489,7 @@ public class TemplateComponent {
break;
case REPORT_REFERENCE:
ClientReportReference cRef = (ClientReportReference) this.content;
ReportReference ref = new ReportReference(cRef.getRefType(), cRef.getTupleList());
ReportReferences ref = new ReportReferences(cRef.getRefType(), cRef.getTupleList());
content = ref;
break;
}
@ -508,7 +511,7 @@ public class TemplateComponent {
}
/**
* this method constructs a Sequence that can be serializable from the TextTableImage Widget
* this method constructs a ReportSequence that can be serializable from the TextTableImage Widget
* @param repSeq
* @return
*/

View File

@ -17,7 +17,7 @@ public class ClientRepeatableSequence extends Composite implements ClientSequenc
private VerticalPanel myPanel = new VerticalPanel();
private Presenter p;
private String identifier;
protected RepeatableSequence repSequence;
protected RepeatableSequence originalSequence = new RepeatableSequence();
@ -29,6 +29,7 @@ public class ClientRepeatableSequence extends Composite implements ClientSequenc
public ClientRepeatableSequence(Presenter p, RepeatableSequence sRS) {
this.p = p;
this.repSequence = sRS;
this.identifier = sRS.getKey();
this.originalSequence = extractOriginalSequence(sRS);
SequenceWidget seqW = new SequenceWidget(p, this, originalSequence, true, false);
myPanel.add(seqW);
@ -153,4 +154,10 @@ public class ClientRepeatableSequence extends Composite implements ClientSequenc
public void AddButtonClicked(RepeatableSequence sequence) {
add("not needed", sequence);
}
public String getIdentifier() {
return identifier;
}
}

View File

@ -56,6 +56,7 @@ public class ClientReportReference extends Composite implements ClientSequence {
SequenceWidget toReturn = new SequenceWidget(p, this, seq, true, false);
if (tupleList.size() == 1) {
toReturn.enableClear();
toReturn.removeAddAnotherButton();
}
return toReturn;
}

View File

@ -6,10 +6,10 @@ import com.google.gwt.user.client.ui.HTML;
public class GroupingDelimiterArea extends HTML {
public GroupingDelimiterArea() {
public GroupingDelimiterArea(int height) {
super();
setWidth("700px");
setHeight("15px");
setHeight(height+"px");
setStyleName("grouping-border");
}
}

View File

@ -31,8 +31,10 @@ import org.apache.commons.io.IOUtils;
import org.gcube.application.framework.accesslogger.library.impl.AccessLogger;
import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.application.framework.core.session.SessionManager;
import org.gcube.application.reporting.ReportSequence;
import org.gcube.application.reporting.ReportsModeler;
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.service.dto.ReportEntry;
import org.gcube.application.rsg.service.dto.ReportType;
@ -139,7 +141,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
* Called then servlet is intialized
*/
public void init() {
_log.info("Initializing Servlet ReportServiceImpl...");
_log.info("Initializing Servlet ReportServiceImpl... connecting to WF DB");
store = new MyDerbyStore();
}
@ -1533,6 +1535,8 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
rm.addTextInput("Corner Rise Seamounts2");
rm.addHeading(3, "This is a Heading of Level 3 that is editable", false);
rm.addTextInput();
rm.nextSection();
rm = addSection2(rm);
try {
return rm.getReportInstance();
} catch (Exception e) {
@ -1559,20 +1563,16 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
Random generator = new Random();
int year = generator.nextInt(15) + 2000;
//construct the references
md.add(new Metadata("Meeting Date", ""+year));
md.add(new Metadata("Report Summary", "Aenean vulputate ac dui eu interdum. Nullam tincidunt hendrerit sollicitudin."));
md.add(new Metadata("Committee", "Lorem ipsum dolor sit amet, consectetur adipiscing elit"));
md.add(new Metadata("URL", "http://archive.nafo.int/open/fc/2012/fcdoc12-01.pdf"));
md.add(new Metadata("Citation", "(Rossi et Al) adipiscing elit oekfha lfkahjf lakjfha lkfahjf alkjdfh "));
md.add(new Metadata("Type", "The type"));
dBTableRows.add(new DBTableRow("primaryKey", md));
md.add(new Metadata("Year", ""+year));
year = generator.nextInt(15) + 2000;
md.add(new Metadata("Validity Period - Start", ""+year));
year = generator.nextInt(15) + 2000;
md.add(new Metadata("Validity Period - End", ""+year));
md.add(new Metadata("VME Specific Measure Summary",
"2011 Roll over of existing measures until 31 Dec 2014. " + UUID.randomUUID().toString()
+ "Closed to demersal fishing with possibilities of an exploratory fishing not exceed-ing 20% "
+ "of the fishable area of each seamount. (CEM 2011, Art. 15)"));
md.add(new Metadata("Link Bookmarked", "http://archive.nafo.int/open/fc/2012/fcdoc12-01.pdf"));
md.add(new Metadata("Link Source URL", "http://archive.nafo.int/open/fc/2012/fcdoc12-01.pdf"));
dBTableRows.add(new DBTableRow(md));
rm.addReference(ReferenceReportType.GeneralMeasure, dBTableRows);
rm.addReference(new ReferenceReport(ReferenceReportType.InformationSource, dBTableRows));
try {
return rm.getReportInstance();
} catch (Exception e) {
@ -1581,5 +1581,33 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
return null;
}
private ReportsModeler addSection2(ReportsModeler rm) {
rm.addHeading(1, "Specific Measure");
ReportSequence seq = new ReportSequence();
seq.addHeading(2, "year");
seq.addTextInput();
seq.addHeading(2, "Validity Period - Start");
seq.addTextInput();
seq.addHeading(2, "Validity Period - End");
seq.addTextInput();
//construct the options (the references)
ArrayList<DBTableRow> dBTableRows = new ArrayList<DBTableRow>();
ArrayList<Metadata> md = new ArrayList<Metadata>();
//construct the references
md.add(new Metadata("Meeting Date", "2009"));
md.add(new Metadata("Report Summary", "Aenean vulputate ac dui eu interdum. Nullam tincidunt hendrerit sollicitudin."));
md.add(new Metadata("Committee", "Lorem ipsum dolor sit amet, consectetur adipiscing elit"));
md.add(new Metadata("URL", "http://archive.nafo.int/open/fc/2012/fcdoc12-01.pdf"));
md.add(new Metadata("Citation", "(Rossi et Al) adipiscing elit oekfha lfkahjf lakjfha lkfahjf alkjdfh "));
md.add(new Metadata("Type", "The type"));
dBTableRows.add(new DBTableRow("primaryKey", md));
seq.addReference(new ReferenceReport(ReferenceReportType.InformationSource, dBTableRows));
rm.addSequence("a key", seq);
return rm;
}
}

View File

@ -3,10 +3,8 @@
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<!-- To Comment out -->
<!-- <set-property name="user.agent" value="gecko1_8" /> -->
<set-property name="user.agent" value="gecko1_8" />
<inherits name='org.gcube.portlets.widgets.userselection.UserSelection' />
<inherits