From e1f91dfe708dc5ba6081b0ff1c2b94942aca3f8b Mon Sep 17 00:00:00 2001 From: Massimiliano Assante Date: Thu, 30 Jan 2014 18:27:23 +0000 Subject: [PATCH] fixed workspace temporary saving for VMEs git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/reports@90798 82a268e6-3cf1-43bd-a215-b396298e98cf --- .classpath | 4 +-- .settings/com.google.gdt.eclipse.core.prefs | 2 +- pom.xml | 2 +- .../targets/ClientRepeatableSequence.java | 34 +++++++++++-------- .../server/servlet/ReportServiceImpl.java | 11 +++--- 5 files changed, 31 insertions(+), 22 deletions(-) diff --git a/.classpath b/.classpath index 2bd8fb6..d7f880d 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 9bafc31..ed811af 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.7.9-SNAPSHOT +lastWarOutDir=/Users/massi/Documents/workspace/reports/target/reports-4.7.10-SNAPSHOT warSrcDir=src/main/webapp warSrcDirIsOutput=false diff --git a/pom.xml b/pom.xml index c811936..d472420 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ org.gcube.portlets.user reports war - 4.7.9-SNAPSHOT + 4.7.10-SNAPSHOT gCube Reports Manager gCube Reports Portlet. diff --git a/src/main/java/org/gcube/portlets/user/reportgenerator/client/targets/ClientRepeatableSequence.java b/src/main/java/org/gcube/portlets/user/reportgenerator/client/targets/ClientRepeatableSequence.java index 925b90f..3272fef 100644 --- a/src/main/java/org/gcube/portlets/user/reportgenerator/client/targets/ClientRepeatableSequence.java +++ b/src/main/java/org/gcube/portlets/user/reportgenerator/client/targets/ClientRepeatableSequence.java @@ -174,14 +174,16 @@ public class ClientRepeatableSequence extends Composite implements ClientSequenc } } } - //for any other component - for (Metadata prop : co.getAllMetadata()) { - //if there's a new component - if ( prop.getAttribute().equals(SequenceWidget.RSG_BINDING_CONTEXT_PROPERTY) && (extractIndexFromBindingContext(prop.getValue()) == -1) ) { - prop.setValue(replaceIndexFromBindingContext(prop.getValue(), maxBindingContext)); - break; - } - } + if (co.getAllMetadata() != null) { + //for any other component + for (Metadata prop : co.getAllMetadata()) { + //if there's a new component + if ( prop.getAttribute().equals(SequenceWidget.RSG_BINDING_CONTEXT_PROPERTY) && (extractIndexFromBindingContext(prop.getValue()) == -1) ) { + prop.setValue(replaceIndexFromBindingContext(prop.getValue(), maxBindingContext)); + break; + } + } + } } return groupedComponents; } @@ -220,13 +222,17 @@ public class ClientRepeatableSequence extends Composite implements ClientSequenc */ private int getMaxIndex() { int max = 0; - for (TemplateComponent co : groupedComponents) { - for (Metadata prop : co.getAllMetadata()) { - if (prop.getAttribute().equals(SequenceWidget.RSG_BINDING_CONTEXT_PROPERTY) || prop.getAttribute().equals(SequenceWidget.RSG_BINDING_PROPERTY)) { - int currValue = extractIndexFromBindingContext(prop.getValue()); - if (currValue > max) - max = currValue; + for (TemplateComponent co : groupedComponents) { + if (co.getAllMetadata() != null) { + for (Metadata prop : co.getAllMetadata()) { + if (prop.getAttribute().equals(SequenceWidget.RSG_BINDING_CONTEXT_PROPERTY) || prop.getAttribute().equals(SequenceWidget.RSG_BINDING_PROPERTY)) { + int currValue = extractIndexFromBindingContext(prop.getValue()); + if (currValue > max) + max = currValue; + } } + } else { + GWT.log("getAllMetadata() null for co=" +co.getType()); } } GWT.log("return max=" +max); 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 0a001dc..a4989e8 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 @@ -384,7 +384,10 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe AccessLogger log = AccessLogger.getAccessLogger(); OpenReportLogEntry logEntry = new OpenReportLogEntry(toReturn.getTemplateName(), templateObjectID); log.logEntry(getASLSession().getUsername(), getASLSession().getScopeName(), logEntry); - + + ModelReader reader = new ModelReader(toReturn); + System.out.println(reader); + return toReturn; } } @@ -827,9 +830,6 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe Model model = toSave; - ModelReader reader = new ModelReader(model); - System.out.println(reader); - storeTemplateInSession(toSave); _log.info("Serializing Model in folder: " + folderid ); _log.info("Trying to convert dynamic images ... "); @@ -838,6 +838,9 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe ServiceUtil myUtil = new ServiceUtil(getASLSession()); boolean result = myUtil.writeModel(model, "CURRENT_OPEN", getVreName(), getUsername()); + ModelReader reader = new ModelReader(model); + System.out.println(reader); + if (!result) { _log.debug("Could not save report, serializing failed"); }