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:
@@ -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>
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user