Class ReportRestController
- java.lang.Object
-
- org.neotropic.kuwaiba.northbound.rest.bem.ReportRestController
-
- All Implemented Interfaces:
ReportRestOpenApi
@RestController @RequestMapping("/v2.1.1/reports/") public class ReportRestController extends Object implements ReportRestOpenApiThe definition of the Report Rest Controller.- Author:
- Mauricio Ruiz Beltrán <mauricio.ruiz@kuwaiba.org>
-
-
Constructor Summary
Constructors Constructor Description ReportRestController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longcreateClassLevelReport(String className, String reportName, String reportDescription, String script, int outputType, boolean enabled, String sessionId)Creates a class level report (a report that will be available for all instances of a given class -and its subclasses-).longcreateInventoryLevelReport(String reportName, String reportDescription, String script, int outputType, boolean enabled, List<StringPair> parameters, String sessionId)Creates an inventory level report (a report that is not tied to a particular instance or class.In most cases, they also receive parameters).ChangeDescriptordeleteReport(long reportId, String sessionId)Deletes a report.byte[]executeClassLevelReport(String objectClassName, String objectId, long reportId, String sessionId)Executes a class level report and returns the result.byte[]executeInventoryLevelReport(long reportId, List<StringPair> parameters, String sessionId)Executes an inventory level report and returns the result.List<ReportMetadataLight>getClassLevelReports(String className, boolean recursive, boolean includeDisabled, String sessionId)Gets the class level reports associated to the given class (or its superclasses).List<ReportMetadataLight>getInventoryLevelReports(boolean includeDisabled, String sessionId)Gets the inventory class reports.ReportMetadatagetReport(long reportId, String sessionId)Gets the information related to a class level report.ChangeDescriptorupdateReport(long reportId, String reportName, String reportDescription, boolean enabled, int outputType, String script, String sessionId)Updates the properties of an existing class level report.ChangeDescriptorupdateReportParameters(long reportId, List<StringPair> parameters, String sessionId)Updates the parameters of a report.
-
-
-
Field Detail
-
PATH
public static final String PATH
Path that includes the Kuwaiba version and core- See Also:
- Constant Field Values
-
-
Method Detail
-
createClassLevelReport
@RequestMapping(method=POST, value="createClassLevelReport/{className}/{reportName}/{reportDescription}/{script}/{outputType}/{enabled}/{sessionId}", produces="application/json") public long createClassLevelReport(@PathVariable("className") String className, @PathVariable("reportName") String reportName, @PathVariable("reportDescription") String reportDescription, @PathVariable("script") String script, @PathVariable("outputType") int outputType, @PathVariable("enabled") boolean enabled, @PathVariable("sessionId") String sessionId)Creates a class level report (a report that will be available for all instances of a given class -and its subclasses-).- Specified by:
createClassLevelReportin interfaceReportRestOpenApi- Parameters:
className- Class this report is going to be related to. It can be ab abstract class and the report will be available for all its subclasses.reportName- Name of the report.reportDescription- ReportMetadata description.script- Script text. If any, "null" otherwise.outputType- What will be the default output of this report? See RemoteReportLight for possible values.enabled- If enabled, a report can be executed.sessionId- The session token id.- Returns:
- The id of the newly created report.
-
createInventoryLevelReport
@RequestMapping(method=POST, value="createInventoryLevelReport/{reportName}/{reportDescription}/{script}/{outputType}/{enabled}/{sessionId}", produces="application/json") public long createInventoryLevelReport(@PathVariable("reportName") String reportName, @PathVariable("reportDescription") String reportDescription, @PathVariable("script") String script, @PathVariable("outputType") int outputType, @PathVariable("enabled") boolean enabled, @RequestBody(required=false) List<StringPair> parameters, @PathVariable("sessionId") String sessionId)Creates an inventory level report (a report that is not tied to a particular instance or class.In most cases, they also receive parameters).- Specified by:
createInventoryLevelReportin interfaceReportRestOpenApi- Parameters:
reportName- Name of the report.reportDescription- ReportMetadata description.script- Script text. If any, "null" otherwise.outputType- What will be the default output of this report? See InventoryLevelReportDescriptor for possible values.enabled- If enabled, a report can be executed.parameters- Optional (it might be either null or an empty list). The list of the parameters that this report will support and optional default values. They will always be captured as strings, so it's up to the author of the report the sanitization and conversion of the inputs.sessionId- The session token id.- Returns:
- The id of the newly created report.
-
deleteReport
@RequestMapping(method=DELETE, value="deleteReport/{reportId}/{sessionId}", produces="application/json") public ChangeDescriptor deleteReport(@PathVariable("reportId") long reportId, @PathVariable("sessionId") String sessionId)Deletes a report.- Specified by:
deleteReportin interfaceReportRestOpenApi- Parameters:
reportId- The id of the report.sessionId- The session token id.- Returns:
- The summary of the changes.
-
updateReport
@RequestMapping(method=PUT, value="updateReport/{reportId}/{reportName}/{reportDescription}/{enabled}/{outputType}/{script}/{sessionId}", produces="application/json") public ChangeDescriptor updateReport(@PathVariable("reportId") long reportId, @PathVariable("reportName") String reportName, @PathVariable("reportDescription") String reportDescription, @PathVariable("enabled") boolean enabled, @PathVariable("outputType") int outputType, @PathVariable("script") String script, @PathVariable("sessionId") String sessionId)Updates the properties of an existing class level report.- Specified by:
updateReportin interfaceReportRestOpenApi- Parameters:
reportId- Id of the report.reportName- The name of the report. Null to leave it unchanged.reportDescription- The description of the report. Null to leave it unchanged.enabled- Is the report enabled? . Null to leave it unchanged.outputType- Type of the output of the report. See LocalReportLight for possible values.script- Text of the script. If any, "null" otherwise.sessionId- The session token id.- Returns:
- The summary of the changes.
-
updateReportParameters
@RequestMapping(method=PUT, value="updateReportParameters/{reportId}/{sessionId}", produces="application/json") public ChangeDescriptor updateReportParameters(@PathVariable("reportId") long reportId, @RequestBody List<StringPair> parameters, @PathVariable("sessionId") String sessionId)Updates the parameters of a report.- Specified by:
updateReportParametersin interfaceReportRestOpenApi- Parameters:
reportId- The id of the report.parameters- The list of parameters and optional default values. Those with null values will be deleted and the ones that didn't exist previously will be created.sessionId- The session token id.- Returns:
- The summary of the changes.
-
getClassLevelReports
@RequestMapping(method=GET, value="getClassLevelReports/{className}/{recursive}/{includeDisabled}/{sessionId}", produces="application/json") public List<ReportMetadataLight> getClassLevelReports(@PathVariable("className") String className, @PathVariable("recursive") boolean recursive, @PathVariable("includeDisabled") boolean includeDisabled, @PathVariable("sessionId") String sessionId)Gets the class level reports associated to the given class (or its superclasses).- Specified by:
getClassLevelReportsin interfaceReportRestOpenApi- Parameters:
className- The class to extract the reports from.recursive- False to get only the directly associated reports. True top get also the reports associate top its superclasses.includeDisabled- True to also include the reports marked as disabled. False to return only the enabled ones.sessionId- The session token id.- Returns:
- The list of reports.
-
getInventoryLevelReports
@RequestMapping(method=GET, value="getInventoryLevelReports/{includeDisabled}/{sessionId}", produces="application/json") public List<ReportMetadataLight> getInventoryLevelReports(@PathVariable("includeDisabled") boolean includeDisabled, @PathVariable("sessionId") String sessionId)Gets the inventory class reports.- Specified by:
getInventoryLevelReportsin interfaceReportRestOpenApi- Parameters:
includeDisabled- True to also include the reports marked as disabled. False to return only the enabled ones.sessionId- The session token id.- Returns:
- The list of reports.
-
getReport
@RequestMapping(method=GET, value="getReport/{reportId}/{sessionId}", produces="application/json") public ReportMetadata getReport(@PathVariable("reportId") long reportId, @PathVariable("sessionId") String sessionId)Gets the information related to a class level report.- Specified by:
getReportin interfaceReportRestOpenApi- Parameters:
reportId- The id of the report.sessionId- The session token id.- Returns:
- The report.
-
executeClassLevelReport
@RequestMapping(method=PUT, value="executeClassLevelReport/{objectClassName}/{objectId}/{reportId}/{sessionId}", produces="application/json") public byte[] executeClassLevelReport(@PathVariable("objectClassName") String objectClassName, @PathVariable("objectId") String objectId, @PathVariable("reportId") long reportId, @PathVariable("sessionId") String sessionId)Executes a class level report and returns the result.- Specified by:
executeClassLevelReportin interfaceReportRestOpenApi- Parameters:
objectClassName- The class of the instance that will be used as input for the report.objectId- The id of the instance that will be used as input for the report.reportId- The id of the report.sessionId- The session token id.- Returns:
- The result of the report execution.
-
executeInventoryLevelReport
@RequestMapping(method=PUT, value="executeInventoryLevelReport/{reportId}/{sessionId}", produces="application/json") public byte[] executeInventoryLevelReport(@PathVariable("reportId") long reportId, @RequestBody(required=false) List<StringPair> parameters, @PathVariable("sessionId") String sessionId)Executes an inventory level report and returns the result.- Specified by:
executeInventoryLevelReportin interfaceReportRestOpenApi- Parameters:
reportId- The id of the report.parameters- List of pairs param name - param value.sessionId- The session token id.- Returns:
- The result of the report execution.
-
-