=== modified file 'dhis-mobile/dhis-service-sms/pom.xml' --- dhis-mobile/dhis-service-sms/pom.xml 2011-05-06 14:31:30 +0000 +++ dhis-mobile/dhis-service-sms/pom.xml 2011-05-24 08:47:57 +0000 @@ -17,6 +17,7 @@ + org.hisp.dhis dhis-api @@ -27,6 +28,7 @@ + org.smslib smslib @@ -39,15 +41,11 @@ + org.springframework spring-context-support ${spring.version} - - - opensymphony - quartz - 1.6.3 === modified file 'dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/gateway/DhisClickatellGateway.java' --- dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/gateway/DhisClickatellGateway.java 2011-05-16 19:04:09 +0000 +++ dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/gateway/DhisClickatellGateway.java 2011-05-24 08:47:57 +0000 @@ -1,5 +1,31 @@ package org.hisp.dhis.mobile.gateway; +/* + * Copyright (c) 2004-2010, 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 HISP project 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. + */ import org.smslib.http.ClickatellHTTPGateway; @@ -8,7 +34,5 @@ public DhisClickatellGateway( String gatewayId, String api_id, String username, String password ) { super( gatewayId, api_id, username, password ); - } - - + } } === modified file 'dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/DefaultSmsImportService.java' --- dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/DefaultSmsImportService.java 2011-05-06 14:31:30 +0000 +++ dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/DefaultSmsImportService.java 2011-05-24 08:47:57 +0000 @@ -60,13 +60,14 @@ import org.springframework.transaction.annotation.Transactional; /** - * The default implementation class of the SmsImportService - * This class provides implementation of the methods required to import SmsInbound - * into the datavalues using the datavalueservice of core DHIS2 + * The default implementation class of the SmsImportService This class provides + * implementation of the methods required to import SmsInbound into the + * datavalues using the datavalueservice of core DHIS2 * * @author Saptarshi */ -public class DefaultSmsImportService implements SmsImportService +public class DefaultSmsImportService + implements SmsImportService { // ------------------------------------------------------------------------- @@ -117,6 +118,7 @@ // ------------------------------------------------------------------------- // Helper Methods // ------------------------------------------------------------------------- + public User getUserInfo( String mobileNumber ) { Collection userList = userStore.getUsersByPhoneNumber( mobileNumber ); @@ -131,7 +133,6 @@ public Period getPeriodInfo( String startDate, String periodTypeId ) throws Exception { - SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd" ); List periods = null; @@ -140,19 +141,22 @@ { pt = new MonthlyPeriodType(); periods = new ArrayList( periodService.getPeriodsByPeriodType( pt ) ); - } else + } + else { if ( periodTypeId.equals( "1" ) ) { pt = new DailyPeriodType(); periods = new ArrayList( periodService.getPeriodsByPeriodType( pt ) ); - } else + } + else { if ( periodTypeId.equals( "6" ) ) { pt = new YearlyPeriodType(); periods = new ArrayList( periodService.getPeriodsByPeriodType( pt ) ); - } else + } + else { if ( periodTypeId.equals( "2" ) ) { @@ -201,6 +205,7 @@ // ------------------------------------------------------------------------- // Implementation // ------------------------------------------------------------------------- + @Override @Transactional public int saveDataValues() @@ -229,17 +234,19 @@ if ( userCredentials != null ) { storedBy = userCredentials.getUsername(); - } else + } + else { - Logger.getInstance().logError( "User with phone number not found : " - + sms.getOriginator(), null, null ); + Logger.getInstance().logError( "User with phone number not found : " + sms.getOriginator(), + null, null ); return -1; } List units = new ArrayList( curUser.getOrganisationUnits() ); if ( units == null || units.size() <= 0 ) { - Logger.getInstance().logError( " User with phone number not assigned any organization unit : " - + sms.getOriginator(), null, null ); + Logger.getInstance().logError( + " User with phone number not assigned any organization unit : " + sms.getOriginator(), + null, null ); return -1; } OrganisationUnit unit = units.get( 0 ); @@ -262,9 +269,11 @@ DataElementCategoryOptionCombo optionCombo = new DataElementCategoryOptionCombo(); - optionCombo = dataElementCategoryService.getDataElementCategoryOptionCombo( Integer.valueOf( optStr ) ); + optionCombo = dataElementCategoryService.getDataElementCategoryOptionCombo( Integer + .valueOf( optStr ) ); - DataValue dataValue = dataValueService.getDataValue( unit, dataElement, period, optionCombo ); + DataValue dataValue = dataValueService.getDataValue( unit, dataElement, period, + optionCombo ); if ( dataValue == null ) { @@ -274,7 +283,8 @@ dataValueService.addDataValue( dataValue ); saveCount++; } - } else + } + else { dataValue.setValue( dataValues[i] ); dataValue.setStoredBy( storedBy ); @@ -282,25 +292,31 @@ saveCount++; } } - } else + } + else { - Logger.getInstance().logError( "Incorrect formatted IdLayout file for : DV = " - + dataValues.length + " DE = " + deIds.length, null, null ); + Logger.getInstance().logError( + "Incorrect formatted IdLayout file for : DV = " + dataValues.length + " DE = " + + deIds.length, null, null ); return -1; } - } else + } + else { - Logger.getInstance().logError( "Unrecognised Phone Numbers : " + sms.getOriginator(), null, null ); + Logger.getInstance().logError( "Unrecognised Phone Numbers : " + sms.getOriginator(), null, + null ); return -1; } } - } else + } + else { Logger.getInstance().logError( "Error finding dataelement ids file: ", null, null ); return -1; } - } catch ( Exception ex ) + } + catch ( Exception ex ) { Logger.getInstance().logError( "Error getting Period!", ex, null ); return -1; === modified file 'dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/DefaultSmsInboundStoreService.java' --- dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/DefaultSmsInboundStoreService.java 2011-05-06 14:31:30 +0000 +++ dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/DefaultSmsInboundStoreService.java 2011-05-24 08:47:57 +0000 @@ -41,10 +41,10 @@ @Transactional public class DefaultSmsInboundStoreService implements SmsInboundStoreService { - // ------------------------------------------------------------------------- // Dependencies // ------------------------------------------------------------------------- + private SmsInboundStore smsInboundStore; public void setSmsInboundStore( SmsInboundStore smsInboundStore ) === modified file 'dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/HibernateSmsInboundStore.java' --- dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/HibernateSmsInboundStore.java 2011-05-06 14:31:30 +0000 +++ dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/HibernateSmsInboundStore.java 2011-05-24 08:47:57 +0000 @@ -57,6 +57,7 @@ // ------------------------------------------------------------------------- // Implementation // ------------------------------------------------------------------------- + @Override public void saveSms( SmsInbound sms ) {