fluid-api/src/main/java/com/fluidbpm/program/api/util/elasticsearch/ESFormUtil.java
public Form getFormAncestor(
			Long electronicFormIdParam,
			boolean includeFieldDataParam,
			boolean includeTableFieldsParam)
	{
		if(electronicFormIdParam == null)
		{
			return null;
		}

		//Query using the descendantId directly...
		StringBuffer ancestorQuery = new StringBuffer(
				Form.JSONMapping.DESCENDANT_IDS);
		ancestorQuery.append(":\"");
		ancestorQuery.append(electronicFormIdParam);
		ancestorQuery.append("\"");

		//Search for the Ancestor...
		List<Form> ancestorForms = null;
		if(includeFieldDataParam)
		{
			ancestorForms = this.searchAndConvertHitsToFormWithAllFields(
					QueryBuilders.queryStringQuery(ancestorQuery.toString()),
					Index.DOCUMENT,
					DEFAULT_OFFSET,
					1,
					new Long[]{});
		}
		else
		{
			ancestorForms = this.searchAndConvertHitsToFormWithNoFields(
					QueryBuilders.queryStringQuery(ancestorQuery.toString()),
					Index.DOCUMENT,
					DEFAULT_OFFSET,
					1,
					new Long[]{});
		}

		Form returnVal = null;
		if(ancestorForms != null && !ancestorForms.isEmpty())
		{
			returnVal = ancestorForms.get(0);
		}

		//No result...
		if(returnVal == null)
		{
			return null;
		}

		//Whether table field data should be included...
		if(!includeTableFieldsParam)
		{
			return returnVal;
		}

		//Populate the Table Fields...
		this.populateTableFields(
				false,
				includeFieldDataParam,
				returnVal.getFormFields());

		return returnVal;
	}
public Form getFormAncestor(
			Long electronicFormIdParam,
			boolean includeFieldDataParam,
			boolean includeTableFieldsParam)
	{
		if(electronicFormIdParam == null)
		{
			return null;
		}

		//Query using the descendantId directly...
		StringBuffer ancestorQuery = new StringBuffer(
				Form.JSONMapping.DESCENDANT_IDS);
		ancestorQuery.append(":\"");
		ancestorQuery.append(electronicFormIdParam);
		ancestorQuery.append("\"");

		//Search for the Ancestor...
		List<Form> ancestorForms = null;
		if(includeFieldDataParam)
		{
			ancestorForms = this.searchAndConvertHitsToFormWithAllFields(
					QueryBuilders.queryStringQuery(ancestorQuery.toString()),
					Index.DOCUMENT,
					DEFAULT_OFFSET,
					1,
					new Long[]{});
		}
		else
		{
			ancestorForms = this.searchAndConvertHitsToFormWithNoFields(
					QueryBuilders.queryStringQuery(ancestorQuery.toString()),
					Index.DOCUMENT,
					DEFAULT_OFFSET,
					1,
					new Long[]{});
		}

		Form returnVal = null;
		if(ancestorForms != null && !ancestorForms.isEmpty())
		{
			returnVal = ancestorForms.get(0);
		}

		//No result...
		if(returnVal == null)
		{
			return null;
		}

		//Whether table field data should be included...
		if(!includeTableFieldsParam)
		{
			return returnVal;
		}

		//Populate the Table Fields...
		this.populateTableFields(
				false,
				includeFieldDataParam,
				returnVal.getFormFields());

		return returnVal;
	}
public Form getFormAncestor ( Long electronicFormIdParam , boolean includeFieldDataParam , boolean includeTableFieldsParam ) { if ( electronicFormIdParam == null ) { return null ; } //Query using the descendantId directly... StringBuffer ancestorQuery = new StringBuffer ( Form . JSONMapping . DESCENDANT_IDS ) ; ancestorQuery . append ( ":\"" ) ; ancestorQuery . append ( electronicFormIdParam ) ; ancestorQuery . append ( "\"" ) ; //Search for the Ancestor... List < Form > ancestorForms = null ; if ( includeFieldDataParam ) { ancestorForms = this . searchAndConvertHitsToFormWithAllFields ( QueryBuilders . queryStringQuery ( ancestorQuery . toString ( ) ) , Index . DOCUMENT , DEFAULT_OFFSET , 1 , new Long [ ] { } ) ; } else { ancestorForms = this . searchAndConvertHitsToFormWithNoFields ( QueryBuilders . queryStringQuery ( ancestorQuery . toString ( ) ) , Index . DOCUMENT , DEFAULT_OFFSET , 1 , new Long [ ] { } ) ; } Form returnVal = null ; if ( ancestorForms != null && ! ancestorForms . isEmpty ( ) ) { returnVal = ancestorForms . get ( 0 ) ; } //No result... if ( returnVal == null ) { return null ; } //Whether table field data should be included... if ( ! includeTableFieldsParam ) { return returnVal ; } //Populate the Table Fields... this . populateTableFields ( false , includeFieldDataParam , returnVal . getFormFields ( ) ) ; return returnVal ; }
Gets the ancestor for the {@code electronicFormIdParam} Form.

@param electronicFormIdParam Identifier for the Form.
@param includeFieldDataParam Whether to populate the return {@code Form} fields.
@param includeTableFieldsParam Whether to populate the return {@code Form} table fields.

@return {@code Form} descendants.

@see Form
Gets the ancestor for the { @code electronicFormIdParam } Form .