dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #40001
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20249: [mobile] update mobile api to follow the change on core models
------------------------------------------------------------
revno: 20249
committer: Long Ngo Thanh <thanhlongngo1988@xxxxxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-09-21 16:24:27 +0700
message:
[mobile] update mobile api to follow the change on core models
modified:
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataElement.java
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/Program.java
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/ProgramStageDataElement.java
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/PatientAttribute.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/java/org/hisp/dhis/mobile/service/DefaultProgramService.java
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ModelMapping.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/model/DataElement.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataElement.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataElement.java 2015-09-21 09:24:27 +0000
@@ -6,6 +6,8 @@
import javax.xml.bind.annotation.XmlAttribute;
+import org.hisp.dhis.common.ValueType;
+
/*
* Copyright (c) 2004-2015, University of Oslo
* All rights reserved.
@@ -46,6 +48,28 @@
private ModelList categoryOptionCombos;
private OptionSet optionSet;
+
+ public static final String TYPE_STRING = "string";
+
+ public static final String TYPE_PHONE_NUMBER = "phoneNumber";
+
+ public static final String TYPE_EMAIL = "email";
+
+ public static final String TYPE_NUMBER = "number";
+
+ public static final String TYPE_LETTER = "letter";
+
+ public static final String TYPE_BOOL = "bool";
+
+ public static final String TYPE_TRUE_ONLY = "trueOnly";
+
+ public static final String TYPE_DATE = "date";
+
+ public static final String TYPE_OPTION_SET = "optionSet";
+
+ public static final String TYPE_TRACKER_ASSOCIATE = "trackerAssociate";
+
+ public static final String TYPE_USERS = "users";
@XmlAttribute
public String getType()
@@ -57,6 +81,57 @@
{
this.type = type;
}
+
+ public void setType (ValueType type) {
+ if ( type == ValueType.BOOLEAN )
+ {
+ this.setType( TYPE_BOOL );
+ }
+ else if ( type == ValueType.DATE || type == ValueType.DATETIME )
+ {
+ this.setType( TYPE_DATE );
+ }
+ else if ( type == ValueType.EMAIL )
+ {
+ this.setType( TYPE_EMAIL );
+ }
+ else if ( type == ValueType.INTEGER || type == ValueType.NUMBER )
+ {
+ this.setType( TYPE_NUMBER );
+ }
+ else if ( type == ValueType.LETTER )
+ {
+ this.setType( TYPE_LETTER );
+ }
+ else if ( type == ValueType.LONG_TEXT )
+ {
+ this.setType( TYPE_STRING );
+ }
+ else if ( type == ValueType.OPTION_SET )
+ {
+ this.setType( TYPE_OPTION_SET );
+ }
+ else if ( type == ValueType.PHONE_NUMBER )
+ {
+ this.setType( TYPE_PHONE_NUMBER );
+ }
+ else if ( type == ValueType.TRACKER_ASSOCIATE )
+ {
+ this.setType( TYPE_TRACKER_ASSOCIATE );
+ }
+ else if ( type == ValueType.TRUE_ONLY )
+ {
+ this.setType( TYPE_TRUE_ONLY );
+ }
+ else if ( type == ValueType.USERNAME )
+ {
+ this.setType( TYPE_USERS );
+ }
+ else
+ {
+ this.setType( TYPE_STRING );
+ }
+ }
public ModelList getCategoryOptionCombos()
{
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/Program.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/Program.java 2015-07-02 07:05:55 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/Program.java 2015-09-21 09:24:27 +0000
@@ -218,7 +218,6 @@
}
dout.writeInt( getRelatedProgramId() );
dout.writeInt( relationshipType );
-
}
@Override
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/ProgramStageDataElement.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/ProgramStageDataElement.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/ProgramStageDataElement.java 2015-09-21 09:24:27 +0000
@@ -36,6 +36,7 @@
import org.hisp.dhis.api.mobile.model.Model;
import org.hisp.dhis.api.mobile.model.ModelList;
import org.hisp.dhis.api.mobile.model.OptionSet;
+import org.hisp.dhis.common.ValueType;
/**
* @author Nguyen Kim Lai
@@ -56,6 +57,28 @@
private String value;
+ public static final String TYPE_STRING = "string";
+
+ public static final String TYPE_PHONE_NUMBER = "phoneNumber";
+
+ public static final String TYPE_EMAIL = "email";
+
+ public static final String TYPE_NUMBER = "number";
+
+ public static final String TYPE_LETTER = "letter";
+
+ public static final String TYPE_BOOL = "bool";
+
+ public static final String TYPE_TRUE_ONLY = "trueOnly";
+
+ public static final String TYPE_DATE = "date";
+
+ public static final String TYPE_OPTION_SET = "optionSet";
+
+ public static final String TYPE_TRACKER_ASSOCIATE = "trackerAssociate";
+
+ public static final String TYPE_USERS = "users";
+
@Override
public void serialize( DataOutputStream dout )
throws IOException
@@ -179,6 +202,57 @@
{
this.type = type;
}
+
+ public void setType (ValueType type) {
+ if ( type == ValueType.BOOLEAN )
+ {
+ this.setType( TYPE_BOOL );
+ }
+ else if ( type == ValueType.DATE || type == ValueType.DATETIME )
+ {
+ this.setType( TYPE_DATE );
+ }
+ else if ( type == ValueType.EMAIL )
+ {
+ this.setType( TYPE_EMAIL );
+ }
+ else if ( type == ValueType.INTEGER || type == ValueType.NUMBER )
+ {
+ this.setType( TYPE_NUMBER );
+ }
+ else if ( type == ValueType.LETTER )
+ {
+ this.setType( TYPE_LETTER );
+ }
+ else if ( type == ValueType.LONG_TEXT )
+ {
+ this.setType( TYPE_STRING );
+ }
+ else if ( type == ValueType.OPTION_SET )
+ {
+ this.setType( TYPE_OPTION_SET );
+ }
+ else if ( type == ValueType.PHONE_NUMBER )
+ {
+ this.setType( TYPE_PHONE_NUMBER );
+ }
+ else if ( type == ValueType.TRACKER_ASSOCIATE )
+ {
+ this.setType( TYPE_TRACKER_ASSOCIATE );
+ }
+ else if ( type == ValueType.TRUE_ONLY )
+ {
+ this.setType( TYPE_TRUE_ONLY );
+ }
+ else if ( type == ValueType.USERNAME )
+ {
+ this.setType( TYPE_USERS );
+ }
+ else
+ {
+ this.setType( TYPE_STRING );
+ }
+ }
public boolean isCompulsory()
{
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/PatientAttribute.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/PatientAttribute.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/PatientAttribute.java 2015-09-21 09:24:27 +0000
@@ -34,6 +34,9 @@
import javax.xml.bind.annotation.XmlAttribute;
+import org.h2.value.Value;
+import org.hisp.dhis.common.ValueType;
+
public class PatientAttribute
implements DataStreamSerializable
{
@@ -51,11 +54,34 @@
private OptionSet optionSet;
+ public static final String TYPE_STRING = "string";
+
+ public static final String TYPE_PHONE_NUMBER = "phoneNumber";
+
+ public static final String TYPE_EMAIL = "email";
+
+ public static final String TYPE_NUMBER = "number";
+
+ public static final String TYPE_LETTER = "letter";
+
+ public static final String TYPE_BOOL = "bool";
+
+ public static final String TYPE_TRUE_ONLY = "trueOnly";
+
+ public static final String TYPE_DATE = "date";
+
+ public static final String TYPE_OPTION_SET = "optionSet";
+
+ public static final String TYPE_TRACKER_ASSOCIATE = "trackerAssociate";
+
+ public static final String TYPE_USERS = "users";
+
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
- public PatientAttribute( String name, String value, String type, boolean isMandatory, boolean isDisplayedInList, OptionSet optionSet )
+ public PatientAttribute( String name, String value, String type, boolean isMandatory, boolean isDisplayedInList,
+ OptionSet optionSet )
{
this.name = name;
this.value = value;
@@ -115,6 +141,58 @@
this.type = type;
}
+ public void setType( ValueType type )
+ {
+ if ( type == ValueType.BOOLEAN )
+ {
+ this.setType( TYPE_BOOL );
+ }
+ else if ( type == ValueType.DATE || type == ValueType.DATETIME )
+ {
+ this.setType( TYPE_DATE );
+ }
+ else if ( type == ValueType.EMAIL )
+ {
+ this.setType( TYPE_EMAIL );
+ }
+ else if ( type == ValueType.INTEGER || type == ValueType.NUMBER )
+ {
+ this.setType( TYPE_NUMBER );
+ }
+ else if ( type == ValueType.LETTER )
+ {
+ this.setType( TYPE_LETTER );
+ }
+ else if ( type == ValueType.LONG_TEXT )
+ {
+ this.setType( TYPE_STRING );
+ }
+ else if ( type == ValueType.OPTION_SET )
+ {
+ this.setType( TYPE_OPTION_SET );
+ }
+ else if ( type == ValueType.PHONE_NUMBER )
+ {
+ this.setType( TYPE_PHONE_NUMBER );
+ }
+ else if ( type == ValueType.TRACKER_ASSOCIATE )
+ {
+ this.setType( TYPE_TRACKER_ASSOCIATE );
+ }
+ else if ( type == ValueType.TRUE_ONLY )
+ {
+ this.setType( TYPE_TRUE_ONLY );
+ }
+ else if ( type == ValueType.USERNAME )
+ {
+ this.setType( TYPE_USERS );
+ }
+ else
+ {
+ this.setType( TYPE_STRING );
+ }
+ }
+
public OptionSet getOptionSet()
{
return optionSet;
@@ -154,7 +232,7 @@
dout.writeUTF( this.type );
dout.writeBoolean( this.isMandatory );
dout.writeBoolean( this.isDisplayedInList );
-
+
int optionSize = (this.optionSet == null || this.optionSet.getOptions() == null) ? 0 : this.optionSet
.getOptions().size();
dout.writeInt( optionSize );
=== 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 2015-09-11 11:54:53 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java 2015-09-21 09:24:27 +0000
@@ -37,6 +37,8 @@
import org.hisp.dhis.api.mobile.model.DataValue;
import org.hisp.dhis.api.mobile.model.Interpretation;
import org.hisp.dhis.api.mobile.model.InterpretationComment;
+import org.hisp.dhis.api.mobile.model.OptionSet;
+import org.hisp.dhis.api.mobile.model.PatientAttribute;
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;
@@ -802,28 +804,27 @@
patientModel.setTrackedEntityName( "" );
}
- List<TrackedEntityAttributeValue> atts = new ArrayList<>(
- patient.getAttributeValues() );
+ List<TrackedEntityAttributeValue> atts = new ArrayList<>( patient.getAttributeValues() );
for ( TrackedEntityAttributeValue value : atts )
{
if ( value != null )
{
- /*
org.hisp.dhis.api.mobile.model.PatientAttribute patientAttribute = new org.hisp.dhis.api.mobile.model.PatientAttribute(
- value.getAttribute().getName(), value.getValue(), value.getAttribute().getValueType(), false, value
- .getAttribute().getDisplayInListNoProgram(), new OptionSet() );
+ value.getAttribute().getName(), value.getValue(), null, false, value.getAttribute()
+ .getDisplayInListNoProgram(), new OptionSet() );
+ patientAttribute.setType( value.getAttribute().getValueType() );
patientAtts.add( patientAttribute );
- */
+
}
}
patientModel.setAttributes( patientAtts );
// Set current programs
- List<ProgramInstance> listOfProgramInstance = new ArrayList<>(
- programInstanceService.getProgramInstances( patient, ProgramInstance.STATUS_ACTIVE ) );
+ List<ProgramInstance> listOfProgramInstance = new ArrayList<>( programInstanceService.getProgramInstances(
+ patient, ProgramInstance.STATUS_ACTIVE ) );
if ( listOfProgramInstance.size() > 0 )
{
@@ -874,8 +875,7 @@
// get relative's name
TrackedEntityInstance relative = entityInstanceService.getTrackedEntityInstance( relationshipMobile
.getPersonBId() );
- List<TrackedEntityAttributeValue> attributes = new ArrayList<>(
- relative.getAttributeValues() );
+ List<TrackedEntityAttributeValue> attributes = new ArrayList<>( relative.getAttributeValues() );
List<TrackedEntityAttributeValue> attributesInList = new ArrayList<>();
for ( TrackedEntityAttributeValue value : attributes )
@@ -925,8 +925,7 @@
ProgramInstance programInstance )
{
List<org.hisp.dhis.api.mobile.model.LWUITmodel.ProgramStage> mobileProgramStages = new ArrayList<>();
- List<ProgramStageInstance> proStageInstanceList = new ArrayList<>(
- programInstance.getProgramStageInstances() );
+ List<ProgramStageInstance> proStageInstanceList = new ArrayList<>( programInstance.getProgramStageInstances() );
Collections.sort( proStageInstanceList, new ProgramStageInstanceVisitDateComparator() );
@@ -1054,12 +1053,14 @@
}
mobileDataElement.setName( dataElementName );
- // mobileDataElement.setType( programStageDataElement.getDataElement().getType() );
+
+ mobileDataElement.setType( programStageDataElement.getDataElement().getValueType() );
// problem
mobileDataElement.setCompulsory( programStageDataElement.isCompulsory() );
- // mobileDataElement.setNumberType( programStageDataElement.getDataElement().getNumberType() );
+ // mobileDataElement.setNumberType(
+ // programStageDataElement.getDataElement().getNumberType() );
// Value
TrackedEntityDataValue patientDataValue = dataValueService.getTrackedEntityDataValue( programStageInstance,
@@ -1068,7 +1069,8 @@
if ( patientDataValue != null )
{
// Convert to standard date format before send to client
- if ( ValueType.DATE == programStageDataElement.getDataElement().getValueType() && !patientDataValue.equals( "" ) )
+ if ( ValueType.DATE == programStageDataElement.getDataElement().getValueType()
+ && !patientDataValue.equals( "" ) )
{
mobileDataElement.setValue( PeriodUtil.convertDateFormat( patientDataValue.getValue() ) );
}
@@ -1177,13 +1179,11 @@
if ( programType == ProgramType.WITHOUT_REGISTRATION )
{
- tempPrograms = new ArrayList<>(
- programService.getProgramsByCurrentUser( ProgramType.WITHOUT_REGISTRATION ) );
+ tempPrograms = new ArrayList<>( programService.getProgramsByCurrentUser( ProgramType.WITHOUT_REGISTRATION ) );
}
else if ( programType == ProgramType.WITH_REGISTRATION )
{
- tempPrograms = new ArrayList<>(
- programService.getProgramsByCurrentUser( ProgramType.WITH_REGISTRATION ) );
+ tempPrograms = new ArrayList<>( programService.getProgramsByCurrentUser( ProgramType.WITH_REGISTRATION ) );
}
List<Program> programs = new ArrayList<>();
@@ -1300,7 +1300,7 @@
org.hisp.dhis.api.mobile.model.LWUITmodel.ProgramStageDataElement mobileDataElement = new org.hisp.dhis.api.mobile.model.LWUITmodel.ProgramStageDataElement();
mobileDataElement.setId( programStageDataElement.getDataElement().getId() );
mobileDataElement.setName( programStageDataElement.getDataElement().getName() );
- // mobileDataElement.setType( programStageDataElement.getDataElement().getType() );
+ mobileDataElement.setType( programStageDataElement.getDataElement().getValueType() );
// problem
mobileDataElement.setCompulsory( programStageDataElement.isCompulsory() );
@@ -1413,13 +1413,13 @@
{
List<org.hisp.dhis.api.mobile.model.PatientAttribute> list = new ArrayList<>();
- /*
for ( TrackedEntityAttribute patientAtt : getPatientAtts( null ) )
{
- list.add( new PatientAttribute( patientAtt.getName(), null, patientAtt.getValueType(), false, patientAtt
- .getDisplayInListNoProgram(), new OptionSet() ) );
+ PatientAttribute patientAttribute = new PatientAttribute( patientAtt.getName(), null, null, false,
+ patientAtt.getDisplayInListNoProgram(), new OptionSet() );
+ patientAttribute.setType( patientAtt.getValueType() );
+ list.add( patientAttribute );
}
- */
return list;
}
@@ -1429,7 +1429,6 @@
{
List<org.hisp.dhis.api.mobile.model.PatientAttribute> list = new ArrayList<>();
- /*
for ( TrackedEntityAttribute pa : getPatientAtts( programId ) )
{
PatientAttribute patientAttribute = new PatientAttribute();
@@ -1441,7 +1440,6 @@
list.add( patientAttribute );
}
- */
return list;
}
@@ -1466,7 +1464,8 @@
}
@Override
- public Patient savePatient( org.hisp.dhis.api.mobile.model.LWUITmodel.Patient patient, int orgUnitId, String programIdText )
+ public Patient savePatient( org.hisp.dhis.api.mobile.model.LWUITmodel.Patient patient, int orgUnitId,
+ String programIdText )
throws NotAllowedException
{
TrackedEntityInstance patientWeb = new TrackedEntityInstance();
@@ -1522,7 +1521,9 @@
entityInstanceService.deleteTrackedEntityInstance( newTrackedEntityInstance );
if ( code == TrackedEntityInstanceService.ERROR_DUPLICATE_IDENTIFIER )
{
- errorMsg = "Duplicate value of " + attributeService.getTrackedEntityAttribute( Integer.parseInt( errorCode[1] ) ).getDisplayName();
+ errorMsg = "Duplicate value of "
+ + attributeService.getTrackedEntityAttribute( Integer.parseInt( errorCode[1] ) )
+ .getDisplayName();
}
else
{
@@ -1732,7 +1733,8 @@
else
{
TrackedEntityAttribute at = attributeService.getTrackedEntityAttributeByName( split[0] );
- QueryItem queryItem = new QueryItem( at, at.getLegendSet(), at.getValueType(), at.getAggregationType(), at.getOptionSet() );
+ QueryItem queryItem = new QueryItem( at, at.getLegendSet(), at.getValueType(), at.getAggregationType(),
+ at.getOptionSet() );
QueryOperator operator = QueryOperator.fromString( split[1] );
queryItem.getFilters().add( new QueryFilter( operator, split[2] ) );
param.getFilters().add( queryItem );
@@ -1934,7 +1936,8 @@
}
}
- smsSender.sendMessage( lostEvent.getName(), lostEvent.getSMS(), currentUserService.getCurrentUser(), recipientsList, false );
+ smsSender.sendMessage( lostEvent.getName(), lostEvent.getSMS(), currentUserService.getCurrentUser(),
+ recipientsList, false );
}
notification.setMessage( "Success" );
@@ -1954,7 +1957,8 @@
public org.hisp.dhis.api.mobile.model.LWUITmodel.Patient generateRepeatableEvent( int orgUnitId, String eventInfo )
throws NotAllowedException
{
- //OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( orgUnitId );
+ // OrganisationUnit orgUnit =
+ // organisationUnitService.getOrganisationUnit( orgUnitId );
String[] keys = eventInfo.split( "_" );
ProgramStage programStage = programStageService.getProgramStage( Integer.parseInt( keys[4] ) );
@@ -1978,7 +1982,7 @@
newProgramStageInstance.setDueDate( PeriodUtil.stringToDate( nextDueDate ) );
- //newProgramStageInstance.setOrganisationUnit( orgUnit );
+ // newProgramStageInstance.setOrganisationUnit( orgUnit );
}
else
{
@@ -1990,13 +1994,12 @@
newProgramStageInstance.setProgramStage( programStage );
newProgramStageInstance.setDueDate( PeriodUtil.stringToDate( nextDueDate ) );
newProgramStageInstance.setExecutionDate( PeriodUtil.stringToDate( nextDueDate ) );
- //newProgramStageInstance.setOrganisationUnit( orgUnit );
+ // newProgramStageInstance.setOrganisationUnit( orgUnit );
}
programInstance.getProgramStageInstances().add( newProgramStageInstance );
- List<ProgramStageInstance> proStageInstanceList = new ArrayList<>(
- programInstance.getProgramStageInstances() );
+ List<ProgramStageInstance> proStageInstanceList = new ArrayList<>( programInstance.getProgramStageInstances() );
Collections.sort( proStageInstanceList, new ProgramStageInstanceVisitDateComparator() );
@@ -2550,7 +2553,8 @@
try
{
- for ( org.hisp.dhis.api.mobile.model.LWUITmodel.ProgramInstance mobileProgramInstance : patient.getEnrollmentPrograms() )
+ for ( org.hisp.dhis.api.mobile.model.LWUITmodel.ProgramInstance mobileProgramInstance : patient
+ .getEnrollmentPrograms() )
{
Date incidentDate = PeriodUtil.stringToDate( mobileProgramInstance.getDateOfIncident() );
enrollProgram( patientId + "-" + mobileProgramInstance.getProgramId(),
@@ -2569,7 +2573,7 @@
{
errorMsg = "Duplicate value of "
+ attributeService.getTrackedEntityAttribute( Integer.parseInt( errorCode[1] ) )
- .getDisplayName();
+ .getDisplayName();
}
else
{
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/DefaultProgramService.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/DefaultProgramService.java 2015-09-11 11:54:53 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/DefaultProgramService.java 2015-09-21 09:24:27 +0000
@@ -249,10 +249,11 @@
for ( ProgramStageDataElement programStageDataElement : programStageDataElements )
{
org.hisp.dhis.dataelement.DataElement dataElement = programStageDataElement.getDataElement();
- org.hisp.dhis.api.mobile.model.LWUITmodel.ProgramStageDataElement de = ModelMapping.getDataElementLWUIT( dataElement );
+ org.hisp.dhis.api.mobile.model.LWUITmodel.ProgramStageDataElement de = ModelMapping
+ .getDataElementLWUIT( dataElement );
de.setCompulsory( programStageDataElement.isCompulsory() );
- // de.setNumberType( programStageDataElement.getDataElement().getNumberType() );
+ de.setNumberType( null );
des.add( de );
}
@@ -274,7 +275,8 @@
// data element list of program stage
List<Integer> dataElementIds = new ArrayList<>();
- for ( ProgramStageDataElement eachPogramStageDataElement : eachSection.getProgramStageDataElements() )
+ for ( ProgramStageDataElement eachPogramStageDataElement : eachSection
+ .getProgramStageDataElements() )
{
dataElementIds.add( eachPogramStageDataElement.getDataElement().getId() );
}
@@ -290,8 +292,7 @@
pr.setProgramStages( prStgs );
- List<ProgramTrackedEntityAttribute> programPatientAttributes = new ArrayList<>(
- program.getProgramAttributes() );
+ List<ProgramTrackedEntityAttribute> programPatientAttributes = new ArrayList<>( program.getProgramAttributes() );
for ( ProgramTrackedEntityAttribute ppa : programPatientAttributes )
{
@@ -315,7 +316,7 @@
org.hisp.dhis.api.mobile.model.PatientAttribute mobileAttribute = new org.hisp.dhis.api.mobile.model.PatientAttribute();
mobileAttribute.setName( pa.getName() );
- // mobileAttribute.setType( pa.getValueType() );
+ mobileAttribute.setType( pa.getValueType() );
mobileAttribute.setValue( "" );
if ( ppa.isDisplayInList() )
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ModelMapping.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ModelMapping.java 2015-09-04 07:11:50 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ModelMapping.java 2015-09-21 09:24:27 +0000
@@ -46,7 +46,7 @@
DataElement de = new DataElement();
de.setId( dataElement.getId() );
de.setName( dataElement.getFormNameFallback() );
- // de.setType( dataElement.getType() );
+ de.setType( dataElement.getValueType() );
de.setCategoryOptionCombos( getCategoryOptionCombos( dataElement ) );
@@ -64,8 +64,7 @@
ProgramStageDataElement de = new ProgramStageDataElement();
de.setId( dataElement.getId() );
de.setName( dataElement.getFormNameFallback() );
- // de.setType( dataElement.getType() );
-
+ de.setType( dataElement.getValueType() );
de.setCategoryOptionCombos( getCategoryOptionCombos( dataElement ) );
// Limit the optionset transfer to the client
@@ -85,7 +84,7 @@
{
mobileOptionSet.setId( dhisOptionSet.getId() );
mobileOptionSet.setName( dhisOptionSet.getName() );
-// mobileOptionSet.setOptions( dhisOptionSet.getOptions() );
+ mobileOptionSet.setOptions( dhisOptionSet.getOptionValues() );
}
else
{