Register external reports in exits

The InterPlay public API can be used to import an external report or file in theReport Server database. External reports are reports that were not generated in the application, but can be imported and made available to end users.

The user can list, download or delete the reports, according to his rights.

To register an external report in an exit:

  1. Declare a ReportExternalService variable and annotate it with @Autowired.
  2. The Spring container injects the implementation.
  3. public class MyCustomAction implements ExecuteActionExit
  4. {
  5. @Autowired
  6. private ReportExternalService reportExt;
  7. ……

2. Use the ReportExternalService implementation to set the details of the report: name, category, file name, directory name, shared, and so on.

@Override

public ExecuteActionResult execute(Object currentEditedObject, List<Object> selectedObjects, SourceDatabaseExternal sourceDatabaseExternal, Map<String, Object> functionArguments)

throws InterplayException

{

ExecuteActionResult res = new ExecuteActionResult();

try

{

reportExt.registerExternalReport()

.setName("reportName")

//.setFile("d:/connections.xml")

.setDir("D:/tmp/documentation", "index.html")

//.setFile("d:/jamon.htm")

.setCategory("publicReports")

.commit();

}

catch (ServiceException e)

{

e.printStackTrace();

}

res.setSuccess(true);

return res;

}

For more information about how to use the API, consult the JavaDoc of the ReportExternalService class and methods.

Related Links