Finished implementing requirements from FAO for writing back to the VME-DB, connected to the export service of RSG (without success)
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/reports@90453 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
4830e2830f
commit
0aa2cbd1cc
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" output="target/reports-4.7.1-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
<classpathentry kind="src" output="target/reports-4.7.2-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"/>
|
||||||
|
@ -26,10 +26,10 @@
|
||||||
</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="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="owner.project.facets" value="java"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="output" path="target/reports-4.7.1-SNAPSHOT/WEB-INF/classes"/>
|
<classpathentry kind="output" path="target/reports-4.7.2-SNAPSHOT/WEB-INF/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
<<<<<<<=.mine
|
<<<<<<<=.mine
|
||||||
>>>>>>>=.r71295
|
>>>>>>>=.r71295
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
lastWarOutDir=/Users/massi/Documents/workspace/reports/target/reports-4.7.1-SNAPSHOT
|
lastWarOutDir=/Users/massi/Documents/workspace/reports/target/reports-4.7.2-SNAPSHOT
|
||||||
warSrcDir=src/main/webapp
|
warSrcDir=src/main/webapp
|
||||||
warSrcDirIsOutput=false
|
warSrcDirIsOutput=false
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||||
org.eclipse.jdt.core.compiler.source=1.6
|
org.eclipse.jdt.core.compiler.source=1.7
|
||||||
|
|
|
@ -3,5 +3,5 @@
|
||||||
<fixed facet="wst.jsdt.web"/>
|
<fixed facet="wst.jsdt.web"/>
|
||||||
<installed facet="wst.jsdt.web" version="1.0"/>
|
<installed facet="wst.jsdt.web" version="1.0"/>
|
||||||
<installed facet="jst.web" version="2.4"/>
|
<installed facet="jst.web" version="2.4"/>
|
||||||
<installed facet="java" version="1.6"/>
|
<installed facet="java" version="1.7"/>
|
||||||
</faceted-project>
|
</faceted-project>
|
||||||
|
|
6
pom.xml
6
pom.xml
|
@ -12,7 +12,7 @@
|
||||||
<groupId>org.gcube.portlets.user</groupId>
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
<artifactId>reports</artifactId>
|
<artifactId>reports</artifactId>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
<version>4.7.1-SNAPSHOT</version>
|
<version>4.7.2-SNAPSHOT</version>
|
||||||
<name>gCube Reports Manager</name>
|
<name>gCube Reports Manager</name>
|
||||||
<description>
|
<description>
|
||||||
gCube Reports Portlet.
|
gCube Reports Portlet.
|
||||||
|
@ -281,8 +281,8 @@
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>2.3.2</version>
|
<version>2.3.2</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>1.6</source>
|
<source>1.7</source>
|
||||||
<target>1.6</target>
|
<target>1.7</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<!-- SA Plugin -->
|
<!-- SA Plugin -->
|
||||||
|
|
|
@ -29,6 +29,10 @@ import com.google.gwt.user.client.ui.PopupPanel;
|
||||||
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
|
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
|
||||||
*/
|
*/
|
||||||
public class CommonCommands {
|
public class CommonCommands {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public Command exportToRSG;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -229,6 +233,12 @@ public class CommonCommands {
|
||||||
saveReportAsDialog();
|
saveReportAsDialog();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exportToRSG = new Command() {
|
||||||
|
public void execute() {
|
||||||
|
presenter.exportReportToRSG();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
} //end constructor
|
} //end constructor
|
||||||
|
|
||||||
|
|
|
@ -419,6 +419,7 @@ public class Presenter {
|
||||||
|
|
||||||
toReturn.put("structureView", commonCommands.structureView);
|
toReturn.put("structureView", commonCommands.structureView);
|
||||||
toReturn.put("save", commonCommands.saveTemplate);
|
toReturn.put("save", commonCommands.saveTemplate);
|
||||||
|
toReturn.put("exportRSG", commonCommands.exportToRSG);
|
||||||
toReturn.put("newdoc", commonCommands.newTemplate);
|
toReturn.put("newdoc", commonCommands.newTemplate);
|
||||||
toReturn.put("open_report", commonCommands.openReport);
|
toReturn.put("open_report", commonCommands.openReport);
|
||||||
toReturn.put("open_template", commonCommands.openTemplate);
|
toReturn.put("open_template", commonCommands.openTemplate);
|
||||||
|
@ -523,7 +524,26 @@ public class Presenter {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save the current report in a given folder
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void exportReportToRSG() {
|
||||||
|
dlg.center();
|
||||||
|
dlg.show();
|
||||||
|
Model toSave = model.getSerializableModel();
|
||||||
|
reportService.exportReportToRSG(toSave, new AsyncCallback<Void>() {
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
dlg.hide();
|
||||||
|
MessageBox.alert("Warning","Report Not Exported: " + caught.getMessage(), null);
|
||||||
|
}
|
||||||
|
public void onSuccess(Void result) {
|
||||||
|
dlg.hide();
|
||||||
|
MessageBox.info("Exporting to RSG Operation","Report Exported Successfully", null);
|
||||||
|
refreshWorkspace();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Save the current report in a given folder
|
* Save the current report in a given folder
|
||||||
*
|
*
|
||||||
|
|
|
@ -85,6 +85,11 @@ public interface ReportService extends RemoteService{
|
||||||
*/
|
*/
|
||||||
void saveReport(Model toSave);
|
void saveReport(Model toSave);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param toSave the report instance to save
|
||||||
|
*/
|
||||||
|
void exportReportToRSG(Model toSave);
|
||||||
|
|
||||||
Model getWorkflowDocumentFromDocumentLibrary();
|
Model getWorkflowDocumentFromDocumentLibrary();
|
||||||
|
|
||||||
void updateWorkflowDocument(Model toSave, boolean update);
|
void updateWorkflowDocument(Model toSave, boolean update);
|
||||||
|
|
|
@ -86,4 +86,5 @@ public interface ReportServiceAsync {
|
||||||
void getVMEReportRef2Associate(String id, VMETypeIdentifier refType, AsyncCallback<Model> callback);
|
void getVMEReportRef2Associate(String id, VMETypeIdentifier refType, AsyncCallback<Model> callback);
|
||||||
void importVMETemplate(VMETypeIdentifier refType,
|
void importVMETemplate(VMETypeIdentifier refType,
|
||||||
AsyncCallback<Model> callback);
|
AsyncCallback<Model> callback);
|
||||||
|
void exportReportToRSG(Model toSave, AsyncCallback<Void> callback);
|
||||||
}
|
}
|
||||||
|
|
|
@ -386,6 +386,7 @@ public class TemplateComponent {
|
||||||
if (refs != null) {
|
if (refs != null) {
|
||||||
ArrayList<Tuple> tuple = refs.getTuples();
|
ArrayList<Tuple> tuple = refs.getTuples();
|
||||||
ClientReportReference cmSeq = new ClientReportReference(presenter, refs.getRefType(), tuple, refs.isSingleRelation());
|
ClientReportReference cmSeq = new ClientReportReference(presenter, refs.getRefType(), tuple, refs.isSingleRelation());
|
||||||
|
cmSeq.setMetadata(sc.getMetadata());
|
||||||
this.content = cmSeq;
|
this.content = cmSeq;
|
||||||
} else
|
} else
|
||||||
this.content = new HTML("");
|
this.content = new HTML("");
|
||||||
|
@ -522,6 +523,7 @@ public class TemplateComponent {
|
||||||
break;
|
break;
|
||||||
case REPORT_REFERENCE:
|
case REPORT_REFERENCE:
|
||||||
ClientReportReference cRef = (ClientReportReference) this.content;
|
ClientReportReference cRef = (ClientReportReference) this.content;
|
||||||
|
metas = cRef.getMetadata();
|
||||||
ReportReferences ref = new ReportReferences(cRef.getRefType(), cRef.getTupleList(), cRef.isSingleRelation());
|
ReportReferences ref = new ReportReferences(cRef.getRefType(), cRef.getTupleList(), cRef.isSingleRelation());
|
||||||
content = ref;
|
content = ref;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -7,9 +7,12 @@ import org.gcube.portlets.d4sreporting.common.shared.BasicComponent;
|
||||||
import org.gcube.portlets.d4sreporting.common.shared.ComponentType;
|
import org.gcube.portlets.d4sreporting.common.shared.ComponentType;
|
||||||
import org.gcube.portlets.d4sreporting.common.shared.Metadata;
|
import org.gcube.portlets.d4sreporting.common.shared.Metadata;
|
||||||
import org.gcube.portlets.d4sreporting.common.shared.RepeatableSequence;
|
import org.gcube.portlets.d4sreporting.common.shared.RepeatableSequence;
|
||||||
|
import org.gcube.portlets.d4sreporting.common.shared.ReportReferences;
|
||||||
|
import org.gcube.portlets.d4sreporting.common.shared.Tuple;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
|
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.model.TemplateComponent;
|
import org.gcube.portlets.user.reportgenerator.client.model.TemplateComponent;
|
||||||
|
|
||||||
|
import com.google.gwt.core.shared.GWT;
|
||||||
import com.google.gwt.user.client.ui.Composite;
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||||
|
|
||||||
|
@ -35,7 +38,7 @@ public class ClientRepeatableSequence extends Composite implements ClientSequenc
|
||||||
this.originalSequence = extractOriginalSequence(sRS);
|
this.originalSequence = extractOriginalSequence(sRS);
|
||||||
SequenceWidget seqW = new SequenceWidget(p, this, originalSequence, true, false);
|
SequenceWidget seqW = new SequenceWidget(p, this, originalSequence, true, false);
|
||||||
myPanel.add(seqW);
|
myPanel.add(seqW);
|
||||||
|
|
||||||
for (RepeatableSequence repeatSeq : getRepeats()) {
|
for (RepeatableSequence repeatSeq : getRepeats()) {
|
||||||
addAnother(repeatSeq);
|
addAnother(repeatSeq);
|
||||||
}
|
}
|
||||||
|
@ -86,7 +89,7 @@ public class ClientRepeatableSequence extends Composite implements ClientSequenc
|
||||||
if (repeatDelimiterCounter == 0) {
|
if (repeatDelimiterCounter == 0) {
|
||||||
toReturn.add(new RepeatableSequence(groupedComponents, repSequence.getHeight()));
|
toReturn.add(new RepeatableSequence(groupedComponents, repSequence.getHeight()));
|
||||||
repeatDelimiterCounter = 2;
|
repeatDelimiterCounter = 2;
|
||||||
groupedComponents = new ArrayList<BasicComponent>();
|
groupedComponents = new ArrayList<BasicComponent>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//if there is only the first sequence return nothing
|
//if there is only the first sequence return nothing
|
||||||
|
@ -109,7 +112,7 @@ public class ClientRepeatableSequence extends Composite implements ClientSequenc
|
||||||
SequenceWidget seqW = new SequenceWidget(p, this, sRS, false, false);
|
SequenceWidget seqW = new SequenceWidget(p, this, sRS, false, false);
|
||||||
myPanel.add(seqW);
|
myPanel.add(seqW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void addNew(RepeatableSequence sRS) {
|
protected void addNew(RepeatableSequence sRS) {
|
||||||
SequenceWidget seqW = new SequenceWidget(p, this, sRS, false, true);
|
SequenceWidget seqW = new SequenceWidget(p, this, sRS, false, true);
|
||||||
|
@ -125,42 +128,98 @@ public class ClientRepeatableSequence extends Composite implements ClientSequenc
|
||||||
groupedComponents.remove(tc);
|
groupedComponents.remove(tc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//TODO: change the -1 in the current max
|
/**
|
||||||
|
* add the template component in the model
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void addTemplateComponent(TemplateComponent toAdd) {
|
||||||
|
groupedComponents.add(toAdd);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* return the grouped components of a sequence. For the specific RSG case if it finds a @see {@link SequenceWidget} RSG_BINDING_PROPERTY
|
||||||
|
* with value -1 it update it to the max value so far (requirement for RSG needed to wrote back the report in the DB)
|
||||||
|
* Note that a Sequence can contain multiple sequences and they are separeted by componentType.REPEAT_SEQUENCE_DELIMITER
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ArrayList<TemplateComponent> getGroupedComponents() {
|
public ArrayList<TemplateComponent> getGroupedComponents() {
|
||||||
return groupedComponents;
|
int maxBindingContext = getMaxIndex();
|
||||||
}
|
for (int i = 0; i < groupedComponents.size(); i++) {
|
||||||
/**
|
TemplateComponent co = groupedComponents.get(i);
|
||||||
* @return specific cor RSG Case search for binding="geoRefList[3]"
|
|
||||||
*/
|
if (co.getType() == ComponentType.REPEAT_SEQUENCE_DELIMITER) {
|
||||||
private int getMaxIndex() {
|
maxBindingContext++;
|
||||||
int max = 0;
|
}
|
||||||
for (TemplateComponent co : groupedComponents) {
|
|
||||||
for (Metadata prop : co.getAllMetadata()) {
|
//specific for report References in Sequences
|
||||||
if (prop.getAttribute().equals(SequenceWidget.RSG_BINDING_PROPERTY)) {
|
if (co.getType() == ComponentType.REPORT_REFERENCE) {
|
||||||
int currValue = extractIndexFromBindingContext(prop.getValue());
|
GWT.log("Reference found");
|
||||||
if (currValue > max)
|
ClientReportReference refGroup = (ClientReportReference) co.getContent();
|
||||||
max = currValue;
|
if (refGroup != null) {
|
||||||
|
for (Metadata prop : refGroup.getMetadata()) {
|
||||||
|
GWT.log("-" + prop.getAttribute()+":"+prop.getValue());
|
||||||
|
//if there's a new component
|
||||||
|
if ( prop.getAttribute().equals(SequenceWidget.RSG_BINDING_PROPERTY) && (extractIndexFromBindingContext(prop.getValue()) == -1) ) {
|
||||||
|
prop.setValue(replaceIndexFromBindingContext(prop.getValue(), maxBindingContext));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//GWT.log("-" + prop.getAttribute()+":"+prop.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//for any other component
|
||||||
|
for (Metadata prop : co.getAllMetadata()) {
|
||||||
|
//if there's a new component
|
||||||
|
if ( prop.getAttribute().equals(SequenceWidget.RSG_BINDING_PROPERTY) && (extractIndexFromBindingContext(prop.getValue()) == -1) ) {
|
||||||
|
prop.setValue(replaceIndexFromBindingContext(prop.getValue(), maxBindingContext));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return max;
|
return groupedComponents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param binding it expect sth like #.profileList[0] or #.specificMeasureList[0] etc
|
||||||
|
* and return the integer into square brackets
|
||||||
|
* @return the integer into square brackets
|
||||||
|
*/
|
||||||
private int extractIndexFromBindingContext(String binding) {
|
private int extractIndexFromBindingContext(String binding) {
|
||||||
int openSquareBracket = binding.lastIndexOf("[")+1;
|
int openSquareBracket = binding.lastIndexOf("[")+1;
|
||||||
int closeSquareBracket = binding.lastIndexOf("]");
|
int closeSquareBracket = binding.lastIndexOf("]");
|
||||||
return Integer.parseInt(binding.substring(openSquareBracket, closeSquareBracket));
|
return Integer.parseInt(binding.substring(openSquareBracket, closeSquareBracket));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param binding it expect sth like #.profileList[0] or #.specificMeasureList[0] etc
|
||||||
|
* @param newIndex
|
||||||
|
* @return return the newIndex into square brackets
|
||||||
|
*/
|
||||||
private String replaceIndexFromBindingContext(String binding, int newIndex) {
|
private String replaceIndexFromBindingContext(String binding, int newIndex) {
|
||||||
int openSquareBracket = binding.lastIndexOf("[")+1;
|
int openSquareBracket = binding.lastIndexOf("[")+1;
|
||||||
int closeSquareBracket = binding.lastIndexOf("]");
|
int closeSquareBracket = binding.lastIndexOf("]");
|
||||||
String toReturn = binding.substring(0, openSquareBracket) + newIndex + binding.substring(closeSquareBracket);
|
String toReturn = binding.substring(0, openSquareBracket) + newIndex + binding.substring(closeSquareBracket);
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @return specific cor RSG Case search for binding="geoRefList[3]" and return the max number into the square brackets
|
||||||
|
*/
|
||||||
|
private int getMaxIndex() {
|
||||||
|
int max = 0;
|
||||||
|
for (TemplateComponent co : groupedComponents) {
|
||||||
|
for (Metadata prop : co.getAllMetadata()) {
|
||||||
|
if (prop.getAttribute().equals(SequenceWidget.RSG_BINDING_PROPERTY)) {
|
||||||
|
int currValue = extractIndexFromBindingContext(prop.getValue());
|
||||||
|
if (currValue > max)
|
||||||
|
max = currValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
GWT.log("return max=" +max);
|
||||||
|
return max;
|
||||||
|
}
|
||||||
public void setGroupedComponents(ArrayList<TemplateComponent> groupedComponents) {
|
public void setGroupedComponents(ArrayList<TemplateComponent> groupedComponents) {
|
||||||
this.groupedComponents = groupedComponents;
|
this.groupedComponents = groupedComponents;
|
||||||
}
|
}
|
||||||
|
@ -196,7 +255,9 @@ public class ClientRepeatableSequence extends Composite implements ClientSequenc
|
||||||
|
|
||||||
public void setMetadata(List<Metadata> metas) {
|
public void setMetadata(List<Metadata> metas) {
|
||||||
this.metas = metas;
|
this.metas = metas;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
package org.gcube.portlets.user.reportgenerator.client.targets;
|
package org.gcube.portlets.user.reportgenerator.client.targets;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.portlets.d4sreporting.common.shared.BasicComponent;
|
import org.gcube.portlets.d4sreporting.common.shared.BasicComponent;
|
||||||
import org.gcube.portlets.d4sreporting.common.shared.ComponentType;
|
import org.gcube.portlets.d4sreporting.common.shared.ComponentType;
|
||||||
|
import org.gcube.portlets.d4sreporting.common.shared.Metadata;
|
||||||
import org.gcube.portlets.d4sreporting.common.shared.RepeatableSequence;
|
import org.gcube.portlets.d4sreporting.common.shared.RepeatableSequence;
|
||||||
import org.gcube.portlets.d4sreporting.common.shared.Tuple;
|
import org.gcube.portlets.d4sreporting.common.shared.Tuple;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
|
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
|
||||||
|
@ -20,10 +22,10 @@ import com.google.gwt.user.client.ui.VerticalPanel;
|
||||||
* @author massi
|
* @author massi
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ClientReportReference extends Composite implements ClientSequence {
|
public class ClientReportReference extends Composite implements ClientSequence, Cloneable {
|
||||||
|
|
||||||
private final int indentationValue = 20;
|
private final int indentationValue = 20;
|
||||||
|
private List<Metadata> metas;
|
||||||
protected ArrayList<TemplateComponent> groupedComponents = new ArrayList<TemplateComponent>();
|
protected ArrayList<TemplateComponent> groupedComponents = new ArrayList<TemplateComponent>();
|
||||||
private VerticalPanel myPanel = new VerticalPanel();
|
private VerticalPanel myPanel = new VerticalPanel();
|
||||||
|
|
||||||
|
@ -109,6 +111,14 @@ public class ClientReportReference extends Composite implements ClientSequence {
|
||||||
return singleRelation;
|
return singleRelation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* add the template component in the model
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void addTemplateComponent(TemplateComponent toAdd) {
|
||||||
|
groupedComponents.add(toAdd);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ArrayList<TemplateComponent> getGroupedComponents() {
|
public ArrayList<TemplateComponent> getGroupedComponents() {
|
||||||
return groupedComponents;
|
return groupedComponents;
|
||||||
|
@ -178,7 +188,7 @@ public class ClientReportReference extends Composite implements ClientSequence {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Ref is a seqeunce with diffrent style (intendedm white background and less wide)
|
* A Ref is a seqeunce with diffrent style (indented, white background and less wide)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private SequenceWidget getRefSequence(Presenter p, ClientSequence owner, RepeatableSequence repSequence, boolean notRemovable, boolean isNew) {
|
private SequenceWidget getRefSequence(Presenter p, ClientSequence owner, RepeatableSequence repSequence, boolean notRemovable, boolean isNew) {
|
||||||
|
@ -188,4 +198,12 @@ public class ClientReportReference extends Composite implements ClientSequence {
|
||||||
toReturn.alignButtonsLeft();
|
toReturn.alignButtonsLeft();
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Metadata> getMetadata() {
|
||||||
|
return metas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMetadata(List<Metadata> metas) {
|
||||||
|
this.metas = metas;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,8 @@ import org.gcube.portlets.user.reportgenerator.client.model.TemplateComponent;
|
||||||
public interface ClientSequence {
|
public interface ClientSequence {
|
||||||
|
|
||||||
ArrayList<TemplateComponent> getGroupedComponents();
|
ArrayList<TemplateComponent> getGroupedComponents();
|
||||||
|
|
||||||
|
void addTemplateComponent(TemplateComponent toAdd);
|
||||||
|
|
||||||
boolean add(String id, RepeatableSequence sequence, boolean isSingleRelation);
|
boolean add(String id, RepeatableSequence sequence, boolean isSingleRelation);
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import org.gcube.portlets.d4sreporting.common.shared.BasicComponent;
|
||||||
import org.gcube.portlets.d4sreporting.common.shared.ComponentType;
|
import org.gcube.portlets.d4sreporting.common.shared.ComponentType;
|
||||||
import org.gcube.portlets.d4sreporting.common.shared.Metadata;
|
import org.gcube.portlets.d4sreporting.common.shared.Metadata;
|
||||||
import org.gcube.portlets.d4sreporting.common.shared.RepeatableSequence;
|
import org.gcube.portlets.d4sreporting.common.shared.RepeatableSequence;
|
||||||
|
import org.gcube.portlets.d4sreporting.common.shared.Tuple;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
|
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
|
||||||
import org.gcube.portlets.user.reportgenerator.client.model.TemplateComponent;
|
import org.gcube.portlets.user.reportgenerator.client.model.TemplateComponent;
|
||||||
|
|
||||||
|
@ -72,10 +73,23 @@ public class SequenceWidget extends Composite {
|
||||||
sComp.setPossibleContent("");
|
sComp.setPossibleContent("");
|
||||||
sComp.setMetadata(setPropertiesForRSG(sComp.getMetadata()));
|
sComp.setMetadata(setPropertiesForRSG(sComp.getMetadata()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TemplateComponent toAdd = new TemplateComponent(p.getModel(), sComp, p, false, null);
|
TemplateComponent toAdd = new TemplateComponent(p.getModel(), sComp, p, false, null);
|
||||||
if (isNew && sComp.getType() == ComponentType.REPORT_REFERENCE ) { //when adding a new Sequence blanks the Ref
|
if (isNew && sComp.getType() == ComponentType.REPORT_REFERENCE ) { //when adding a new Sequence blanks the Ref
|
||||||
ClientReportReference cRef = (ClientReportReference) toAdd.getContent();
|
ClientReportReference cRef = (ClientReportReference) toAdd.getContent();
|
||||||
cRef.clear();
|
//need to clone the Tuple otherwise when blanking the ref it blanks the source too
|
||||||
|
ArrayList<Tuple> clonedTuples = new ArrayList<Tuple>();
|
||||||
|
for (Tuple tuple : cRef.getTupleList()) {
|
||||||
|
Tuple clonedTuple = tuple.clone();
|
||||||
|
clonedTuple.setKey("-1");
|
||||||
|
clonedTuples.add(clonedTuple);
|
||||||
|
}
|
||||||
|
|
||||||
|
ClientReportReference clonedRef = new ClientReportReference(p, cRef.getRefType(), clonedTuples, cRef.isSingleRelation());
|
||||||
|
clonedRef.setMetadata(setPropertiesForRSG(sComp.getMetadata())); //copy the metadata and signal is new
|
||||||
|
toAdd.setContent(clonedRef);
|
||||||
|
clonedRef.clear();
|
||||||
}
|
}
|
||||||
add(toAdd);
|
add(toAdd);
|
||||||
|
|
||||||
|
@ -126,6 +140,7 @@ public class SequenceWidget extends Composite {
|
||||||
private List<Metadata> setPropertiesForRSG(List<Metadata> properties) {
|
private List<Metadata> setPropertiesForRSG(List<Metadata> properties) {
|
||||||
List<Metadata> toReturn = new ArrayList<Metadata>();
|
List<Metadata> toReturn = new ArrayList<Metadata>();
|
||||||
|
|
||||||
|
//cloning metadata
|
||||||
for (Metadata metadata : properties) {
|
for (Metadata metadata : properties) {
|
||||||
Metadata toAdd = new Metadata(metadata.getAttribute(), metadata.getValue());
|
Metadata toAdd = new Metadata(metadata.getAttribute(), metadata.getValue());
|
||||||
toReturn.add(toAdd);
|
toReturn.add(toAdd);
|
||||||
|
@ -177,10 +192,10 @@ public class SequenceWidget extends Composite {
|
||||||
buttonsWrapperPanel.insert(clearB, 0);
|
buttonsWrapperPanel.insert(clearB, 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//TODO:
|
||||||
public void clearAssociation() {
|
public void clearAssociation() {
|
||||||
|
|
||||||
GWT.log("Clearing Association");
|
GWT.log("Clearing Association");
|
||||||
//in the MODEL leave only the delimiters
|
//in the MODEL leave only the delimiters
|
||||||
ArrayList<BasicComponent> cleanedRef = new ArrayList<BasicComponent>();
|
ArrayList<BasicComponent> cleanedRef = new ArrayList<BasicComponent>();
|
||||||
for (BasicComponent bc : repSequence.getGroupedComponents()) {
|
for (BasicComponent bc : repSequence.getGroupedComponents()) {
|
||||||
|
@ -219,7 +234,7 @@ public class SequenceWidget extends Composite {
|
||||||
|
|
||||||
public void add(TemplateComponent toAdd) {
|
public void add(TemplateComponent toAdd) {
|
||||||
if (toAdd.getType() != ComponentType.REPEAT_SEQUENCE_INNER) {
|
if (toAdd.getType() != ComponentType.REPEAT_SEQUENCE_INNER) {
|
||||||
owner.getGroupedComponents().add(toAdd);
|
owner.addTemplateComponent(toAdd);
|
||||||
seqGroupedComponents.add(toAdd);
|
seqGroupedComponents.add(toAdd);
|
||||||
myPanel.add(toAdd.getContent());
|
myPanel.add(toAdd.getContent());
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,12 @@ public class RichTextToolbar extends Composite {
|
||||||
} else if (sender == save) {
|
} else if (sender == save) {
|
||||||
//call the command of Templates or Reports
|
//call the command of Templates or Reports
|
||||||
commands.get("save").execute();
|
commands.get("save").execute();
|
||||||
} else if (sender == newdoc) {
|
}
|
||||||
|
else if (sender == saveDB) {
|
||||||
|
//call the command toExport to RSG the current instance of the model
|
||||||
|
commands.get("exportRSG").execute();
|
||||||
|
}
|
||||||
|
else if (sender == newdoc) {
|
||||||
commands.get("newdoc").execute();
|
commands.get("newdoc").execute();
|
||||||
}else if (sender == structureView) {
|
}else if (sender == structureView) {
|
||||||
commands.get("structureView").execute();
|
commands.get("structureView").execute();
|
||||||
|
@ -255,13 +260,7 @@ public class RichTextToolbar extends Composite {
|
||||||
//add the close button
|
//add the close button
|
||||||
topPanel.add(close = createPushButton(images.closeDoc(), strings.close_report()));
|
topPanel.add(close = createPushButton(images.closeDoc(), strings.close_report()));
|
||||||
if (isVme) {
|
if (isVme) {
|
||||||
topPanel.add(saveDB = createPushButton(images.db_save(), "Commit current in VME-DB"));
|
topPanel.add(saveDB = createPushButton(images.db_save(), "Commit current in VME-DB")); //TODO:
|
||||||
saveDB.addClickHandler(new ClickHandler() {
|
|
||||||
@Override
|
|
||||||
public void onClick(ClickEvent event) {
|
|
||||||
Window.alert("Not currently available");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! isVme) {
|
if (! isVme) {
|
||||||
|
@ -437,6 +436,7 @@ public class RichTextToolbar extends Composite {
|
||||||
public void enableCommands(boolean enable) {
|
public void enableCommands(boolean enable) {
|
||||||
open_report.setEnabled(enable);
|
open_report.setEnabled(enable);
|
||||||
save.setEnabled(enable);
|
save.setEnabled(enable);
|
||||||
|
|
||||||
if (newdoc != null) {
|
if (newdoc != null) {
|
||||||
newdoc.setEnabled(enable);
|
newdoc.setEnabled(enable);
|
||||||
open_template.setEnabled(enable);
|
open_template.setEnabled(enable);
|
||||||
|
|
|
@ -558,7 +558,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getRSGWSAddress() {
|
private String getRSGWSAddress() {
|
||||||
String addr = (String) getASLSession().getAttribute(RSG_WS_ADDRESS);
|
String addr = (String) getASLSession().getAttribute(RSG_WS_ADDRESS);
|
||||||
_log.trace("getRSGWSAddress: " + addr);
|
_log.trace("getRSGWSAddress: " + addr);
|
||||||
|
@ -812,19 +812,19 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
|
||||||
saveReport(toSave, folderid, itemName);
|
saveReport(toSave, folderid, itemName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param save a report in another folder .
|
* @param save a report in another folder .
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void saveReport(Model toSave, String folderid, String newname) {
|
public void saveReport(Model toSave, String folderid, String newname) {
|
||||||
|
|
||||||
Model model = toSave;
|
Model model = toSave;
|
||||||
|
|
||||||
ModelReader reader = new ModelReader(model);
|
ModelReader reader = new ModelReader(model);
|
||||||
System.out.println(reader);
|
System.out.println(reader);
|
||||||
|
|
||||||
storeTemplateInSession(toSave);
|
storeTemplateInSession(toSave);
|
||||||
_log.info("Serializing Model in folder: " + folderid );
|
_log.info("Serializing Model in folder: " + folderid );
|
||||||
_log.info("Trying to convert dynamic images ... ");
|
_log.info("Trying to convert dynamic images ... ");
|
||||||
|
@ -1165,9 +1165,9 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
|
||||||
getASLSession().setAttribute(WfDocsLibrary.WORKFLOW_READONLY_ATTRIBUTE, true);
|
getASLSession().setAttribute(WfDocsLibrary.WORKFLOW_READONLY_ATTRIBUTE, true);
|
||||||
return new SessionInfo(getUserBean(), getVreName(), true, true, false);
|
return new SessionInfo(getUserBean(), getVreName(), true, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isVME = isReportsStoreGatewayAvailable();
|
boolean isVME = isReportsStoreGatewayAvailable();
|
||||||
|
|
||||||
if (getASLSession().getAttribute(WfDocsLibrary.WORKFLOW_ID_ATTRIBUTE) == null) {
|
if (getASLSession().getAttribute(WfDocsLibrary.WORKFLOW_ID_ATTRIBUTE) == null) {
|
||||||
_log.debug("WfDocsLibrary.WORKFLOW_ID_ATTRIBUTE is NULL: ");
|
_log.debug("WfDocsLibrary.WORKFLOW_ID_ATTRIBUTE is NULL: ");
|
||||||
return new SessionInfo(getUserBean(), getVreName(), false, false, isVME);
|
return new SessionInfo(getUserBean(), getVreName(), false, false, isVME);
|
||||||
|
@ -1578,7 +1578,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
|
||||||
}
|
}
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Model importVMETemplate(VMETypeIdentifier refType) {
|
public Model importVMETemplate(VMETypeIdentifier refType) {
|
||||||
RsgService rsgClient = new RsgClient(getRSGWSAddress());
|
RsgService rsgClient = new RsgClient(getRSGWSAddress());
|
||||||
|
@ -1604,6 +1604,26 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
|
||||||
}
|
}
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exportReportToRSG(Model model) {
|
||||||
|
RsgService rsgClient = new RsgClient(getRSGWSAddress());
|
||||||
|
|
||||||
|
//Use the RSG client to get a template for the report whose type is the last token (i.e. the corresponding class' 'simple name')
|
||||||
|
//appearing in the VME model class name as stored in the 'type' metadata
|
||||||
|
|
||||||
|
//If you're updating a 'report':
|
||||||
|
CompiledReport template = rsgClient.getTemplate(new ReportType(VMETypeIdentifier.Vme.getId()));
|
||||||
|
CompiledReport toSend = null;
|
||||||
|
try {
|
||||||
|
toSend = new ReportManagerReportBuilder().extract(template, model);
|
||||||
|
} catch (ReportBuilderException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
//Actual RSG client interface exposes different methods (publish / publishDelta etc.) that need to be updated
|
||||||
|
rsgClient.update(toSend);
|
||||||
|
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* this method look for a ReportsStoreGateway WS available in the infrastructure
|
* this method look for a ReportsStoreGateway WS available in the infrastructure
|
||||||
* @return true if an instance of the ReportsStoreGateway is available in the infrastructure
|
* @return true if an instance of the ReportsStoreGateway is available in the infrastructure
|
||||||
|
@ -1635,5 +1655,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
|
||||||
else return false;
|
else return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue