fluid-api/src/main/java/com/fluidbpm/program/api/vo/field/Field.java
@XmlTransient
	public Field populateFromElasticSearchJson(
			JSONObject jsonObjectParam
	) throws JSONException {
		if(this.getFieldNameAsUpperCamel() == null) {
			return null;
		}

		String fieldIdAsString = this.getFieldNameAsUpperCamel();
		if(jsonObjectParam.isNull(fieldIdAsString)) {
			return null;
		}

		Field.Type type;
		if((type = this.getTypeAsEnum()) == null) {
			return null;
		}

		Object formFieldValue = jsonObjectParam.get(fieldIdAsString);
		Field fieldToAdd = null;

		switch (type) {
			case DateTime:
				if(formFieldValue instanceof Long) {
					fieldToAdd = new Field(
							this.getId(),
							this.getFieldName(),
							new Date(((Long)formFieldValue).longValue()),
							type);
				}
				break;
			case Decimal:
				if(formFieldValue instanceof Number) {
					fieldToAdd = new Field(
							this.getId(),
							this.getFieldName(),
							((Number)formFieldValue).doubleValue(),
							type);
				}
				break;
			case MultipleChoice:
				if(formFieldValue instanceof JSONArray) {
					JSONArray casted = (JSONArray)formFieldValue;
					List<String> selectedChoices = new ArrayList();
					for(int index = 0;index < casted.length();index++) {
						selectedChoices.add(casted.get(index).toString());
					}

					if(selectedChoices.isEmpty()) {
						return null;
					}

					MultiChoice multiChoiceToSet = new MultiChoice(selectedChoices);

					fieldToAdd = new Field(
							this.getId(),
							this.getFieldName(),
							multiChoiceToSet,
							type);
				}
				break;
			case Table:
				List<Form> tableRecords = new ArrayList();

				//When array already...
				if(formFieldValue instanceof JSONArray) {
					JSONArray casted = (JSONArray)formFieldValue;
					for(int index = 0;index < casted.length();index++) {
						Object obAtIndex = casted.get(index);

						if(obAtIndex instanceof Number) {
							tableRecords.add(new Form(((Number)obAtIndex).longValue()));
						}
					}
				}
				//When there is only a single number stored...
				else if(formFieldValue instanceof Number) {
					tableRecords.add(new Form(((Number)formFieldValue).longValue()));
				}

				if(tableRecords.isEmpty()) {
					return null;
				}

				fieldToAdd = new Field(
						this.getId(),
						this.getFieldName(),
						new TableField(tableRecords),
						type);
				break;
			case Text:
			case ParagraphText:
				if(formFieldValue instanceof String) {
					//Latitude and Longitude storage...
					if(LATITUDE_AND_LONGITUDE.equals(this.getTypeMetaData())) {
						String formFieldValueStr = formFieldValue.toString();

						UtilGlobal utilGlobal = new UtilGlobal();
						double latitude = utilGlobal.getLatitudeFromElasticSearchText(formFieldValueStr);
						double longitude = utilGlobal.getLongitudeFromElasticSearchText(formFieldValueStr);

						String newFieldVal =
								(latitude + UtilGlobal.PIPE + longitude + UtilGlobal.PIPE);

						fieldToAdd = new Field(
								this.getId(),
								this.getFieldName(),
								newFieldVal,
								type);
					} else {
						//Other...
						fieldToAdd = new Field(
								this.getId(),
								this.getFieldName(),
								formFieldValue.toString(),
								type);
					}
				}
				break;
			case TrueFalse:
				if(formFieldValue instanceof Boolean) {
					fieldToAdd = new Field(
							this.getId(),
							this.getFieldName(),
							formFieldValue,
							type);
				}
				break;
		}

		return fieldToAdd;
	}
@XmlTransient
	public Field populateFromElasticSearchJson(
			JSONObject jsonObjectParam
	) throws JSONException {
		if(this.getFieldNameAsUpperCamel() == null) {
			return null;
		}

		String fieldIdAsString = this.getFieldNameAsUpperCamel();
		if(jsonObjectParam.isNull(fieldIdAsString)) {
			return null;
		}

		Field.Type type;
		if((type = this.getTypeAsEnum()) == null) {
			return null;
		}

		Object formFieldValue = jsonObjectParam.get(fieldIdAsString);
		Field fieldToAdd = null;

		switch (type) {
			case DateTime:
				if(formFieldValue instanceof Long) {
					fieldToAdd = new Field(
							this.getId(),
							this.getFieldName(),
							new Date(((Long)formFieldValue).longValue()),
							type);
				}
				break;
			case Decimal:
				if(formFieldValue instanceof Number) {
					fieldToAdd = new Field(
							this.getId(),
							this.getFieldName(),
							((Number)formFieldValue).doubleValue(),
							type);
				}
				break;
			case MultipleChoice:
				if(formFieldValue instanceof JSONArray) {
					JSONArray casted = (JSONArray)formFieldValue;
					List<String> selectedChoices = new ArrayList();
					for(int index = 0;index < casted.length();index++) {
						selectedChoices.add(casted.get(index).toString());
					}

					if(selectedChoices.isEmpty()) {
						return null;
					}

					MultiChoice multiChoiceToSet = new MultiChoice(selectedChoices);

					fieldToAdd = new Field(
							this.getId(),
							this.getFieldName(),
							multiChoiceToSet,
							type);
				}
				break;
			case Table:
				List<Form> tableRecords = new ArrayList();

				//When array already...
				if(formFieldValue instanceof JSONArray) {
					JSONArray casted = (JSONArray)formFieldValue;
					for(int index = 0;index < casted.length();index++) {
						Object obAtIndex = casted.get(index);

						if(obAtIndex instanceof Number) {
							tableRecords.add(new Form(((Number)obAtIndex).longValue()));
						}
					}
				}
				//When there is only a single number stored...
				else if(formFieldValue instanceof Number) {
					tableRecords.add(new Form(((Number)formFieldValue).longValue()));
				}

				if(tableRecords.isEmpty()) {
					return null;
				}

				fieldToAdd = new Field(
						this.getId(),
						this.getFieldName(),
						new TableField(tableRecords),
						type);
				break;
			case Text:
			case ParagraphText:
				if(formFieldValue instanceof String) {
					//Latitude and Longitude storage...
					if(LATITUDE_AND_LONGITUDE.equals(this.getTypeMetaData())) {
						String formFieldValueStr = formFieldValue.toString();

						UtilGlobal utilGlobal = new UtilGlobal();
						double latitude = utilGlobal.getLatitudeFromElasticSearchText(formFieldValueStr);
						double longitude = utilGlobal.getLongitudeFromElasticSearchText(formFieldValueStr);

						String newFieldVal =
								(latitude + UtilGlobal.PIPE + longitude + UtilGlobal.PIPE);

						fieldToAdd = new Field(
								this.getId(),
								this.getFieldName(),
								newFieldVal,
								type);
					} else {
						//Other...
						fieldToAdd = new Field(
								this.getId(),
								this.getFieldName(),
								formFieldValue.toString(),
								type);
					}
				}
				break;
			case TrueFalse:
				if(formFieldValue instanceof Boolean) {
					fieldToAdd = new Field(
							this.getId(),
							this.getFieldName(),
							formFieldValue,
							type);
				}
				break;
		}

		return fieldToAdd;
	}
Populate the object based on the ElasticSearch JSON structure.

@param jsonObjectParam The JSON object to populate from.
@return {@link Field} - The field to be added, if invalid a {@code null}
will be returned.

@throws JSONException If there is a problem with the JSON Body.

@see ABaseFluidJSONObject#toJsonObject()