|
|
|
|
@@ -47,7 +47,7 @@ import org.xml.sax.SAXException;
|
|
|
|
|
import org.xml.sax.SAXParseException;
|
|
|
|
|
|
|
|
|
|
import ch.psi.fda.model.v1.Configuration;
|
|
|
|
|
import ch.psi.fda.model.v1.Data;
|
|
|
|
|
//import ch.psi.fda.model.v1.Data;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Manage the serialization and deserialization of the model
|
|
|
|
|
@@ -113,13 +113,13 @@ public class ModelManager {
|
|
|
|
|
try{
|
|
|
|
|
Configuration model = (Configuration) u.unmarshal(bsource, Configuration.class).getValue();
|
|
|
|
|
|
|
|
|
|
// Ensure that the filename inside the xml file is always the file name
|
|
|
|
|
Data d = model.getData();
|
|
|
|
|
if(d==null){
|
|
|
|
|
d = new Data();
|
|
|
|
|
model.setData(d);
|
|
|
|
|
}
|
|
|
|
|
d.setFileName(file.getName().replaceAll("\\.xml$", ""));
|
|
|
|
|
// // Ensure that the filename inside the xml file is always the file name
|
|
|
|
|
// Data d = model.getData();
|
|
|
|
|
// if(d==null){
|
|
|
|
|
// d = new Data();
|
|
|
|
|
// model.setData(d);
|
|
|
|
|
// }
|
|
|
|
|
// d.setFileName(file.getName().replaceAll("\\.xml$", ""));
|
|
|
|
|
|
|
|
|
|
return (model);
|
|
|
|
|
}
|
|
|
|
|
@@ -153,13 +153,13 @@ public class ModelManager {
|
|
|
|
|
try{
|
|
|
|
|
Configuration model = (Configuration) u.unmarshal(new StreamSource(file), Configuration.class).getValue();
|
|
|
|
|
|
|
|
|
|
// Ensure that the filename inside the xml file is always the file name
|
|
|
|
|
Data d = model.getData();
|
|
|
|
|
if(d==null){
|
|
|
|
|
d = new Data();
|
|
|
|
|
model.setData(d);
|
|
|
|
|
}
|
|
|
|
|
d.setFileName(file.getName().replaceAll("\\.xml$", ""));
|
|
|
|
|
// // Ensure that the filename inside the xml file is always the file name
|
|
|
|
|
// Data d = model.getData();
|
|
|
|
|
// if(d==null){
|
|
|
|
|
// d = new Data();
|
|
|
|
|
// model.setData(d);
|
|
|
|
|
// }
|
|
|
|
|
// d.setFileName(file.getName().replaceAll("\\.xml$", ""));
|
|
|
|
|
|
|
|
|
|
return (model);
|
|
|
|
|
}
|
|
|
|
|
@@ -192,13 +192,13 @@ public class ModelManager {
|
|
|
|
|
Schema schema = sf.newSchema(new Source[]{s}); // Use schema reference provided in XML
|
|
|
|
|
m.setSchema(schema);
|
|
|
|
|
|
|
|
|
|
// Set scan name equal to file name
|
|
|
|
|
Data d = model.getData();
|
|
|
|
|
if(d==null){
|
|
|
|
|
d = new Data();
|
|
|
|
|
model.setData(d);
|
|
|
|
|
}
|
|
|
|
|
d.setFileName(file.getName().replaceAll("\\.xml$", ""));
|
|
|
|
|
// // Set scan name equal to file name
|
|
|
|
|
// Data d = model.getData();
|
|
|
|
|
// if(d==null){
|
|
|
|
|
// d = new Data();
|
|
|
|
|
// model.setData(d);
|
|
|
|
|
// }
|
|
|
|
|
// d.setFileName(file.getName().replaceAll("\\.xml$", ""));
|
|
|
|
|
|
|
|
|
|
m.marshal( new JAXBElement<Configuration>(qname, Configuration.class, model ), file);
|
|
|
|
|
}
|
|
|
|
|
|