fluid-api/src/main/java/com/fluidbpm/program/api/vo/form/Form.java
@Override
	@XmlTransient
	public JSONObject toJsonMappingForElasticSearch() throws JSONException {

		JSONObject returnVal = new JSONObject();

		//Id...
		{
			JSONObject idJsonObj = new JSONObject();
			idJsonObj.put(
					Field.JSONMapping.Elastic.MAPPING_ONLY_TYPE,
					Field.ElasticSearchType.LONG);
			returnVal.put(ABaseFluidJSONObject.JSONMapping.ID, idJsonObj);
		}

		//Form Type...
		{
			JSONObject formTypeJsonObj = new JSONObject();
			formTypeJsonObj.put(
					Field.JSONMapping.Elastic.MAPPING_ONLY_TYPE,
					Field.ElasticSearchType.KEYWORD);
			returnVal.put(JSONMapping.FORM_TYPE, formTypeJsonObj);
		}

		//Form Type Id...
		{
			JSONObject formTypeIdJsonObj = new JSONObject();
			formTypeIdJsonObj.put(
					Field.JSONMapping.Elastic.MAPPING_ONLY_TYPE,
					Field.ElasticSearchType.LONG);
			returnVal.put(JSONMapping.FORM_TYPE_ID, formTypeIdJsonObj);
		}

		//Title...
		{
			JSONObject titleJsonObj = new JSONObject();
			titleJsonObj.put(
					Field.JSONMapping.Elastic.MAPPING_ONLY_TYPE,
					Field.ElasticSearchType.TEXT);
			returnVal.put(JSONMapping.TITLE, titleJsonObj);
		}

		//Form Description...
		{
			JSONObject formDescJsonObj = new JSONObject();
			formDescJsonObj.put(
					Field.JSONMapping.Elastic.MAPPING_ONLY_TYPE,
					Field.ElasticSearchType.KEYWORD);
			returnVal.put(JSONMapping.FORM_DESCRIPTION, formDescJsonObj);
		}

		//State...
		{
			JSONObject stateJsonObj = new JSONObject();
			stateJsonObj.put(
					Field.JSONMapping.Elastic.MAPPING_ONLY_TYPE,
					Field.ElasticSearchType.KEYWORD);
			returnVal.put(JSONMapping.STATE, stateJsonObj);
		}

		//Flow State...
		{
			JSONObject flowStateJsonObj = new JSONObject();
			flowStateJsonObj.put(
					Field.JSONMapping.Elastic.MAPPING_ONLY_TYPE,
					Field.ElasticSearchType.KEYWORD);
			returnVal.put(JSONMapping.FLOW_STATE, flowStateJsonObj);
		}

		//Current User...
		{
			JSONObject currentUserJsonObj = new JSONObject();
			currentUserJsonObj.put(
					Field.JSONMapping.Elastic.MAPPING_ONLY_TYPE,
					Field.ElasticSearchType.OBJECT);

			JSONObject properties = new JSONObject();

			//Current User Id...
			JSONObject currentUserUserIdJsonObj = new JSONObject();
			currentUserUserIdJsonObj.put(
					Field.JSONMapping.Elastic.MAPPING_ONLY_TYPE,
					Field.ElasticSearchType.LONG);
			properties.put(User.JSONMapping.Elastic.USER_ID, currentUserUserIdJsonObj);

			//Current User Id...
			JSONObject currentUserUsernameJsonObj = new JSONObject();
			currentUserUsernameJsonObj.put(
					Field.JSONMapping.Elastic.MAPPING_ONLY_TYPE,
					Field.ElasticSearchType.KEYWORD);
			properties.put(User.JSONMapping.USERNAME, currentUserUsernameJsonObj);

			currentUserJsonObj.put(
					ABaseFluidJSONObject.JSONMapping.Elastic.PROPERTIES,
					properties);

			returnVal.put(JSONMapping.CURRENT_USER, currentUserJsonObj);
		}

		//Date Created...
		{
			JSONObject dateCreatedJsonObj = new JSONObject();
			dateCreatedJsonObj.put(
					Field.JSONMapping.Elastic.MAPPING_ONLY_TYPE,
					Field.ElasticSearchType.DATE);
			returnVal.put(JSONMapping.DATE_CREATED, dateCreatedJsonObj);
		}

		//Date Last Updated...
		{
			JSONObject dateLastUpdatedJsonObj = new JSONObject();
			dateLastUpdatedJsonObj.put(
					Field.JSONMapping.Elastic.MAPPING_ONLY_TYPE,
					Field.ElasticSearchType.DATE);
			returnVal.put(JSONMapping.DATE_LAST_UPDATED, dateLastUpdatedJsonObj);
		}

		//Get the listing of form fields...
		if(this.getFormFields() != null &&
				!this.getFormFields().isEmpty())
		{
			for(Field toAdd : this.getFormFields())
			{
				JSONObject convertedField = toAdd.toJsonMappingForElasticSearch();
				if(convertedField == null)
				{
					continue;
				}

				String fieldNameAsCamel = toAdd.getFieldNameAsUpperCamel();
				returnVal.put(fieldNameAsCamel, convertedField);
			}
		}

		//Ancestor Obj...
		{
			JSONObject ancestorJsonObj = new JSONObject();
			ancestorJsonObj.put(
					Field.JSONMapping.Elastic.MAPPING_ONLY_TYPE,
					Field.ElasticSearchType.LONG);
			returnVal.put(JSONMapping.ANCESTOR_ID, ancestorJsonObj);
		}

		//Table field parent id...
		{
			JSONObject tblFieldParentIdJsonObj = new JSONObject();
			tblFieldParentIdJsonObj.put(
					Field.JSONMapping.Elastic.MAPPING_ONLY_TYPE,
					Field.ElasticSearchType.LONG);
			returnVal.put(JSONMapping.TABLE_FIELD_PARENT_ID, tblFieldParentIdJsonObj);
		}

		return returnVal;
	}
@Override
	@XmlTransient
	public JSONObject toJsonMappingForElasticSearch() throws JSONException {

		JSONObject returnVal = new JSONObject();

		//Id...
		{
			JSONObject idJsonObj = new JSONObject();
			idJsonObj.put(
					Field.JSONMapping.Elastic.MAPPING_ONLY_TYPE,
					Field.ElasticSearchType.LONG);
			returnVal.put(ABaseFluidJSONObject.JSONMapping.ID, idJsonObj);
		}

		//Form Type...
		{
			JSONObject formTypeJsonObj = new JSONObject();
			formTypeJsonObj.put(
					Field.JSONMapping.Elastic.MAPPING_ONLY_TYPE,
					Field.ElasticSearchType.KEYWORD);
			returnVal.put(JSONMapping.FORM_TYPE, formTypeJsonObj);
		}

		//Form Type Id...
		{
			JSONObject formTypeIdJsonObj = new JSONObject();
			formTypeIdJsonObj.put(
					Field.JSONMapping.Elastic.MAPPING_ONLY_TYPE,
					Field.ElasticSearchType.LONG);
			returnVal.put(JSONMapping.FORM_TYPE_ID, formTypeIdJsonObj);
		}

		//Title...
		{
			JSONObject titleJsonObj = new JSONObject();
			titleJsonObj.put(
					Field.JSONMapping.Elastic.MAPPING_ONLY_TYPE,
					Field.ElasticSearchType.TEXT);
			returnVal.put(JSONMapping.TITLE, titleJsonObj);
		}

		//Form Description...
		{
			JSONObject formDescJsonObj = new JSONObject();
			formDescJsonObj.put(
					Field.JSONMapping.Elastic.MAPPING_ONLY_TYPE,
					Field.ElasticSearchType.KEYWORD);
			returnVal.put(JSONMapping.FORM_DESCRIPTION, formDescJsonObj);
		}

		//State...
		{
			JSONObject stateJsonObj = new JSONObject();
			stateJsonObj.put(
					Field.JSONMapping.Elastic.MAPPING_ONLY_TYPE,
					Field.ElasticSearchType.KEYWORD);
			returnVal.put(JSONMapping.STATE, stateJsonObj);
		}

		//Flow State...
		{
			JSONObject flowStateJsonObj = new JSONObject();
			flowStateJsonObj.put(
					Field.JSONMapping.Elastic.MAPPING_ONLY_TYPE,
					Field.ElasticSearchType.KEYWORD);
			returnVal.put(JSONMapping.FLOW_STATE, flowStateJsonObj);
		}

		//Current User...
		{
			JSONObject currentUserJsonObj = new JSONObject();
			currentUserJsonObj.put(
					Field.JSONMapping.Elastic.MAPPING_ONLY_TYPE,
					Field.ElasticSearchType.OBJECT);

			JSONObject properties = new JSONObject();

			//Current User Id...
			JSONObject currentUserUserIdJsonObj = new JSONObject();
			currentUserUserIdJsonObj.put(
					Field.JSONMapping.Elastic.MAPPING_ONLY_TYPE,
					Field.ElasticSearchType.LONG);
			properties.put(User.JSONMapping.Elastic.USER_ID, currentUserUserIdJsonObj);

			//Current User Id...
			JSONObject currentUserUsernameJsonObj = new JSONObject();
			currentUserUsernameJsonObj.put(
					Field.JSONMapping.Elastic.MAPPING_ONLY_TYPE,
					Field.ElasticSearchType.KEYWORD);
			properties.put(User.JSONMapping.USERNAME, currentUserUsernameJsonObj);

			currentUserJsonObj.put(
					ABaseFluidJSONObject.JSONMapping.Elastic.PROPERTIES,
					properties);

			returnVal.put(JSONMapping.CURRENT_USER, currentUserJsonObj);
		}

		//Date Created...
		{
			JSONObject dateCreatedJsonObj = new JSONObject();
			dateCreatedJsonObj.put(
					Field.JSONMapping.Elastic.MAPPING_ONLY_TYPE,
					Field.ElasticSearchType.DATE);
			returnVal.put(JSONMapping.DATE_CREATED, dateCreatedJsonObj);
		}

		//Date Last Updated...
		{
			JSONObject dateLastUpdatedJsonObj = new JSONObject();
			dateLastUpdatedJsonObj.put(
					Field.JSONMapping.Elastic.MAPPING_ONLY_TYPE,
					Field.ElasticSearchType.DATE);
			returnVal.put(JSONMapping.DATE_LAST_UPDATED, dateLastUpdatedJsonObj);
		}

		//Get the listing of form fields...
		if(this.getFormFields() != null &&
				!this.getFormFields().isEmpty())
		{
			for(Field toAdd : this.getFormFields())
			{
				JSONObject convertedField = toAdd.toJsonMappingForElasticSearch();
				if(convertedField == null)
				{
					continue;
				}

				String fieldNameAsCamel = toAdd.getFieldNameAsUpperCamel();
				returnVal.put(fieldNameAsCamel, convertedField);
			}
		}

		//Ancestor Obj...
		{
			JSONObject ancestorJsonObj = new JSONObject();
			ancestorJsonObj.put(
					Field.JSONMapping.Elastic.MAPPING_ONLY_TYPE,
					Field.ElasticSearchType.LONG);
			returnVal.put(JSONMapping.ANCESTOR_ID, ancestorJsonObj);
		}

		//Table field parent id...
		{
			JSONObject tblFieldParentIdJsonObj = new JSONObject();
			tblFieldParentIdJsonObj.put(
					Field.JSONMapping.Elastic.MAPPING_ONLY_TYPE,
					Field.ElasticSearchType.LONG);
			returnVal.put(JSONMapping.TABLE_FIELD_PARENT_ID, tblFieldParentIdJsonObj);
		}

		return returnVal;
	}
@ Override @ XmlTransient public JSONObject toJsonMappingForElasticSearch ( ) throws JSONException { JSONObject returnVal = new JSONObject ( ) ; //Id... { JSONObject idJsonObj = new JSONObject ( ) ; idJsonObj . put ( Field . JSONMapping . Elastic . MAPPING_ONLY_TYPE , Field . ElasticSearchType . LONG ) ; returnVal . put ( ABaseFluidJSONObject . JSONMapping . ID , idJsonObj ) ; } //Form Type... { JSONObject formTypeJsonObj = new JSONObject ( ) ; formTypeJsonObj . put ( Field . JSONMapping . Elastic . MAPPING_ONLY_TYPE , Field . ElasticSearchType . KEYWORD ) ; returnVal . put ( JSONMapping . FORM_TYPE , formTypeJsonObj ) ; } //Form Type Id... { JSONObject formTypeIdJsonObj = new JSONObject ( ) ; formTypeIdJsonObj . put ( Field . JSONMapping . Elastic . MAPPING_ONLY_TYPE , Field . ElasticSearchType . LONG ) ; returnVal . put ( JSONMapping . FORM_TYPE_ID , formTypeIdJsonObj ) ; } //Title... { JSONObject titleJsonObj = new JSONObject ( ) ; titleJsonObj . put ( Field . JSONMapping . Elastic . MAPPING_ONLY_TYPE , Field . ElasticSearchType . TEXT ) ; returnVal . put ( JSONMapping . TITLE , titleJsonObj ) ; } //Form Description... { JSONObject formDescJsonObj = new JSONObject ( ) ; formDescJsonObj . put ( Field . JSONMapping . Elastic . MAPPING_ONLY_TYPE , Field . ElasticSearchType . KEYWORD ) ; returnVal . put ( JSONMapping . FORM_DESCRIPTION , formDescJsonObj ) ; } //State... { JSONObject stateJsonObj = new JSONObject ( ) ; stateJsonObj . put ( Field . JSONMapping . Elastic . MAPPING_ONLY_TYPE , Field . ElasticSearchType . KEYWORD ) ; returnVal . put ( JSONMapping . STATE , stateJsonObj ) ; } //Flow State... { JSONObject flowStateJsonObj = new JSONObject ( ) ; flowStateJsonObj . put ( Field . JSONMapping . Elastic . MAPPING_ONLY_TYPE , Field . ElasticSearchType . KEYWORD ) ; returnVal . put ( JSONMapping . FLOW_STATE , flowStateJsonObj ) ; } //Current User... { JSONObject currentUserJsonObj = new JSONObject ( ) ; currentUserJsonObj . put ( Field . JSONMapping . Elastic . MAPPING_ONLY_TYPE , Field . ElasticSearchType . OBJECT ) ; JSONObject properties = new JSONObject ( ) ; //Current User Id... JSONObject currentUserUserIdJsonObj = new JSONObject ( ) ; currentUserUserIdJsonObj . put ( Field . JSONMapping . Elastic . MAPPING_ONLY_TYPE , Field . ElasticSearchType . LONG ) ; properties . put ( User . JSONMapping . Elastic . USER_ID , currentUserUserIdJsonObj ) ; //Current User Id... JSONObject currentUserUsernameJsonObj = new JSONObject ( ) ; currentUserUsernameJsonObj . put ( Field . JSONMapping . Elastic . MAPPING_ONLY_TYPE , Field . ElasticSearchType . KEYWORD ) ; properties . put ( User . JSONMapping . USERNAME , currentUserUsernameJsonObj ) ; currentUserJsonObj . put ( ABaseFluidJSONObject . JSONMapping . Elastic . PROPERTIES , properties ) ; returnVal . put ( JSONMapping . CURRENT_USER , currentUserJsonObj ) ; } //Date Created... { JSONObject dateCreatedJsonObj = new JSONObject ( ) ; dateCreatedJsonObj . put ( Field . JSONMapping . Elastic . MAPPING_ONLY_TYPE , Field . ElasticSearchType . DATE ) ; returnVal . put ( JSONMapping . DATE_CREATED , dateCreatedJsonObj ) ; } //Date Last Updated... { JSONObject dateLastUpdatedJsonObj = new JSONObject ( ) ; dateLastUpdatedJsonObj . put ( Field . JSONMapping . Elastic . MAPPING_ONLY_TYPE , Field . ElasticSearchType . DATE ) ; returnVal . put ( JSONMapping . DATE_LAST_UPDATED , dateLastUpdatedJsonObj ) ; } //Get the listing of form fields... if ( this . getFormFields ( ) != null && ! this . getFormFields ( ) . isEmpty ( ) ) { for ( Field toAdd : this . getFormFields ( ) ) { JSONObject convertedField = toAdd . toJsonMappingForElasticSearch ( ) ; if ( convertedField == null ) { continue ; } String fieldNameAsCamel = toAdd . getFieldNameAsUpperCamel ( ) ; returnVal . put ( fieldNameAsCamel , convertedField ) ; } } //Ancestor Obj... { JSONObject ancestorJsonObj = new JSONObject ( ) ; ancestorJsonObj . put ( Field . JSONMapping . Elastic . MAPPING_ONLY_TYPE , Field . ElasticSearchType . LONG ) ; returnVal . put ( JSONMapping . ANCESTOR_ID , ancestorJsonObj ) ; } //Table field parent id... { JSONObject tblFieldParentIdJsonObj = new JSONObject ( ) ; tblFieldParentIdJsonObj . put ( Field . JSONMapping . Elastic . MAPPING_ONLY_TYPE , Field . ElasticSearchType . LONG ) ; returnVal . put ( JSONMapping . TABLE_FIELD_PARENT_ID , tblFieldParentIdJsonObj ) ; } return returnVal ; }
Creates the mapping object required by Elastic Search when making
use of enhanced data-types.

See {@code https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-types.html}.

@return {@code JSONObject} representation of {@code Form} for
ElasticSearch mapping.

@throws JSONException If there is a problem with the JSON Body.
Creates the mapping object required by Elastic Search when making use of enhanced data - types .