private static void addUserLocation(JSONObject obj, PreviewUser user) { if (obj.has(PurplemoonAPIConstantsV1.ProfileDetails.LOCATION_CURRENT)) { user.setCurrentLocation( translateToLocationBean( obj.optJSONObject(PurplemoonAPIConstantsV1.ProfileDetails.LOCATION_CURRENT))); } if (obj.has(PurplemoonAPIConstantsV1.ProfileDetails.LOCATION_HOME)) { user.setHomeLocation( translateToLocationBean( obj.optJSONObject(PurplemoonAPIConstantsV1.ProfileDetails.LOCATION_HOME))); } if (obj.has(PurplemoonAPIConstantsV1.ProfileDetails.LOCATION_HOME2)) { user.setHome2Location( translateToLocationBean( obj.optJSONObject(PurplemoonAPIConstantsV1.ProfileDetails.LOCATION_HOME2))); } }
private static void translatePreviewUserProperties( JSONObject jsonUserObject, PreviewUser previewUser) { previewUser.setFirstName( jsonUserObject.optString(PurplemoonAPIConstantsV1.ProfileDetails.FIRST_NAME, null)); previewUser.setLastName( jsonUserObject.optString(PurplemoonAPIConstantsV1.ProfileDetails.LAST_NAME, null)); previewUser.setHeight( JSONUtility.optInt(jsonUserObject, PurplemoonAPIConstantsV1.ProfileDetails.HEIGHT, null)); previewUser.setWeight( JSONUtility.optInt(jsonUserObject, PurplemoonAPIConstantsV1.ProfileDetails.WEIGHT, null)); previewUser.setPhysique( APIUtility.translateToPhysique( jsonUserObject.optString(PurplemoonAPIConstantsV1.ProfileDetails.PHYSIQUE, null))); previewUser.setHairColor( APIUtility.translateToHairColor( jsonUserObject.optString(PurplemoonAPIConstantsV1.ProfileDetails.HAIR_COLOR, null))); previewUser.setHairLength( APIUtility.translateToHairLength( jsonUserObject.optString(PurplemoonAPIConstantsV1.ProfileDetails.HAIR_LENGTH, null))); previewUser.setEyeColor( APIUtility.translateToEyeColor( jsonUserObject.optString(PurplemoonAPIConstantsV1.ProfileDetails.EYE_COLOR, null))); previewUser.setFacialHair( APIUtility.translateToFacialHair( jsonUserObject.optString(PurplemoonAPIConstantsV1.ProfileDetails.FACIAL_HAIR, null))); previewUser.setDrinkerFrequency( APIUtility.translateToDrinkerFrequency( jsonUserObject.optString(PurplemoonAPIConstantsV1.ProfileDetails.DRINKER, null))); previewUser.setSmokerFrequency( APIUtility.translateToSmoker( jsonUserObject.optString(PurplemoonAPIConstantsV1.ProfileDetails.SMOKER, null))); previewUser.setVegetarian( APIUtility.translateToVegetarian( jsonUserObject.optString(PurplemoonAPIConstantsV1.ProfileDetails.VEGETARIAN, null))); previewUser.setWantsKids( APIUtility.translateToWantsKids( jsonUserObject.optString(PurplemoonAPIConstantsV1.ProfileDetails.WANTS_KIDS, null))); previewUser.setHasKids( APIUtility.translateToHasKids( jsonUserObject.optString(PurplemoonAPIConstantsV1.ProfileDetails.HAS_KIDS, null))); previewUser.setReligion( APIUtility.translateToReligion( jsonUserObject.optString(PurplemoonAPIConstantsV1.ProfileDetails.RELIGION, null))); previewUser.setPolitics( APIUtility.translateToPolitics( jsonUserObject.optString(PurplemoonAPIConstantsV1.ProfileDetails.POLITICS, null))); // TODO Preview user needs to be implemented here (Occupation!) addUserLocation(jsonUserObject, previewUser); }