dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #29980
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15203: [mobile j2me] find user for sending message
------------------------------------------------------------
revno: 15203
committer: Hong Em <em.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-05-09 17:07:18 +0700
message:
[mobile j2me] find user for sending message
added:
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Recipient.java
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/User.java
modified:
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/ActivityReportingService.java
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/MobileOrgUnitLinks.java
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java
dhis-2/dhis-services/dhis-service-mobile/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/mobile/api/model/OrgUnitTest.java
dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/mobile/api/model/OrgUnitsTest.java
dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileClientController.java
dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileOrganisationUnitController.java
--
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-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/ActivityReportingService.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/ActivityReportingService.java 2014-05-05 10:16:05 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/ActivityReportingService.java 2014-05-09 10:07:18 +0000
@@ -35,6 +35,7 @@
import org.hisp.dhis.api.mobile.model.ActivityValue;
import org.hisp.dhis.api.mobile.model.Message;
import org.hisp.dhis.api.mobile.model.PatientAttribute;
+import org.hisp.dhis.api.mobile.model.User;
import org.hisp.dhis.api.mobile.model.LWUITmodel.LostEvent;
import org.hisp.dhis.api.mobile.model.LWUITmodel.Notification;
import org.hisp.dhis.api.mobile.model.LWUITmodel.Patient;
@@ -106,4 +107,7 @@
public String sendFeedback( Message message )
throws NotAllowedException;
+ public Collection<User> findUser( String keyword )
+ throws NotAllowedException;
+
}
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/MobileOrgUnitLinks.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/MobileOrgUnitLinks.java 2014-05-05 10:16:05 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/MobileOrgUnitLinks.java 2014-05-09 10:07:18 +0000
@@ -67,6 +67,8 @@
private String sendFeedbackUrl;
+ private String findUserUrl;
+
private String updateContactUrl;
private String findPatientUrl;
@@ -227,6 +229,16 @@
this.sendFeedbackUrl = sendFeedbackUrl;
}
+ public String getFindUserUrl()
+ {
+ return findUserUrl;
+ }
+
+ public void setFindUserUrl( String findUserUrl )
+ {
+ this.findUserUrl = findUserUrl;
+ }
+
public String getUpdateContactUrl()
{
return updateContactUrl;
@@ -382,6 +394,7 @@
dataOutputStream.writeUTF( searchUrl );
dataOutputStream.writeUTF( updateNewVersionUrl );
dataOutputStream.writeUTF( sendFeedbackUrl );
+ dataOutputStream.writeUTF( findUserUrl );
dataOutputStream.writeUTF( updateContactUrl );
dataOutputStream.writeUTF( findPatientUrl );
dataOutputStream.writeUTF( registerPersonUrl );
@@ -396,7 +409,6 @@
dataOutputStream.writeUTF( handleLostToFollowUpUrl );
dataOutputStream.writeUTF( generateRepeatableEventUrl );
dataOutputStream.writeUTF( uploadSingleEventWithoutRegistration );
-
}
@@ -415,6 +427,7 @@
searchUrl = dataInputStream.readUTF();
updateNewVersionUrl = dataInputStream.readUTF();
sendFeedbackUrl = dataInputStream.readUTF();
+ findUserUrl = dataInputStream.readUTF();
updateContactUrl = dataInputStream.readUTF();
findPatientUrl = dataInputStream.readUTF();
registerPersonUrl = dataInputStream.readUTF();
@@ -464,6 +477,7 @@
dataOutputStream.writeUTF( this.searchUrl );
dataOutputStream.writeUTF( this.updateNewVersionUrl );
dataOutputStream.writeUTF( this.sendFeedbackUrl );
+ dataOutputStream.writeUTF( this.findUserUrl );
// dataOutputStream.writeUTF( this.updateContactUrl );
}
@@ -483,6 +497,7 @@
dataOutputStream.writeUTF( searchUrl );
dataOutputStream.writeUTF( updateNewVersionUrl );
dataOutputStream.writeUTF( sendFeedbackUrl );
+ dataOutputStream.writeUTF( findUserUrl );
dataOutputStream.writeUTF( updateContactUrl );
dataOutputStream.writeUTF( findPatientUrl );
dataOutputStream.writeUTF( registerPersonUrl );
=== added file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Recipient.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Recipient.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Recipient.java 2014-05-09 10:07:18 +0000
@@ -0,0 +1,125 @@
+package org.hisp.dhis.api.mobile.model;
+
+/*
+ * Copyright (c) 2004-2014, 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.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.util.Collection;
+
+public class Recipient
+ implements DataStreamSerializable
+{
+ private String clientVersion;
+
+ private Collection<User> users;
+
+ public String getClientVersion()
+ {
+ return clientVersion;
+ }
+
+ public void setClientVersion( String clientVersion )
+ {
+ this.clientVersion = clientVersion;
+ }
+
+ public Collection<User> getUsers()
+ {
+ return users;
+ }
+
+ public void setUsers( Collection<User> users )
+ {
+ this.users = users;
+ }
+
+ @Override
+ public void serialize( DataOutputStream dout )
+ throws IOException
+ {
+ if ( users == null )
+ {
+ dout.writeInt( 0 );
+ }
+ else
+ {
+ dout.writeInt( users.size() );
+ for ( User user : users )
+ {
+ user.setClientVersion( DataStreamSerializable.TWO_POINT_TEN );
+ user.serialize( dout );
+ }
+ }
+
+ }
+
+ @Override
+ public void deSerialize( DataInputStream dataInputStream )
+ throws IOException
+ {
+
+ }
+
+ @Override
+ public void serializeVersion2_8( DataOutputStream dataOutputStream )
+ throws IOException
+ {
+
+ }
+
+ @Override
+ public void serializeVersion2_9( DataOutputStream dataOutputStream )
+ throws IOException
+ {
+
+ }
+
+ @Override
+ public void serializeVersion2_10( DataOutputStream dout )
+ throws IOException
+ {
+
+ if ( users == null )
+ {
+ dout.writeInt( 0 );
+ }
+ else
+ {
+ dout.writeInt( users.size() );
+ for ( User user : users )
+ {
+ user.setClientVersion( DataStreamSerializable.TWO_POINT_TEN );
+ user.serialize( dout );
+ }
+ }
+
+ }
+
+}
=== added file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/User.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/User.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/User.java 2014-05-09 10:07:18 +0000
@@ -0,0 +1,131 @@
+package org.hisp.dhis.api.mobile.model;
+
+/*
+ * Copyright (c) 2004-2014, 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.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+import javax.xml.bind.annotation.XmlAttribute;
+
+public class User
+ implements DataStreamSerializable
+{
+ private String clientVersion;
+
+ private String surname;
+
+ private String firstName;
+
+ public User()
+ {
+ }
+
+ public User( String surname, String firstName )
+ {
+ super();
+ this.surname = surname;
+ this.firstName = firstName;
+ }
+
+ public String getClientVersion()
+ {
+ return clientVersion;
+ }
+
+ public void setClientVersion( String clientVersion )
+ {
+ this.clientVersion = clientVersion;
+ }
+
+ @XmlAttribute
+ public String getSurname()
+ {
+ return surname;
+ }
+
+ public void setSurname( String surname )
+ {
+ this.surname = surname;
+ }
+
+ @XmlAttribute
+ public String getFirstName()
+ {
+ return firstName;
+ }
+
+ public void setFirstName( String firstName )
+ {
+ this.firstName = firstName;
+ }
+
+ @Override
+ public void serialize( DataOutputStream dout )
+ throws IOException
+ {
+ dout.writeUTF( this.surname );
+ dout.writeUTF( this.firstName );
+
+ }
+
+ @Override
+ public void deSerialize( DataInputStream din )
+ throws IOException
+ {
+ surname = din.readUTF();
+ firstName = din.readUTF();
+ }
+
+ @Override
+ public void serializeVersion2_8( DataOutputStream dout )
+ throws IOException
+ {
+ dout.writeUTF( this.surname );
+ dout.writeUTF( this.firstName );
+ }
+
+ @Override
+ public void serializeVersion2_9( DataOutputStream dout )
+ throws IOException
+ {
+ dout.writeUTF( this.surname );
+ dout.writeUTF( this.firstName );
+ }
+
+ @Override
+ public void serializeVersion2_10( DataOutputStream dout )
+ throws IOException
+ {
+ dout.writeUTF( this.surname );
+ dout.writeUTF( this.firstName );
+
+ }
+
+}
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java 2014-05-09 09:08:45 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java 2014-05-09 10:07:18 +0000
@@ -99,6 +99,7 @@
import org.hisp.dhis.trackedentitydatavalue.TrackedEntityDataValueService;
import org.hisp.dhis.user.CurrentUserService;
import org.hisp.dhis.user.User;
+import org.hisp.dhis.user.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Required;
@@ -153,6 +154,8 @@
private TrackedEntityAttributeService attributeService;
+ private UserService userService;
+
private Integer patientId;
@Autowired
@@ -253,6 +256,12 @@
this.programService = programService;
}
+ @Required
+ public void setUserService( UserService userService )
+ {
+ this.userService = userService;
+ }
+
// -------------------------------------------------------------------------
// MobileDataSetService
// -------------------------------------------------------------------------
@@ -1877,4 +1886,37 @@
return FEEDBACK_SENT;
}
+
+ @Override
+ public Collection<org.hisp.dhis.api.mobile.model.User> findUser( String keyword )
+ throws NotAllowedException
+ {
+ Collection<User> users = new HashSet<User>();
+
+ Collection<org.hisp.dhis.api.mobile.model.User> userList = new HashSet<org.hisp.dhis.api.mobile.model.User>();
+
+ if ( keyword != null )
+ {
+ int index = keyword.indexOf( ' ' );
+
+ if ( index != -1 && index == keyword.lastIndexOf( ' ' ) )
+ {
+ String[] keys = keyword.split( " " );
+ keyword = keys[0] + " " + keys[1];
+ }
+ }
+
+ users = userService.getUsersByName( keyword );
+
+ for ( User userCore : users )
+ {
+ org.hisp.dhis.api.mobile.model.User user = new org.hisp.dhis.api.mobile.model.User();
+ user.setSurname( userCore.getSurname() );
+ user.setFirstName( userCore.getFirstName() );
+ userList.add( user );
+
+ }
+
+ return userList;
+ }
}
\ No newline at end of file
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/resources/META-INF/dhis/beans.xml 2014-03-26 19:40:22 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/resources/META-INF/dhis/beans.xml 2014-05-09 10:07:18 +0000
@@ -1,52 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd">
-
- <!-- Services -->
-
- <bean id="org.hisp.dhis.mobile.api.FacilityReportingService" class="org.hisp.dhis.mobile.service.FacilityReportingServiceImpl">
- <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
- <property name="i18nService" ref="org.hisp.dhis.i18n.I18nService" />
- <property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
- <property name="categoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
- <property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService" />
- <property name="registrationService" ref="org.hisp.dhis.dataset.CompleteDataSetRegistrationService" />
- <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
- <property name="oUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
- </bean>
-
- <bean id="org.hisp.dhis.mobile.api.ActivityReportingService" class="org.hisp.dhis.mobile.service.ActivityReportingServiceImpl">
- <property name="attValueService" ref="org.hisp.dhis.trackedentityattributevalue.TrackedEntityAttributeValueService" />
- <property name="programStageInstanceService" ref="org.hisp.dhis.program.ProgramStageInstanceService" />
- <property name="mobileSettingService" ref="org.hisp.dhis.api.mobile.TrackedEntityMobileSettingService" />
- <property name="programStageSectionService" ref="org.hisp.dhis.program.ProgramStageSectionService" />
- <property name="entityInstanceService" ref="org.hisp.dhis.trackedentity.TrackedEntityInstanceService" />
- <property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
- <property name="relationshipService" ref="org.hisp.dhis.relationship.RelationshipService" />
- <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
- <property name="dataValueService" ref="org.hisp.dhis.trackedentitydatavalue.TrackedEntityDataValueService" />
- <property name="programService" ref="org.hisp.dhis.program.ProgramService" />
- <property name="attributeService" ref="org.hisp.dhis.trackedentity.TrackedEntityAttributeService" />
- <property name="relationshipTypeService" ref="org.hisp.dhis.relationship.RelationshipTypeService" />
- <property name="programStageService" ref="org.hisp.dhis.program.ProgramStageService" />
- <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
- <property name="messageService" ref="org.hisp.dhis.message.MessageService" />
- <property name="smsSender" ref="org.hisp.dhis.sms.SmsSender" />
- </bean>
-
- <bean id="org.hisp.dhis.mobile.api.IProgramService" class="org.hisp.dhis.mobile.service.DefaultProgramService">
- <property name="programService" ref="org.hisp.dhis.program.ProgramService" />
- </bean>
-
- <bean id="org.hisp.dhis.api.mobile.TrackedEntityMobileSettingService"
- class="org.hisp.dhis.mobile.service.DefaultTrackedEntityMobileSettingService">
- <property name="mobileSettingStore" ref="org.hisp.dhis.api.mobile.TrackedEntityMobileSettingStore" />
- </bean>
-
- <bean id="org.hisp.dhis.api.mobile.TrackedEntityMobileSettingStore" class="org.hisp.dhis.mobile.service.HibernateTrackedEntityMobileSettingStore">
- <property name="clazz" value="org.hisp.dhis.trackedentity.TrackedEntityMobileSetting" />
- <property name="sessionFactory" ref="sessionFactory" />
- </bean>
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd">
+
+ <!-- Services -->
+
+ <bean id="org.hisp.dhis.mobile.api.FacilityReportingService"
+ class="org.hisp.dhis.mobile.service.FacilityReportingServiceImpl">
+ <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
+ <property name="i18nService" ref="org.hisp.dhis.i18n.I18nService" />
+ <property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
+ <property name="categoryService"
+ ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
+ <property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService" />
+ <property name="registrationService"
+ ref="org.hisp.dhis.dataset.CompleteDataSetRegistrationService" />
+ <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
+ <property name="oUnitService"
+ ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.mobile.api.ActivityReportingService"
+ class="org.hisp.dhis.mobile.service.ActivityReportingServiceImpl">
+ <property name="attValueService"
+ ref="org.hisp.dhis.trackedentityattributevalue.TrackedEntityAttributeValueService" />
+ <property name="programStageInstanceService"
+ ref="org.hisp.dhis.program.ProgramStageInstanceService" />
+ <property name="mobileSettingService"
+ ref="org.hisp.dhis.api.mobile.TrackedEntityMobileSettingService" />
+ <property name="programStageSectionService"
+ ref="org.hisp.dhis.program.ProgramStageSectionService" />
+ <property name="entityInstanceService"
+ ref="org.hisp.dhis.trackedentity.TrackedEntityInstanceService" />
+ <property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
+ <property name="relationshipService"
+ ref="org.hisp.dhis.relationship.RelationshipService" />
+ <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
+ <property name="dataValueService"
+ ref="org.hisp.dhis.trackedentitydatavalue.TrackedEntityDataValueService" />
+ <property name="programService" ref="org.hisp.dhis.program.ProgramService" />
+ <property name="attributeService"
+ ref="org.hisp.dhis.trackedentity.TrackedEntityAttributeService" />
+ <property name="relationshipTypeService"
+ ref="org.hisp.dhis.relationship.RelationshipTypeService" />
+ <property name="programStageService" ref="org.hisp.dhis.program.ProgramStageService" />
+ <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
+ <property name="messageService" ref="org.hisp.dhis.message.MessageService" />
+ <property name="smsSender" ref="org.hisp.dhis.sms.SmsSender" />
+ <property name="userService" ref="org.hisp.dhis.user.UserService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.mobile.api.IProgramService" class="org.hisp.dhis.mobile.service.DefaultProgramService">
+ <property name="programService" ref="org.hisp.dhis.program.ProgramService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.api.mobile.TrackedEntityMobileSettingService"
+ class="org.hisp.dhis.mobile.service.DefaultTrackedEntityMobileSettingService">
+ <property name="mobileSettingStore"
+ ref="org.hisp.dhis.api.mobile.TrackedEntityMobileSettingStore" />
+ </bean>
+
+ <bean id="org.hisp.dhis.api.mobile.TrackedEntityMobileSettingStore"
+ class="org.hisp.dhis.mobile.service.HibernateTrackedEntityMobileSettingStore">
+ <property name="clazz"
+ value="org.hisp.dhis.trackedentity.TrackedEntityMobileSetting" />
+ <property name="sessionFactory" ref="sessionFactory" />
+ </bean>
</beans>
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/mobile/api/model/OrgUnitTest.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/mobile/api/model/OrgUnitTest.java 2014-05-05 10:16:05 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/mobile/api/model/OrgUnitTest.java 2014-05-09 10:07:18 +0000
@@ -60,6 +60,7 @@
unit.setSearchUrl( "search" );
unit.setUpdateNewVersionUrl( "" );
unit.setSendFeedbackUrl( "sendFeedbackUrl" );
+ unit.setFindUserUrl( "findUserUrl" );
unit.setUpdateContactUrl( "updateContactUrl" );
unit.setFindPatientUrl( "findPatientUrl" );
unit.setUploadProgramStageUrl( "uploadProgramStageUrl" );
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/mobile/api/model/OrgUnitsTest.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/mobile/api/model/OrgUnitsTest.java 2014-05-05 10:16:05 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/mobile/api/model/OrgUnitsTest.java 2014-05-09 10:07:18 +0000
@@ -86,6 +86,7 @@
orgUnit.setSearchUrl( "search" );
orgUnit.setUpdateNewVersionUrl( "updateNewVersionUrl" );
orgUnit.setSendFeedbackUrl( "sendFeedback" );
+ orgUnit.setFindUserUrl( "findUserUrl" );
orgUnit.setUpdateContactUrl( "updateContactForMobile" );
orgUnit.setFindPatientUrl( "findPatient" );
orgUnit.setRegisterPersonUrl( "registerPerson" );
=== modified file 'dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileClientController.java'
--- dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileClientController.java 2014-05-05 10:16:05 +0000
+++ dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileClientController.java 2014-05-09 10:07:18 +0000
@@ -83,8 +83,8 @@
@RequestMapping( method = RequestMethod.GET, value = "/{version}" )
@ResponseBody
- public OrgUnits getOrgUnitsForUser( HttpServletRequest request,
- @PathVariable String version )
+ public OrgUnits getOrgUnitsForUser( HttpServletRequest request, @PathVariable
+ String version )
throws NotAllowedException
{
User user = currentUserService.getCurrentUser();
@@ -108,8 +108,8 @@
@RequestMapping( method = RequestMethod.GET, value = "/{version}/LWUIT" )
@ResponseBody
- public OrgUnits getOrgUnitsForUserLWUIT( HttpServletRequest request,
- @PathVariable String version )
+ public OrgUnits getOrgUnitsForUserLWUIT( HttpServletRequest request, @PathVariable
+ String version )
throws NotAllowedException
{
User user = currentUserService.getCurrentUser();
@@ -147,7 +147,8 @@
orgUnit.setChangeUpdateDataSetLangUrl( getUrl( request, unit.getId(), "changeLanguageDataSet" ) );
orgUnit.setSearchUrl( getUrl( request, unit.getId(), "search" ) );
orgUnit.setUpdateNewVersionUrl( getUrl( request, unit.getId(), "updateNewVersionUrl" ) );
- orgUnit.setSendFeedbackUrl( getUrl(request, unit.getId(), "sendFeedback") );
+ orgUnit.setSendFeedbackUrl( getUrl( request, unit.getId(), "sendFeedback" ) );
+ orgUnit.setFindUserUrl( getUrl( request, unit.getId(), "findUser" ) );
orgUnit.setUpdateContactUrl( getUrl( request, unit.getId(), "updateContactForMobile" ) );
orgUnit.setFindPatientUrl( getUrl( request, unit.getId(), "findPatient" ) );
orgUnit.setRegisterPersonUrl( getUrl( request, unit.getId(), "registerPerson" ) );
@@ -161,7 +162,8 @@
orgUnit.setFindLostToFollowUpUrl( getUrl( request, unit.getId(), "findLostToFollowUp" ) );
orgUnit.setHandleLostToFollowUpUrl( getUrl( request, unit.getId(), "handleLostToFollowUp" ) );
orgUnit.setGenerateRepeatableEventUrl( getUrl( request, unit.getId(), "generateRepeatableEvent" ) );
- orgUnit.setUploadSingleEventWithoutRegistration(getUrl( request, unit.getId(), "uploadSingleEventWithoutRegistration" ));
+ orgUnit.setUploadSingleEventWithoutRegistration( getUrl( request, unit.getId(),
+ "uploadSingleEventWithoutRegistration" ) );
// generate URL for download new version
String full = UrlUtils.buildFullRequestUrl( request );
=== modified file 'dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileOrganisationUnitController.java'
--- dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileOrganisationUnitController.java 2014-05-05 10:16:05 +0000
+++ dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileOrganisationUnitController.java 2014-05-09 10:07:18 +0000
@@ -44,11 +44,12 @@
import org.hisp.dhis.api.mobile.model.DataSetValue;
import org.hisp.dhis.api.mobile.model.DataSetValueList;
import org.hisp.dhis.api.mobile.model.DataStreamSerializable;
+import org.hisp.dhis.api.mobile.model.Message;
import org.hisp.dhis.api.mobile.model.MobileModel;
import org.hisp.dhis.api.mobile.model.ModelList;
+import org.hisp.dhis.api.mobile.model.Recipient;
import org.hisp.dhis.api.mobile.model.SMSCode;
import org.hisp.dhis.api.mobile.model.SMSCommand;
-import org.hisp.dhis.api.mobile.model.Message;
import org.hisp.dhis.api.mobile.model.LWUITmodel.LostEvent;
import org.hisp.dhis.api.mobile.model.LWUITmodel.Notification;
import org.hisp.dhis.api.mobile.model.LWUITmodel.Patient;
@@ -560,4 +561,17 @@
}
+ @RequestMapping( method = RequestMethod.GET, value = "{clientVersion}/orgUnits/{id}/findUser" )
+ @ResponseBody
+ public Recipient findUser( String clientVersion, @PathVariable
+ int id, @RequestHeader( "name" )
+ String keyword )
+ throws NotAllowedException
+ {
+ Recipient recipient = new Recipient();
+ recipient.setClientVersion( clientVersion );
+ recipient.setUsers( activityReportingService.findUser( keyword ) );
+ return recipient;
+ }
+
}