/** * Queries the results with the given {@link CredentialQuery} parameter. * * @param scopeId * The {@link ScopeId} in which to search results. * @param query * The {@link CredentialQuery} to use to filter results. * @return The {@link CredentialListResult} of all the result matching the given {@link CredentialQuery} parameter. * @throws Exception * Whenever something bad happens. See specific {@link KapuaService} exceptions. * @since 1.0.0 */ @ApiOperation(nickname = "credentialQuery", value = "Queries the Credentials", notes = "Queries the Credentials with the given CredentialQuery parameter returning all matching Credentials", response = CredentialListResult.class) @POST @Path("_query") @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) public CredentialListResult query( @ApiParam(value = "The ScopeId in which to search results.", required = true, defaultValue = DEFAULT_SCOPE_ID) @PathParam("scopeId") ScopeId scopeId, @ApiParam(value = "The CredentialQuery to use to filter results.", required = true) CredentialQuery query) throws Exception { query.setScopeId(scopeId); return credentialService.query(query); }
/** * Counts the results with the given {@link CredentialQuery} parameter. * * @param scopeId * The {@link ScopeId} in which to search results. * @param query * The {@link CredentialQuery} to use to filter results. * @return The count of all the result matching the given {@link CredentialQuery} parameter. * @throws Exception * Whenever something bad happens. See specific {@link KapuaService} exceptions. * @since 1.0.0 */ @ApiOperation(nickname = "credentialCount", value = "Counts the Credentials", notes = "Counts the Credentials with the given CredentialQuery parameter returning the number of matching Credentials", response = CountResult.class) @POST @Path("_count") @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) public CountResult count( @ApiParam(value = "The ScopeId in which to count results", required = true, defaultValue = DEFAULT_SCOPE_ID) @PathParam("scopeId") ScopeId scopeId, @ApiParam(value = "The CredentialQuery to use to filter count results", required = true) CredentialQuery query) throws Exception { query.setScopeId(scopeId); return new CountResult(credentialService.count(query)); }