Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Genesys Backend Genesys Backend
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 25
    • Issues 25
    • List
    • Boards
    • Service Desk
    • Milestones
  • Deployments
    • Deployments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Genesys PGR
  • Genesys BackendGenesys Backend
  • Issues
  • #316
Closed
Open
Created Sep 04, 2018 by Matija Obreza@mobrezaOwner

Export: Descriptor data as Excel

Extend DescriptorController API v0 with a method that returns filtered results in Excel format using the format of the existing sheet for descriptors of the standard Catalog Excel template.

@PostMapping(value = "/export", produces = { "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" } )
public void exportDescriptors(
		@RequestParam(name = "f", required = false) String filterCode,
		@RequestBody(required = false) DescriptorFilter filter, HttpServletResponse response) throws IOException {

	if (filterCode != null) {
		filter = shortFilterService.filterByCode(filterCode, DescriptorFilter.class);
	} else {
		filterCode = shortFilterService.getCode(filter);
	}

	response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
	response.addHeader("Content-Disposition", String.format("attachment; filename=\"genesys-descriptors-" + filterCode + ".xlsx\""));
	response.flushBuffer();

	// Write XLSX to the stream.
	final OutputStream outputStream = response.getOutputStream();

	try {
		descriptorService.exportDescriptors(filter, outputStream);
		response.flushBuffer();
	} catch (EOFException e) {
		LOG.warn("Download was aborted", e);
	}
}

The export should include the UUID and version as the first two columns of the updated Excel sheet.

Assignee
Assign to
Time tracking