Issue FDA-35

Now the (file)name inside the xml file is always the same as the
filename of the xml file
This commit is contained in:
2013-09-23 10:49:09 +02:00
parent 21d935e35e
commit a5da9a2527
3 changed files with 11 additions and 2 deletions

View File

@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>ch.psi</groupId>
<artifactId>fda</artifactId>
<version>1.1.38</version>
<version>1.1.39</version>
<dependencies>
<dependency>

View File

@@ -47,6 +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;
/**
* Manage the serialization and deserialization of the model
@@ -173,6 +174,14 @@ 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());
m.marshal( new JAXBElement<Configuration>(qname, Configuration.class, model ), file);
}
}

View File

@@ -106,7 +106,7 @@ public class ModelManagerTest {
Scan s = new Scan();
c.setScan(s);
ModelManager.marshall(c, new File(tmpDirectory+"/scan.xml"));
ModelManager.marshall(c, new File(tmpDirectory+"/scan1234.xml"));
}