package eu.simstadt.nf; import java.util.ArrayList; import java.util.List; /** * Every instance of this class describes an export or import job for the novaFACTORY. Instances of JobBuilder * take JobDescriptions and build XML export and import job files out of it. * * @author Marcel Bruse */ public class JobDescriptorImpl implements JobDescriptor { private static final String DEFAULT_ACCOUNT = "Habib"; private static final String DEFAULT_XMETA_DATA = "0"; private static final String DEFAULT_CALIBRATION = "0"; private static final String DEFAULT_PRODUCT = "LBTEST"; private static final String DEFAULT_ZIP_RESULT = "0"; private static final String DEFAULT_DHK_RESOLVE_REFERENCES = "1"; private static final String DEFAULT_USE_PDCT_BORDER_POLY = "0"; private static final String DEFAULT_USE_NO_DATA_MASK = "0"; private static final String DEFAULT_ECK = "0"; private static final String DEFAULT_COL = "0"; private static final String DEFAULT_EXPORT_META_DATA = "1"; private static final String DEFAULT_FORMAT = "CityGML"; private static final String DEFAULT_SCALE = "10000.0"; private static final String DEFAULT_RESOLUTION = "100.0"; private static final String DEFAULT_MERGE_MAP_SHEETS = "off"; private static final String DEFAULT_SRS = "31467"; private static final String DEFAULT_SINGLE = "1"; private static final String DEFAULT_PLOTFRAME = "0"; private static final String DEFAULT_PLOT_LABEL_SRS = "-1"; private static final String DEFAULT_MONO = "0"; private static final String DEFAULT_COLOR = "0"; private static final String DEFAULT_JOBNUMBER = "GR_EXPORT_CITYGML_LOD1"; private static final String DEFAULT_INITIATOR = "2758"; /** The version of the novaFACTORY XML export job format. */ public static final String EXPORT_JOB_VERSION = "1.0.0"; /** TODO: Who or what is this initiator? */ private String initiator; /** The number of the job which can actually be a string. */ private String jobnumber; /** The account or user for which a job should be executed. */ private String account; /** The product for which a job should be executed. */ private String product; /** Color attribute of the layers tag. */ private String color; /** The mono attribute of the layers tag. */ private String mono; /** The plotLabelSrs flag of the layers tag. */ private String plotLabelSrs; /** The plotframe flag of the layers tag. */ private String plotframe; /** The single flag of the layers tag. */ private String single; /** The layers which will be involved in a job. */ private ArrayList layerList = new ArrayList<>(); /** The SRS for the job. */ private String srs; /** The merge_mapsheets attribute of the extend tag. */ private String mergeMapsheets; /** The polygon of the selected region which should be exported. */ ArrayList regionPolygon = new ArrayList<>(); /** The resolution for the job. */ private String resolution; /** The scale for the job. */ private String scale; /** The format for the job. E.g. CityGML. */ private String format; /** The exportmetadata flag for the job. */ private String exportmetadata; /** The col attribute of the addfile tag. */ private String col; /** The eck attribute of the addfile tag. */ private String eck; /** The usenodatamask flag for the job. */ private String usenodatamask; /** The usepdctborderpoly flag for the job. */ private String usepdctborderpoly; /** The dhkresolvereferences flag for the job. */ private String dhkresolvereferences; /** Flag for zipped results. */ private String zipresult; /** The calibration attribute of the exportmetadata tag. */ private String calibration; /** The xmetadata attribute of the exportmetadata tag. */ private String xmetadata; public String getInitiator() { return initiator; } public void setInitiator(String initiator) { this.initiator = initiator; } public String getJobnumber() { return jobnumber; } public void setJobnumber(String jobnumber) { this.jobnumber = jobnumber; } public String getAccount() { return account; } public void setAccount(String account) { this.account = account; } public String getProduct() { return product; } public void setProduct(String product) { this.product = product; } public String getColor() { return color; } public void setColor(String color) { this.color = color; } public String getMono() { return mono; } public void setMono(String mono) { this.mono = mono; } public String getPlotLabelSrs() { return plotLabelSrs; } public void setPlotLabelSrs(String plotLabelSrs) { this.plotLabelSrs = plotLabelSrs; } public String getPlotframe() { return plotframe; } public void setPlotframe(String plotframe) { this.plotframe = plotframe; } public String getSingle() { return single; } public void setSingle(String single) { this.single = single; } public ArrayList getLayerList() { return layerList; } public void setLayerList(ArrayList layerList) { this.layerList = layerList; } public void addLayer(Layer layer) { layerList.add(layer); } public String getSrs() { return srs; } public void setSrs(String srs) { this.srs = srs; } public String getMergeMapsheets() { return mergeMapsheets; } public void setMergeMapsheets(String mergeMapsheets) { this.mergeMapsheets = mergeMapsheets; } public String getResolution() { return resolution; } public void setResolution(String resolution) { this.resolution = resolution; } public String getScale() { return scale; } public void setScale(String scale) { this.scale = scale; } public String getFormat() { return format; } public void setFormat(String format) { this.format = format; } public String getExportmetadata() { return exportmetadata; } public void setExportmetadata(String exportmetadata) { this.exportmetadata = exportmetadata; } public String getCol() { return col; } public void setCol(String col) { this.col = col; } public String getEck() { return eck; } public void setEck(String eck) { this.eck = eck; } public String getUsenodatamask() { return usenodatamask; } public void setUsenodatamask(String usenodatamask) { this.usenodatamask = usenodatamask; } public String getUsepdctborderpoly() { return usepdctborderpoly; } public void setUsepdctborderpoly(String usepdctborderpoly) { this.usepdctborderpoly = usepdctborderpoly; } public String getDhkresolvereferences() { return dhkresolvereferences; } public void setDhkresolvereferences(String dhkresolvereferences) { this.dhkresolvereferences = dhkresolvereferences; } public String getZipresult() { return zipresult; } public void setZipresult(String zipresult) { this.zipresult = zipresult; } public String getCalibration() { return calibration; } public void setCalibration(String calibration) { this.calibration = calibration; } public String getXmetadata() { return xmetadata; } public void setXmetadata(String xmetadata) { this.xmetadata = xmetadata; } @Override public String supportsExportJobVersion() { return EXPORT_JOB_VERSION; } @Override public String supportsImportJobVersion() { // TODO Auto-generated method stub return null; } /** * Adds a new coordinate to the region polygon. A region polygon is only used for export jobs. * * @param coordinate The new coordiante of the region polygon of a export job. */ public void addCoordinateToRegionPolygon(Coord coordinate) { regionPolygon.add(coordinate); } /** * Sets the whole region polygon for an export job. * * @param regionPolygon The region polygon to be used for an export job. */ public void setRegionPolygon(List regionPolygon) { this.regionPolygon.clear(); this.regionPolygon.addAll(regionPolygon); } /** * @return Returns the region polygon. */ public ArrayList getRegionPolygon() { return regionPolygon; } /** * @return Returns true, if all mandatory elements and attributes are set. Otherwise, false. */ public boolean isValid() { if (regionPolygon.isEmpty() || layerList.isEmpty() || initiator.isEmpty() || account.isEmpty() || jobnumber.isEmpty() || product.isEmpty() || color.isEmpty() || mono.isEmpty() || plotLabelSrs.isEmpty() || plotframe.isEmpty() || single.isEmpty() || srs.isEmpty() || resolution.isEmpty() || scale.isEmpty() || format.isEmpty() || exportmetadata.isEmpty() || col.isEmpty() || eck.isEmpty()){ return false; } else { return true; } } public static JobDescriptorImpl getDefaultDescriptor() { JobDescriptorImpl descriptor = new JobDescriptorImpl(); descriptor.setInitiator(DEFAULT_INITIATOR); descriptor.setJobnumber(DEFAULT_JOBNUMBER); descriptor.setAccount(DEFAULT_ACCOUNT); descriptor.setProduct(DEFAULT_PRODUCT); descriptor.setColor(DEFAULT_COLOR); descriptor.setMono(DEFAULT_MONO); descriptor.setPlotLabelSrs(DEFAULT_PLOT_LABEL_SRS); descriptor.setPlotframe(DEFAULT_PLOTFRAME); descriptor.setSingle(DEFAULT_SINGLE); descriptor.setSrs(DEFAULT_SRS); descriptor.setMergeMapsheets(DEFAULT_MERGE_MAP_SHEETS); descriptor.setResolution(DEFAULT_RESOLUTION); descriptor.setScale(DEFAULT_SCALE); descriptor.setFormat(DEFAULT_FORMAT); descriptor.setExportmetadata(DEFAULT_EXPORT_META_DATA); descriptor.setCol(DEFAULT_COL); descriptor.setEck(DEFAULT_ECK); descriptor.setUsenodatamask(DEFAULT_USE_NO_DATA_MASK); descriptor.setUsepdctborderpoly(DEFAULT_USE_PDCT_BORDER_POLY); descriptor.setDhkresolvereferences(DEFAULT_DHK_RESOLVE_REFERENCES); descriptor.setZipresult(DEFAULT_ZIP_RESULT); descriptor.setCalibration(DEFAULT_CALIBRATION); descriptor.setXmetadata(DEFAULT_XMETA_DATA); return descriptor; } }