@Test public void should_map_pages() { PageRange range = PageRange.parse("1-10"); ReportExportOptions criteria = ReportExportOptions.builder() .withFormat(ReportFormat.PDF) .withPageRange(range) .build(); ExecutionRequestOptions options = mapper.transform(criteria); assertThat("Failed to map 'pages' option", options.getPages(), is("1-10")); }
public ExecutionRequestOptions transform(ReportExportOptions options) { ExecutionRequestOptions resultOptions = ExecutionRequestOptions.create(); ReportFormat format = options.getFormat(); resultOptions.withOutputFormat(format.toString().toLowerCase()); PageRange pageRange = options.getPageRange(); if (pageRange != null) { resultOptions.withPages(pageRange.toString()); } String prefix = options.getAttachmentPrefix(); if (prefix != null) { resultOptions.withAttachmentsPrefix(prefix); } ReportMarkup markup = options.getMarkupType(); if (markup != null) { resultOptions.withMarkupType(markup.toString().toLowerCase()); } resultOptions.withIgnorePagination(options.getIgnorePagination()); resultOptions.withAnchor(options.getAnchor()); resultOptions.withAllowInlineScripts(options.getAllowInlineScripts()); resultOptions.withBaseUrl(mBaseUrl); return resultOptions; }
ExportOptionsMapper { public ExecutionRequestOptions transform(ReportExportOptions options) { ExecutionRequestOptions resultOptions = ExecutionRequestOptions.create(); ReportFormat format = options.getFormat(); resultOptions.withOutputFormat(format.toString().toLowerCase()); PageRange pageRange = options.getPageRange(); if (pageRange != null) { resultOptions.withPages(pageRange.toString()); } String prefix = options.getAttachmentPrefix(); if (prefix != null) { resultOptions.withAttachmentsPrefix(prefix); } ReportMarkup markup = options.getMarkupType(); if (markup != null) { resultOptions.withMarkupType(markup.toString().toLowerCase()); } resultOptions.withIgnorePagination(options.getIgnorePagination()); resultOptions.withAnchor(options.getAnchor()); resultOptions.withAllowInlineScripts(options.getAllowInlineScripts()); resultOptions.withBaseUrl(mBaseUrl); return resultOptions; } }
ExportOptionsMapper { public ExecutionRequestOptions transform(ReportExportOptions options) { ExecutionRequestOptions resultOptions = ExecutionRequestOptions.create(); ReportFormat format = options.getFormat(); resultOptions.withOutputFormat(format.toString().toLowerCase()); PageRange pageRange = options.getPageRange(); if (pageRange != null) { resultOptions.withPages(pageRange.toString()); } String prefix = options.getAttachmentPrefix(); if (prefix != null) { resultOptions.withAttachmentsPrefix(prefix); } ReportMarkup markup = options.getMarkupType(); if (markup != null) { resultOptions.withMarkupType(markup.toString().toLowerCase()); } resultOptions.withIgnorePagination(options.getIgnorePagination()); resultOptions.withAnchor(options.getAnchor()); resultOptions.withAllowInlineScripts(options.getAllowInlineScripts()); resultOptions.withBaseUrl(mBaseUrl); return resultOptions; } protected  ExportOptionsMapper(String baseUrl); }
ExportOptionsMapper { public ExecutionRequestOptions transform(ReportExportOptions options) { ExecutionRequestOptions resultOptions = ExecutionRequestOptions.create(); ReportFormat format = options.getFormat(); resultOptions.withOutputFormat(format.toString().toLowerCase()); PageRange pageRange = options.getPageRange(); if (pageRange != null) { resultOptions.withPages(pageRange.toString()); } String prefix = options.getAttachmentPrefix(); if (prefix != null) { resultOptions.withAttachmentsPrefix(prefix); } ReportMarkup markup = options.getMarkupType(); if (markup != null) { resultOptions.withMarkupType(markup.toString().toLowerCase()); } resultOptions.withIgnorePagination(options.getIgnorePagination()); resultOptions.withAnchor(options.getAnchor()); resultOptions.withAllowInlineScripts(options.getAllowInlineScripts()); resultOptions.withBaseUrl(mBaseUrl); return resultOptions; } protected  ExportOptionsMapper(String baseUrl); static ExportOptionsMapper create(ServerVersion serverVersion, String baseUrl); ExecutionRequestOptions transform(ReportExportOptions options); }
ExportOptionsMapper { public ExecutionRequestOptions transform(ReportExportOptions options) { ExecutionRequestOptions resultOptions = ExecutionRequestOptions.create(); ReportFormat format = options.getFormat(); resultOptions.withOutputFormat(format.toString().toLowerCase()); PageRange pageRange = options.getPageRange(); if (pageRange != null) { resultOptions.withPages(pageRange.toString()); } String prefix = options.getAttachmentPrefix(); if (prefix != null) { resultOptions.withAttachmentsPrefix(prefix); } ReportMarkup markup = options.getMarkupType(); if (markup != null) { resultOptions.withMarkupType(markup.toString().toLowerCase()); } resultOptions.withIgnorePagination(options.getIgnorePagination()); resultOptions.withAnchor(options.getAnchor()); resultOptions.withAllowInlineScripts(options.getAllowInlineScripts()); resultOptions.withBaseUrl(mBaseUrl); return resultOptions; } protected  ExportOptionsMapper(String baseUrl); static ExportOptionsMapper create(ServerVersion serverVersion, String baseUrl); ExecutionRequestOptions transform(ReportExportOptions options);  }