Moved all data objects to Serializable and some generics bits.
This commit is contained in:
parent
1b3e65fa83
commit
3bf185ad48
73 changed files with 228 additions and 181 deletions
|
|
@ -24,6 +24,7 @@ package net.forwardfire.vasc.export.generic;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -66,7 +67,7 @@ abstract public class AbstractVascEntryExportWriter implements VascEntryExportWr
|
|||
|
||||
int dataSize = entry.getVascFrontendController().getVascEntryState().getEntryDataList().size();
|
||||
for (int dataIndex=0;dataIndex<dataSize;dataIndex++) {
|
||||
Object o = entry.getVascFrontendController().getVascEntryState().getEntryDataList().get(dataIndex);
|
||||
Serializable o = entry.getVascFrontendController().getVascEntryState().getEntryDataList().get(dataIndex);
|
||||
doExportRowStart(o);
|
||||
try {
|
||||
doExportRowFields(o);
|
||||
|
|
@ -96,10 +97,10 @@ abstract public class AbstractVascEntryExportWriter implements VascEntryExportWr
|
|||
abstract protected void doExportStart() throws IOException;
|
||||
abstract protected void doExportEnd() throws IOException;
|
||||
|
||||
abstract protected void doExportRowStart(Object row) throws IOException;
|
||||
abstract protected void doExportRowEnd(Object row,boolean isLast) throws IOException;
|
||||
abstract protected void doExportRowStart(Serializable row) throws IOException;
|
||||
abstract protected void doExportRowEnd(Serializable row,boolean isLast) throws IOException;
|
||||
|
||||
protected void doExportRowFields(Object row) throws IOException,VascBackendException {
|
||||
protected void doExportRowFields(Serializable row) throws IOException,VascBackendException {
|
||||
// todo: rm me and use data selector
|
||||
List<VascEntryField> fieldList = new ArrayList<VascEntryField>(getVascEntry().getVascEntryFields());
|
||||
int fields = fieldList.size();
|
||||
|
|
@ -109,5 +110,5 @@ abstract public class AbstractVascEntryExportWriter implements VascEntryExportWr
|
|||
}
|
||||
}
|
||||
|
||||
abstract protected void doExportRowField(Object row,VascEntryField field,boolean isLast) throws IOException,VascBackendException;
|
||||
abstract protected void doExportRowField(Serializable row,VascEntryField field,boolean isLast) throws IOException,VascBackendException;
|
||||
}
|
||||
|
|
@ -24,6 +24,7 @@ package net.forwardfire.vasc.export.generic;
|
|||
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.Serializable;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
|
|
@ -122,17 +123,17 @@ public class VascEntryExportWriterCsv extends AbstractVascEntryExportWriter {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExportRowStart(Object row) {
|
||||
protected void doExportRowStart(Serializable row) {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doExportRowEnd(Object row,boolean isLast) {
|
||||
protected void doExportRowEnd(Serializable row,boolean isLast) {
|
||||
p.write(lineEnd.toCharType());
|
||||
p.flush();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doExportRowField(Object o, VascEntryField c,boolean isLast) throws VascBackendException {
|
||||
protected void doExportRowField(Serializable o, VascEntryField c,boolean isLast) throws VascBackendException {
|
||||
p.write(quoteChar.toCharType());
|
||||
p.write(c.getVascEntryFieldValue().getDisplayValue(c.getBackendName(), o));
|
||||
p.write(quoteChar.toCharType());
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ package net.forwardfire.vasc.export.generic;
|
|||
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.Serializable;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
|
|
@ -63,18 +64,18 @@ public class VascEntryExportWriterXml extends AbstractVascEntryExportWriter {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExportRowStart(Object row) {
|
||||
protected void doExportRowStart(Serializable row) {
|
||||
p.write("\t<row>\n");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doExportRowEnd(Object row,boolean isLast) {
|
||||
protected void doExportRowEnd(Serializable row,boolean isLast) {
|
||||
p.write("\t</row>\n");
|
||||
p.flush();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doExportRowField(Object o, VascEntryField c,boolean isLast) throws VascBackendException {
|
||||
protected void doExportRowField(Serializable o, VascEntryField c,boolean isLast) throws VascBackendException {
|
||||
if (xmlTree) {
|
||||
p.write("\t\t<"+c.getId()+"><![CDATA[");
|
||||
p.write(""+c.getVascEntryFieldValue().getDisplayValue(c.getBackendName(), o));
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
package net.forwardfire.vasc.export.jr4o;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
|
@ -72,7 +73,7 @@ public class JRDynamicDataSourceVascEntry extends AbstractJRDynamicDataSource {
|
|||
for (int page=0;page<=pages;page++) {
|
||||
vascEntry.getVascFrontendController().getVascEntryState().getVascBackendState().setPageIndex(page);
|
||||
vascEntry.getVascFrontendController().getVascFrontendActions().refreshData();
|
||||
for (Object o:vascEntry.getVascFrontendController().getVascEntryState().getEntryDataList()) {
|
||||
for (Serializable o:vascEntry.getVascFrontendController().getVascEntryState().getEntryDataList()) {
|
||||
List<String> row = new ArrayList<String>(30);
|
||||
for (VascEntryField c:fields) {
|
||||
row.add(c.getVascEntryFieldValue().getDisplayValue(c.getBackendName(), o));
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ package net.forwardfire.vasc.export.json;
|
|||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -92,12 +93,12 @@ public class VascEntryExportWriterJson extends AbstractVascEntryExportWriter {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExportRowStart(Object row) {
|
||||
protected void doExportRowStart(Serializable row) {
|
||||
rowData.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doExportRowEnd(Object row,boolean isLast) throws IOException {
|
||||
protected void doExportRowEnd(Serializable row,boolean isLast) throws IOException {
|
||||
JSONObject.writeJSONString(rowData, p);
|
||||
if (isLast==false) {
|
||||
p.write(",");
|
||||
|
|
@ -107,7 +108,7 @@ public class VascEntryExportWriterJson extends AbstractVascEntryExportWriter {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExportRowField(Object row, VascEntryField field,boolean isLast) throws VascBackendException {
|
||||
protected void doExportRowField(Serializable row, VascEntryField field,boolean isLast) throws VascBackendException {
|
||||
String key = field.getId();
|
||||
Object data = field.getVascEntryFieldValue().getValue(field.getBackendName(), row);
|
||||
rowData.put(key, data);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue