Commit dcf31f94 authored by duminil's avatar duminil
Browse files

Removing hard coded usernames.

parent 405be881
...@@ -32,11 +32,12 @@ public class ExportJobFromJavaFXRegionChooser implements JobStatusListener ...@@ -32,11 +32,12 @@ public class ExportJobFromJavaFXRegionChooser implements JobStatusListener
public void processJob(Geometry poly, String productName, JSObject novaFactoryOpenLayer) throws InterruptedException { public void processJob(Geometry poly, String productName, JSObject novaFactoryOpenLayer) throws InterruptedException {
this.novaFactoryOpenLayer = novaFactoryOpenLayer; this.novaFactoryOpenLayer = novaFactoryOpenLayer;
ExportJobDescription description = ExportJobDescription.getDefaultDescriptor(); ExportJobDescription description = ExportJobDescription.getDefaultDescriptor();
description.setInitiator("2758"); description.setInitiator(String.valueOf((int) (Math.random() * 9999)));
description.setAccount("Bruse"); String userName = System.getProperty("user.name");
description.setAccount(userName);
// description.setProduct("WU3"); // description.setProduct("WU3");
description.setProduct(productName); description.setProduct(productName);
description.setJobnumber("Bruse_0815"); description.setJobnumber(userName);
//FIXME: Zipped GMLs coming from nF don't have any defined srsName //FIXME: Zipped GMLs coming from nF don't have any defined srsName
...@@ -88,7 +89,7 @@ public void jobStatusChanged(JobStatusEvent event) { ...@@ -88,7 +89,7 @@ public void jobStatusChanged(JobStatusEvent event) {
try { try {
File file = job.getResult(); File file = job.getResult();
novaFactoryOpenLayer.call("updateStatus", "DOWNLOADED AS ZIP"); novaFactoryOpenLayer.call("updateStatus", "DOWNLOADED AS ZIP");
novaFactoryOpenLayer.call("selectSaveFile", file.toString()); // novaFactoryOpenLayer.call("selectSaveFile", file.toString());
// System.out.println("CityGML at " + file.getAbsolutePath()); // System.out.println("CityGML at " + file.getAbsolutePath());
//TODO: Call downloadFinished if FAILED //TODO: Call downloadFinished if FAILED
novaFactoryOpenLayer.call("downloadFinished"); novaFactoryOpenLayer.call("downloadFinished");
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
import java.util.Objects; import java.util.Objects;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.ParserConfigurationException;
...@@ -22,23 +21,23 @@ ...@@ -22,23 +21,23 @@
import javax.xml.transform.TransformerFactory; import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource; import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamResult;
import org.osgeo.proj4j.BasicCoordinateTransform; import org.osgeo.proj4j.BasicCoordinateTransform;
import org.osgeo.proj4j.CRSFactory; import org.osgeo.proj4j.CRSFactory;
import org.osgeo.proj4j.CoordinateReferenceSystem; import org.osgeo.proj4j.CoordinateReferenceSystem;
import org.osgeo.proj4j.ProjCoordinate; import org.osgeo.proj4j.ProjCoordinate;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import eu.simstadt.nf4j.InvalidJobDescriptorException; import eu.simstadt.nf4j.InvalidJobDescriptorException;
/** /**
* Builds nF import and export jobs using nF's XML job format. Please read the nF manual if you want more * Builds nF import and export jobs using nF's XML job format. Please read the nF manual if you want more details about
* details about the numerous job attributes listed below. * the numerous job attributes listed below.
* *
* @author Marcel Bruse * @author Marcel Bruse
*/ */
public class JobFileBuilderImpl implements JobFileBuilder<ImportJobDescription, ExportJobDescription> { public class JobFileBuilderImpl implements JobFileBuilder<ImportJobDescription, ExportJobDescription>
{
/** Supported version of the novaFACTORY. */ /** Supported version of the novaFACTORY. */
public static final String NOVA_FACTORY_VERSION = "6.3.1.1"; public static final String NOVA_FACTORY_VERSION = "6.3.1.1";
...@@ -73,8 +72,8 @@ public String supportsImportJobVersion() { ...@@ -73,8 +72,8 @@ public String supportsImportJobVersion() {
/** /**
* This is an intermediate prototype. * This is an intermediate prototype.
* *
* @param jobDescriptor A job descriptor which describes the export job with all its attributes according to * @param jobDescriptor A job descriptor which describes the export job with all its attributes according to a valid
* a valid nF export job DTD. * nF export job DTD.
* @return Returns a string representation of the nF export job. * @return Returns a string representation of the nF export job.
* @throws FailedJobTransmissionException * @throws FailedJobTransmissionException
*/ */
...@@ -103,7 +102,7 @@ public File buildExportJobFile(ExportJobDescription jobDescriptor) throws Invali ...@@ -103,7 +102,7 @@ public File buildExportJobFile(ExportJobDescription jobDescriptor) throws Invali
job.appendChild(jobnumber); job.appendChild(jobnumber);
Element account = doc.createElement("account"); Element account = doc.createElement("account");
account.appendChild(doc.createTextNode("Habib")); account.appendChild(doc.createTextNode(System.getProperty("user.name")));
job.appendChild(account); job.appendChild(account);
Element product = doc.createElement("product"); Element product = doc.createElement("product");
...@@ -289,8 +288,8 @@ public static ProjCoordinate transformCoordinate(ProjCoordinate wgs84Position, ...@@ -289,8 +288,8 @@ public static ProjCoordinate transformCoordinate(ProjCoordinate wgs84Position,
} }
/** /**
* Appends the region polygon to the XML export job document. In order to do this, the given WGS 84 region * Appends the region polygon to the XML export job document. In order to do this, the given WGS 84 region polygon
* polygon will be transformed into a DHDN Gauss-Kruger zone 3 polygon. * will be transformed into a DHDN Gauss-Kruger zone 3 polygon.
* *
* @param doc The XML export job document. * @param doc The XML export job document.
* @param regionPolygon The polygon of the region which has been selected to be exported. * @param regionPolygon The polygon of the region which has been selected to be exported.
...@@ -315,8 +314,8 @@ private static Element createRegionPolygonElement(Document doc, List<Coord> regi ...@@ -315,8 +314,8 @@ private static Element createRegionPolygonElement(Document doc, List<Coord> regi
/** /**
* Builds a zipped import job file. This file can be sent to a nF server instance by the caller afterwards. * Builds a zipped import job file. This file can be sent to a nF server instance by the caller afterwards.
* *
* @param jobDescriptor A job descriptor which describes the import job with all its attributes according to * @param jobDescriptor A job descriptor which describes the import job with all its attributes according to a valid
* a valid nF import job DTD. * nF import job DTD.
* @return Returns a XML import job document. * @return Returns a XML import job document.
*/ */
@Override @Override
......
...@@ -30,10 +30,11 @@ public class SuccessfulExportJob implements JobStatusListener ...@@ -30,10 +30,11 @@ public class SuccessfulExportJob implements JobStatusListener
@Test @Test
public void processJob() throws InterruptedException { public void processJob() throws InterruptedException {
ExportJobDescription description = ExportJobDescription.getDefaultDescriptor(); ExportJobDescription description = ExportJobDescription.getDefaultDescriptor();
description.setInitiator("2758"); description.setInitiator(String.valueOf((int) (Math.random() * 9999)));
description.setAccount("Bruse"); String userName = System.getProperty("user.name");
description.setAccount(userName);
description.setProduct("WU3"); description.setProduct("WU3");
description.setJobnumber("Bruse_0815"); description.setJobnumber(userName);
//FIXME: Zipped GMLs coming from nF don't have any defined srsName //FIXME: Zipped GMLs coming from nF don't have any defined srsName
//FIXME: Save files somewhere else //FIXME: Save files somewhere else
...@@ -140,7 +141,7 @@ public void jobStatusChanged(JobStatusEvent event) { ...@@ -140,7 +141,7 @@ public void jobStatusChanged(JobStatusEvent event) {
try { try {
File file = job.getResult(); File file = job.getResult();
assertTrue(file.canRead()); assertTrue(file.canRead());
// System.out.println("CityGML at " + file.getAbsolutePath()); // System.out.println("CityGML at " + file.getAbsolutePath());
} catch (FailedTransmissionException ex) { } catch (FailedTransmissionException ex) {
ex.printStackTrace(); ex.printStackTrace();
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment