package org.adaptlab.chpir.android.models;

import org.adaptlab.chpir.android.activerecordcloudsync.ReceiveModel;
import org.json.JSONObject;

public class Property extends ReceiveModel {

    @Override
    public void createObjectFromJSON(JSONObject jsonObject) {
        // TODO Auto-generated method stub
        
    }

}

@@ -37,16 +37,40 @@
 odels;%0A%0A
+import java.util.List;%0A%0A
 import o
@@ -155,196 +155,2792 @@
 JSON
-Object;%0A%0Apublic class Property extends ReceiveModel %7B%0A%0A    @Override%0A    public void createObjectFromJSON(JSONObject jsonObject) %7B%0A        // TODO Auto-generated method stub%0A        %0A    %7D%0A
+Exception;%0Aimport org.json.JSONObject;%0A%0Aimport android.util.Log;%0A%0Aimport com.activeandroid.annotation.Column;%0Aimport com.activeandroid.annotation.Table;%0Aimport com.activeandroid.query.Select;%0A%0A@Table(name = %22Property%22)%0Apublic class Property extends ReceiveModel %7B%0A    private static final String TAG = %22Property%22;%0A%0A    @Column(name = %22RemoteId%22)%0A    private Long mRemoteId;%0A    @Column(name = %22Label%22)%0A    private String mLabel;%0A    @Column(name = %22TypeOf%22)%0A    private String mTypeOf;%0A    @Column(name = %22Required%22)%0A    private boolean mRequired;%0A    @Column(name = %22ParticipantType%22)%0A    private ParticipantType mParticipantType;%0A    %0A    @Override%0A    public void createObjectFromJSON(JSONObject jsonObject) %7B%0A        try %7B%0A            Long remoteId = jsonObject.getLong(%22id%22);%0A            %0A            // If a Property already exists, update it from the remote%0A            Property property = Property.findByRemoteId(remoteId);%0A            if (property == null) %7B%0A                property = this;%0A            %7D%0A            %0A            Log.i(TAG, %22Creating object from JSON Object: %22 + jsonObject);%0A            property.setLabel(jsonObject.getString(%22label%22));%0A            property.setRemoteId(remoteId);%0A            property.setTypeOf(jsonObject.getString(%22type_of%22));%0A            property.setRequired(jsonObject.getBoolean(%22required%22));%0A            property.setParticipantType(ParticipantType.findByRemoteId(jsonObject.getLong(%22participant_type_id%22)));%0A            property.save();%0A        %7D catch (JSONException je) %7B%0A            Log.e(TAG, %22Error parsing object json%22, je);%0A        %7D %0A    %7D%0A    %0A    /*%0A     * Finders%0A     */%0A    public static List%3CProperty%3E getAll() %7B%0A        return new Select().from(Property.class).orderBy(%22Id ASC%22).execute();%0A    %7D%0A    %0A    public static Property findByRemoteId(Long id) %7B%0A        return new Select().from(Property.class).where(%22RemoteId = ?%22, id).executeSingle();%0A    %7D%0A    %0A    /*%0A     * Getters / Setters%0A     */%0A    public String getLabel() %7B%0A        return mLabel;%0A    %7D%0A    %0A    public Long getRemoteId() %7B%0A        return mRemoteId;%0A    %7D%0A    %0A    public String getTypeOf() %7B%0A        return mTypeOf;%0A    %7D%0A    %0A    public boolean getRequired() %7B%0A        return mRequired;%0A    %7D%0A    %0A    public ParticipantType getParticipantType() %7B%0A        return mParticipantType;%0A    %7D%0A    %0A    private void setLabel(String label) %7B%0A        mLabel = label;%0A    %7D%0A    %0A    private void setRemoteId(Long remoteId) %7B%0A        mRemoteId = remoteId;%0A    %7D%0A    %0A    private void setTypeOf(String typeOf) %7B%0A        mTypeOf = typeOf;%0A    %7D%0A    %0A    private void setRequired(boolean required) %7B%0A        mRequired = required;%0A    %7D%0A    %0A    private void setParticipantType(ParticipantType participantType) %7B%0A        mParticipantType = participantType;%0A    %7D
 %0A%7D%0A

Add property model