private Form mapFormContainerTo ( Map < Long , String > definitionAndTitleParam , ResultSet resultSetParam ) throws SQLException { Long formId = resultSetParam . getLong ( SQLColumnIndex . _01_FORM_ID ) ; String formType = definitionAndTitleParam . get ( resultSetParam . getLong ( SQLColumnIndex . _02_FORM_TYPE ) ) ; String title = resultSetParam . getString ( SQLColumnIndex . _03_TITLE ) ; Date created = resultSetParam . getDate ( SQLColumnIndex . _04_CREATED ) ; Date lastUpdated = resultSetParam . getDate ( SQLColumnIndex . _05_LAST_UPDATED ) ; Long currentUserId = resultSetParam . getLong ( SQLColumnIndex . _06_CURRENT_USER_ID ) ; if ( formType == null ) { throw new SQLException ( "No mapping found for Form Type '" + resultSetParam . getLong ( SQLColumnIndex . _02_FORM_TYPE ) + "'." ) ; } Form toAdd = new Form ( formType ) ; toAdd . setId ( formId ) ; toAdd . setTitle ( title ) ; //Created... if ( created != null ) { toAdd . setDateCreated ( new Date ( created . getTime ( ) ) ) ; } //Last Updated... if ( lastUpdated != null ) { toAdd . setDateLastUpdated ( new Date ( lastUpdated . getTime ( ) ) ) ; } //Current User... if ( currentUserId != null && currentUserId . longValue ( ) > 0 ) { User currentUser = new User ( ) ; currentUser . setId ( currentUserId ) ; toAdd . setCurrentUser ( currentUser ) ; } return toAdd ; }
Maps the Form to the provided Definition - Id and Title .