=== removed file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/xml/ExcelExtension.java' --- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/xml/ExcelExtension.java 2010-07-13 00:31:39 +0000 +++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/xml/ExcelExtension.java 1970-01-01 00:00:00 +0000 @@ -1,58 +0,0 @@ -package org.hisp.dhis.importexport.xml; - -import java.util.Calendar; -import java.util.GregorianCalendar; - -/* - * Copyright (c) 2004-2005, University of Oslo - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of the nor the names of its contributors may - * be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * - * @author bobj - */ -public class ExcelExtension -{ - public static String date( String xltimestr ) - { - try - { - // the number of days since 1/1/1900 - Integer xldays = new Integer( xltimestr ); - - // the beginning of excel time is 1/1/1900 - Calendar cal = new GregorianCalendar(); - cal.set( 1900, 0, 1 ); - // cal.add( Calendar.DAY_OF_MONTH, 20 ); - cal.add( Calendar.DAY_OF_MONTH, xldays.intValue() - 2 ); - return cal.getTime().toString(); - } - catch ( Exception ex ) - { - return ""; - } - } -} === added file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/xml/Util.java' --- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/xml/Util.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/xml/Util.java 2011-09-20 22:17:20 +0000 @@ -0,0 +1,88 @@ +package org.hisp.dhis.importexport.xml; + +import java.util.Calendar; +import java.util.GregorianCalendar; +import java.util.StringTokenizer; + +/* + * Copyright (c) 2004-2005, University of Oslo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of the nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * + * @author bobj + * + * Some static helper functions + * + */ +public class Util +{ + /** + * Compensating for Excel wonky storage for dates + * + * @param xltimestr the number of days since 1/1/1900 as undertood by excel + * @return + */ + public static String date( String xltimestr ) + { + try + { + // the number of days since 1/1/1900 + Integer xldays = new Integer( xltimestr ); + + // the beginning of excel time is 1/1/1900 + Calendar cal = new GregorianCalendar(); + cal.set( 1900, 0, 1 ); + // cal.add( Calendar.DAY_OF_MONTH, 20 ); + cal.add( Calendar.DAY_OF_MONTH, xldays.intValue() - 2 ); + return cal.getTime().toString(); + } + catch ( Exception ex ) + { + return ""; + } + } + + /** + * Tokenizer to convert coordinates in GML to a sequence of nnn,nnn + * @param coordinates + * @return + */ + public static String gmlToCoords(String coordinates) + { + StringBuilder sb = new StringBuilder(); + String[] coords = coordinates.split( "\\s"); + + for (String coord : coords) + { + sb.append( ""); + sb.append( coord); + sb.append( ""); + } + + return sb.toString(); + } +} === modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/resources/transform/gml2dxf.xsl' --- dhis-2/dhis-services/dhis-service-importexport/src/main/resources/transform/gml2dxf.xsl 2011-09-16 11:07:56 +0000 +++ dhis-2/dhis-services/dhis-service-importexport/src/main/resources/transform/gml2dxf.xsl 2011-09-20 22:17:20 +0000 @@ -1,31 +1,18 @@ - + -10000 +100000 - - - - - - - - - - - - - - , - - - - - - - + + + @@ -71,4 +58,5 @@ + \ No newline at end of file