dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #23906
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11650: Create new object PhoneNumberPattern, this will be used for phone number validation
------------------------------------------------------------
revno: 11650
committer: Lai <lai.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-08-13 15:06:25 +0700
message:
Create new object PhoneNumberPattern, this will be used for phone number validation
added:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/phonepattern/
dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/phonepattern/PhoneNumberPattern.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/phonepattern/PhoneNumberPatternService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/phonepattern/PhoneNumberPatternStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/hibernate/HibernatePhoneNumberPatternStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/phonepattern/
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/phonepattern/DefaultPhoneNumberPatternService.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/sms/hibernate/PhoneNumberPattern.hbm.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/MobilePhonesPatternAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/phonePatternPage.vm
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/SharingUtils.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/outbound/OutboundSmsStore.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/menu.vm
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/SharingUtils.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/SharingUtils.java 2013-08-13 07:18:45 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/SharingUtils.java 2013-08-13 08:06:25 +0000
@@ -39,6 +39,7 @@
import org.hisp.dhis.program.Program;
import org.hisp.dhis.report.Report;
import org.hisp.dhis.reporttable.ReportTable;
+import org.hisp.dhis.sms.phonepattern.PhoneNumberPattern;
import org.hisp.dhis.user.User;
import org.hisp.dhis.user.UserGroup;
import org.hisp.dhis.user.UserGroupAccess;
@@ -107,6 +108,7 @@
addType( org.hisp.dhis.mapping.Map.class, "map", "F_MAP_EXTERNAL_ADD", "F_MAP_PUBLIC_ADD", null );
addType( Chart.class, "chart", "F_CHART_PUBLIC_ADD", "F_CHART_PUBLIC_ADD", null );
addType( ReportTable.class, "reportTable", "F_REPORTTABLE_OPEN_ADD", "F_REPORTTABLE_PUBLIC_ADD", null );
+ addType( PhoneNumberPattern.class, "phoneNumberPattern", null, null, null );
}
public static boolean isSupported( String type )
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/outbound/OutboundSmsStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/outbound/OutboundSmsStore.java 2013-08-08 06:59:54 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/outbound/OutboundSmsStore.java 2013-08-13 08:06:25 +0000
@@ -2,6 +2,8 @@
import java.util.List;
+import org.hisp.dhis.common.GenericStore;
+
/*
* Copyright (c) 2004-2012, University of Oslo
* All rights reserved.
@@ -29,7 +31,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-public interface OutboundSmsStore
+public interface OutboundSmsStore extends GenericStore<OutboundSms>
{
int saveOutboundSms( OutboundSms sms );
=== added directory 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/phonepattern'
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/phonepattern/PhoneNumberPattern.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/phonepattern/PhoneNumberPattern.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/phonepattern/PhoneNumberPattern.java 2013-08-13 08:06:25 +0000
@@ -0,0 +1,89 @@
+/*
+ * 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.sms.phonepattern;
+
+import java.util.List;
+
+import org.hisp.dhis.common.BaseIdentifiableObject;
+
+ /**
+ * @author Nguyen Kim Lai
+ *
+ * @version PhoneNumberPattern.java 1:11:57 PM Aug 7, 2013 $
+ */
+public class PhoneNumberPattern extends BaseIdentifiableObject
+{
+ private static final long serialVersionUID = -9068432098081093265L;
+
+ private List<String> startWiths;
+
+ private List<String> followBys;
+
+ private Integer digitLeft;
+
+ private String regex;
+
+ public List<String> getStartWiths()
+ {
+ return startWiths;
+ }
+
+ public void setStartWiths( List<String> startWiths )
+ {
+ this.startWiths = startWiths;
+ }
+
+ public List<String> getFollowBys()
+ {
+ return followBys;
+ }
+
+ public void setFollowBys( List<String> followBys )
+ {
+ this.followBys = followBys;
+ }
+
+ public Integer getDigitLeft()
+ {
+ return digitLeft;
+ }
+
+ public void setDigitLeft( Integer digitLeft )
+ {
+ this.digitLeft = digitLeft;
+ }
+
+ public String getRegex()
+ {
+ return regex;
+ }
+
+ public void setRegex( String regex )
+ {
+ this.regex = regex;
+ }
+}
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/phonepattern/PhoneNumberPatternService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/phonepattern/PhoneNumberPatternService.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/phonepattern/PhoneNumberPatternService.java 2013-08-13 08:06:25 +0000
@@ -0,0 +1,49 @@
+/*
+ * 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.sms.phonepattern;
+
+import java.util.List;
+
+ /**
+ * @author Nguyen Kim Lai
+ *
+ * @version PhonePatternService.java 2:13:18 PM Aug 7, 2013 $
+ */
+public interface PhoneNumberPatternService
+{
+ String ID = PhoneNumberPatternService.class.getName();
+
+ int savePhonePattern( PhoneNumberPattern sms );
+
+ void updatePhonePattern( PhoneNumberPattern sms );
+
+ void deleteById( Integer outboundSmsId );
+
+ List<PhoneNumberPattern> getAllPhonePattern();
+
+ PhoneNumberPattern getPhonePatternById( int id );
+}
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/phonepattern/PhoneNumberPatternStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/phonepattern/PhoneNumberPatternStore.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/phonepattern/PhoneNumberPatternStore.java 2013-08-13 08:06:25 +0000
@@ -0,0 +1,41 @@
+/*
+ * 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.sms.phonepattern;
+
+import org.hisp.dhis.common.GenericNameableObjectStore;
+
+/**
+ * @author Nguyen Kim Lai
+ *
+ * @version PhoneNumberPatternStore.java 3:08:01 PM Aug 8, 2013 $
+ */
+public interface PhoneNumberPatternStore extends GenericNameableObjectStore<PhoneNumberPattern>
+{
+ String ID = PhoneNumberPatternStore.class.getName();
+
+ void deleteById ( Integer id );
+}
=== added file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/hibernate/HibernatePhoneNumberPatternStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/hibernate/HibernatePhoneNumberPatternStore.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/hibernate/HibernatePhoneNumberPatternStore.java 2013-08-13 08:06:25 +0000
@@ -0,0 +1,66 @@
+/*
+ * 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.sms.hibernate;
+
+import org.hisp.dhis.hibernate.HibernateGenericStore;
+import org.hisp.dhis.sms.phonepattern.PhoneNumberPattern;
+import org.hisp.dhis.sms.phonepattern.PhoneNumberPatternStore;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * @author Nguyen Kim Lai
+ *
+ * @version HibernatePhoneNumberPatternStore.java 3:21:45 PM Aug 8, 2013 $
+ */
+
+@Transactional
+public class HibernatePhoneNumberPatternStore
+ extends HibernateGenericStore<PhoneNumberPattern>
+ implements PhoneNumberPatternStore
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private JdbcTemplate jdbcTemplate;
+
+ public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
+ {
+ this.jdbcTemplate = jdbcTemplate;
+ }
+
+ // -------------------------------------------------------------------------
+ // Implementation
+ // -------------------------------------------------------------------------
+
+ @Override
+ public void deleteById( Integer id )
+ {
+ delete( get( id ) );
+ }
+}
=== added directory 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/phonepattern'
=== added file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/phonepattern/DefaultPhoneNumberPatternService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/phonepattern/DefaultPhoneNumberPatternService.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/phonepattern/DefaultPhoneNumberPatternService.java 2013-08-13 08:06:25 +0000
@@ -0,0 +1,82 @@
+/*
+ * 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.sms.phonepattern;
+
+import java.util.List;
+
+/**
+ * @author Nguyen Kim Lai
+ *
+ * @version DefaultPhoneNumberPatternService.java 3:21:33 PM Aug 8, 2013 $
+ */
+public class DefaultPhoneNumberPatternService
+ implements PhoneNumberPatternService
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+ private PhoneNumberPatternStore phoneNumberPatternStore;
+
+ public void setPhoneNumberPatternStore( PhoneNumberPatternStore phoneNumberPatternStore )
+ {
+ this.phoneNumberPatternStore = phoneNumberPatternStore;
+ }
+
+ // -------------------------------------------------------------------------
+ // Implementation
+ // -------------------------------------------------------------------------
+
+ @Override
+ public void deleteById( Integer id )
+ {
+ phoneNumberPatternStore.deleteById( id );
+ }
+
+ @Override
+ public List<PhoneNumberPattern> getAllPhonePattern()
+ {
+ return phoneNumberPatternStore.getAll();
+ }
+
+ @Override
+ public PhoneNumberPattern getPhonePatternById( int id )
+ {
+ return phoneNumberPatternStore.get( id );
+ }
+
+ @Override
+ public int savePhonePattern( PhoneNumberPattern phoneNumberPattern )
+ {
+ return phoneNumberPatternStore.save( phoneNumberPattern );
+ }
+
+ @Override
+ public void updatePhonePattern( PhoneNumberPattern phoneNumberPattern )
+ {
+ phoneNumberPatternStore.update( phoneNumberPattern );
+ }
+}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2013-08-12 07:30:03 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2013-08-13 08:06:25 +0000
@@ -347,9 +347,12 @@
<property name="jdbcTemplate" ref="jdbcTemplate" />
</bean>
-
-
-
+ <bean id="phoneNumberPatternStore" class="org.hisp.dhis.sms.hibernate.HibernatePhoneNumberPatternStore">
+ <property name="clazz" value="org.hisp.dhis.sms.phonepattern.PhoneNumberPattern" />
+ <property name="sessionFactory" ref="sessionFactory" />
+ <property name="jdbcTemplate" ref="jdbcTemplate" />
+ </bean>
+
<!-- Service definitions -->
<bean id="org.hisp.dhis.dataelement.DataElementOperandService" class="org.hisp.dhis.dataelement.DefaultDataElementOperandService">
@@ -781,6 +784,9 @@
<property name="userService" ref="org.hisp.dhis.user.UserService" />
</bean>
+ <bean id="org.hisp.dhis.sms.phonepattern.PhoneNumberPatternService" class="org.hisp.dhis.sms.phonepattern.DefaultPhoneNumberPatternService">
+ <property name="phoneNumberPatternStore" ref="phoneNumberPatternStore" />
+ </bean>
<!-- I18nService -->
=== added file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/sms/hibernate/PhoneNumberPattern.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/sms/hibernate/PhoneNumberPattern.hbm.xml 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/sms/hibernate/PhoneNumberPattern.hbm.xml 2013-08-13 08:06:25 +0000
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping>
+ <class name="org.hisp.dhis.sms.phonepattern.PhoneNumberPattern" table="phonenumberpattern">
+
+ <id name="id" column="phonenumberpatternid">
+ <generator class="native" />
+ </id>
+
+ <list name="startWiths" table="phone_pattern_start">
+ <key column="phone_pattern_id" />
+ <list-index column="sort_order" base="1" />
+ <element type="text"/>
+ </list>
+
+ <list name="followBys" table="phone_pattern_follow">
+ <key column="phone_pattern_id" />
+ <list-index column="sort_order" base="1" />
+ <element type="text"/>
+ </list>
+
+ <property name="digitLeft" />
+
+ <property name="regex" />
+
+ </class>
+</hibernate-mapping>
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/MobilePhonesPatternAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/MobilePhonesPatternAction.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/MobilePhonesPatternAction.java 2013-08-13 08:06:25 +0000
@@ -0,0 +1,77 @@
+/*
+ * 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.sms.phonepattern.PhoneNumberPattern;
+import org.hisp.dhis.sms.phonepattern.PhoneNumberPatternService;
+
+import com.opensymphony.xwork2.Action;
+
+ /**
+ * @author Nguyen Kim Lai
+ *
+ * @version MobilePhonesPatternAction.java 10:19:46 AM Aug 7, 2013 $
+ */
+public class MobilePhonesPatternAction implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private PhoneNumberPatternService phoneNumberPatternService;
+
+ public void setPhoneNumberPatternService( PhoneNumberPatternService phoneNumberPatternService )
+ {
+ this.phoneNumberPatternService = phoneNumberPatternService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action Implementation
+ // -------------------------------------------------------------------------
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ /*PhoneNumberPattern phoneNumberPattern = new PhoneNumberPattern();
+ List<String> startWiths = new ArrayList<String>();
+ startWiths.add( "+84" );
+ List<String> followBys = new ArrayList<String>();
+ followBys.add( "9" );
+ phoneNumberPattern.setStartWiths( startWiths );
+ phoneNumberPattern.setFollowBys( followBys );
+ phoneNumberPattern.setDigitLeft( 8 );
+
+ phoneNumberPatternService.savePhonePattern( phoneNumberPattern );*/
+
+ return SUCCESS;
+ }
+
+}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/META-INF/dhis/beans.xml 2013-08-12 03:29:54 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/META-INF/dhis/beans.xml 2013-08-13 08:06:25 +0000
@@ -8,68 +8,59 @@
<property name="incomingSmsService"
ref="org.hisp.dhis.sms.incoming.IncomingSmsService" />
</bean>
-
+
<bean id="org.hisp.dhis.mobile.caseentry.state.SelectedStateManager"
class="org.hisp.dhis.mobile.caseentry.state.DefaultSelectedStateManager">
- <property name="patientService"
- ref="org.hisp.dhis.patient.PatientService" />
+ <property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
<property name="selectionManager"
ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
- <property name="programInstanceService"
- ref="org.hisp.dhis.program.ProgramInstanceService" />
+ <property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
<property name="programStageInstanceService"
ref="org.hisp.dhis.program.ProgramStageInstanceService" />
</bean>
- <bean id="org.hisp.dhis.mobile.action.NoAction"
- class="org.hisp.dhis.mobile.action.NoAction" scope="prototype" />
+ <bean id="org.hisp.dhis.mobile.action.NoAction" class="org.hisp.dhis.mobile.action.NoAction"
+ scope="prototype" />
<bean id="org.hisp.dhis.mobile.action.incoming.ReceivingSMSAction"
- class="org.hisp.dhis.mobile.action.incoming.ReceivingSMSAction"
- scope="prototype">
+ class="org.hisp.dhis.mobile.action.incoming.ReceivingSMSAction" scope="prototype">
<property name="incomingSmsService"
ref="org.hisp.dhis.sms.incoming.IncomingSmsService" />
</bean>
- <bean
- id="org.hisp.dhis.mobile.action.incoming.DeleteReceiveSMSAction"
+ <bean id="org.hisp.dhis.mobile.action.incoming.DeleteReceiveSMSAction"
class="org.hisp.dhis.mobile.action.incoming.DeleteReceiveSMSAction"
scope="prototype">
<property name="incomingSmsService"
ref="org.hisp.dhis.sms.incoming.IncomingSmsService" />
</bean>
- <bean id="org.hisp.dhis.mobile.action.DeleteSentSMSAction"
- class="org.hisp.dhis.mobile.action.DeleteSentSMSAction"
+ <bean id="org.hisp.dhis.mobile.action.DeleteSentSMSAction" class="org.hisp.dhis.mobile.action.DeleteSentSMSAction"
scope="prototype">
<property name="outboundSmsService"
ref="org.hisp.dhis.sms.outbound.OutboundSmsService" />
</bean>
- <bean
- id="org.hisp.dhis.mobile.action.incoming.UpdateReceiveSMSAction"
+ <bean id="org.hisp.dhis.mobile.action.incoming.UpdateReceiveSMSAction"
class="org.hisp.dhis.mobile.action.incoming.UpdateReceiveSMSAction"
scope="prototype">
<property name="incomingSmsService"
ref="org.hisp.dhis.sms.incoming.IncomingSmsService" />
</bean>
- <bean id="org.hisp.dhis.mobile.action.ShowSentSMSAction"
- class="org.hisp.dhis.mobile.action.ShowSentSMSAction"
+ <bean id="org.hisp.dhis.mobile.action.ShowSentSMSAction" class="org.hisp.dhis.mobile.action.ShowSentSMSAction"
scope="prototype">
<property name="outboundSmsService"
ref="org.hisp.dhis.sms.outbound.OutboundSmsService" />
<property name="programStageInstanceService"
ref="org.hisp.dhis.program.ProgramStageInstanceService" />
- <property name="userService"
- ref="org.hisp.dhis.user.UserService" />
+ <property name="userService" ref="org.hisp.dhis.user.UserService" />
</bean>
<!-- Patient Mobile Settings -->
<bean id="org.hisp.dhis.mobile.action.ShowMobileSettingFormAction"
- class="org.hisp.dhis.mobile.action.ShowMobileSettingFormAction"
- scope="prototype">
+ class="org.hisp.dhis.mobile.action.ShowMobileSettingFormAction" scope="prototype">
<property name="patientMobileSettingService"
ref="org.hisp.dhis.mobile.service.PatientMobileSettingService" />
<property name="patientAttributeService"
@@ -77,8 +68,7 @@
</bean>
<bean id="org.hisp.dhis.mobile.action.UpdateMobileSettingAction"
- class="org.hisp.dhis.mobile.action.UpdateMobileSettingAction"
- scope="prototype">
+ class="org.hisp.dhis.mobile.action.UpdateMobileSettingAction" scope="prototype">
<property name="patientMobileSettingService"
ref="org.hisp.dhis.mobile.service.PatientMobileSettingService" />
<property name="patientAttributeService"
@@ -88,40 +78,32 @@
<!-- Mobile DataSet -->
<bean id="org.hisp.dhis.mobile.action.MobileDataSetListAction"
- class="org.hisp.dhis.mobile.action.MobileDataSetListAction"
- scope="prototype">
- <property name="dataSetService"
- ref="org.hisp.dhis.dataset.DataSetService" />
+ class="org.hisp.dhis.mobile.action.MobileDataSetListAction" scope="prototype">
+ <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
</bean>
<bean id="org.hisp.dhis.mobile.action.UpdateMobileDataSetAction"
- class="org.hisp.dhis.mobile.action.UpdateMobileDataSetAction"
- scope="prototype">
- <property name="dataSetService"
- ref="org.hisp.dhis.dataset.DataSetService" />
+ class="org.hisp.dhis.mobile.action.UpdateMobileDataSetAction" scope="prototype">
+ <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
</bean>
<!-- SMS Service Configuration -->
<bean id="org.hisp.dhis.mobile.action.GetSmsConfigurationAction"
- class="org.hisp.dhis.mobile.action.GetSmsConfigurationAction"
- scope="prototype" />
+ class="org.hisp.dhis.mobile.action.GetSmsConfigurationAction" scope="prototype" />
<bean id="org.hisp.dhis.mobile.action.SaveSmsConfigurationAction"
- class="org.hisp.dhis.mobile.action.SaveSmsConfigurationAction"
- scope="prototype" />
+ class="org.hisp.dhis.mobile.action.SaveSmsConfigurationAction" scope="prototype" />
<bean id="org.hisp.dhis.mobile.action.UpdateBulkGateWayConfigAction"
class="org.hisp.dhis.mobile.action.UpdateBulkGateWayConfigAction"
scope="prototype" />
- <bean
- id="org.hisp.dhis.mobile.action.UpdateModemGateWayConfigAction"
+ <bean id="org.hisp.dhis.mobile.action.UpdateModemGateWayConfigAction"
class="org.hisp.dhis.mobile.action.UpdateModemGateWayConfigAction"
scope="prototype" />
- <bean
- id="org.hisp.dhis.mobile.action.UpdateClickatellGateWayConfigAction"
+ <bean id="org.hisp.dhis.mobile.action.UpdateClickatellGateWayConfigAction"
class="org.hisp.dhis.mobile.action.UpdateClickatellGateWayConfigAction"
scope="prototype" />
@@ -130,27 +112,21 @@
class="org.hisp.dhis.mobile.action.UpdateGenericHTTPGateWayConfigAction"
scope="prototype" />
- <bean
- id="org.hisp.dhis.mobile.action.UpdateDefaultGatewayAction"
- class="org.hisp.dhis.mobile.action.UpdateDefaultGatewayAction"
- scope="prototype" />
+ <bean id="org.hisp.dhis.mobile.action.UpdateDefaultGatewayAction"
+ class="org.hisp.dhis.mobile.action.UpdateDefaultGatewayAction" scope="prototype" />
<bean id="org.hisp.dhis.mobile.action.RemoveGatewayConfigAction"
- class="org.hisp.dhis.mobile.action.RemoveGatewayConfigAction"
- scope="prototype" />
+ class="org.hisp.dhis.mobile.action.RemoveGatewayConfigAction" scope="prototype" />
<bean id="org.hisp.dhis.mobile.action.ReloadStartStopServiceAction"
class="org.hisp.dhis.mobile.action.ReloadStartStopServiceAction"
scope="prototype" />
<bean id="org.hisp.dhis.mobile.action.smscommand.SMSCommandAction"
- class="org.hisp.dhis.mobile.action.smscommand.SMSCommandAction"
- scope="prototype">
+ class="org.hisp.dhis.mobile.action.smscommand.SMSCommandAction" scope="prototype">
<property name="smsCommandService" ref="smsCommandService" />
- <property name="dataSetService"
- ref="org.hisp.dhis.dataset.DataSetService" />
- <property name="userGroupService"
- ref="org.hisp.dhis.user.UserGroupService" />
+ <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
+ <property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService" />
</bean>
@@ -158,12 +134,9 @@
class="org.hisp.dhis.mobile.action.smscommand.EditSMSCommandForm"
scope="prototype">
<property name="smsCommandService" ref="smsCommandService" />
- <property name="dataSetService"
- ref="org.hisp.dhis.dataset.DataSetService" />
- <property name="dataElementService"
- ref="org.hisp.dhis.dataelement.DataElementService" />
- <property name="userGroupService"
- ref="org.hisp.dhis.user.UserGroupService" />
+ <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
+ <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
+ <property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService" />
</bean>
@@ -171,10 +144,8 @@
class="org.hisp.dhis.mobile.action.smscommand.CreateSMSCommandForm"
scope="prototype">
<property name="smsCommandService" ref="smsCommandService" />
- <property name="dataSetService"
- ref="org.hisp.dhis.dataset.DataSetService" />
- <property name="userGroupService"
- ref="org.hisp.dhis.user.UserGroupService" />
+ <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
+ <property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService" />
</bean>
<bean id="org.hisp.dhis.mobile.action.smscommand.DeleteSMSCommandAction"
@@ -184,16 +155,15 @@
</bean>
<bean id="org.hisp.dhis.mobile.action.J2meClientUpdateAction"
- class="org.hisp.dhis.mobile.action.J2meClientUpdateAction"
- scope="prototype">
+ class="org.hisp.dhis.mobile.action.J2meClientUpdateAction" scope="prototype">
<property name="patientMobileSettingService"
ref="org.hisp.dhis.mobile.service.PatientMobileSettingService" />
</bean>
-
- <!--
+
<bean id="org.hisp.dhis.mobile.action.MobilePhonesPatternAction"
- class="org.hisp.dhis.mobile.action.MobilePhonesPatternAction"
- scope="prototype">
+ class="org.hisp.dhis.mobile.action.MobilePhonesPatternAction" scope="prototype">
+ <property name="phoneNumberPatternService"
+ ref="org.hisp.dhis.sms.phonepattern.PhoneNumberPatternService"></property>
</bean>
- -->
+
</beans>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/struts.xml 2013-08-08 07:11:28 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/struts.xml 2013-08-13 08:06:25 +0000
@@ -205,12 +205,12 @@
<param name="requiredAuthorities">F_MOBILE_SENDSMS</param>
</action>
- <!-- Mobile Phones Pattern
+ <!-- Mobile Phones Pattern -->
<action name="mobilePhonesPattern" class="org.hisp.dhis.mobile.action.MobilePhonesPatternAction">
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-maintenance-mobile/phonePatternPage.vm</param>
<param name="menu">/dhis-web-maintenance-mobile/menu.vm</param>
- </action>-->
+ </action>
</package>
</struts>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/menu.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/menu.vm 2013-08-08 06:59:54 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/menu.vm 2013-08-13 08:06:25 +0000
@@ -8,5 +8,5 @@
<li><a href="showReceivingPage.action">$i18n.getString( "show_receive_sms_form" )</a></li>
<li><a href="SMSCommands.action">$i18n.getString( "sms_command_form" )</a></li>
<li><a href="showJ2meClientUpdatePage.action">$i18n.getString( "j2me_client_update" )</a></li>
- <!--<li><a href="mobilePhonesPattern.action">$i18n.getString( "mobile_phones_pattern" )</a></li>-->
+ <!--<li><a href="mobilePhonesPattern.action">$i18n.getString( "mobile_phones_pattern" )</a></li>-->
</ul>
\ No newline at end of file
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/phonePatternPage.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/phonePatternPage.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/phonePatternPage.vm 2013-08-13 08:06:25 +0000
@@ -0,0 +1,21 @@
+<h3>$i18n.getString( "mobile_phones_pattern" )</h3>
+<form>
+ <table>
+ <tr>
+ <td>$i18n.getString( "start_with" ) :</td>
+ <td><input type="text"/></td>
+ </tr>
+ <tr>
+ <td>$i18n.getString( "follow_by" ) :</td>
+ <td><input type="text"/></td>
+ </tr>
+ <tr>
+ <td>$i18n.getString( "digit_left" ) :</td>
+ <td><input type="text"/></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td><input type="button" value="$i18n.getString( 'save' )"</td>
+ </tr>
+ </table>
+</form>
\ No newline at end of file