=== modified file 'dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/ehcache.xml' --- dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/ehcache.xml 2011-09-21 12:46:20 +0000 +++ dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/ehcache.xml 2011-10-20 18:51:07 +0000 @@ -167,7 +167,7 @@ - + @@ -184,6 +184,8 @@ + + === modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ValidationUtils.java' --- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ValidationUtils.java 2011-10-12 07:51:57 +0000 +++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ValidationUtils.java 2011-10-20 18:51:07 +0000 @@ -110,8 +110,29 @@ } /** + * Returns the longitude from the given coordinate. Returns null if the + * coordinate string is not valid. The coordinate is on the form + * longitude / latitude. + * + * @param coordinate the coordinate string. + * @return the longitude. + */ + public static String getLongitude( String coordinate ) + { + if ( coordinate == null ) + { + return null; + } + + Matcher matcher = COORDINATE_PATTERN.matcher( coordinate ); + + return matcher.find() ? matcher.group( 1 ) : null; + } + + /** * Returns the latitude from the given coordinate. Returns null if the - * coordinate string is not valid. + * coordinate string is not valid. The coordinate is on the form + * longitude / latitude. * * @param coordinate the coordinate string. * @return the latitude. @@ -125,37 +146,19 @@ Matcher matcher = COORDINATE_PATTERN.matcher( coordinate ); - return matcher.find() ? matcher.group( 1 ) : null; - } - - /** - * Returns the longitude from the given coordinate. Returns null if the - * coordinate string is not valid. - * - * @param coordinate the coordinate string. - * @return the longitude. - */ - public static String getLongitude( String coordinate ) - { - if ( coordinate == null ) - { - return null; - } - - Matcher matcher = COORDINATE_PATTERN.matcher( coordinate ); - return matcher.find() ? matcher.group( 2 ) : null; } - + /** - * Returns a coordinate string based on the given latitude and longitude. + * Returns a coordinate string based on the given latitude and longitude. + * The coordinate is on the form longitude / latitude. * + * @param longitude the longitude string. * @param latitude the latitude string. - * @param longitude the longitude string. * @return a coordinate string. */ - public static String getCoordinate( String latitude, String longitude ) + public static String getCoordinate( String longitude, String latitude ) { - return "[" + latitude + "," + longitude + "]"; + return "[" + longitude + "," + latitude + "]"; } } === modified file 'dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/ValidationUtilsTest.java' --- dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/ValidationUtilsTest.java 2011-10-12 07:51:57 +0000 +++ dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/ValidationUtilsTest.java 2011-10-20 18:51:07 +0000 @@ -56,22 +56,22 @@ assertFalse( coordinateIsValid( "S-0.27726 E37.08472" ) ); assertFalse( coordinateIsValid( null ) ); } + + @Test + public void testGetLongitude() + { + assertEquals( "+37.99034", getLongitude( "[+37.99034,-28.94221]" ) ); + assertEquals( "37.99034", getLongitude( "[37.99034,28.94221]" ) ); + assertNull( getLongitude( "23.34343,56.3232" ) ); + assertNull( getLongitude( null ) ); + } @Test public void testGetLatitude() { - assertEquals( "+37.99034", getLatitude( "[+37.99034,-28.94221]" ) ); - assertEquals( "37.99034", getLatitude( "[37.99034,28.94221]" ) ); + assertEquals( "-28.94221", getLatitude( "[+37.99034,-28.94221]" ) ); + assertEquals( "28.94221", getLatitude( "[37.99034,28.94221]" ) ); assertNull( getLatitude( "23.34343,56.3232" ) ); assertNull( getLatitude( null ) ); } - - @Test - public void testGetLongitude() - { - assertEquals( "-28.94221", getLongitude( "[+37.99034,-28.94221]" ) ); - assertEquals( "28.94221", getLongitude( "[37.99034,28.94221]" ) ); - assertNull( getLongitude( "23.34343,56.3232" ) ); - assertNull( getLongitude( null ) ); - } } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/AddOrganisationUnitAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/AddOrganisationUnitAction.java 2011-10-06 18:31:41 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/AddOrganisationUnitAction.java 2011-10-20 18:51:07 +0000 @@ -138,6 +138,13 @@ this.comment = comment; } + private String longitude; + + public void setLongitude( String longitude ) + { + this.longitude = longitude; + } + private String latitude; public void setLatitude( String latitude ) @@ -145,13 +152,6 @@ this.latitude = latitude; } - private String longitude; - - public void setLongitude( String longitude ) - { - this.longitude = longitude; - } - private String url; public void setUrl( String url ) @@ -224,8 +224,8 @@ { code = nullIfEmpty( code ); comment = nullIfEmpty( comment ); + longitude = nullIfEmpty( longitude ); latitude = nullIfEmpty( latitude ); - longitude = nullIfEmpty( longitude ); url = nullIfEmpty( url ); contactPerson = nullIfEmpty( contactPerson ); @@ -235,8 +235,8 @@ Date date = format.parseDate( openingDate ); - String coordinates = latitude != null && longitude != null ? - ValidationUtils.getCoordinate( latitude, longitude ) : null; + String coordinates = longitude != null && latitude != null ? + ValidationUtils.getCoordinate( longitude, latitude ) : null; // --------------------------------------------------------------------- // Get parent === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/GetOrganisationUnitAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/GetOrganisationUnitAction.java 2011-10-06 18:31:41 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/GetOrganisationUnitAction.java 2011-10-20 18:51:07 +0000 @@ -155,7 +155,14 @@ { return point; } - + + private String longitude; + + public String getLongitude() + { + return longitude; + } + private String latitude; public String getLatitude() @@ -163,13 +170,6 @@ return latitude; } - private String longitude; - - public String getLongitude() - { - return longitude; - } - // ------------------------------------------------------------------------- // Action implementation // ------------------------------------------------------------------------- @@ -203,8 +203,8 @@ // --------------------------------------------------------------------- point = organisationUnit.getCoordinates() == null || coordinateIsValid( organisationUnit.getCoordinates() ); + longitude = ValidationUtils.getLongitude( organisationUnit.getCoordinates() ); latitude = ValidationUtils.getLatitude( organisationUnit.getCoordinates() ); - longitude = ValidationUtils.getLongitude( organisationUnit.getCoordinates() ); return SUCCESS; } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/UpdateOrganisationUnitAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/UpdateOrganisationUnitAction.java 2011-10-06 18:31:41 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/UpdateOrganisationUnitAction.java 2011-10-20 18:51:07 +0000 @@ -160,6 +160,13 @@ this.comment = comment; } + private String longitude; + + public void setLongitude( String longitude ) + { + this.longitude = longitude; + } + private String latitude; public void setLatitude( String latitude ) @@ -167,13 +174,6 @@ this.latitude = latitude; } - private String longitude; - - public void setLongitude( String longitude ) - { - this.longitude = longitude; - } - private String url; public void setUrl( String url ) @@ -246,8 +246,8 @@ { code = nullIfEmpty( code ); comment = nullIfEmpty( comment ); + longitude = nullIfEmpty( longitude ); latitude = nullIfEmpty( latitude ); - longitude = nullIfEmpty( longitude ); url = nullIfEmpty( url ); contactPerson = nullIfEmpty( contactPerson ); @@ -264,8 +264,8 @@ cDate = format.parseDate( closedDate ); } - String coordinates = latitude != null && longitude != null ? - ValidationUtils.getCoordinate( latitude, longitude ) : null; + String coordinates = longitude != null && latitude != null ? + ValidationUtils.getCoordinate( longitude, latitude ) : null; // --------------------------------------------------------------------- // Update organisation unit === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitForm.vm 2011-10-06 18:31:41 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitForm.vm 2011-10-20 18:51:07 +0000 @@ -51,13 +51,13 @@ + + + + - - - - === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitForm.vm 2011-10-06 18:31:41 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitForm.vm 2011-10-20 18:51:07 +0000 @@ -77,13 +77,13 @@ #if( $point ) + + + + - - - - #end