public Response findByIds ( @ NotNull @ PathParam ( "ids" ) URI_ID id , @ NotNull @ PathParam ( "ids" ) final PathSegment ids , @ QueryParam ( "include_deleted" ) final boolean includeDeleted ) throws Exception { final Query < MODEL > query = server . find ( modelType ) ; final MODEL_ID firstId = tryConvertId ( ids . getPath ( ) ) ; Set < String > idSet = ids . getMatrixParameters ( ) . keySet ( ) ; final Set < MODEL_ID > idCollection = Sets . newLinkedHashSet ( ) ; idCollection . add ( firstId ) ; if ( ! idSet . isEmpty ( ) ) { idCollection . addAll ( Collections2 . transform ( idSet , this :: tryConvertId ) ) ; } matchedFindByIds ( firstId , idCollection , includeDeleted ) ; Object model ; if ( includeDeleted ) { query . setIncludeSoftDeletes ( ) ; } final TxRunnable configureQuery = t -> { configDefaultQuery ( query ) ; configFindByIdsQuery ( query , includeDeleted ) ; applyUriQuery ( query , false ) ; } ; if ( ! idSet . isEmpty ( ) ) { model = executeTx ( t -> { configureQuery . run ( t ) ; List < MODEL > m = query . where ( ) . idIn ( idCollection . toArray ( ) ) . findList ( ) ; return processFoundByIdsModelList ( m , includeDeleted ) ; } ) ; } else { model = executeTx ( t -> { configureQuery . run ( t ) ; MODEL m = query . setId ( firstId ) . findOne ( ) ; return processFoundByIdModel ( m , includeDeleted ) ; } ) ; } if ( isEmptyEntity ( model ) ) { throw new NotFoundException ( ) ; } return Response . ok ( model ) . build ( ) ; }
Find a model or model list given its Ids .