protected final List < Form > populateTableFields ( boolean addAllTableRecordsForReturnParam , boolean includeFieldDataParam , List < Field > formFieldsParam ) { if ( formFieldsParam == null || formFieldsParam . isEmpty ( ) ) { return null ; } List < Form > allTableRecordsFromAllFields = addAllTableRecordsForReturnParam ? new ArrayList ( ) : null ; //Populate each of the Table Fields... for ( Field descendantField : formFieldsParam ) { //Skip if not Table Field... if ( ! ( descendantField . getFieldValue ( ) instanceof TableField ) ) { continue ; } TableField tableField = ( TableField ) descendantField . getFieldValue ( ) ; List < Form > tableRecordWithIdOnly = tableField . getTableRecords ( ) ; if ( tableRecordWithIdOnly == null || tableRecordWithIdOnly . isEmpty ( ) ) { continue ; } //Populate the ids for lookup... List < Long > formIdsOnly = new ArrayList ( ) ; for ( Form tableRecord : tableRecordWithIdOnly ) { formIdsOnly . add ( tableRecord . getId ( ) ) ; } List < Form > populatedTableRecords = this . getFormsByIds ( Index . TABLE_RECORD , formIdsOnly , includeFieldDataParam , DEFAULT_OFFSET , MAX_NUMBER_OF_TABLE_RECORDS ) ; if ( addAllTableRecordsForReturnParam && populatedTableRecords != null ) { allTableRecordsFromAllFields . addAll ( populatedTableRecords ) ; } tableField . setTableRecords ( populatedTableRecords ) ; descendantField . setFieldValue ( tableField ) ; } return allTableRecordsFromAllFields ; }
Populate all the Table Field values from the Table index .