ProductionRequest implements XmlConvertible { public Geometry getRegionGeometry() throws ProductionException { Geometry regionGeometry = getRegionGeometry(null); if (regionGeometry == null) { throw new ProductionException( "Missing region geometry, either parameter 'regionWKT' or 'minLon', 'minLat','maxLon','maxLat' must be provided"); } return regionGeometry; } private  ProductionRequest();  ProductionRequest(String productionType,
                             String userName,
                             String... productionParametersKeyValuePairs);  ProductionRequest(String productionType,
                             String userName,
                             Map<String, String> productionParameters); String getProductionType(); String getUserName(); Map<String, String> getParameters(); String getParameter(String name, boolean mandatory); void setParameter(String key, String value); void ensureParameterSet(String name); static DateFormat getDateFormat(); String getString(String name); String getString(String name, String def); boolean getBoolean(String name); Boolean getBoolean(String name, Boolean def); int getInteger(String name); Integer getInteger(String name, Integer def); float getFloat(String name); Float getFloat(String name, Float def); double getDouble(String name); Double getDouble(String name, Double def); Date getDate(String name); Date getDate(String name, Date def); Date[] getDates(String name, Date[] def); Geometry getGeometry(String name); Geometry getGeometry(String name, Geometry def); String getProductionName(String defaultProductionName); boolean isAutoStaging(); String getStagingDirectory(String productionId); String getRegionName(); Geometry getRegionGeometry(); Geometry getRegionGeometry(Geometry defaultGeometry); List<DateRange> getDateRanges(); DateRange createFromMinMax(); String getXmlDecodedString(String name, String def); @Override String toXml(); static ProductionRequest fromXml(String xml); static final String DATE_PATTERN; static final DateFormat DATE_FORMAT; }
@Test public void testGetRegionGeometry() throws ProductionException { ProductionRequest req; Geometry regionGeometry; try { req = new ProductionRequest("typeA", "ewa", "maxLon", "-20.0", "maxLat", "23.4"); req.getRegionGeometry(null); fail("Incomplete definition of region geometry"); } catch (ProductionException e) { } req = new ProductionRequest("typeA", "ewa", "minLon", "-60.0", "maxLon", "-20.0", "minLat", "13.4", "maxLat", "23.4"); regionGeometry = req.getRegionGeometry(null); assertTrue(regionGeometry instanceof Polygon); assertEquals("POLYGON ((-60 13.4, -20 13.4, -20 23.4, -60 23.4, -60 13.4))", regionGeometry.toString()); req = new ProductionRequest("typeA", "ewa", "regionWKT", "POINT(-60.0 13.4)"); regionGeometry = req.getRegionGeometry(null); assertTrue(regionGeometry instanceof Point); assertEquals("POINT (-60 13.4)", regionGeometry.toString()); req = new ProductionRequest("typeA", "ewa", "regionWKT", "POLYGON ((10 10, 20 10, 20 20, 10 20, 10 10))"); regionGeometry = req.getRegionGeometry(null); assertTrue(regionGeometry instanceof Polygon); assertEquals("POLYGON ((10 10, 20 10, 20 20, 10 20, 10 10))", regionGeometry.toString()); req = new ProductionRequest("typeA", "ewa"); Point defaultGeometry = new GeometryFactory().createPoint(new Coordinate(1, 2)); regionGeometry = req.getRegionGeometry(defaultGeometry); assertSame(defaultGeometry, regionGeometry); }