=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/J2meClientUpdateAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/J2meClientUpdateAction.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/J2meClientUpdateAction.java 2012-08-23 05:49:32 +0000 @@ -0,0 +1,113 @@ +/* + * 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. + */ + +package org.hisp.dhis.mobile.action; + +import java.util.ArrayList; +import java.util.List; + +import org.hisp.dhis.api.mobile.PatientMobileSettingService; +import org.hisp.dhis.i18n.I18n; +import org.hisp.dhis.patient.PatientAttribute; +import org.hisp.dhis.patient.PatientMobileSetting; + + +import com.opensymphony.xwork2.Action; + +/** + * @author Nguyen Kim Lai + * + * @version $ J2meClientUpdateAction.java Aug 15, 2012 $ + */ +public class J2meClientUpdateAction + implements Action +{ + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + PatientMobileSettingService patientMobileSettingService; + + public void setPatientMobileSettingService( PatientMobileSettingService patientMobileSettingService ) + { + this.patientMobileSettingService = patientMobileSettingService; + } + + // ------------------------------------------------------------------------- + // Input & Output + // ------------------------------------------------------------------------- + + private double version; + + public void setVersion( double version ) + { + this.version = version; + } + + private String autoUpdate; + + public void setAutoUpdate( String autoUpdate ) + { + this.autoUpdate = autoUpdate; + } + + private PatientMobileSetting patientMobileSetting; + + public PatientMobileSetting getPatientMobileSetting() + { + return patientMobileSetting; + } + + @Override + public String execute() + throws Exception + { + List list = new ArrayList(); + + list = (List) patientMobileSettingService.getCurrentSetting(); + + this.patientMobileSetting = list.get( 0 ); + + if ( this.version != 0 ) + { + this.patientMobileSetting.setVersionToUpdate( this.version ); + } + if ( autoUpdate != null && autoUpdate.equals( "yes" ) ) + { + this.patientMobileSetting.setAutoUpdateClient( true ); + } + + if ( autoUpdate != null && autoUpdate.equals( "no" ) ) + { + this.patientMobileSetting.setAutoUpdateClient( false ); + } + patientMobileSettingService.savePatientMobileSetting( this.patientMobileSetting ); + + return SUCCESS; + } + +} === added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/j2meClientUpdatePage.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/j2meClientUpdatePage.vm 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/j2meClientUpdatePage.vm 2012-08-23 05:49:32 +0000 @@ -0,0 +1,49 @@ + +

$i18n.getString( 'j2me_client_update_config' )

+
+ + + + + + + + + + + + + + + + + + + + +
$i18n.getString("configuration")
$i18n.getString( 'auto_update_client' ): + Yes  + No +
$i18n.getString( 'client_older_than' ) *:
+
\ No newline at end of file