Split backend to backend api.
This commit is contained in:
parent
4bd244f4e5
commit
a13719f008
116 changed files with 1029 additions and 815 deletions
|
|
@ -27,6 +27,7 @@ import java.io.OutputStream;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryExport;
|
||||
|
|
@ -67,7 +68,11 @@ abstract public class AbstractVascEntryExportWriter implements VascEntryExportWr
|
|||
for (int dataIndex=0;dataIndex<dataSize;dataIndex++) {
|
||||
Object o = entry.getVascFrontendController().getVascEntryState().getEntryDataList().get(dataIndex);
|
||||
doExportRowStart(o);
|
||||
doExportRowFields(o);
|
||||
try {
|
||||
doExportRowFields(o);
|
||||
} catch (VascBackendException e) {
|
||||
throw new VascException(e);
|
||||
}
|
||||
doExportRowEnd(o,(dataIndex==dataSize-1));
|
||||
}
|
||||
}
|
||||
|
|
@ -94,7 +99,7 @@ abstract public class AbstractVascEntryExportWriter implements VascEntryExportWr
|
|||
abstract protected void doExportRowStart(Object row) throws IOException;
|
||||
abstract protected void doExportRowEnd(Object row,boolean isLast) throws IOException;
|
||||
|
||||
protected void doExportRowFields(Object row) throws IOException,VascException {
|
||||
protected void doExportRowFields(Object row) throws IOException,VascBackendException {
|
||||
// todo: rm me and use data selector
|
||||
List<VascEntryField> fieldList = new ArrayList<VascEntryField>(getVascEntry().getVascEntryFields());
|
||||
int fields = fieldList.size();
|
||||
|
|
@ -104,5 +109,5 @@ abstract public class AbstractVascEntryExportWriter implements VascEntryExportWr
|
|||
}
|
||||
}
|
||||
|
||||
abstract protected void doExportRowField(Object row,VascEntryField field,boolean isLast) throws IOException,VascException;
|
||||
abstract protected void doExportRowField(Object row,VascEntryField field,boolean isLast) throws IOException,VascBackendException;
|
||||
}
|
||||
|
|
@ -25,8 +25,8 @@ package net.forwardfire.vasc.export.generic;
|
|||
import java.io.OutputStream;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
|
||||
/**
|
||||
* VascEntryExporterCsv writes data to csv output format.
|
||||
|
|
@ -132,9 +132,9 @@ public class VascEntryExportWriterCsv extends AbstractVascEntryExportWriter {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExportRowField(Object o, VascEntryField c,boolean isLast) throws VascException {
|
||||
protected void doExportRowField(Object o, VascEntryField c,boolean isLast) throws VascBackendException {
|
||||
p.write(quoteChar.toCharType());
|
||||
p.write(c.getVascEntryFieldValue().getDisplayValue(c, o));
|
||||
p.write(c.getVascEntryFieldValue().getDisplayValue(c.getBackendName(), o));
|
||||
p.write(quoteChar.toCharType());
|
||||
if (isLast==false) {
|
||||
p.write(separatorChar.toCharType());
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@ package net.forwardfire.vasc.export.generic;
|
|||
import java.io.OutputStream;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
|
||||
/**
|
||||
* VascEntryExportWriterXml writes entry data to xml format.
|
||||
|
|
@ -74,14 +74,14 @@ public class VascEntryExportWriterXml extends AbstractVascEntryExportWriter {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExportRowField(Object o, VascEntryField c,boolean isLast) throws VascException {
|
||||
protected void doExportRowField(Object o, VascEntryField c,boolean isLast) throws VascBackendException {
|
||||
if (xmlTree) {
|
||||
p.write("\t\t<"+c.getId()+"><![CDATA[");
|
||||
p.write(""+c.getVascEntryFieldValue().getDisplayValue(c, o));
|
||||
p.write(""+c.getVascEntryFieldValue().getDisplayValue(c.getBackendName(), o));
|
||||
p.write("]]></"+c.getId()+">\n");
|
||||
} else {
|
||||
p.write("\t\t<column name=\""+c.getId()+"\"><![CDATA[");
|
||||
p.write(""+c.getVascEntryFieldValue().getDisplayValue(c, o));
|
||||
p.write(""+c.getVascEntryFieldValue().getDisplayValue(c.getBackendName(), o));
|
||||
p.write("]]></column>\n");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,9 +27,9 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendDataSelector.EntryFieldSelectType;
|
||||
import net.forwardfire.vasc.lib.jr4o.data.AbstractJRDynamicDataSource;
|
||||
import net.sf.jasperreports.engine.JRException;
|
||||
|
|
@ -75,13 +75,13 @@ public class JRDynamicDataSourceVascEntry extends AbstractJRDynamicDataSource {
|
|||
for (Object o:vascEntry.getVascFrontendController().getVascEntryState().getEntryDataList()) {
|
||||
List<String> row = new ArrayList<String>(30);
|
||||
for (VascEntryField c:fields) {
|
||||
row.add(c.getVascEntryFieldValue().getDisplayValue(c, o));
|
||||
row.add(c.getVascEntryFieldValue().getDisplayValue(c.getBackendName(), o));
|
||||
}
|
||||
data.add(row);
|
||||
}
|
||||
}
|
||||
} catch (VascException ve) {
|
||||
throw new RuntimeException(ve);
|
||||
} catch (VascBackendException ve) {
|
||||
throw new RuntimeException(ve); // TODO: replace me
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ import java.util.Map;
|
|||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.JSONValue;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.export.generic.AbstractVascEntryExportWriter;
|
||||
|
||||
/**
|
||||
|
|
@ -107,9 +107,9 @@ public class VascEntryExportWriterJson extends AbstractVascEntryExportWriter {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExportRowField(Object row, VascEntryField field,boolean isLast) throws VascException {
|
||||
protected void doExportRowField(Object row, VascEntryField field,boolean isLast) throws VascBackendException {
|
||||
String key = field.getId();
|
||||
Object data = field.getVascEntryFieldValue().getValue(field, row);
|
||||
Object data = field.getVascEntryFieldValue().getValue(field.getBackendName(), row);
|
||||
rowData.put(key, data);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue