=== removed directory 'dhis-mobile' === removed directory 'dhis-mobile/dhis-service-sms' === removed file 'dhis-mobile/dhis-service-sms/pom.xml' --- dhis-mobile/dhis-service-sms/pom.xml 2012-05-29 07:58:51 +0000 +++ dhis-mobile/dhis-service-sms/pom.xml 1970-01-01 00:00:00 +0000 @@ -1,55 +0,0 @@ - - - 4.0.0 - - - org.hisp.dhis - dhis-services - 2.9-SNAPSHOT - - - dhis-service-sms - jar - DHIS SMS Service - - - - - - - org.hisp.dhis - dhis-api - - - org.hisp.dhis - dhis-service-core - - - - - - org.smslib - smslib - 3.5.1 - - - org.rxtx - rxtx - 2.1.7 - - - - - - org.springframework - spring-context-support - ${spring.version} - - - - - ../../ - - === removed directory 'dhis-mobile/dhis-service-sms/src' === removed directory 'dhis-mobile/dhis-service-sms/src/main' === removed directory 'dhis-mobile/dhis-service-sms/src/main/java' === removed directory 'dhis-mobile/dhis-service-sms/src/main/java/org' === removed directory 'dhis-mobile/dhis-service-sms/src/main/java/org/hisp' === removed directory 'dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis' === removed directory 'dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile' === removed directory 'dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/gateway' === removed 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-12-26 10:07:59 +0000 +++ dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/gateway/DhisClickatellGateway.java 1970-01-01 00:00:00 +0000 @@ -1,38 +0,0 @@ -package org.hisp.dhis.mobile.gateway; - -/* - * Copyright (c) 2004-2012, 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; - -public class DhisClickatellGateway extends ClickatellHTTPGateway -{ - public DhisClickatellGateway( String gatewayId, String api_id, String username, String password ) - { - super( gatewayId, api_id, username, password ); - } -} === removed directory 'dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms' === removed 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-12-26 10:07:59 +0000 +++ dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/DefaultSmsImportService.java 1970-01-01 00:00:00 +0000 @@ -1,326 +0,0 @@ -package org.hisp.dhis.mobile.sms; - -/* - * Copyright (c) 2004-2012, 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 java.io.File; -import java.io.FileInputStream; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Properties; - -import org.hisp.dhis.dataelement.DataElement; -import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo; -import org.hisp.dhis.dataelement.DataElementCategoryService; -import org.hisp.dhis.dataelement.DataElementService; -import org.hisp.dhis.datavalue.DataValue; -import org.hisp.dhis.datavalue.DataValueService; -import org.hisp.dhis.mobile.sms.api.SmsFormat; -import org.hisp.dhis.mobile.sms.api.SmsImportService; -import org.hisp.dhis.mobile.sms.api.SmsInbound; -import org.hisp.dhis.mobile.sms.api.SmsInboundStoreService; -import org.hisp.dhis.organisationunit.OrganisationUnit; -import org.hisp.dhis.period.DailyPeriodType; -import org.hisp.dhis.period.MonthlyPeriodType; -import org.hisp.dhis.period.Period; -import org.hisp.dhis.period.PeriodService; -import org.hisp.dhis.period.PeriodType; -import org.hisp.dhis.period.WeeklyPeriodType; -import org.hisp.dhis.period.YearlyPeriodType; -import org.hisp.dhis.user.User; -import org.hisp.dhis.user.UserCredentials; -import org.hisp.dhis.user.UserStore; -import org.smslib.helper.Logger; -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 - * - * @author Saptarshi - */ -public class DefaultSmsImportService - implements SmsImportService -{ - - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - private DataElementService dataElementService; - - public void setDataElementService( DataElementService dataElementService ) - { - this.dataElementService = dataElementService; - } - - private DataElementCategoryService dataElementCategoryService; - - public void setDataElementCategoryService( DataElementCategoryService dataElementCategoryService ) - { - this.dataElementCategoryService = dataElementCategoryService; - } - - private DataValueService dataValueService; - - public void setDataValueService( DataValueService dataValueService ) - { - this.dataValueService = dataValueService; - } - - private PeriodService periodService; - - public void setPeriodService( PeriodService periodService ) - { - this.periodService = periodService; - } - - private UserStore userStore; - - public void setUserStore( UserStore userStore ) - { - this.userStore = userStore; - } - - private SmsInboundStoreService smsInboundStoreService; - - public void setSmsInboundStoreService( SmsInboundStoreService smsInboundStoreService ) - { - this.smsInboundStoreService = smsInboundStoreService; - } - - // ------------------------------------------------------------------------- - // Helper Methods - // ------------------------------------------------------------------------- - - public User getUserInfo( String mobileNumber ) - { - Collection userList = userStore.getUsersByPhoneNumber( mobileNumber ); - User selectedUser = null; - if ( userList != null && userList.size() > 0 ) - { - selectedUser = userList.iterator().next(); - } - return selectedUser; - } - - public Period getPeriodInfo( String startDate, String periodTypeId ) - throws Exception - { - SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd" ); - - List periods = null; - PeriodType pt = null; - if ( periodTypeId.equals( "3" ) ) - { - pt = new MonthlyPeriodType(); - periods = new ArrayList( periodService.getPeriodsByPeriodType( pt ) ); - } - else - { - if ( periodTypeId.equals( "1" ) ) - { - pt = new DailyPeriodType(); - periods = new ArrayList( periodService.getPeriodsByPeriodType( pt ) ); - } - else - { - if ( periodTypeId.equals( "6" ) ) - { - pt = new YearlyPeriodType(); - periods = new ArrayList( periodService.getPeriodsByPeriodType( pt ) ); - } - else - { - if ( periodTypeId.equals( "2" ) ) - { - pt = new WeeklyPeriodType(); - periods = new ArrayList( periodService.getPeriodsByPeriodType( pt ) ); - } - } - } - } - - for ( Period period : periods ) - { - String tempDate = dateFormat.format( period.getStartDate() ); - if ( tempDate.equalsIgnoreCase( startDate ) ) - { - return period; - } - } - - Period period = pt.createPeriod( dateFormat.parse( startDate ) ); - period = reloadPeriodForceAdd( period ); - periodService.addPeriod( period ); - - return period; - } - - private Period reloadPeriod( Period period ) - { - return periodService.getPeriod( period.getStartDate(), period.getEndDate(), period.getPeriodType() ); - } - - private Period reloadPeriodForceAdd( Period period ) - { - Period storedPeriod = reloadPeriod( period ); - - if ( storedPeriod == null ) - { - periodService.addPeriod( period ); - - return period; - } - - return storedPeriod; - } - - // ------------------------------------------------------------------------- - // Implementation - // ------------------------------------------------------------------------- - - @Override - @Transactional - public int saveDataValues() - { - int importedMessages = 0; - - try - { - File deIdFile = new File( System.getenv( "DHIS2_HOME" ) + File.separator + "formIDLayout.csv" ); - if ( deIdFile.exists() ) - { - FileInputStream f = new FileInputStream( deIdFile ); - Properties props = new Properties(); - props.load( f ); - f.close(); - - Collection msgs = smsInboundStoreService.getAllReceivedSms(); - for ( SmsInbound sms : msgs ) - { - SmsFormat dataSms = new SmsFormat( sms ); - String storedBy = ""; - User curUser = getUserInfo( sms.getOriginator() ); - if ( curUser != null ) - { - UserCredentials userCredentials = userStore.getUserCredentials( curUser ); - if ( userCredentials != null ) - { - storedBy = userCredentials.getUsername(); - } - else - { - 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 ); - return -1; - } - OrganisationUnit unit = units.get( 0 ); - Period period = getPeriodInfo( dataSms.getPeriodText(), dataSms.getPeriodTypeId() ); - - String[] deIds = props.getProperty( dataSms.getFormId() ).split( "\\," ); - String[] dataValues = dataSms.getDataValues(); - if ( dataValues.length == deIds.length ) - { - int saveCount = 0; - for ( int i = 0; i < dataValues.length; i++ ) - { - String parts[] = deIds[i].split( "\\." ); - - String deStr = parts[0]; - - String optStr = parts[1]; - - DataElement dataElement = dataElementService.getDataElement( Integer.valueOf( deStr ) ); - - DataElementCategoryOptionCombo optionCombo = new DataElementCategoryOptionCombo(); - - optionCombo = dataElementCategoryService.getDataElementCategoryOptionCombo( Integer - .valueOf( optStr ) ); - - DataValue dataValue = dataValueService.getDataValue( unit, dataElement, period, - optionCombo ); - - if ( dataValue == null ) - { - if ( dataValues[i] != null ) - { - dataValue = new DataValue( dataElement, period, unit, optionCombo ); - dataValueService.addDataValue( dataValue ); - saveCount++; - } - } - else - { - dataValue.setValue( dataValues[i] ); - dataValue.setStoredBy( storedBy ); - dataValueService.updateDataValue( dataValue ); - saveCount++; - } - } - } - else - { - Logger.getInstance().logError( - "Incorrect formatted IdLayout file for : DV = " + dataValues.length + " DE = " - + deIds.length, null, null ); - return -1; - } - - } - else - { - Logger.getInstance().logError( "Unrecognised Phone Numbers : " + sms.getOriginator(), null, - null ); - return -1; - } - } - } - else - { - Logger.getInstance().logError( "Error finding dataelement ids file: ", null, null ); - return -1; - } - } - catch ( Exception ex ) - { - Logger.getInstance().logError( "Error getting Period!", ex, null ); - return -1; - } - return importedMessages; - } -} === removed 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-12-26 10:07:59 +0000 +++ dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/DefaultSmsInboundStoreService.java 1970-01-01 00:00:00 +0000 @@ -1,99 +0,0 @@ -package org.hisp.dhis.mobile.sms; - -/* - * Copyright (c) 2004-2012, 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 java.util.Collection; -import java.util.Date; -import org.hisp.dhis.mobile.sms.api.SmsInbound; -import org.hisp.dhis.mobile.sms.api.SmsInboundStore; -import org.hisp.dhis.mobile.sms.api.SmsInboundStoreService; -import org.springframework.transaction.annotation.Transactional; - -/** - * - * @author Saptarshi - */ -@Transactional -public class DefaultSmsInboundStoreService implements SmsInboundStoreService -{ - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private SmsInboundStore smsInboundStore; - - public void setSmsInboundStore( SmsInboundStore smsInboundStore ) - { - this.smsInboundStore = smsInboundStore; - } - - // ------------------------------------------------------------------------- - // Implementation - // ------------------------------------------------------------------------- - @Override - public void saveSms( SmsInbound sms ) - { - smsInboundStore.saveSms( sms ); - } - - @Override - public Collection getSmsByDate( Date startDate, Date endDate ) - { - return smsInboundStore.getSms( null, null, startDate, endDate); - } - - @Override - public Collection getSmsByOriginator( String originator ) - { - return smsInboundStore.getSms( originator, null, null, null ); - } - - @Override - public Collection getSmsByProcess( int process ) - { - return smsInboundStore.getSms( null, process, null, null ); - } - - @Override - public Collection getAllReceivedSms() - { - return smsInboundStore.getSms( null, null, null, null ); - } - - @Override - public void updateSms( SmsInbound sms ) - { - smsInboundStore.updateSms( sms ); - } - - @Override - public long getSmsCount() - { - return smsInboundStore.getSmsCount(); - } -} === removed 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-24 08:47:57 +0000 +++ dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/HibernateSmsInboundStore.java 1970-01-01 00:00:00 +0000 @@ -1,101 +0,0 @@ -package org.hisp.dhis.mobile.sms; - -/* - * Copyright (c) 2004-2007, 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 java.util.Collection; -import java.util.Date; -import org.hibernate.Criteria; -import org.hibernate.Session; -import org.hibernate.SessionFactory; -import org.hibernate.criterion.Projections; -import org.hibernate.criterion.Restrictions; -import org.hisp.dhis.mobile.sms.api.SmsInbound; -import org.hisp.dhis.mobile.sms.api.SmsInboundStore; - -/** - * - * @author Saptarshi - */ -public class HibernateSmsInboundStore implements SmsInboundStore -{ - - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - private SessionFactory sessionFactory; - - public void setSessionFactory( SessionFactory sessionFactory ) - { - this.sessionFactory = sessionFactory; - } - - // ------------------------------------------------------------------------- - // Implementation - // ------------------------------------------------------------------------- - - @Override - public void saveSms( SmsInbound sms ) - { - sessionFactory.getCurrentSession().save( sms ); - } - - @Override - public Collection getSms( String originator, Integer process, Date startDate, Date endDate ) - { - Criteria crit = sessionFactory.getCurrentSession().createCriteria( SmsInbound.class ); - if ( originator != null && !originator.equals( "" ) ) - { - crit.add( Restrictions.eq( "originator", originator ) ); - } - if ( process != null ) - { - crit.add( Restrictions.eq( "process", process ) ); - } - if ( startDate != null && endDate != null ) - { - crit.add( Restrictions.between( "receiveDate", startDate, endDate ) ); - } - return crit.list(); - } - - @Override - public void updateSms( SmsInbound sms ) - { - sessionFactory.getCurrentSession().update( sms ); - } - - @Override - public long getSmsCount() - { - Session session = sessionFactory.getCurrentSession(); - Criteria criteria = session.createCriteria( SmsInbound.class ); - criteria.setProjection( Projections.rowCount() ); - Long count = (Long) criteria.uniqueResult(); - return count != null ? count.longValue() : (long) 0; - } -} === removed file 'dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/SmsService.java' --- dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/SmsService.java 2011-12-26 10:07:59 +0000 +++ dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/SmsService.java 1970-01-01 00:00:00 +0000 @@ -1,627 +0,0 @@ -package org.hisp.dhis.mobile.sms; - -/* - * Copyright (c) 2004-2012, 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 java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.net.URL; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Collection; -import java.util.Date; -import java.util.List; -import java.util.Properties; -import java.util.Timer; -import java.util.TimerTask; -import org.hisp.dhis.mobile.gateway.DhisClickatellGateway; -import org.hisp.dhis.mobile.sms.utils.Compressor; -import org.hisp.dhis.mobile.sms.api.SmsInbound; -import org.hisp.dhis.mobile.sms.api.SmsInboundStoreService; -import org.smslib.AGateway; -import org.smslib.AGateway.Protocols; -import org.smslib.GatewayException; -import org.smslib.ICallNotification; -import org.smslib.IInboundMessageNotification; -import org.smslib.IOutboundMessageNotification; -import org.smslib.IQueueSendingNotification; -import org.smslib.InboundBinaryMessage; -import org.smslib.InboundMessage; -import org.smslib.Message.MessageEncodings; -import org.smslib.Message.MessageTypes; -import org.smslib.OutboundMessage; -import org.smslib.OutboundWapSIMessage; -import org.smslib.OutboundWapSIMessage.WapSISignals; -import org.smslib.Service; -import org.smslib.TimeoutException; -import org.smslib.helper.Logger; -import org.smslib.http.BulkSmsHTTPGateway; -import org.smslib.modem.SerialModemGateway; - -/* - * This class provides services for communicating over Sms - * @author Saptarshi Purkayastha - */ -public class SmsService -{ - - /*------------------------------------------------------------------ - * Dependencies - ------------------------------------------------------------------*/ - SmsInboundStoreService smsInboundStoreService; - - public void setSmsInboundStoreService( SmsInboundStoreService smsInboundStoreService ) - { - this.smsInboundStoreService = smsInboundStoreService; - } - - /*------------------------------------------------------------------ - * Implementation - ------------------------------------------------------------------*/ - private Properties props; - - private InboundNotification inboundNotification; - - private OutboundNotification outboundNotification; - - private CallNotification callNotification; - - private QueueSendingNotification queueSendingNotification; - - // TODO: check advisory: http://blog.smslib.org/2011/05/orphaned-part-detection-issue.html - //private OrphanedMessageNotification orphanedMessageNotification; - - private Timer inboundPollingTimer; - - /* - * Constructor called when SmsService is loaded - */ - public SmsService() - { - Service.getInstance().setInboundMessageNotification( inboundNotification ); - Service.getInstance().setOutboundMessageNotification( outboundNotification ); - Service.getInstance().setCallNotification( callNotification ); - // TODO: check advisory: http://blog.smslib.org/2011/05/orphaned-part-detection-issue.html - //Service.getInstance().setOrphanedMessageNotification( orphanedMessageNotification ); - Service.getInstance().setQueueSendingNotification( queueSendingNotification ); - } - - /*------------------------------------------------------------------ - * Service methods - ------------------------------------------------------------------*/ - /** - * Method to start the service, if it is stopped - * @return The message to be displayed on UI after attempt to start the service - */ - // - public String startSmsService() - { - if ( Service.getInstance().getServiceStatus() == Service.ServiceStatus.STOPPED ) - { - try - { - String result = loadConfiguration(); - if ( !result.contains( "ERROR" ) ) - { - Service.getInstance().startService(); - int inbound_interval = Integer.parseInt( props.getProperty( "settings.inbound_interval", "60" ) ); - inboundPollingTimer = new Timer( "SmsService - InboundPollingTask" ); - InboundPollingTask inboundPollingTask = new InboundPollingTask(); - inboundPollingTimer.schedule( inboundPollingTask, inbound_interval * 1000, inbound_interval * 1000 ); - } - return result; - } catch ( Exception ex ) - { - Logger.getInstance().logError( "Exception starting service: ", ex, null ); - return "ERROR = " + ex.getMessage(); - } - } else - { - return "CANNOT START: SERVICE ALREADY STARTING/STARTED/STOPPING"; - } - } - // - - /** - * Method to stop the service, if it is started - * @return The message to be displayed on UI after attempt to stop the service - */ - // - public String stopSmsService() - { - if ( Service.getInstance().getServiceStatus() == Service.ServiceStatus.STARTED ) - { - try - { - Service.getInstance().stopService(); - inboundPollingTimer.cancel(); - return "SERVICE STOPPED"; - } catch ( Exception ex ) - { - Logger.getInstance().logError( "Exception stopping service: ", ex, null ); - return "ERROR"; - } - } else - { - return "SERVICE ALREADY STOPPED"; - } - } - // - - /** - * To check if SmsService is running or not - * @return true is service is started - */ - // - public boolean isServiceRunning() - { - if ( Service.getInstance().getServiceStatus() == Service.ServiceStatus.STARTED ) - { - return true; - } else - { - return false; - } - } - // - - /** - * Sends the OTA (Over-the-Air) message required to download settings, application or multimedia messages - * @param recipient The phone number of the recipient - * @param url The download URL - * @param prompt The message to be displayed to the recipient - * @return The message to be displayed on UI after attempt to send OTA message - */ - // - public String sendOtaMessage( String recipient, String url, String prompt ) - { - String status = new String(); - try - { - OutboundWapSIMessage wapMsg = new OutboundWapSIMessage( recipient, new URL( url ), prompt ); - wapMsg.setSignal( WapSISignals.HIGH ); - if ( isServiceRunning() ) - { - Service.getInstance().sendMessage( wapMsg ); - status = "WAP MESSAGE SENT"; - } else - { - status = "SERVICE IS NOT RUNNING"; - } - } catch ( Exception e ) - { - status = "ERROR SENDING WAP MSG"; - } - Logger.getInstance().logInfo( status, null, null ); - return status; - } - // - - /** - * Sends an SMS to group of users that is a list of phone numbers of recipients - * @param groupName The name of the group of users - * @param recepients A List of phone numbers - * @param msg The message to be sent to the group - * @return The message to be displayed on UI after attempt to send SMS to a group of users - */ - // - public String sendMessageToGroup( String groupName, List recipients, String msg ) - { - if ( isServiceRunning() ) - { - Service.getInstance().createGroup( groupName ); - for ( String recepient : recipients ) - { - Service.getInstance().addToGroup( groupName, recepient ); - } - OutboundMessage message = new OutboundMessage( groupName, msg ); - - try - { - Service.getInstance().sendMessage( message ); - Logger.getInstance().logInfo( "Message Sent to Group: " + groupName, null, null ); - return "SUCCESS"; - } catch ( TimeoutException ex ) - { - Logger.getInstance().logError( "Timeout error in sending message", ex, null ); - return "ERROR"; - } catch ( GatewayException ex ) - { - Logger.getInstance().logError( "Gateway Exception in sending message", ex, null ); - return "ERROR"; - } catch ( IOException ex ) - { - Logger.getInstance().logError( "IO Exception in sending message", ex, null ); - return "ERROR"; - } catch ( InterruptedException ex ) - { - Logger.getInstance().logError( "Interrupted Exception in sending message", ex, null ); - return "ERROR"; - } finally - { - Service.getInstance().removeGroup( groupName ); - } - } else - { - Logger.getInstance().logError( "Service not running", null, null ); - return "SERVICE NOT RUNNING"; - } - } - // - - /** - * - * @param recipient - * @param msg - * @return - * @throws Exception - */ - public String sendMessage( String recipient, String msg ) throws Exception - { - OutboundMessage outboundMessage = new OutboundMessage( recipient, msg ); - if ( isServiceRunning() ) - { - String longNumber = getProperties().getProperty( "provider.longnumber" ).trim(); - if(longNumber!=null && !longNumber.isEmpty()){ - outboundMessage.setFrom( longNumber ); - } - Service.getInstance().sendMessage( outboundMessage ); - return "MESSAGE SENT SUCCESSFULLY TO: " + recipient; - } else - { - return "SERVICE IS NOT RUNNING"; - } - } - - /*------------------------------------------------------------------ - * SMSLIB CALLBACKS NOT IMPLEMENTED - ONLY USED FOR LOGGING - ------------------------------------------------------------------*/ - // - /** - * Callback called when inbound message is received at the modem. - * Depends on correct CNMI implementation by the modem - */ - class InboundNotification implements IInboundMessageNotification - { - - @Override - public void process( org.smslib.AGateway gateway, MessageTypes msgType, InboundMessage msg ) - { - Logger.getInstance().logInfo( "Received new message from: " + msg.getOriginator(), null, null ); - } - } - - /** - * Callback called when attempt for outbound message is made. - */ - class OutboundNotification implements IOutboundMessageNotification - { - - @Override - public void process( org.smslib.AGateway gateway, org.smslib.OutboundMessage msg ) - { - Logger.getInstance().logInfo( "Attempting or failed to send message from queue to: " + msg.getRecipient(), null, null ); - } - } - - /** - * Functions as a caller id to notify when call is received on the modem - */ - class CallNotification implements ICallNotification - { - - @Override - public void process( org.smslib.AGateway gateway, String callerId ) - { - Logger.getInstance().logInfo( "Receiving call from: " + callerId, null, null ); - } - } - - /** - * Callback to manage the messages that are queued for sending. Any failed outgoing messages are stored in the queue - */ - class QueueSendingNotification implements IQueueSendingNotification - { - - @Override - public void process( org.smslib.AGateway gateway, OutboundMessage msg ) - { - Logger.getInstance().logInfo( "**** >>>> Now Sending: " + msg.getRecipient(), null, gateway.getGatewayId() ); - } - } - - /** - * TODO: ADVISORY: http://blog.smslib.org/2011/05/orphaned-part-detection-issue.html - * Commented the code callback for Orphaned message - */ - /*class OrphanedMessageNotification implements IOrphanedMessageNotification - { - - @Override - public boolean process( org.smslib.AGateway gateway, InboundMessage msg ) - { - System.out.println( "&&&&&&&&&&&&&&&&& ORPHANED INFO &&&&&&&&&&&&&&&&&" ); - System.out.println( msg ); - System.out.println( "&&&&&&&&&&&&&&&&& ORPHANED INFO &&&&&&&&&&&&&&&&&" ); - Logger.getInstance().logInfo( "Leaving orphaned message in queue ", null, gateway.getGatewayId() ); - // Return FALSE to leave orphaned parts in memory. - return false; - } - }*/ - // - - /*------------------------------------------------------------------ - * Helper Methods - ------------------------------------------------------------------*/ - /** - * The Thread that polls the modem to check for all messages on the SIM - * NOTE: THE POLLING TIME, SIM MEMORY LOCATION ARE SET THROUGH CONFIGURATION - */ - // - class InboundPollingTask extends TimerTask - { - - @Override - public void run() - { - try - { - if ( isServiceRunning() ) - { - Logger.getInstance().logDebug( "InboundPollingTask() run.", null, null ); - readMessages(); - } - } catch ( Exception e ) - { - Logger.getInstance().logDebug( "Error in InboundPollingTask()", e, null ); - } - } - } - // - - public Properties getProperties() - { - return props; - } - - /** - * Read the messages from the memory location and save it in the sms_inbound - */ - // - void readMessages() - { - List msgList = new ArrayList(); - try - { - // Read the messages from SIM memory location, which are Inbound messages - Service.getInstance().readMessages( msgList, InboundMessage.MessageClasses.ALL ); - Logger.getInstance().logInfo( "Total messages read at " + Calendar.getInstance().getTime() + " = " + msgList.size(), null, null ); - if ( msgList.size() > 0 ) - { - for ( InboundMessage inMsg : msgList ) - { - try - { - InboundBinaryMessage msg = (InboundBinaryMessage) inMsg; - //Creating sms to store in database - SmsInbound sms = new SmsInbound(); - - //Set sms encoding - if ( msg.getEncoding() == MessageEncodings.ENC7BIT ) - { - sms.setEncoding( '7' ); - } else - { - if ( msg.getEncoding() == MessageEncodings.ENC8BIT ) - { - sms.setEncoding( '8' ); - } else - { - if ( msg.getEncoding() == MessageEncodings.ENCUCS2 ) - { - sms.setEncoding( 'U' ); - } - } - } - - sms.setGatewayId( msg.getGatewayId() ); - sms.setMessageDate( new Date() ); - sms.setOriginalReceiveDate( msg.getDate() ); - sms.setOriginalRefNo( String.valueOf( msg.getMpRefNo() ) ); - sms.setOriginator( msg.getOriginator() ); - sms.setProcess( 0 ); - sms.setReceiveDate( msg.getDate() ); - sms.setText( new String( Compressor.decompress( msg.getDataBytes() ), "UTF-8" ) ); - if ( msg.getType() == MessageTypes.INBOUND ) - { - sms.setType( 'I' ); - } else - { - if ( msg.getType() == MessageTypes.OUTBOUND ) - { - sms.setType( 'O' ); - } else - { - if ( msg.getType() == MessageTypes.STATUSREPORT ) - { - sms.setType( 'S' ); - } else - { - sms.setType( 'U' ); - } - } - } - - //saving sms into database - smsInboundStoreService.saveSms( sms ); - Logger.getInstance().logDebug( "Saved Sms from " + msg.getOriginator(), null, null ); - - //Delete message based on configuration - if ( getProperties().getProperty( "settings.delete_after_processing", "no" ).equalsIgnoreCase( "yes" ) ) - { - Service.getInstance().deleteMessage( msg ); - } - } catch ( ClassCastException ccex ) - { - Logger.getInstance().logInfo( "Ignoring incorrect formatted message", ccex, null ); - } - } - } - } catch ( Exception e ) - { - Logger.getInstance().logError( "SMSServer: reading messages exception!", e, null ); - } - } - // - - /** - * Loads the configuration settings from SMSServer.conf, which should be located in the DHIS2_HOME directory - * @return The message to be displayed on UI after loading of configuration from file is complete - * @throws Exception - */ - // - private String loadConfiguration() throws Exception - { - String configFile = System.getenv( "DHIS2_HOME" ) + File.separator + "SMSServer.conf"; - - if ( new File( configFile ).exists() ) - { - Collection existingGateways = new ArrayList(); - existingGateways.addAll( Service.getInstance().getGateways() ); - - //Remove all existing gateways - for ( AGateway gateway : existingGateways ) - { - Service.getInstance().removeGateway( gateway ); - } - - //Load properties from configuration file - FileInputStream f = new FileInputStream( configFile ); - this.props = new Properties(); - getProperties().load( f ); - f.close(); - - //Add gateway to service based on configuration file - // - for ( int i = 0; i < Integer.MAX_VALUE; i++ ) - { - try - { - String propName = "gateway." + i; - String propValue = getProperties().getProperty( propName, "" ).trim(); - if ( propValue.length() == 0 ) - { - break; - } - String modemName = propValue.split( "\\," )[0].trim(); - if ( modemName.contains( "bulksms" ) ) - { - String username = getProperties().getProperty( "bulksms.username" ); - String password = getProperties().getProperty( "bulksms.password" ); - BulkSmsHTTPGateway gateway = new BulkSmsHTTPGateway("bulksms.http.1", username, password); - gateway.setOutbound( true ); - gateway.setInbound( true ); - Service.getInstance().addGateway( gateway ); - } else if( modemName.contains( "clickatell") ) - { - String username = getProperties().getProperty( "clickatell.username" ); - String password = getProperties().getProperty( "clickatell.password" ); - String api_id = getProperties().getProperty( "clickatell.api_id" ); - DhisClickatellGateway gateway = new DhisClickatellGateway( "clickatell.http.1", api_id, username, password ); - gateway.setOutbound( true ); - gateway.setInbound( true ); - Service.getInstance().addGateway( gateway ); - } - else{ - String port = getProperties().getProperty( modemName + ".port" ); - int baudRate = Integer.parseInt( getProperties().getProperty( modemName + ".baudrate" ) ); - String manufacturer = getProperties().getProperty( modemName + ".manufacturer" ); - String model = getProperties().getProperty( modemName + ".model" ); - String protocol = getProperties().getProperty( modemName + ".protocol" ); - String pin = getProperties().getProperty( modemName + ".pin" ); - String inbound = getProperties().getProperty( modemName + ".inbound" ); - String outbound = getProperties().getProperty( modemName + ".outbound" ); - String simMemLocation = getProperties().getProperty( modemName + ".simMemLocation" ); - - // TODO: DETECT MODEM CLASS AND INSTANTIATE - SerialModemGateway gateway = new SerialModemGateway( modemName, port, baudRate, manufacturer, model ); - - if ( simMemLocation != null && !simMemLocation.equals( "-" ) ) - { - gateway.getATHandler().setStorageLocations( simMemLocation ); - } - - if ( protocol != null && protocol.equalsIgnoreCase( "PDU" ) ) - { - gateway.setProtocol( Protocols.PDU ); - } else - { - if ( protocol != null && protocol.equalsIgnoreCase( "TEXT" ) ) - { - gateway.setProtocol( Protocols.TEXT ); - - } else - { - gateway.setProtocol( Protocols.PDU ); - } - } - if ( pin != null ) - { - gateway.setSimPin( pin ); - } - if ( inbound.equalsIgnoreCase( "yes" ) ) - { - gateway.setInbound( true ); - } else - { - gateway.setInbound( false ); - } - if ( outbound.equalsIgnoreCase( "yes" ) ) - { - gateway.setOutbound( true ); - } else - { - gateway.setOutbound( false ); - } - Service.getInstance().addGateway( gateway ); - } - Logger.getInstance().logInfo( "Load Configuration: added gateway " + i + " / ", null, null ); - } catch ( Exception e ) - { - Logger.getInstance().logError( "Load Configuration: Unknown Gateway in configuration file!, " + e.getMessage(), null, null ); - } - } - // - return "SUCCESSFULLY STARTED SERVICE"; - } else - { - return "ERROR LOADING CONFIGURATION FILE"; - } - } - // -} === removed directory 'dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/api' === removed file 'dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/api/ReceiveSMS.java' --- dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/api/ReceiveSMS.java 2011-05-06 14:31:30 +0000 +++ dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/api/ReceiveSMS.java 1970-01-01 00:00:00 +0000 @@ -1,90 +0,0 @@ -package org.hisp.dhis.mobile.sms.api; - -import java.io.Serializable; - -public class ReceiveSMS implements Serializable - -{ - /** - * Sender Phone Number with time of Received, Unique and Required. - */ - private String receiverInfo; - - /** - * Message to send to sender, Required - */ - private String receiveingMessage; - - // ------------------------------------------------------------------------- - // Contructors - // ------------------------------------------------------------------------- - - public ReceiveSMS() - { - - } - - public ReceiveSMS( String receiverInfo, String receiveingMessage ) - { - this.receiverInfo = receiverInfo; - this.receiveingMessage = receiveingMessage; - } - - // ------------------------------------------------------------------------- - // hashCode and equals - // ------------------------------------------------------------------------- - - @Override - public int hashCode() - { - return receiverInfo.hashCode(); - } - - @Override - public boolean equals( Object o ) - { - if ( this == o ) - { - return true; - } - - if ( o == null ) - { - return false; - } - - if ( !(o instanceof ReceiveSMS) ) - { - return false; - } - - final ReceiveSMS other = (ReceiveSMS) o; - - return receiverInfo.equals( other.getReceiverInfo() ); - } - - // ------------------------------------------------------------------------- - // Getters and setters - // ------------------------------------------------------------------------- - - public String getReceiverInfo() - { - return receiverInfo; - } - - public void setReceiverInfo( String receiverInfo ) - { - this.receiverInfo = receiverInfo; - } - - public String getReceiveingMessage() - { - return receiveingMessage; - } - - public void setReceiveingMessage( String receiveingMessage ) - { - this.receiveingMessage = receiveingMessage; - } - -} === removed file 'dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/api/ReceiveSMSService.java' --- dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/api/ReceiveSMSService.java 2012-05-29 07:58:51 +0000 +++ dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/api/ReceiveSMSService.java 1970-01-01 00:00:00 +0000 @@ -1,22 +0,0 @@ -package org.hisp.dhis.mobile.sms.api; - -import java.util.Collection; - -public interface ReceiveSMSService -{ - - String ID = ReceiveSMSService.class.getName(); - - void addReceiveSMS ( ReceiveSMS receiveSMS ); - - void updateReceiveSMS ( ReceiveSMS receiveSMS ); - - void deleteReceiveSMS ( ReceiveSMS receiveSMS ); - - Collection getReceiveSMS( int start, int end ); - - Collection getAllReceiveSMS(); - - long getRowCount(); - -} === removed file 'dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/api/ReceiveSMSStore.java' --- dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/api/ReceiveSMSStore.java 2012-05-29 07:58:51 +0000 +++ dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/api/ReceiveSMSStore.java 1970-01-01 00:00:00 +0000 @@ -1,22 +0,0 @@ -package org.hisp.dhis.mobile.sms.api; - -import java.util.Collection; - -public interface ReceiveSMSStore -{ - - String ID = ReceiveSMSService.class.getName(); - - void addReceiveSMS ( ReceiveSMS receiveSMS ); - - void updateReceiveSMS ( ReceiveSMS receiveSMS ); - - void deleteReceiveSMS ( ReceiveSMS receiveSMS ); - - Collection getReceiveSMS( int start, int end ); - - Collection getAllReceiveSMS(); - - long getRowCount(); - -} === removed file 'dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/api/SendSMS.java' --- dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/api/SendSMS.java 2011-05-06 14:31:30 +0000 +++ dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/api/SendSMS.java 1970-01-01 00:00:00 +0000 @@ -1,91 +0,0 @@ -package org.hisp.dhis.mobile.sms.api; - -import java.io.Serializable; - -public class SendSMS implements Serializable -{ - public static final int sendSMSRange = 30; - - /** - * Sender Phone Number with time of Received, Unique and Required. - */ - private String senderInfo; - - /** - * Message to send to sender, Required - */ - private String sendingMessage; - - // ------------------------------------------------------------------------- - // Contructors - // ------------------------------------------------------------------------- - - public SendSMS() - { - - } - - public SendSMS( String senderInfo, String sendingMessage ) - { - this.senderInfo = senderInfo; - this.sendingMessage = sendingMessage; - } - - // ------------------------------------------------------------------------- - // hashCode and equals - // ------------------------------------------------------------------------- - - @Override - public int hashCode() - { - return senderInfo.hashCode(); - } - - @Override - public boolean equals( Object o ) - { - if ( this == o ) - { - return true; - } - - if ( o == null ) - { - return false; - } - - if ( !(o instanceof SendSMS) ) - { - return false; - } - - final SendSMS other = (SendSMS) o; - - return senderInfo.equals( other.getSenderInfo() ); - } - - // ------------------------------------------------------------------------- - // Getters and setters - // ------------------------------------------------------------------------- - - public String getSenderInfo() - { - return senderInfo; - } - - public void setSenderInfo( String senderInfo ) - { - this.senderInfo = senderInfo; - } - - public String getSendingMessage() - { - return sendingMessage; - } - - public void setSendingMessage( String sendingMessage ) - { - this.sendingMessage = sendingMessage; - } - -} === removed file 'dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/api/SendSMSService.java' --- dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/api/SendSMSService.java 2011-05-06 14:31:30 +0000 +++ dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/api/SendSMSService.java 1970-01-01 00:00:00 +0000 @@ -1,25 +0,0 @@ -package org.hisp.dhis.mobile.sms.api; - -import java.util.Collection; - -public interface SendSMSService -{ - String ID = SendSMSService.class.getName(); - - // ------------------------------------------------------------------------- - // SendSMS - // ------------------------------------------------------------------------- - - void addSendSMS( SendSMS sendSMS ); - - void updateSendSMS( SendSMS sendSMS ); - - void deleteSendSMS( SendSMS sendSMS ); - - Collection getSendSMS( int start, int end ); - - Collection getAllSendSMS( ); - - long getRowCount(); - -} === removed file 'dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/api/SendSMSStore.java' --- dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/api/SendSMSStore.java 2011-05-06 14:31:30 +0000 +++ dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/api/SendSMSStore.java 1970-01-01 00:00:00 +0000 @@ -1,24 +0,0 @@ -package org.hisp.dhis.mobile.sms.api; - -import java.util.Collection; - -public interface SendSMSStore -{ - String ID = SendSMSStore.class.getName(); - - // ------------------------------------------------------------------------- - // SendSMS - // ------------------------------------------------------------------------- - - void addSendSMS( SendSMS sendSMS ); - - void updateSendSMS( SendSMS sendSMS ); - - void deleteSendSMS( SendSMS sendSMS ); - - Collection getSendSMS( int start, int end ); - - Collection getAllSendSMS( ); - - long getRowCount(); -} === removed file 'dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/api/SmsFormat.java' --- dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/api/SmsFormat.java 2011-05-06 14:31:30 +0000 +++ dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/api/SmsFormat.java 1970-01-01 00:00:00 +0000 @@ -1,109 +0,0 @@ -package org.hisp.dhis.mobile.sms.api; - -/* - * Copyright (c) 2004-2007, 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. - */ -/** - * - * @author Saptarshi - */ -public class SmsFormat -{ - - String version; - - String formId; - - String periodTypeId; - - String periodText; - - String[] dataValues; - - public SmsFormat( SmsInbound sms ) - { - String info = sms.getText(); - String[] text = info.split( "#" ); - version = text[0]; - text = text[1].split( "\\*" ); - formId = text[0]; - text = text[1].split( "\\?" ); - periodTypeId = text[0]; - text = text[1].split( "\\$" ); - periodText = text[0]; - dataValues = text[1].split( "\\|", 1000 ); - } - - public String[] getDataValues() - { - return dataValues; - } - - public void setDataValues( String[] dataValues ) - { - this.dataValues = dataValues; - } - - public String getFormId() - { - return formId; - } - - public void setFormId( String formId ) - { - this.formId = formId; - } - - public String getPeriodText() - { - return periodText; - } - - public void setPeriodText( String periodText ) - { - this.periodText = periodText; - } - - public String getPeriodTypeId() - { - return periodTypeId; - } - - public void setPeriodTypeId( String periodTypeId ) - { - this.periodTypeId = periodTypeId; - } - - public String getVersion() - { - return version; - } - - public void setVersion( String version ) - { - this.version = version; - } -} === removed file 'dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/api/SmsImportService.java' --- dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/api/SmsImportService.java 2011-05-06 14:31:30 +0000 +++ dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/api/SmsImportService.java 1970-01-01 00:00:00 +0000 @@ -1,37 +0,0 @@ -package org.hisp.dhis.mobile.sms.api; - -/* - * Copyright (c) 2004-2007, 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. - */ - -/** - * - * @author Saptarshi - */ -public interface SmsImportService -{ - int saveDataValues(); -} === removed file 'dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/api/SmsInbound.java' --- dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/api/SmsInbound.java 2011-05-06 14:31:30 +0000 +++ dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/api/SmsInbound.java 1970-01-01 00:00:00 +0000 @@ -1,247 +0,0 @@ -package org.hisp.dhis.mobile.sms.api; - -/* - * Copyright (c) 2004-2007, 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 java.io.Serializable; -import java.util.Date; - -/** - * - * @author Saptarshi - */ -public class SmsInbound implements Serializable -{ - // ------------------------------------------------------------------------- - // Properties - // ------------------------------------------------------------------------- - // - /* - * The table's primary key. - */ - private Integer id; - - /* - * When new rows (i.e. messages) are created, sets this field to 0. - * When datavalues successfully saved (completed), sets this field to 1. - * When datavalues cannot be saved (bounced), sets this field to 2. - */ - private Integer process; - - /* - * The originator of the received message. - */ - private String originator; - - /* - * "I" for inbound message, "S" for status report message. - */ - private Character type; - - /* - * "7" for 7bit, "8" for 8bit and "U" for Unicode/UCS2. - */ - private Character encoding; - - /* - * The message date (retrieved by the message headers). - */ - private Date messageDate; - - /* - * The datetime when message was received. - */ - private Date receiveDate; - - /* - * The body of the message. - */ - private String text; - - /* - * Available only for status report messages: refers to the RefNo of the original outbound message. - */ - private String originalRefNo; - - /* - * Available only for status report messages: refers to the receive date of the original outbound message. - */ - private Date originalReceiveDate; - - /* - * The ID of the gateway from which the message was received. - */ - private String gatewayId; - // - - // ------------------------------------------------------------------------- - // Getter-Setters - // ------------------------------------------------------------------------- - // - public Character getEncoding() - { - return encoding; - } - - public void setEncoding( Character encoding ) - { - this.encoding = encoding; - } - - public String getGatewayId() - { - return gatewayId; - } - - public void setGatewayId( String gatewayId ) - { - this.gatewayId = gatewayId; - } - - public Integer getId() - { - return id; - } - - public void setId( Integer id ) - { - this.id = id; - } - - public Date getMessageDate() - { - return messageDate; - } - - public void setMessageDate( Date messageDate ) - { - this.messageDate = messageDate; - } - - public Date getOriginalReceiveDate() - { - return originalReceiveDate; - } - - public void setOriginalReceiveDate( Date originalReceiveDate ) - { - this.originalReceiveDate = originalReceiveDate; - } - - public String getOriginalRefNo() - { - return originalRefNo; - } - - public void setOriginalRefNo( String originalRefNo ) - { - this.originalRefNo = originalRefNo; - } - - public String getOriginator() - { - return originator; - } - - public void setOriginator( String originator ) - { - this.originator = originator; - } - - public Integer getProcess() - { - return process; - } - - public void setProcess( Integer process ) - { - this.process = process; - } - - public Date getReceiveDate() - { - return receiveDate; - } - - public void setReceiveDate( Date receiveDate ) - { - this.receiveDate = receiveDate; - } - - public String getText() - { - return text; - } - - public void setText( String text ) - { - this.text = text; - } - - public Character getType() - { - return type; - } - - public void setType( Character type ) - { - this.type = type; - } - // - - // ------------------------------------------------------------------------- - // hashCode and equals - // ------------------------------------------------------------------------- - // - @Override - public int hashCode() - { - return this.hashCode(); - } - - @Override - public boolean equals( Object o ) - { - if ( this == o ) - { - return true; - } - - if ( o == null ) - { - return false; - } - - if ( !(o instanceof ReceiveSMS) ) - { - return false; - } - final SmsInbound other = (SmsInbound) o; - return o.equals( other ); - } - // -} === removed file 'dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/api/SmsInboundStore.java' --- dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/api/SmsInboundStore.java 2011-12-26 10:07:59 +0000 +++ dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/api/SmsInboundStore.java 1970-01-01 00:00:00 +0000 @@ -1,49 +0,0 @@ -package org.hisp.dhis.mobile.sms.api; - -/* - * Copyright (c) 2004-2012, 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 java.util.Collection; -import java.util.Date; - -/** - * The API for CRUD into the sms_inbound table - * @author Saptarshi - */ -public interface SmsInboundStore -{ - - String ID = SmsInboundStore.class.getName(); - - void saveSms( SmsInbound sms ); - - Collection getSms( String originator, Integer process, Date startDate, Date endDate); - - void updateSms (SmsInbound sms); - - long getSmsCount(); -} === removed file 'dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/api/SmsInboundStoreService.java' --- dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/api/SmsInboundStoreService.java 2011-12-26 10:07:59 +0000 +++ dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/api/SmsInboundStoreService.java 1970-01-01 00:00:00 +0000 @@ -1,55 +0,0 @@ -package org.hisp.dhis.mobile.sms.api; - -/* - * Copyright (c) 2004-2012, 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 java.util.Collection; -import java.util.Date; - -/** - * - * @author Saptarshi - */ -public interface SmsInboundStoreService -{ - - String ID = SmsInboundStoreService.class.getName(); - - void saveSms( SmsInbound sms ); - - Collection getSmsByDate( Date startDate, Date endDate ); - - Collection getSmsByOriginator( String originator ); - - Collection getSmsByProcess( int process ); - - Collection getAllReceivedSms(); - - void updateSms( SmsInbound sms ); - - long getSmsCount(); -} === removed directory 'dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/utils' === removed file 'dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/utils/Compressor.java' --- dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/utils/Compressor.java 2011-05-06 14:31:30 +0000 +++ dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/utils/Compressor.java 1970-01-01 00:00:00 +0000 @@ -1,337 +0,0 @@ -/** - * Implementation of Range Coding Compression/Decompression - * Range encoding is a lossless data compression method defined by G N N Martin in his - * 1979 paper on "Range encoding: an algorithm for removing redundancy from a - * digitized message". - * - * This code was written to provide simple data compression for J2ME. - * - * Based on reference materials and code from http://www.bodden.de/studies/ac/ - * - * The homepage for this software is http://winterwell.com/software/compressor.php - * - * (c) 2008 Joe Halliwell - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ -package org.hisp.dhis.mobile.sms.utils; - - -import java.io.IOException; -import java.io.ByteArrayOutputStream; - -public class Compressor -{ - - /* Tailored to int as 32bit signed */ - private final static int FIRST_QUARTER = 0x200000; - - private final static int THIRD_QUARTER = 0x600000; - - private final static int HALF = 0x400000; - - private final static int HIGH = 0x7fffff; - - private final static int INITIAL_READ = 23; - - public static byte[] compress( byte[] in ) - { - - class BitOutputBuffer - { - - ByteArrayOutputStream buf; - - byte[] currentByte; - - byte currentBit; - - BitOutputBuffer() - { - buf = new ByteArrayOutputStream(); - currentByte = new byte[1]; - currentByte[0] = 0; - currentBit = 0; - } - - void writeBit( byte bit ) throws IOException - { - currentByte[0] = (byte) ( ( currentByte[0] ) << 1 ); - currentByte[0] += bit; - currentBit += 1; - if ( currentBit == 8 ) - { - buf.write( currentByte ); - currentByte[0] = 0; - currentBit = 0; - } - } - - void flush() throws IOException - { - /* Pad the buffer with zeros */ - while ( currentBit != 0 ) - { - writeBit( (byte) 0 ); - } - buf.flush(); - } - - byte[] toByteArray() - { - try - { - buf.flush(); - return buf.toByteArray(); - } catch ( IOException e ) - { - return null; - } - } - } - - BitOutputBuffer bitBuf = new BitOutputBuffer(); - - int low = 0, high = HIGH, total; - int mLow = low, mHigh = high, mStep = 0; - int mScale = 0; - int current = 0; - - /* Initialize frequency table */ - int[] freq = new int[257]; - for ( int i = 0; i < 257; i++ ) - { - freq[i] = 1; - } - total = 257; - - try - { - - for ( int i = 0; i < in.length + 1; i++ ) - { - - if ( i == in.length ) - { - /* Encode terminator if necessary */ - low = total - 1; - high = total; - } else - { - /* Otherwise retrieve cumulative freq */ - current = in[i] & 0xff; // Get unsigned value - low = 0; - for ( int j = 0; j < current; j++ ) - { - low += freq[j]; - } - high = low + freq[current]; - } - - /* 2. Update the coder */ - mStep = ( mHigh - mLow + 1 ) / total; - mHigh = ( mLow + mStep * high ) - 1; - mLow = mLow + mStep * low; - - /* Renormalize if possible */ - while ( ( mHigh < HALF ) || ( mLow >= HALF ) ) - { - if ( mHigh < HALF ) - { - bitBuf.writeBit( (byte) 0 ); - mLow = mLow * 2; - mHigh = mHigh * 2 + 1; - - /* Perform e3 mappings */ - for ( ; mScale > 0; mScale-- ) - { - bitBuf.writeBit( (byte) 1 ); - } - } else - { - if ( mLow >= HALF ) - { - bitBuf.writeBit( (byte) 1 ); - mLow = ( mLow - HALF ) * 2; - mHigh = ( mHigh - HALF ) * 2 + 1; - - /* Perform e3 mappings */ - for ( ; mScale > 0; mScale-- ) - { - bitBuf.writeBit( (byte) 0 ); - } - } - } - } - - while ( ( FIRST_QUARTER <= mLow ) && ( mHigh < THIRD_QUARTER ) ) - { - mScale++; - mLow = ( mLow - FIRST_QUARTER ) * 2; - mHigh = ( mHigh - FIRST_QUARTER ) * 2 + 1; - } - - /* 3. Update model */ - freq[current] += 1; - total += 1; - - } - /* Finish encoding */ - if ( mLow < FIRST_QUARTER ) - { - /* Case: mLow < FirstQuarter < Half <= mHigh */ - bitBuf.writeBit( (byte) 0 ); - /* Perform e3-scaling */ - for ( int i = 0; i < mScale + 1; i++ ) - { - bitBuf.writeBit( (byte) 1 ); - } - } else - { - /* Case: mLow < Half < ThirdQuarter <= mHigh */ - bitBuf.writeBit( (byte) 1 ); - } - bitBuf.flush(); - } catch ( IOException e ) - { - return null; - } - return bitBuf.toByteArray(); - } - - public static byte[] decompress( byte[] in ) - { - - class BitInputBuffer - { - - byte[] source; - - int bytep = 0, bitp = 0; - - byte currentByte = 0; - - BitInputBuffer( byte[] source ) - { - this.source = source; - currentByte = source[0];// & 0xff; - } - - int readBit() - { - int result = ( currentByte >> 7 ) & 1; - currentByte = (byte) ( currentByte << 1 ); - if ( bitp++ == 7 ) - { - bytep++; - if ( bytep > source.length - 1 ) - { - currentByte = 0; - } else - { - currentByte = source[bytep]; - bitp = 0; - } - } - return result; - } - } - - ByteArrayOutputStream buf = new ByteArrayOutputStream(); - /* Initialise frequency table */ - - int[] freq = new int[257]; - for ( int i = 0; i < 257; i++ ) - { - freq[i] = 1; - } - int total = 257; - int current = 0; - int value; - int low = 0, high = HIGH; - int mLow = low, mHigh = high, mStep = 0, mScale = 0, mBuffer = 0; - BitInputBuffer inbuf = new BitInputBuffer( in ); - /* Fill buffer with bits from the input stream */ - - for ( int i = 0; i < INITIAL_READ; i++ ) - { - mBuffer = 2 * mBuffer; - mBuffer += inbuf.readBit(); - } - - while ( true ) - { - /* 1. Retrieve current byte */ - mStep = ( mHigh - mLow + 1 ) / total; - value = ( mBuffer - mLow ) / mStep; - low = 0; - for ( current = 0; current < 256 && low + freq[current] <= value; current++ ) - { - low += freq[current]; - } - - if ( current == 256 ) - { - break; - } - - buf.write( current ); - high = low + freq[current]; - - /* 2. Update the decoder */ - mHigh = mLow + mStep * high - 1; // interval open at the top => -1 - - /* Update lower bound */ - mLow = mLow + mStep * low; - - /* e1/e2 mapping */ - while ( ( mHigh < HALF ) || ( mLow >= HALF ) ) - { - if ( mHigh < HALF ) - { - mLow = mLow * 2; - mHigh = ( ( mHigh * 2 ) + 1 ); - mBuffer = ( 2 * mBuffer ); - } else - { - if ( mLow >= HALF ) - { - mLow = 2 * ( mLow - HALF ); - mHigh = 2 * ( mHigh - HALF ) + 1; - mBuffer = 2 * ( mBuffer - HALF ); - } - } - - mBuffer += inbuf.readBit(); - mScale = 0; - } - - /* e3 mapping */ - while ( ( FIRST_QUARTER <= mLow ) && ( mHigh < THIRD_QUARTER ) ) - { - mScale++; - mLow = 2 * ( mLow - FIRST_QUARTER ); - mHigh = 2 * ( mHigh - FIRST_QUARTER ) + 1; - mBuffer = 2 * ( mBuffer - FIRST_QUARTER ); - mBuffer += inbuf.readBit(); - } - - /* 3. Update frequency table */ - freq[current] += 1; - total += 1; - } - - return buf.toByteArray(); - } -} === removed file 'dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/utils/XMLFilter.java' --- dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/utils/XMLFilter.java 2011-05-06 14:31:30 +0000 +++ dhis-mobile/dhis-service-sms/src/main/java/org/hisp/dhis/mobile/sms/utils/XMLFilter.java 1970-01-01 00:00:00 +0000 @@ -1,12 +0,0 @@ -package org.hisp.dhis.mobile.sms.utils; - -import java.io.File; -import java.io.FilenameFilter; - -public class XMLFilter implements FilenameFilter -{ - public boolean accept(File dir, String name) - { - return ( name.endsWith(".xml") ); - } -} === removed directory 'dhis-mobile/dhis-service-sms/src/main/resources' === removed directory 'dhis-mobile/dhis-service-sms/src/main/resources/META-INF' === removed directory 'dhis-mobile/dhis-service-sms/src/main/resources/META-INF/dhis' === removed file 'dhis-mobile/dhis-service-sms/src/main/resources/META-INF/dhis/beans.xml' --- dhis-mobile/dhis-service-sms/src/main/resources/META-INF/dhis/beans.xml 2011-05-06 14:31:30 +0000 +++ dhis-mobile/dhis-service-sms/src/main/resources/META-INF/dhis/beans.xml 1970-01-01 00:00:00 +0000 @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - === removed directory 'dhis-mobile/dhis-service-sms/src/main/resources/org' === removed directory 'dhis-mobile/dhis-service-sms/src/main/resources/org/hisp' === removed directory 'dhis-mobile/dhis-service-sms/src/main/resources/org/hisp/dhis' === removed directory 'dhis-mobile/dhis-service-sms/src/main/resources/org/hisp/dhis/mobile' === removed directory 'dhis-mobile/dhis-service-sms/src/main/resources/org/hisp/dhis/mobile/sms' === removed directory 'dhis-mobile/dhis-service-sms/src/main/resources/org/hisp/dhis/mobile/sms/hibernate' === removed file 'dhis-mobile/dhis-service-sms/src/main/resources/org/hisp/dhis/mobile/sms/hibernate/Sms.hbm.xml' --- dhis-mobile/dhis-service-sms/src/main/resources/org/hisp/dhis/mobile/sms/hibernate/Sms.hbm.xml 2011-05-06 14:31:30 +0000 +++ dhis-mobile/dhis-service-sms/src/main/resources/org/hisp/dhis/mobile/sms/hibernate/Sms.hbm.xml 1970-01-01 00:00:00 +0000 @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - === removed directory 'dhis-mobile/dhis-service-sms/src/test' === removed directory 'dhis-mobile/dhis-service-sms/src/test/java' === removed directory 'dhis-mobile/dhis-service-sms/src/test/java/org' === removed directory 'dhis-mobile/dhis-service-sms/src/test/java/org/hisp' === removed directory 'dhis-mobile/dhis-service-sms/src/test/java/org/hisp/dhis' === removed directory 'dhis-mobile/dhis-service-sms/src/test/java/org/hisp/dhis/mobile' === removed directory 'dhis-mobile/dhis-service-sms/src/test/java/org/hisp/dhis/mobile/sms' === removed file 'dhis-mobile/dhis-service-sms/src/test/java/org/hisp/dhis/mobile/sms/DefaultSmsInboundStoreServiceTest.java' --- dhis-mobile/dhis-service-sms/src/test/java/org/hisp/dhis/mobile/sms/DefaultSmsInboundStoreServiceTest.java 2011-05-06 14:31:30 +0000 +++ dhis-mobile/dhis-service-sms/src/test/java/org/hisp/dhis/mobile/sms/DefaultSmsInboundStoreServiceTest.java 1970-01-01 00:00:00 +0000 @@ -1,140 +0,0 @@ -package org.hisp.dhis.mobile.sms; - - -import org.hisp.dhis.mobile.sms.api.SmsInboundStoreService; -import java.util.Calendar; -import org.hisp.dhis.DhisSpringTest; -import java.util.Collection; -import java.util.Date; -import org.hisp.dhis.mobile.sms.api.SmsInbound; -import org.junit.Test; -import static org.junit.Assert.*; - -/** - * - * @author Saptarshi - */ -public class DefaultSmsInboundStoreServiceTest extends DhisSpringTest -{ - - private SmsInboundStoreService smsInboundStoreService; - - private SmsInbound testSms; - - // ------------------------------------------------------------------------- - // Fixture - // ------------------------------------------------------------------------- - @Override - public void setUpTest() - throws Exception - { - smsInboundStoreService = (SmsInboundStoreService) getBean( SmsInboundStoreService.ID ); - testSms = new SmsInbound(); - testSms.setEncoding( 'U' ); - testSms.setGatewayId( "modem1" ); - testSms.setMessageDate( new Date() ); - testSms.setOriginalReceiveDate( new Date() ); - testSms.setOriginalRefNo( "1" ); - testSms.setProcess( 0 ); - testSms.setReceiveDate( new Date() ); - testSms.setText( "I AM A DISCO DANCER" ); - testSms.setType( 'I' ); - testSms.setOriginator( "+919867192752" ); - } - - /** - * Test of saveSms method, of class HibernateSmsInboundStore. - */ - @Test - public void testSaveSms() - { - System.out.println( "testSaveSms" ); - smsInboundStoreService.saveSms( testSms ); - - for ( SmsInbound savedSms : smsInboundStoreService.getAllReceivedSms() ) - { - assertEquals( testSms, savedSms ); - } - } - - /** - * Test of getSmsByDate method, of class HibernateSmsInboundStore. - */ - @Test - public void testGetSmsByDate() throws Exception - { - System.out.println( "testSaveSms" ); - Calendar today = Calendar.getInstance(); - Calendar prevDay = ( (Calendar) today.clone() ); - prevDay.add( Calendar.DAY_OF_YEAR, -1 ); - Calendar nextDay = ( (Calendar) today.clone() ); - nextDay.add( Calendar.DAY_OF_YEAR, 1 ); - System.out.println( "testGetSmsByDate" ); - Date startDate = prevDay.getTime(); - Date endDate = nextDay.getTime(); - smsInboundStoreService.saveSms( testSms ); - Collection smsByDate = smsInboundStoreService.getSmsByDate( startDate, endDate ); - for ( SmsInbound sms : smsByDate ) - { - assertEquals( sms, testSms ); - } - } - - /** - * Test of getSmsByRecipient method, of class HibernateSmsInboundStore. - */ - @Test - public void testGetSmsByRecipient() - { - System.out.println( "testGetSmsByRecipient" ); - String originator = "+919867192752"; - smsInboundStoreService.saveSms( testSms ); - Collection result = smsInboundStoreService.getSmsByOriginator( originator ); - for ( SmsInbound sms : result ) - { - assertEquals( sms, testSms ); - } - } - - /** - * Test of getSmsByProcess method, of class HibernateSmsInboundStore. - */ - @Test - public void testGetSmsByProcess() - { - System.out.println( "testGetSmsByProcess" ); - smsInboundStoreService.saveSms( testSms ); - Collection result = smsInboundStoreService.getSmsByProcess( 0 ); - for ( SmsInbound sms : result ) - { - assertEquals( sms, testSms ); - } - } - - /** - * Test of getAllReceiveSMS method, of class HibernateSmsInboundStore. - */ - public void testGetAllReceiveSMS() - { - // TODO review the generated test code and remove the default call to fail. - fail( "The test case is a prototype." ); - } - - /** - * Test of updateSms method, of class HibernateSmsInboundStore. - */ - public void testUpdateSms() - { - // TODO review the generated test code and remove the default call to fail. - fail( "The test case is a prototype." ); - } - - /** - * Test of getSmsCount method, of class HibernateSmsInboundStore. - */ - public void testGetSmsCount() - { - // TODO review the generated test code and remove the default call to fail. - fail( "The test case is a prototype." ); - } -} === removed directory 'dhis-mobile/dhis-service-sms/src/test/java/org/hisp/dhis/mobile/sms/utils' === removed file 'dhis-mobile/dhis-service-sms/src/test/java/org/hisp/dhis/mobile/sms/utils/CompressorTest.java' --- dhis-mobile/dhis-service-sms/src/test/java/org/hisp/dhis/mobile/sms/utils/CompressorTest.java 2011-12-26 10:07:59 +0000 +++ dhis-mobile/dhis-service-sms/src/test/java/org/hisp/dhis/mobile/sms/utils/CompressorTest.java 1970-01-01 00:00:00 +0000 @@ -1,61 +0,0 @@ -package org.hisp.dhis.mobile.sms.utils; - -/* - * Copyright (c) 2004-2012, 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.hisp.dhis.mobile.sms.utils.Compressor; -import org.junit.Test; -import static org.junit.Assert.*; - -/** - * - * @author Saptarshi - */ -public class CompressorTest -{ - - public CompressorTest() - { - } - - /** - * Test of compress method, of class Compressor. - */ - @Test - public void testCompressDecompress() - { - System.out.println( "Compress-Decompress String test" ); - String testStr = "2#48*1?2010-11-08$1|2|3|4|5|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0"; - byte[] compressed = Compressor.compress( testStr.getBytes() ); - double diff = testStr.getBytes().length-compressed.length; - System.out.println( "Compression Ratio = " + ((diff/testStr.getBytes().length)*100.0D)+"%" ); - byte[] in = testStr.getBytes(); - byte[] expResult = testStr.getBytes(); - byte[] result = Compressor.decompress( Compressor.compress( in ) ); - assertArrayEquals( expResult, result ); - } -} === removed directory 'dhis-mobile/dhis-service-sms/src/test/resources' === removed directory 'dhis-mobile/dhis-web-sms' === removed file 'dhis-mobile/dhis-web-sms/log4j.properties' --- dhis-mobile/dhis-web-sms/log4j.properties 2011-05-06 14:31:30 +0000 +++ dhis-mobile/dhis-web-sms/log4j.properties 1970-01-01 00:00:00 +0000 @@ -1,29 +0,0 @@ - -# Configuration file for log4j - -# Log to file setup -log4j.appender.file = org.apache.log4j.RollingFileAppender -log4j.appender.file.File = dhis.log -log4j.appender.file.MaxFileSize = 100KB -log4j.appender.file.MaxBackupIndex = 3 -log4j.appender.file.layout = org.apache.log4j.PatternLayout -log4j.appender.file.layout.ConversionPattern = * %-5p %d{ABSOLUTE} %m (%F [%t])%n - -# Log to console setup -log4j.appender.console = org.apache.log4j.ConsoleAppender -log4j.appender.console.layout = org.apache.log4j.PatternLayout -log4j.appender.console.layout.ConversionPattern = * %-5p %d{ABSOLUTE} %m (%F [%t])%n - -#Audit log level -log4j.appender.AUDIT=org.apache.log4j.DailyRollingFileAppender -log4j.appender.AUDIT.File= audit.log -log4j.appender.AUDIT.DatePattern='.'yyyy-MM-dd -log4j.appender.AUDIT.threshold=AUDIT_TRAIL#org.hisp.dhis.system.util.AuditLogLevel -log4j.appender.AUDIT.layout=org.apache.log4j.PatternLayout -log4j.appender.AUDIT.layout.ConversionPattern= * %-5p %d{ABSOLUTE} %m %n - -# Categories (order: DEBUG, INFO, WARN, ERROR, FATAL) -log4j.rootCategory = WARN, console -log4j.category.org.hisp.dhis = INFO, AUDIT -log4j.category.org.amplecode = INFO -log4j.category.smslib = INFO \ No newline at end of file === removed file 'dhis-mobile/dhis-web-sms/pom.xml' --- dhis-mobile/dhis-web-sms/pom.xml 2012-05-29 07:58:51 +0000 +++ dhis-mobile/dhis-web-sms/pom.xml 1970-01-01 00:00:00 +0000 @@ -1,54 +0,0 @@ - - 4.0.0 - - - org.hisp.dhis - dhis-web - 2.9-SNAPSHOT - - - dhis-web-sms - war - DHIS SMS - - - dhis-web-sms - - - - - - - org.hisp.dhis - dhis-web-commons - - - org.hisp.dhis - dhis-web-commons-resources - war - - - org.hisp.dhis - dhis-service-sms - 2.9-SNAPSHOT - jar - - - - commons-fileupload - commons-fileupload - - - commons-io - commons-io - - - - - ../../ - - - - === removed directory 'dhis-mobile/dhis-web-sms/src' === removed directory 'dhis-mobile/dhis-web-sms/src/main' === removed directory 'dhis-mobile/dhis-web-sms/src/main/java' === removed directory 'dhis-mobile/dhis-web-sms/src/main/java/org' === removed directory 'dhis-mobile/dhis-web-sms/src/main/java/org/hisp' === removed directory 'dhis-mobile/dhis-web-sms/src/main/java/org/hisp/dhis' === removed directory 'dhis-mobile/dhis-web-sms/src/main/java/org/hisp/dhis/mobile' === removed directory 'dhis-mobile/dhis-web-sms/src/main/java/org/hisp/dhis/mobile/action' === removed file 'dhis-mobile/dhis-web-sms/src/main/java/org/hisp/dhis/mobile/action/MobileHomePageAction.java' --- dhis-mobile/dhis-web-sms/src/main/java/org/hisp/dhis/mobile/action/MobileHomePageAction.java 2011-05-06 14:31:30 +0000 +++ dhis-mobile/dhis-web-sms/src/main/java/org/hisp/dhis/mobile/action/MobileHomePageAction.java 1970-01-01 00:00:00 +0000 @@ -1,63 +0,0 @@ -package org.hisp.dhis.mobile.action; - -/* - * Copyright (c) 2004-2007, 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 com.opensymphony.xwork2.Action; -import java.io.File; - -public class MobileHomePageAction - implements Action -{ - - @Override - public String execute() throws Exception - { - File miFolder = new File( System.getenv( "DHIS2_HOME" ), "mi" ); - if ( !(miFolder.exists() && miFolder.isDirectory()) ) - { - miFolder.mkdir(); - } - File pendingFolder = new File( miFolder, "pending" ); - if ( !(pendingFolder.exists() && pendingFolder.isDirectory()) ) - { - pendingFolder.mkdir(); - } - File bouncedFolder = new File( miFolder, "bounced" ); - if ( !(bouncedFolder.exists() && bouncedFolder.isDirectory()) ) - { - bouncedFolder.mkdir(); - } - File completedFolder = new File( miFolder, "completed" ); - if ( !(completedFolder.exists() && completedFolder.isDirectory()) ) - { - completedFolder.mkdir(); - } - - return SUCCESS; - } -} === removed file 'dhis-mobile/dhis-web-sms/src/main/java/org/hisp/dhis/mobile/action/MobileSettingsAction.java' --- dhis-mobile/dhis-web-sms/src/main/java/org/hisp/dhis/mobile/action/MobileSettingsAction.java 2011-05-16 19:04:09 +0000 +++ dhis-mobile/dhis-web-sms/src/main/java/org/hisp/dhis/mobile/action/MobileSettingsAction.java 1970-01-01 00:00:00 +0000 @@ -1,380 +0,0 @@ -package org.hisp.dhis.mobile.action; - -/* - * Copyright (c) 2004-2007, 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 com.opensymphony.xwork2.Action; -import java.io.File; -import java.io.FileOutputStream; -import java.io.FileReader; -import java.io.FileWriter; -import java.util.Properties; - -public class MobileSettingsAction implements Action -{ - - private File configFile = new File( System.getenv( "DHIS2_HOME" ), "SMSServer.conf" ); - - private Properties props = new Properties(); - - private String balancer; - - public String getBalancer() - { - return props.getProperty( "smsserver.balancer" ); - } - - public void setBalancer( String balancer ) - { - props.setProperty( "smsserver.balancer", balancer ); - } - - private String router; - - public String getRouter() - { - return props.getProperty( "smsserver.router" ); - } - - public void setRouter( String router ) - { - props.setProperty( "smsserver.router", router ); - } - - private String gatewayName; - - public String getGatewayName() - { - return props.getProperty( "gateway.0" ); - } - - public void setGatewayName( String gatewayName ) - { - props.setProperty( "gateway.0", gatewayName ); - } - - private String bulksmsUsername; - - public String getBulksmsUsername() - { - return props.getProperty( "bulksms.username" ); - } - - public void setBulksmsUsername( String bulksmsUsername ) - { - props.setProperty( "bulksms.username", bulksmsUsername ); - } - - private String bulksmsPassword; - - public String getBulksmsPassword() - { - return props.getProperty( "bulksms.password" ); - } - - public void setBulksmsPassword( String bulksmsPassword ) - { - props.setProperty( "bulksms.password", bulksmsPassword ); - } - - private String clickatellUsername; - - public String getClickatellUsername() - { - return props.getProperty( "clickatell.username" ); - } - - public void setClickatellUsername( String clickatellUsername ) - { - props.setProperty( "clickatell.username", clickatellUsername); - } - - private String clickatellPassword; - - public String getClickatellPassword() - { - return props.getProperty( "clickatell.password" ); - } - - public void setClickatellPassword( String clickatellPassword ) - { - props.setProperty( "clickatell.password", clickatellPassword); - } - - private String clickatellApiId; - - public String getClickatellApiId() - { - return props.getProperty( "clickatell.api_id" ); - } - - public void setClickatellApiId( String clickatellApiId ) - { - props.setProperty( "clickatell.api_id" , clickatellApiId); - } - - private String longNumber; - - public String getLongNumber() - { - return props.getProperty( "provider.longnumber" ); - } - - public void setLongNumber( String longNumber ) - { - props.setProperty( "provider.longnumber" , longNumber); - } - - private String port; - - public String getPort() - { - return props.getProperty( "modem1.port" ); - } - - public void setPort( String port ) - { - props.setProperty( "modem1.port", port ); - } - - private String baudRate; - - public String getBaudRate() - { - return props.getProperty( "modem1.baudrate" ); - } - - public void setBaudRate( String baudRate ) - { - props.setProperty( "modem1.baudrate", baudRate ); - } - - private String manufacturer; - - public String getManufacturer() - { - return props.getProperty( "modem1.manufacturer" ); - } - - public void setManufacturer( String manufacturer ) - { - props.setProperty( "modem1.manufacturer", manufacturer ); - } - - private String model; - - public String getModel() - { - return props.getProperty( "modem1.model" ); - } - - public void setModel( String model ) - { - props.setProperty( "modem1.model", model ); - } - - private String protocol; - - public String getProtocol() - { - return props.getProperty( "modem1.protocol" ); - } - - public void setProtocol( String protocol ) - { - props.setProperty( "modem1.protocol", protocol ); - } - - private String pin; - - public String getPin() - { - return props.getProperty( "modem1.pin" ); - } - - public void setPin( String pin ) - { - props.setProperty( "modem1.pin", pin ); - } - - private String inbound; - - public String getInbound() - { - return props.getProperty( "modem1.inbound" ); - } - - public void setInbound( String inbound ) - { - props.setProperty( "modem1.inbound", inbound ); - } - - private String outbound; - - public String getOutbound() - { - return props.getProperty( "modem1.outbound" ); - } - - public void setOutbound( String outbound ) - { - props.setProperty( "modem1.outbound", outbound ); - } - - private String smsc_number; - - public String getSmsc_number() - { - return props.getProperty( "modem1.smsc_number" ); - } - - public void setSmsc_number( String smsc_number ) - { - props.setProperty( "modem1.smsc_number", smsc_number ); - } - - private String init_string; - - public String getInit_string() - { - return props.getProperty( "modem1.init_string" ); - } - - public void setInit_string( String init_string ) - { - props.setProperty( "modem1.init_string", init_string ); - } - - private String inbound_interval; - - public String getInbound_interval() - { - return props.getProperty( "settings.inbound_interval" ); - } - - public void setInbound_interval( String inbound_interval ) - { - props.setProperty( "settings.inbound_interval", inbound_interval ); - } - - private String outbound_interval; - - public String getOutbound_interval() - { - return props.getProperty( "settings.outbound_interval" ); - } - - public void setOutbound_interval( String outbound_interval ) - { - props.setProperty( "settings.outbound_interval", outbound_interval ); - } - - private String delete_after_processing; - - public String getDelete_after_processing() - { - return props.getProperty( "settings.delete_after_processing" ); - } - - public void setDelete_after_processing( String delete_after_processing ) throws Exception - { - props.setProperty( "settings.delete_after_processing", delete_after_processing ); - } - - private String simMemLocation = "-"; - - public void setSimMemLocation(String simMemLocation) - { - props.setProperty("modem1.simMemLocation", simMemLocation); - } - - public String getSimMemLocation() - { - return props.getProperty( "modem1.simMemLocation" ); - } - - private String send_mode; - - public String getSend_mode() - { - return props.getProperty( "settings.send_mode" ); - } - - public void setSend_mode( String send_mode ) throws Exception - { - props.setProperty( "settings.send_mode", send_mode ); - props.store( new FileWriter( configFile ), "SMS Server Configuration" ); - message = "Settings Saved Successfully"; - } - - private String message = ""; - - public String getMessage() - { - return message; - } - - @Override - public String execute() - throws Exception - { - if ( !configFile.exists() ) - { - FileOutputStream fos = new FileOutputStream( configFile ); - fos.close(); - props.setProperty( "smsserver.balancer", "RoundRobinLoadBalancer" ); - props.setProperty( "smsserver.router", "NumberPoolRouter" ); - props.setProperty( "gateway.0", "modem1, SerialModem" ); - props.setProperty( "bulksms.username", "" ); - props.setProperty( "bulksms.password", "" ); - props.setProperty( "clickatell.username", ""); - props.setProperty( "clickatell.password", ""); - props.setProperty( "clickatell.api_id", ""); - props.setProperty( "provider.longnumber", "" ); - props.setProperty( "modem1.port", "COM1" ); - props.setProperty( "modem1.baudrate", "57600" ); - props.setProperty( "modem1.manufacturer", "Generic" ); - props.setProperty( "modem1.model", "AT" ); - props.setProperty( "modem1.protocol", "PDU" ); - props.setProperty( "modem1.pin", "0000" ); - props.setProperty( "modem1.inbound", "yes" ); - props.setProperty( "modem1.outbound", "yes" ); - props.setProperty( "modem1.smsc_number", "" ); - props.setProperty( "modem1.init_string", "ATZ\\\rATZ\\\rATZ\\\r" ); - props.setProperty( "modem1.simMemLocation", "-"); - props.setProperty( "settings.inbound_interval", "600" ); - props.setProperty( "settings.outbound_interval", "10" ); - props.setProperty( "settings.delete_after_processing", "yes" ); - props.setProperty( "settings.send_mode", "async" ); - props.store( new FileWriter( configFile ), "SMS Server Configuration" ); - } else - { - props.load( new FileReader( configFile ) ); - } - return SUCCESS; - } -} === removed file 'dhis-mobile/dhis-web-sms/src/main/java/org/hisp/dhis/mobile/action/ReceiveImportPageAction.java' --- dhis-mobile/dhis-web-sms/src/main/java/org/hisp/dhis/mobile/action/ReceiveImportPageAction.java 2011-05-06 14:31:30 +0000 +++ dhis-mobile/dhis-web-sms/src/main/java/org/hisp/dhis/mobile/action/ReceiveImportPageAction.java 1970-01-01 00:00:00 +0000 @@ -1,144 +0,0 @@ -package org.hisp.dhis.mobile.action; - -/* - * Copyright (c) 2004-2007, 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 com.opensymphony.xwork2.Action; -import java.io.File; -import java.util.List; -import org.apache.commons.io.FileUtils; -import org.hisp.dhis.mobile.sms.SmsService; -import org.hisp.dhis.mobile.sms.api.SmsImportService; - -public class ReceiveImportPageAction implements Action -{ - - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - SmsService smsService; - - public void setSmsService( SmsService smsService ) - { - this.smsService = smsService; - } - - private SmsImportService smsImportService; - - public void setSmsImportService( SmsImportService smsImportService ) - { - this.smsImportService = smsImportService; - } - - // ------------------------------------------------------------------------- - // Action Implementation - // ------------------------------------------------------------------------- - String result = ""; - - public String getResult() - { - return result; - } - - boolean smsServiceStatus; - - public boolean getSmsServiceStatus() - { - if(smsService.isServiceRunning()) - return true; - else - return false; - } - - String statAction; - - public void setStatAction( String statAction ) - { - if ( statAction.equalsIgnoreCase( "Start" ) ) - { - this.result = smsService.startSmsService(); - } else - { - this.result = smsService.stopSmsService(); - } - } - - String importAction; - - public void setImportAction( String importAction ) - { - startImportingMessages(); - } - - private List pending; - - public List getPending() - { - File pendingFolder = new File( System.getenv( "DHIS2_HOME" ) + File.separator + "mi" + File.separator + "pending" ); - pending = (List) FileUtils.listFiles( pendingFolder, new String[] - { - "xml" - }, false ); - return pending; - } - - private List bounced; - - public List getBounced() - { - File bouncedFolder = new File( System.getenv( "DHIS2_HOME" ) + File.separator + "mi" + File.separator + "bounced" ); - bounced = (List) FileUtils.listFiles( bouncedFolder, new String[] - { - "xml" - }, false ); - return bounced; - } - - private List completed; - - public List getCompleted() - { - File completedFolder = new File( System.getenv( "DHIS2_HOME" ) + File.separator + "mi" + File.separator + "completed" ); - completed = (List) FileUtils.listFiles( completedFolder, new String[] - { - "xml" - }, false ); - return completed; - } - - public void startImportingMessages() - { - smsImportService.saveDataValues(); - } - - @Override - public String execute() - throws Exception - { - return SUCCESS; - } -} === removed file 'dhis-mobile/dhis-web-sms/src/main/java/org/hisp/dhis/mobile/action/SendSMSAction.java' --- dhis-mobile/dhis-web-sms/src/main/java/org/hisp/dhis/mobile/action/SendSMSAction.java 2011-05-06 14:31:30 +0000 +++ dhis-mobile/dhis-web-sms/src/main/java/org/hisp/dhis/mobile/action/SendSMSAction.java 1970-01-01 00:00:00 +0000 @@ -1,107 +0,0 @@ -package org.hisp.dhis.mobile.action; - -/* - * Copyright (c) 2004-2007, 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 com.opensymphony.xwork2.Action; -import org.hisp.dhis.mobile.sms.SmsService; - -public class SendSMSAction implements Action -{ - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - SmsService smsService; - - public void setSmsService( SmsService smsService ) - { - this.smsService = smsService; - } - - // ------------------------------------------------------------------------- - // Action Implementation - // ------------------------------------------------------------------------- - boolean smsServiceStatus; - - public boolean getSmsServiceStatus() - { - return smsService.isServiceRunning(); - } - - String statAction; - - public void setStatAction( String statAction ) - { - if ( statAction.equalsIgnoreCase( "Start" ) ) - { - this.message = smsService.startSmsService(); - } else - { - this.message = smsService.stopSmsService(); - } - } - - String recipient; - - public void setRecipient( String recipient ) - { - this.recipient = recipient; - } - - String msg; - - public void setMsg( String msg ) - { - this.msg = msg; - } - - String send; - - public void setSend( String send ) - { - this.send = send; - } - - String message = ""; - - public String getMessage() - { - return message; - } - - @Override - public String execute() - throws Exception - { - if ( this.send != null ) - { - this.message = smsService.sendMessage( recipient, msg ); - } - return SUCCESS; - } -} === removed directory 'dhis-mobile/dhis-web-sms/src/main/resources' === removed directory 'dhis-mobile/dhis-web-sms/src/main/resources/META-INF' === removed directory 'dhis-mobile/dhis-web-sms/src/main/resources/META-INF/dhis' === removed file 'dhis-mobile/dhis-web-sms/src/main/resources/META-INF/dhis/beans.xml' --- dhis-mobile/dhis-web-sms/src/main/resources/META-INF/dhis/beans.xml 2011-05-06 20:21:40 +0000 +++ dhis-mobile/dhis-web-sms/src/main/resources/META-INF/dhis/beans.xml 1970-01-01 00:00:00 +0000 @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - === removed directory 'dhis-mobile/dhis-web-sms/src/main/resources/org' === removed directory 'dhis-mobile/dhis-web-sms/src/main/resources/org/hisp' === removed directory 'dhis-mobile/dhis-web-sms/src/main/resources/org/hisp/dhis' === removed directory 'dhis-mobile/dhis-web-sms/src/main/resources/org/hisp/dhis/mobile' === removed file 'dhis-mobile/dhis-web-sms/src/main/resources/org/hisp/dhis/mobile/i18n_module.properties' === removed file 'dhis-mobile/dhis-web-sms/src/main/resources/org/hisp/dhis/mobile/i18n_module_id_ID.properties' === removed file 'dhis-mobile/dhis-web-sms/src/main/resources/org/hisp/dhis/mobile/i18n_module_my_MM.properties' === removed file 'dhis-mobile/dhis-web-sms/src/main/resources/org/hisp/dhis/mobile/i18n_module_pt_BR.properties' === removed file 'dhis-mobile/dhis-web-sms/src/main/resources/org/hisp/dhis/mobile/i18n_module_pt_PT.properties' === removed file 'dhis-mobile/dhis-web-sms/src/main/resources/struts.xml' --- dhis-mobile/dhis-web-sms/src/main/resources/struts.xml 2011-05-06 20:21:40 +0000 +++ dhis-mobile/dhis-web-sms/src/main/resources/struts.xml 1970-01-01 00:00:00 +0000 @@ -1,40 +0,0 @@ - - - - - - - - - - /main.vm - /dhis-web-sms/welcome.vm - /dhis-web-sms/menu.vm - - - /main.vm - /dhis-web-sms/receiveImportPage.vm - /dhis-web-sms/menu.vm - css/receiveImportPage.css - - - /main.vm - /dhis-web-sms/sendSMSPage.vm - /dhis-web-sms/menu.vm - F_MOBILE_SENDSMS - - - /main.vm - /dhis-web-sms/mobileSettingsPage.vm - /dhis-web-sms/menu.vm - F_MOBILE_SETTINGS - - - - \ No newline at end of file === removed directory 'dhis-mobile/dhis-web-sms/src/main/webapp' === removed directory 'dhis-mobile/dhis-web-sms/src/main/webapp/META-INF' === removed file 'dhis-mobile/dhis-web-sms/src/main/webapp/META-INF/context.xml' --- dhis-mobile/dhis-web-sms/src/main/webapp/META-INF/context.xml 2011-05-06 14:31:30 +0000 +++ dhis-mobile/dhis-web-sms/src/main/webapp/META-INF/context.xml 1970-01-01 00:00:00 +0000 @@ -1,2 +0,0 @@ - - === removed directory 'dhis-mobile/dhis-web-sms/src/main/webapp/WEB-INF' === removed directory 'dhis-mobile/dhis-web-sms/src/main/webapp/WEB-INF/classes' === removed file 'dhis-mobile/dhis-web-sms/src/main/webapp/WEB-INF/classes/log4j.properties' --- dhis-mobile/dhis-web-sms/src/main/webapp/WEB-INF/classes/log4j.properties 2011-05-06 14:31:30 +0000 +++ dhis-mobile/dhis-web-sms/src/main/webapp/WEB-INF/classes/log4j.properties 1970-01-01 00:00:00 +0000 @@ -1,29 +0,0 @@ - -# Configuration file for log4j - -# Log to file setup -log4j.appender.file = org.apache.log4j.RollingFileAppender -log4j.appender.file.File = dhis.log -log4j.appender.file.MaxFileSize = 100KB -log4j.appender.file.MaxBackupIndex = 3 -log4j.appender.file.layout = org.apache.log4j.PatternLayout -log4j.appender.file.layout.ConversionPattern = * %-5p %d{ABSOLUTE} %m (%F [%t])%n - -# Log to console setup -log4j.appender.console = org.apache.log4j.ConsoleAppender -log4j.appender.console.layout = org.apache.log4j.PatternLayout -log4j.appender.console.layout.ConversionPattern = * %-5p %d{ABSOLUTE} %m (%F [%t])%n - -#Audit log level -log4j.appender.AUDIT=org.apache.log4j.DailyRollingFileAppender -log4j.appender.AUDIT.File= audit.log -log4j.appender.AUDIT.DatePattern='.'yyyy-MM-dd -log4j.appender.AUDIT.threshold=AUDIT_TRAIL#org.hisp.dhis.system.util.AuditLogLevel -log4j.appender.AUDIT.layout=org.apache.log4j.PatternLayout -log4j.appender.AUDIT.layout.ConversionPattern= * %-5p %d{ABSOLUTE} %m %n - -# Categories (order: DEBUG, INFO, WARN, ERROR, FATAL) -log4j.rootCategory = WARN, console -log4j.category.org.hisp.dhis = INFO, AUDIT -log4j.category.org.amplecode = INFO -log4j.category.smslib = INFO === removed file 'dhis-mobile/dhis-web-sms/src/main/webapp/WEB-INF/web.xml' --- dhis-mobile/dhis-web-sms/src/main/webapp/WEB-INF/web.xml 2011-05-06 20:21:40 +0000 +++ dhis-mobile/dhis-web-sms/src/main/webapp/WEB-INF/web.xml 1970-01-01 00:00:00 +0000 @@ -1,60 +0,0 @@ - - - - DHIS Mobile Importing - - - contextConfigLocation - classpath*:/META-INF/dhis/beans.xml - - - automaticAccessType - ghostAdmin - - - - RedirectFilter - org.hisp.dhis.servlet.filter.HttpRedirectFilter - - redirectPath - dhis-web-sms/index.action - - - - OpenSessionInViewFilter - org.springframework.orm.hibernate3.support.OpenSessionInViewFilter - - - springSecurityFilterChain - org.springframework.web.filter.DelegatingFilterProxy - - - Struts - org.apache.struts2.dispatcher.FilterDispatcher - - - - RedirectFilter - / - - - OpenSessionInViewFilter - *.action - - - springSecurityFilterChain - /* - - - Struts - *.action - - - - org.springframework.web.context.ContextLoaderListener - - - org.hisp.dhis.system.startup.StartupListener - - === removed directory 'dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms' === removed directory 'dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/css' === removed file 'dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/css/StylesForTags.css' --- dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/css/StylesForTags.css 2011-05-06 20:21:40 +0000 +++ dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/css/StylesForTags.css 1970-01-01 00:00:00 +0000 @@ -1,56 +0,0 @@ -.Heading { - font-family: times,arial, georgia, tahoma; - font-size: 35px; - font-weight: bold; - white-space: nowrap; - cursor: default; -} - -.Normal { - font-family: arial, georgia, tahoma; - font-size: 10px; - white-space: nowrap; - cursor: default; - text-align: center; -} - -.NormalB { - font-family: arial, georgia, tahoma; - font-size: 13px; - font-weight: bold; - white-space: nowrap; - cursor: default; -} - -.TableDataCellStyles { - font-family: arial, georgia, tahoma; - font-size: 10px; - white-space: nowrap; - cursor: default; - text-align: center; - border:1px dotted #C0C0C0; -} - -.TableHeadingCellStyles { - font-family: arial, georgia, tahoma; - font-size: 11px; - white-space: nowrap; - cursor: default; -} - -.DefaultFontStyles { - font-family: arial, georgia, tahoma; - font-size: 13px; - font-weight: bold; - white-space: nowrap; - cursor: default; -} - -.DefaultFontStylesNoBold { - font-family: arial, georgia, tahoma; - font-size: 13px; - white-space: nowrap; - cursor: default; -} - - === removed file 'dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/css/receiveImportPage.css' --- dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/css/receiveImportPage.css 2011-05-06 20:21:40 +0000 +++ dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/css/receiveImportPage.css 1970-01-01 00:00:00 +0000 @@ -1,27 +0,0 @@ -.header{ - color: white; - padding: 5px 5px; - margin: -16px 0 0 -20px; - font-weight: bold; - background-color: #8FABC7; -} -.box{ - position:relative; - border: 1px solid #8FABC7; - padding: 5px 5px; - margin-left: -20px; -} -.mainTable{ - width: 100%; - border-collapse: collapse; -} -.mainTable th{ - border: 1px solid #C3C3C3; - padding: 3px; - vertical-align: top; -} -.mainTable td{ - border: 1px solid #C3C3C3; - padding: 3px; - vertical-align: top; -} \ No newline at end of file === removed file 'dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/css/stylesForReports.css' --- dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/css/stylesForReports.css 2011-05-06 20:21:40 +0000 +++ dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/css/stylesForReports.css 1970-01-01 00:00:00 +0000 @@ -1,74 +0,0 @@ - - -.reportheading { - font-family: arial, georgia, tahoma; - font-size: 17px; - font-weight: bold; - white-space: nowrap; - cursor: default; -} - -.reportheadingwithunderline { - font-family: arial, georgia, tahoma; - font-size: 13px; - font-weight: bold; - white-space: nowrap; - cursor: default; -} - -.reportsubheading { - font-family: arial, georgia, tahoma; - font-size: 15px; - font-weight: bold; - white-space: nowrap; - cursor: default; -} - -.tableheading1 { - font-family: arial, georgia, tahoma; - font-size: 13px; - font-weight: bold; - cursor: default; -} - -.tabledata1 { - font-family: arial, georgia, tahoma; - font-size: 12px; - cursor: default; -} - -.tableheading2 { - font-family: arial, georgia, tahoma; - font-size: 10px; - font-weight: bold; - cursor: default; -} - -.tabledata2 { - font-family: arial, georgia, tahoma; - font-size: 10px; - cursor: default; -} - -#dropmenudiv{ - position:absolute; - border:1px solid black; - border-bottom-width: 0; - font:normal 12px Verdana; - line-height:18px; - z-index:100; - } - - #dropmenudiv a{ - width: 100%; - display: block; - text-indent: 3px; - border-bottom: 1px solid black; - padding: 1px 0; - text-decoration: none; - font-weight: bold; - } - - #dropmenudiv a:hover{ /*hover background color*/ - background-color: yellow; - } === removed directory 'dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/images' === removed file 'dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/images/intro.png' Binary files dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/images/intro.png 2011-05-06 20:21:40 +0000 and dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/images/intro.png 1970-01-01 00:00:00 +0000 differ === removed directory 'dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/javascript' === removed file 'dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/javascript/user.js' --- dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/javascript/user.js 2011-05-06 20:21:40 +0000 +++ dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/javascript/user.js 1970-01-01 00:00:00 +0000 @@ -1,54 +0,0 @@ -function removeUserGroup( userGroupId, userGroupName ) -{ - removeItem( userGroupId, userGroupName, i18n_confirm_delete, "removeUserGroup.action" ); -} - -function showUserGroupDetails( userGroupId ) -{ - var request = new Request(); - request.setResponseTypeXML( 'userGroup' ); - request.setCallbackSuccess( userGroupReceived ); - request.send( 'getUserGroup.action?userGroupId=' + userGroupId ); -} - -function userGroupReceived( userGroupElement ) -{ - setInnerHTML( 'nameField', getElementValue( userGroupElement, 'name' ) ); - setInnerHTML( 'idField', getElementValue( userGroupElement, 'id' ) ); - setInnerHTML( 'noOfGroupField', getElementValue( userGroupElement, 'noOfUsers' ) ); - - showDetails(); -} - -function addValidation () -{ - var k =0 ; - var xyz=document.getElementById("name"); - var abc =document.getElementById("groupMembers"); - var c = abc.length ; - if( xyz.value == "") { - alert ("please select name "); - return false; - } - else if ( c <=0 ){ - alert("please select at least one member"); - return false ; - }else - if (c >0 ) - { - for( k =0;k<=c;k++) - { - abc.options[k].selected = true ; - - } - } - - return true; -} - -function editValidation () -{ -alert("dev"); -} - - === removed file 'dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/menu.vm' --- dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/menu.vm 2011-05-11 07:26:38 +0000 +++ dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/menu.vm 1970-01-01 00:00:00 +0000 @@ -1,6 +0,0 @@ -

DHIS SMS

- \ No newline at end of file === removed file 'dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/mobileImportingResult.vm' --- dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/mobileImportingResult.vm 2011-05-06 20:21:40 +0000 +++ dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/mobileImportingResult.vm 1970-01-01 00:00:00 +0000 @@ -1,4 +0,0 @@ - -
-$importStatus -
\ No newline at end of file === removed file 'dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/mobileSettingsPage.vm' --- dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/mobileSettingsPage.vm 2011-05-16 19:04:09 +0000 +++ dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/mobileSettingsPage.vm 1970-01-01 00:00:00 +0000 @@ -1,39 +0,0 @@ -

Mobile Gateway Settings

-
-
- - #if($balancer) #end - #if($router) #end - #if($gatewayName) #end - #if($gatewayName == "bulksms") - - - - #end - #if($gatewayName == "clickatell") - - - - - #end - #if($port) #end - #if($baudRate) #end - #if($manufacturer) #end - #if($model) #end - #if($protocol) #end - #if($pin) #end - #if($inbound) #end - #if($outbound) #end - #if($smsc_number) #end - #if($init_string) #end - #if($inbound_interval) #end - #if($outbound_interval) #end - #if($delete_after_processing) #end - #if($send_mode) #end - #if($simMemLocation) #end - - -
Balancer:
Router:
Gateway Name:
Bulksms Username:
Bulksms Password:
Longnumber:
Clickatell Username:
Clickatell Password:
Clickatell API ID:
Longnumber:
Modem Port#:
Baudrate:
Manufacturer:
Model:
Protocol:
Pin:
Allow Inbound Msg:
Allow Outbound Msg:
SMSC Number:
Modem Init String:
Inbound Interval:
Outbound Interval:
Delete after processing:
Send Mode:
SIM Memory Location:
-
- $message -
\ No newline at end of file === removed file 'dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/receiveImportPage.vm' --- dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/receiveImportPage.vm 2011-05-06 20:21:40 +0000 +++ dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/receiveImportPage.vm 1970-01-01 00:00:00 +0000 @@ -1,69 +0,0 @@ - - -#if ($smsServiceStatus) -
-
SMS Service: Started - -
-
-#else -
-
SMS Service: Not Started - -
-
-#end -

Receive SMS

-
-
-
Import SMS
-
- - - - - - - - - - - - - - - - - - -
Pending ($pending.size())Bounced ($bounced.size())Completed ($completed.size())
Show DetailsShow Details$completed.size() Already Imported
- - -
- -$result \ No newline at end of file === removed file 'dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/sendSMSPage.vm' --- dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/sendSMSPage.vm 2011-05-06 20:21:40 +0000 +++ dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/sendSMSPage.vm 1970-01-01 00:00:00 +0000 @@ -1,32 +0,0 @@ - - -
- #if ($smsServiceStatus) -
SMS Service: Started - -
- #else -
SMS Service: Not Started - -
- #end -
-

Send SMS

-
-
- - - - -
Phone #:
-
-$message -
\ No newline at end of file === removed file 'dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/welcome.vm' --- dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/welcome.vm 2011-05-06 20:21:40 +0000 +++ dhis-mobile/dhis-web-sms/src/main/webapp/dhis-web-sms/welcome.vm 1970-01-01 00:00:00 +0000 @@ -1,2 +0,0 @@ -

DHIS SMS

-
\ No newline at end of file === removed file 'dhis-mobile/pom.xml' --- dhis-mobile/pom.xml 2012-05-29 07:58:51 +0000 +++ dhis-mobile/pom.xml 1970-01-01 00:00:00 +0000 @@ -1,31 +0,0 @@ - - 4.0.0 - - org.hisp.dhis - dhis-sms - 2.9-SNAPSHOT - pom - Mobile SMS Modules - - http://dhis2.org/mobile - - The DHIS2 Mobile SMS Modules add functionality for sending and - recieving SMS to DHIS2. With a configured SMS modem, a custom - built mobile client and a corresponding mapping from the SMS - format used by the clients, mobiles can be used to report on data - sets to DHIS2. - - - - DHIS2 - http://dhis2.org - - - - dhis-service-sms - dhis-web-sms - - -