/** * Counts the results with the given {@link ManagementOperationNotificationQuery} parameter. * * @param scopeId The {@link ScopeId} in which to search results. * @param operationId The id of the {@link Device} in which to search results * @param query The {@link ManagementOperationNotificationQuery} to use to filter results. * @return The count of all the result matching the given {@link ManagementOperationNotificationQuery} parameter. * @throws Exception Whenever something bad happens. See specific {@link KapuaService} exceptions. * @since 1.0.0 */ @ApiOperation(nickname = "ManagementOperationNotificationCount", value = "Counts the ManagementOperationNotifications", notes = "Counts the ManagementOperationNotifications with the given ManagementOperationNotificationQuery parameter returning the number of matching ManagementOperationNotifications", 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 device id to filter results.") @PathParam("deviceId") EntityId deviceId, @ApiParam(value = "The id of the Device in which to count results") @PathParam("operationId") EntityId operationId, @ApiParam(value = "The ManagementOperationNotificationQuery to use to filter count results", required = true) ManagementOperationNotificationQuery query) throws Exception { query.setScopeId(scopeId); query.setPredicate(new AttributePredicateImpl<>(ManagementOperationNotificationAttributes.OPERATION_ID, operationId)); return new CountResult(managementOperationNotificationService.count(query)); }
/** * Queries the results with the given {@link ManagementOperationNotificationQuery} parameter. * * @param scopeId The {@link ScopeId} in which to search results. * @param operationId The id of the {@link Device} in which to search results * @param query The {@link ManagementOperationNotificationQuery} to use to filter results. * @return The {@link ManagementOperationNotificationListResult} of all the result matching the given {@link ManagementOperationNotificationQuery} parameter. * @throws Exception Whenever something bad happens. See specific {@link KapuaService} exceptions. * @since 1.0.0 */ @ApiOperation(nickname = "ManagementOperationNotificationQuery", value = "Queries the ManagementOperationNotifications", notes = "Queries the ManagementOperationNotifications with the given ManagementOperationNotifications parameter returning all matching ManagementOperationNotifications", response = ManagementOperationNotificationListResult.class) @POST @Path("_query") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public ManagementOperationNotificationListResult query( @ApiParam(value = "The ScopeId in which to search results.", required = true, defaultValue = DEFAULT_SCOPE_ID) @PathParam("scopeId") ScopeId scopeId, @ApiParam(value = "The device id to filter results.") @PathParam("deviceId") EntityId deviceId, @ApiParam(value = "The id of the Device in which to search results") @PathParam("operationId") EntityId operationId, @ApiParam(value = "The ManagementOperationNotificationQuery to use to filter results.", required = true) ManagementOperationNotificationQuery query) throws Exception { query.setScopeId(scopeId); AndPredicateImpl andPredicate = new AndPredicateImpl(); andPredicate.and(new AttributePredicateImpl<>(ManagementOperationNotificationAttributes.OPERATION_ID, operationId)); query.setPredicate(andPredicate); return managementOperationNotificationService.query(query); }