Update TethysExporter.java

updated export code to add namespace to the xml produced
This commit is contained in:
kbolaughlin 2023-03-15 12:38:29 -07:00
parent 98ce0ff9d2
commit ceefa6188c

View File

@ -1,7 +1,7 @@
package tethys.output; package tethys.output;
import java.io.IOException; import java.io.IOException;
import java.io.StringWriter; import java.io.PrintWriter;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.ArrayList; import java.util.ArrayList;
@ -30,6 +30,7 @@ import dbxml.uploader.Importer;
import metadata.MetaDataContol; import metadata.MetaDataContol;
import metadata.deployment.DeploymentData; import metadata.deployment.DeploymentData;
import nilus.Deployment; import nilus.Deployment;
import nilus.MarshalXML;
import tethys.TethysControl; import tethys.TethysControl;
import tethys.dbxml.DBXMLConnect; import tethys.dbxml.DBXMLConnect;
import tethys.deployment.DeploymentHandler; import tethys.deployment.DeploymentHandler;
@ -85,16 +86,12 @@ public class TethysExporter {
Path tempFile = null; Path tempFile = null;
try { try {
JAXBContext jaxB = JAXBContext.newInstance(Deployment.class); MarshalXML marshal = new MarshalXML();
Marshaller marshall = jaxB.createMarshaller(); marshal.createInstance(Deployment.class);
marshall.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
StringWriter sw = new StringWriter();
marshall.marshal(deployment1, sw);
tempFile = Files.createTempFile("pamGuardToTethys", ".xml"); tempFile = Files.createTempFile("pamGuardToTethys", ".xml");
Files.write(tempFile, sw.toString().getBytes()); marshal.marshal(deployment1, tempFile.toString());
String fileError = Importer.ImportFiles("http://localhost:9779", "Deployments",
String fileText = Importer.ImportFiles("http://localhost:9779", "Deployment",
new String[] { tempFile.toString() }, "", "", false); new String[] { tempFile.toString() }, "", "", false);
tempFile.toFile().deleteOnExit(); tempFile.toFile().deleteOnExit();
@ -110,6 +107,7 @@ public class TethysExporter {
e.printStackTrace(); e.printStackTrace();
} }
SnapshotGeometry arrayGeometry = findArrayGeometrey(); SnapshotGeometry arrayGeometry = findArrayGeometrey();
/** /**