Skip to content

Commit

Permalink
Merge pull request #386 from veraPDF/refactoring
Browse files Browse the repository at this point in the history
Replace createProcessConfig methods calls
  • Loading branch information
MaximPlusov authored Jan 16, 2024
2 parents c19fd7d + e1b6d06 commit 34c1b44
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 16 deletions.
6 changes: 3 additions & 3 deletions gui/src/main/java/org/verapdf/gui/CheckerPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ private void setupFixMetadataCheckBox(final GridBagLayout gbl, final GridBagCons
this.fixMetadata.setSelected(false);
this.fixMetadata.setEnabled(false);
} else {
this.fixMetadata.setSelected(config.createProcessorConfig().getTasks().contains(TaskType.FIX_METADATA));
this.fixMetadata.setSelected(config.getApplicationConfig().getProcessType().getTasks().contains(TaskType.FIX_METADATA));
}
setGridBagConstraintsParameters(gbc, GUIConstants.FIX_METADATA_CHECKBOX_CONSTRAINT_GRID_X,
GUIConstants.FIX_METADATA_CHECKBOX_CONSTRAINT_GRID_Y,
Expand Down Expand Up @@ -362,7 +362,7 @@ private void setupChooseFlavourBox(final GridBagLayout gbl, final GridBagConstra
this.chooseFlavour.setOpaque(true);
ChooseFlavourRenderer renderer = new ChooseFlavourRenderer();
this.chooseFlavour.setRenderer(renderer);
PDFAFlavour fromConfig = config.createProcessorConfig().getValidatorConfig().getFlavour();
PDFAFlavour fromConfig = config.getValidatorConfig().getFlavour();
String fromConfigFlavourText = getFlavourReadableText(fromConfig);
if (availableFlavours.contains(fromConfigFlavourText)) {
this.chooseFlavour.setSelectedItem(fromConfigFlavourText);
Expand Down Expand Up @@ -882,7 +882,7 @@ ValidatorConfig validatorConfigFromState() {
validatorConfig.isRecordPasses(), maxFails,
validatorConfig.isDebug(), validatorConfig.isLogsEnabled(),
validatorConfig.getLoggingLevel(), validatorConfig.getMaxNumberOfDisplayedFailedChecks(),
validatorConfig.showErrorMessages(), null, validatorConfig.getShowProgress(), false);
validatorConfig.showErrorMessages(), null, validatorConfig.getShowProgress(), validatorConfig.getNonPDFExtension());
}

VeraAppConfig appConfigFromState() {
Expand Down
6 changes: 3 additions & 3 deletions gui/src/main/java/org/verapdf/gui/SettingsPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public void keyReleased(KeyEvent e) {
this.chooseDefaultFlavour.setOpaque(true);
ChooseFlavourRenderer renderer = new ChooseFlavourRenderer();
this.chooseDefaultFlavour.setRenderer(renderer);
PDFAFlavour fromConfig = config.createProcessorConfig().getValidatorConfig().getDefaultFlavour();
PDFAFlavour fromConfig = config.getValidatorConfig().getDefaultFlavour();
String fromConfigDefaultFlavourText = CheckerPanel.getFlavourReadableText(fromConfig);
if (availableFlavours.contains(fromConfigDefaultFlavourText)) {
this.chooseDefaultFlavour.setSelectedItem(fromConfigDefaultFlavourText);
Expand Down Expand Up @@ -266,7 +266,7 @@ boolean showDialog(Component parent, String title, ConfigManager settings) {

this.ok = false;

ValidatorConfig validatorConfig = settings.createProcessorConfig().getValidatorConfig();
ValidatorConfig validatorConfig = settings.getValidatorConfig();
this.hidePassedRules.setSelected(validatorConfig.isRecordPasses());

if (Foundries.defaultParserIsPDFBox()) {
Expand Down Expand Up @@ -303,7 +303,7 @@ boolean showDialog(Component parent, String title, ConfigManager settings) {
String fromConfigDefaultFlavourText = CheckerPanel.getFlavourReadableText(defaultFlavour);
this.chooseDefaultFlavour.setSelectedItem(fromConfigDefaultFlavourText);

this.fixMetadataPrefix.setText(settings.createProcessorConfig().getFixerConfig().getFixesPrefix());
this.fixMetadataPrefix.setText(settings.getFixerConfig().getFixesPrefix());

VeraAppConfig appConfig = settings.getApplicationConfig();
this.fixMetadataFolder.setText(appConfig.getFixesFolder());
Expand Down
14 changes: 5 additions & 9 deletions gui/src/main/java/org/verapdf/gui/ValidateWorker.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.verapdf.core.utils.LogsFileHandler;
import org.verapdf.features.FeatureExtractorConfig;
import org.verapdf.gui.utils.GUIConstants;
import org.verapdf.pdfa.validation.profiles.Profiles;
import org.verapdf.pdfa.validation.profiles.ValidationProfile;
import org.verapdf.pdfa.validation.validators.ValidatorConfig;
import org.verapdf.policy.PolicyChecker;
Expand Down Expand Up @@ -109,15 +110,10 @@ protected ValidateWorkerSummary doInBackground() {
this.parent.handleValidationError(ERROR_IN_OBTAINING_POLICY_FEATURES + ": ", e);
}
}
ProcessorConfig resultConfig = this.customProfile == null
? ProcessorFactory.fromValues(validatorConfig, featuresConfig,
this.configManager.getPluginsCollectionConfig(),
this.configManager.getFixerConfig(), tasks,
veraAppConfig.getFixesFolder())
: ProcessorFactory.fromValues(validatorConfig, featuresConfig,
this.configManager.getPluginsCollectionConfig(),
this.configManager.getFixerConfig(), tasks,
this.customProfile, veraAppConfig.getFixesFolder());
ProcessorConfig resultConfig = ProcessorFactory.fromValues(validatorConfig, featuresConfig,
this.configManager.getPluginsCollectionConfig(), this.configManager.getFixerConfig(), tasks,
this.customProfile == null ? Profiles.defaultProfile() : this.customProfile,
veraAppConfig.getFixesFolder());
try (BatchProcessor processor = ProcessorFactory.fileBatchProcessor(resultConfig)) {
VeraAppConfig applicationConfig = this.configManager.getApplicationConfig();
BatchSummary batchSummary = processor.process(this.pdfs,
Expand Down
2 changes: 1 addition & 1 deletion gui/src/main/java/org/verapdf/gui/utils/GUIConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public final class GUIConstants {
public static final String LABEL_TOOL_TIP = "<html>PDF flavour: the PDF/A or PDF/UA part and conformance level<br>" +
"Validation profile: custom collection of validation rules</html>";

public static final String CONSORTIUM_TEXT = "© 2015-2023 veraPDF Consortium"; //$NON-NLS-1$
public static final String CONSORTIUM_TEXT = "© 2015-2024 veraPDF Consortium"; //$NON-NLS-1$
public static final String PREFORMA_FUNDED_TEXT = "Funded by the European Commission’s PREFORMA Project";
public static final String TITLE = "veraPDF Conformance Checker";
public static final String ENCRYPTED_PDF = "Document is password encrypted and can not be processed.";
Expand Down

0 comments on commit 34c1b44

Please sign in to comment.