public static < E > Holder < E > configureFieldByName ( Criteria < E > criteria , String name ) { if ( Validations . isEmptyOrNull ( name ) ) return null ; // parse x.y name as [x, y] String [ ] names = name . split ( "\\." ) ; // uses to keep current name by names index. String currentName ; // init start index of names. int step = 0 ; // always will be current criteria CriteriaParent < E > currentCriteria = criteria ; FieldMeta currentFieldMeta ; // use aliasJoiner to use as alias. StringJoiner aliasJoiner = new StringJoiner ( "$" ) ; do { // get current name of field by index. like x.y.z => if step = 1 then currentName = y currentName = names [ step ] ; if ( Validations . isEmptyOrNull ( currentName ) ) { throw new RuntimeException ( currentName + " defined name is wrong ! " ) ; } currentFieldMeta = criteria . getMeta ( ) . getFieldMap ( ) . get ( currentName ) ; step ++ ; aliasJoiner . add ( currentCriteria . getAlias ( ) ) ; if ( step >= names . length ) { break ; } if ( currentFieldMeta . getReference ( ) == null ) { throw new RuntimeException ( "" + currentName + " join field of " + name + "'s reference target information must defined ! " ) ; } CriteriaJoin < E > criteriaJoin = currentCriteria . getJoin ( currentName ) ; if ( criteriaJoin == null ) { currentCriteria . createJoin ( currentName , currentFieldMeta . getReference ( ) . getTargetEntity ( ) , currentFieldMeta . getReference ( ) . getReferenceId ( ) ) ; } currentCriteria = criteriaJoin ; } while ( step >= names . length ) ; Holder < E > holder = new Holder <> ( ) ; holder . currentFieldName = currentName ; holder . currentCriteria = currentCriteria ; holder . currentFieldMeta = currentFieldMeta ; return holder ; }
roleOid . permissionOid . code