starts implementation for central importing

git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@3915 8810af33-2d31-482b-a856-94f89814c4df
pull/2/head
tosmers 2016-03-09 17:39:07 +00:00
parent 465029c738
commit 7b354a4be4
2 changed files with 23 additions and 5 deletions

View File

@ -58,9 +58,9 @@ public abstract class AbstractMarshaller<I extends Identifiable> {
public void init(final Format format, String baseFileName) {
public void init(final Format format, String filename) {
this.format = format;
this.filename = baseFileName;
this.filename = filename;
switch (this.format) {
case XML:
@ -83,7 +83,7 @@ public abstract class AbstractMarshaller<I extends Identifiable> {
public void exportList(final List<I> exportList) {
File file = new File(filename + "_" + getObjectClass().toString());
File file = new File(filename);
FileWriter fileWriter = null;
try {

View File

@ -67,7 +67,7 @@ public class Marshaller {
for (Map.Entry<Class<? extends Identifiable>, List<Identifiable>>
classListEntry : classListMap.entrySet()) {
exportList( classListEntry.getValue(), classListEntry.getKey(),
exportList(classListEntry.getValue(), classListEntry.getKey(),
format, filename);
}
}
@ -130,11 +130,29 @@ public class Marshaller {
final AbstractMarshaller<I> marshaller = (AbstractMarshaller<I>)
iterator.next();
marshaller.init(format, filename);
marshaller.init(format, filename + "__" + type.toString());
marshaller.exportList(list);
}
}
public <I extends Identifiable> void importObjects(
List<String> filenames, Format format) {
for (String filename : filenames) {
String[] splitFilename = filename.split("__");
String className =
splitFilename[splitFilename.length].split(".")[0];
try {
Class objectClass = Class.forName(className);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
Class[] subclasses = Identifiable.class.getClasses();
}
}
/**
* {@link AnnotationLiteral} used for filtering the available marshallers.
*/