private Object toScriptEngineValueMap ( Entity entity , int depth ) { if ( entity != null ) { Object idValue = toScriptEngineValue ( entity , entity . getEntityType ( ) . getIdAttribute ( ) , 0 ) ; if ( depth == 0 ) { return idValue ; } else { Map < String , Object > map = Maps . newHashMap ( ) ; entity . getEntityType ( ) . getAtomicAttributes ( ) . forEach ( attr -> map . put ( attr . getName ( ) , toScriptEngineValue ( entity , attr , depth ) ) ) ; map . put ( KEY_ID_VALUE , idValue ) ; return map ; } } else { return null ; } }
Convert entity to a JavaScript object . Adds _idValue as a special key to every level for quick access to the id value of an entity .