Skip to content

Commit

Permalink
feat: Simplified module
Browse files Browse the repository at this point in the history
Refs: DEV-12343
  • Loading branch information
nirikash committed Dec 27, 2024
1 parent 6586a13 commit 5eabad6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
package ch.sbb.polarion.extension.pdf_exporter;

import ch.sbb.polarion.extension.generic.service.PolarionService;
import ch.sbb.polarion.extension.pdf_exporter.converter.HtmlToPdfConverter;
import ch.sbb.polarion.extension.pdf_exporter.converter.PdfConverter;
import ch.sbb.polarion.extension.pdf_exporter.converter.PdfConverterJobsService;
import ch.sbb.polarion.extension.pdf_exporter.converter.PropertiesUtility;
import ch.sbb.polarion.extension.pdf_exporter.service.PdfExporterPolarionService;
import ch.sbb.polarion.extension.pdf_exporter.util.PdfValidationService;
import com.google.inject.AbstractModule;
import com.polarion.platform.core.PlatformContext;
import com.polarion.platform.security.ISecurityService;
Expand All @@ -15,16 +8,16 @@ public class PdfExporterInternModule extends AbstractModule {

@Override
protected void configure() {
PdfExporterPolarionService pdfExporterPolarionService = new PdfExporterPolarionService();
PdfConverter pdfConverter = new PdfConverter();
// PdfExporterPolarionService pdfExporterPolarionService = new PdfExporterPolarionService();
// PdfConverter pdfConverter = new PdfConverter();
ISecurityService securityService = PlatformContext.getPlatform().lookupService(ISecurityService.class);

bind(PolarionService.class).toInstance(pdfExporterPolarionService);
bind(PdfConverter.class).toInstance(pdfConverter);
bind(ISecurityService.class).toInstance(securityService);
bind(PdfValidationService.class).toInstance(new PdfValidationService(pdfConverter));
bind(PdfConverterJobsService.class).toInstance(new PdfConverterJobsService(pdfConverter, securityService));
bind(PropertiesUtility.class).toInstance(new PropertiesUtility());
bind(HtmlToPdfConverter.class).toInstance(new HtmlToPdfConverter());

// bind(PolarionService.class).toInstance(pdfExporterPolarionService);
// bind(PdfConverter.class).toInstance(pdfConverter);
// bind(PdfValidationService.class).toInstance(new PdfValidationService(pdfConverter));
// bind(PdfConverterJobsService.class).toInstance(new PdfConverterJobsService(pdfConverter, securityService));
// bind(PropertiesUtility.class).toInstance(new PropertiesUtility());
// bind(HtmlToPdfConverter.class).toInstance(new HtmlToPdfConverter());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import ch.sbb.polarion.extension.pdf_exporter.util.html.HtmlLinksHelper;
import ch.sbb.polarion.extension.pdf_exporter.weasyprint.WeasyPrintOptions;
import ch.sbb.polarion.extension.pdf_exporter.weasyprint.service.WeasyPrintServiceConnector;
import com.google.inject.Inject;
import lombok.Getter;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.VisibleForTesting;
Expand All @@ -22,6 +23,7 @@ public class HtmlToPdfConverter {
@Getter
private final WeasyPrintServiceConnector weasyPrintServiceConnector;

@Inject
public HtmlToPdfConverter() {
this.pdfTemplateProcessor = new PdfTemplateProcessor();
PdfExporterFileResourceProvider fileResourceProvider = new PdfExporterFileResourceProvider();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import ch.sbb.polarion.extension.generic.rest.filter.LogoutFilter;
import ch.sbb.polarion.extension.pdf_exporter.rest.model.conversion.ExportParams;
import com.google.inject.Inject;
import com.polarion.core.util.logging.Logger;
import com.polarion.platform.security.ISecurityService;
import lombok.Builder;
Expand Down Expand Up @@ -36,6 +37,7 @@ public class PdfConverterJobsService {
private final PdfConverter pdfConverter;
private final ISecurityService securityService;

@Inject
public PdfConverterJobsService(PdfConverter pdfConverter, ISecurityService securityService) {
this.pdfConverter = pdfConverter;
this.securityService = securityService;
Expand Down

0 comments on commit 5eabad6

Please sign in to comment.