diff options
author | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-07-06 17:27:03 +0200 |
---|---|---|
committer | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-07-06 17:27:03 +0200 |
commit | bd8c480935a4b5ce8747f2a9405c4dc97d9d01a8 (patch) | |
tree | 3f426e8fa800a298c1f1566dda4e18bb6913417a /pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow | |
parent | da37de85afc55f67b4ceefe35350ac9a0af32c6e (diff) | |
download | pdf-over-bd8c480935a4b5ce8747f2a9405c4dc97d9d01a8.tar.gz pdf-over-bd8c480935a4b5ce8747f2a9405c4dc97d9d01a8.tar.bz2 pdf-over-bd8c480935a4b5ce8747f2a9405c4dc97d9d01a8.zip |
YAGNI: ConfigurationContainer interface
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow')
3 files changed, 268 insertions, 1254 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java index 1377f4ac..69978e27 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java @@ -73,8 +73,8 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, * Constructor */ public ConfigProviderImpl() { - this.configuration = new ConfigurationContainerImpl(); - this.configurationOverlay = new ConfigurationContainerImpl(); + this.configuration = new ConfigurationContainer(); + this.configurationOverlay = new ConfigurationContainer(); } /* @@ -150,7 +150,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, String bkuUrl = config.getProperty(Constants.CFG_MOBILE_BKU_URL); if (bkuUrl != null && !bkuUrl.isEmpty()) - this.configuration.setMobileBKUURL(bkuUrl); + this.configuration.mobileBKUURL = bkuUrl; String bkuType = config .getProperty(Constants.CFG_MOBILE_BKU_TYPE); @@ -159,17 +159,16 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, { try { - this.configuration.setMobileBKUType(MobileBKUs.valueOf( - bkuType.trim().toUpperCase())); + this.configuration.mobileBKUType = MobileBKUs.valueOf(bkuType.trim().toUpperCase()); } catch (IllegalArgumentException e) { log.error("Invalid BKU type: " + bkuType); - this.configuration.setMobileBKUType(DEFAULT_MOBILE_BKU_TYPE); + this.configuration.mobileBKUType = DEFAULT_MOBILE_BKU_TYPE; } } String useBase64 = config.getProperty(Constants.CFG_MOBILE_BKU_BASE64); if (useBase64 != null) - this.configuration.setMobileBKUBase64(useBase64.equalsIgnoreCase(Constants.TRUE)); + this.configuration.mobileBKUBase64 = useBase64.equalsIgnoreCase(Constants.TRUE); String proxyPortString = config.getProperty(Constants.CFG_PROXY_PORT); if (proxyPortString != null && !proxyPortString.trim().isEmpty()) @@ -230,7 +229,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, // ignore parsing exception } } - this.configuration.setMainWindowSize(new Point(width, height)); + this.configuration.mainWindowSize = new Point(width, height); // Set Signature Position String signaturePosition = config.getProperty(Constants.CFG_SIGNATURE_POSITION); @@ -337,7 +336,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, props.setProperty(Constants.CFG_SIGNATURE_PLACEHOLDER_TRANSPARENCY, Integer.toString(getPlaceholderTransparency())); - Point size = this.configuration.getMainWindowSize(); + Point size = this.configuration.mainWindowSize; props.setProperty(Constants.CFG_MAINWINDOW_SIZE, size.x + "," + size.y); Locale configLocale = getLocale(); @@ -462,7 +461,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public void setDefaultBKU(BKUs bku) { - this.configuration.setDefaultBKU(bku); + this.configuration.defaultBKU = bku; } /* (non-Javadoc) @@ -470,7 +469,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public void setDefaultBKUOverlay(BKUs bku) { - this.configurationOverlay.setDefaultBKU(bku); + this.configurationOverlay.defaultBKU = bku; } @@ -481,7 +480,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public BKUs getDefaultBKU() { - BKUs bku = this.configurationOverlay.getDefaultBKU(); + BKUs bku = this.configurationOverlay.defaultBKU; if (bku == BKUs.NONE) bku = getDefaultBKUPersistent(); return bku; @@ -492,7 +491,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public BKUs getDefaultBKUPersistent() { - return this.configuration.getDefaultBKU(); + return this.configuration.defaultBKU; } /** @@ -503,7 +502,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public void setDefaultSignaturePosition(SignaturePosition signaturePosition) { - this.configuration.setDefaultSignaturePosition(signaturePosition); + this.configuration.defaultSignaturePosition = signaturePosition; } @@ -512,7 +511,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public void setDefaultSignaturePositionOverlay(SignaturePosition signaturePosition) { - this.configurationOverlay.setDefaultSignaturePosition(signaturePosition); + this.configurationOverlay.defaultSignaturePosition = signaturePosition; } /* @@ -523,7 +522,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public SignaturePosition getDefaultSignaturePosition() { - SignaturePosition position = this.configurationOverlay.getDefaultSignaturePosition(); + SignaturePosition position = this.configurationOverlay.defaultSignaturePosition; if (position == null) position = getDefaultSignaturePositionPersistent(); return position; @@ -534,7 +533,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public SignaturePosition getDefaultSignaturePositionPersistent() { - return this.configuration.getDefaultSignaturePosition(); + return this.configuration.defaultSignaturePosition; } /** @@ -545,7 +544,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public void setPlaceholderTransparency(int transparency) { - this.configuration.setPlaceholderTransparency(transparency); + this.configuration.placeholderTransparency = transparency; } /* @@ -556,7 +555,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public int getPlaceholderTransparency() { - return this.configuration.getPlaceholderTransparency(); + return this.configuration.placeholderTransparency; } /** @@ -619,9 +618,9 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, @Override public void setDefaultMobilePassword(String password) { if (password == null || password.trim().isEmpty()) { - this.configuration.setMobilePassword(STRING_EMPTY); + this.configuration.mobilePassword = STRING_EMPTY; } else { - this.configuration.setMobilePassword(password); + this.configuration.mobilePassword = password; } } @@ -631,9 +630,9 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, @Override public void setDefaultMobilePasswordOverlay(String password) { if (password == null || password.trim().isEmpty()) { - this.configurationOverlay.setMobilePassword(STRING_EMPTY); + this.configurationOverlay.mobilePassword = STRING_EMPTY; } else { - this.configurationOverlay.setMobilePassword(password); + this.configurationOverlay.mobilePassword = password; } } @@ -644,7 +643,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public String getDefaultMobilePassword() { - String password = this.configurationOverlay.getMobilePassword(); + String password = this.configurationOverlay.mobilePassword; if (password == null) password = getDefaultMobilePasswordPersistent(); return password; @@ -655,7 +654,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public String getDefaultMobilePasswordPersistent() { - String password = this.configuration.getMobilePassword(); + String password = this.configuration.mobilePassword; if (password == null) password = STRING_EMPTY; return password; @@ -744,9 +743,9 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, @Override public void setProxyHost(String host) { if (host == null || host.trim().isEmpty()) { - this.configuration.setProxyHost(STRING_EMPTY); + this.configuration.proxyHost = STRING_EMPTY; } else { - this.configuration.setProxyHost(host); + this.configuration.proxyHost = host; } } @@ -756,9 +755,9 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, @Override public void setProxyHostOverlay(String host) { if (host == null || host.trim().isEmpty()) { - this.configurationOverlay.setProxyHost(STRING_EMPTY); + this.configurationOverlay.proxyHost = STRING_EMPTY; } else { - this.configurationOverlay.setProxyHost(host); + this.configurationOverlay.proxyHost = host; } } @@ -769,7 +768,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public String getProxyHost() { - String host = this.configurationOverlay.getProxyHost(); + String host = this.configurationOverlay.proxyHost; if (host == null) host = getProxyHostPersistent(); return host; @@ -780,7 +779,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public String getProxyHostPersistent() { - String host = this.configuration.getProxyHost(); + String host = this.configuration.proxyHost; if (host == null) host = STRING_EMPTY; return host; @@ -845,9 +844,9 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, @Override public void setProxyUser(String user) { if (user == null || user.trim().isEmpty()) { - this.configuration.setProxyUser(STRING_EMPTY); + this.configuration.proxyUser = STRING_EMPTY; } else { - this.configuration.setProxyUser(user); + this.configuration.proxyUser = user; } } @@ -857,9 +856,9 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, @Override public void setProxyUserOverlay(String user) { if (user == null || user.trim().isEmpty()) { - this.configurationOverlay.setProxyUser(STRING_EMPTY); + this.configurationOverlay.proxyUser = STRING_EMPTY; } else { - this.configurationOverlay.setProxyUser(user); + this.configurationOverlay.proxyUser = user; } } @@ -868,7 +867,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public String getProxyUser() { - String user = this.configurationOverlay.getProxyUser(); + String user = this.configurationOverlay.proxyUser; if (user == null) user = getProxyUserPersistent(); return user; @@ -879,7 +878,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public String getProxyUserPersistent() { - String user = this.configuration.getProxyUser(); + String user = this.configuration.proxyUser; if (user == null) user = STRING_EMPTY; return user; @@ -894,9 +893,9 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, @Override public void setProxyPass(String pass) { if (pass == null || pass.trim().isEmpty()) { - this.configuration.setProxyPass(STRING_EMPTY); + this.configuration.proxyPass = STRING_EMPTY; } else { - this.configuration.setProxyPass(pass); + this.configuration.proxyPass = pass; } } @@ -906,9 +905,9 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, @Override public void setProxyPassOverlay(String pass) { if (pass == null || pass.trim().isEmpty()) { - this.configurationOverlay.setProxyPass(STRING_EMPTY); + this.configurationOverlay.proxyPass = STRING_EMPTY; } else { - this.configurationOverlay.setProxyPass(pass); + this.configurationOverlay.proxyPass = pass; } } @@ -917,7 +916,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public String getProxyPass() { - String pass = this.configurationOverlay.getProxyPass(); + String pass = this.configurationOverlay.proxyPass; if (pass == null) pass = getProxyPassPersistent(); return pass; @@ -928,7 +927,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public String getProxyPassPersistent() { - String pass = this.configuration.getProxyPass(); + String pass = this.configuration.proxyPass; if (pass == null) pass = STRING_EMPTY; return pass; @@ -944,9 +943,9 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, @Override public void setDefaultOutputFolder(String outputFolder) { if (outputFolder == null || outputFolder.trim().isEmpty()) { - this.configuration.setOutputFolder(STRING_EMPTY); + this.configuration.outputFolder = STRING_EMPTY; } else { - this.configuration.setOutputFolder(outputFolder); + this.configuration.outputFolder = outputFolder; } } @@ -956,9 +955,9 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, @Override public void setDefaultOutputFolderOverlay(String outputFolder) { if (outputFolder == null || outputFolder.trim().isEmpty()) { - this.configurationOverlay.setOutputFolder(STRING_EMPTY); + this.configurationOverlay.outputFolder = STRING_EMPTY; } else { - this.configurationOverlay.setOutputFolder(outputFolder); + this.configurationOverlay.outputFolder = outputFolder; } } @@ -969,7 +968,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public String getDefaultOutputFolder() { - String outputFolder = this.configurationOverlay.getOutputFolder(); + String outputFolder = this.configurationOverlay.outputFolder; if (outputFolder == null) outputFolder = getDefaultOutputFolderPersistent(); return outputFolder; @@ -980,7 +979,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public String getDefaultOutputFolderPersistent() { - String outputFolder = this.configuration.getOutputFolder(); + String outputFolder = this.configuration.outputFolder; if (outputFolder == null) outputFolder = STRING_EMPTY; return outputFolder; @@ -993,7 +992,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public String getMobileBKUURL() { - return this.configuration.getMobileBKUURL(); + return this.configuration.mobileBKUURL; } /* (non-Javadoc) @@ -1001,7 +1000,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public MobileBKUs getMobileBKUType() { - return this.configuration.getMobileBKUType(); + return this.configuration.mobileBKUType; } @@ -1010,7 +1009,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public boolean getMobileBKUBase64() { - return this.configuration.getMobileBKUBase64(); + return this.configuration.mobileBKUBase64; } /* @@ -1023,9 +1022,9 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, @Override public void setSignatureNote(String note) { if (note == null || note.trim().isEmpty()) { - this.configuration.setSignatureNote(STRING_EMPTY); + this.configuration.signatureNote = STRING_EMPTY; } else { - this.configuration.setSignatureNote(note); + this.configuration.signatureNote = note; } } @@ -1036,7 +1035,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public String getSignatureNote() { - String note = this.configuration.getSignatureNote(); + String note = this.configuration.signatureNote; if (note == null) note = STRING_EMPTY; return note; @@ -1048,9 +1047,9 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, @Override public void setLocale(Locale locale) { if(locale == null) { - this.configuration.setLocale(Messages.getDefaultLocale()); + this.configuration.locale = Messages.getDefaultLocale(); } else { - this.configuration.setLocale(locale); + this.configuration.locale = locale; Locale.setDefault(locale); Messages.setLocale(locale); } @@ -1061,7 +1060,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public Locale getLocale() { - Locale locale = this.configuration.getLocale(); + Locale locale = this.configuration.locale; if (locale == null) locale = Messages.getDefaultLocale(); return locale; @@ -1073,9 +1072,9 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, @Override public void setSignatureLocale(Locale locale) { if(locale == null) { - this.configuration.setSignatureLocale(Messages.getDefaultLocale()); + this.configuration.signatureLocale = Messages.getDefaultLocale(); } else { - this.configuration.setSignatureLocale(locale); + this.configuration.signatureLocale = locale; } } @@ -1084,7 +1083,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public Locale getSignatureLocale() { - Locale locale = this.configuration.getSignatureLocale(); + Locale locale = this.configuration.signatureLocale; if (locale == null) locale = Messages.getDefaultLocale(); return locale; @@ -1095,7 +1094,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public void setSignaturePdfACompat(boolean compat) { - this.configuration.setSignaturePdfACompat(compat); + this.configuration.signaturePDFACompat = compat; } /* (non-Javadoc) @@ -1103,7 +1102,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public boolean getSignaturePdfACompat() { - return this.configuration.getSignaturePdfACompat(); + return this.configuration.signaturePDFACompat; } /* (non-Javadoc) @@ -1111,7 +1110,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public void setKeyStoreEnabled(Boolean enabled) { - this.configuration.setKeyStoreEnabled(enabled); + this.configuration.keystoreEnabled = enabled; } /* (non-Javadoc) @@ -1119,7 +1118,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public void setKeyStoreEnabledOverlay(Boolean enabled) { - this.configurationOverlay.setKeyStoreEnabled(enabled); + this.configurationOverlay.keystoreEnabled = enabled; } /* (non-Javadoc) @@ -1127,7 +1126,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public Boolean getKeyStoreEnabled() { - Boolean enabled = this.configurationOverlay.getKeyStoreEnabled(); + Boolean enabled = this.configurationOverlay.keystoreEnabled; if (enabled == null) enabled = getKeyStoreEnabledPersistent(); return enabled; @@ -1138,7 +1137,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public Boolean getKeyStoreEnabledPersistent() { - Boolean enabled = this.configuration.getKeyStoreEnabled(); + Boolean enabled = this.configuration.keystoreEnabled; if (enabled == null) enabled = false; return enabled; @@ -1150,9 +1149,9 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, @Override public void setKeyStoreFile(String file) { if (file == null || file.trim().isEmpty()) { - this.configuration.setKeyStoreFile(STRING_EMPTY); + this.configuration.keystoreFile = STRING_EMPTY; } else { - this.configuration.setKeyStoreFile(file); + this.configuration.keystoreFile = file; } } @@ -1162,9 +1161,9 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, @Override public void setKeyStoreFileOverlay(String file) { if (file == null || file.trim().isEmpty()) { - this.configurationOverlay.setKeyStoreFile(STRING_EMPTY); + this.configurationOverlay.keystoreFile = STRING_EMPTY; } else { - this.configurationOverlay.setKeyStoreFile(file); + this.configurationOverlay.keystoreFile = file; } } @@ -1173,7 +1172,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public String getKeyStoreFile() { - String file = this.configurationOverlay.getKeyStoreFile(); + String file = this.configurationOverlay.keystoreFile; if (file == null) file = getKeyStoreFilePersistent(); return file; @@ -1184,7 +1183,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public String getKeyStoreFilePersistent() { - String file = this.configuration.getKeyStoreFile(); + String file = this.configuration.keystoreFile; if (file == null) file = STRING_EMPTY; return file; @@ -1196,9 +1195,9 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, @Override public void setKeyStoreType(String type) { if (type == null || type.trim().isEmpty()) { - this.configuration.setKeyStoreType(STRING_EMPTY); + this.configuration.keystoreType = STRING_EMPTY; } else { - this.configuration.setKeyStoreType(type); + this.configuration.keystoreType = type; } } @@ -1208,9 +1207,9 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, @Override public void setKeyStoreTypeOverlay(String type) { if (type == null || type.trim().isEmpty()) { - this.configurationOverlay.setKeyStoreType(STRING_EMPTY); + this.configurationOverlay.keystoreType = STRING_EMPTY; } else { - this.configurationOverlay.setKeyStoreType(type); + this.configurationOverlay.keystoreType = type; } } @@ -1219,7 +1218,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public String getKeyStoreType() { - String type = this.configurationOverlay.getKeyStoreType(); + String type = this.configurationOverlay.keystoreType; if (type == null) type = getKeyStoreTypePersistent(); return type; @@ -1230,7 +1229,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public String getKeyStoreTypePersistent() { - String type = this.configuration.getKeyStoreType(); + String type = this.configuration.keystoreType; if (type == null) type = STRING_EMPTY; return type; @@ -1242,9 +1241,9 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, @Override public void setKeyStoreAlias(String alias) { if (alias == null || alias.trim().isEmpty()) { - this.configuration.setKeyStoreAlias(STRING_EMPTY); + this.configuration.keystoreAlias = STRING_EMPTY; } else { - this.configuration.setKeyStoreAlias(alias); + this.configuration.keystoreAlias = alias; } } @@ -1254,9 +1253,9 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, @Override public void setKeyStoreAliasOverlay(String alias) { if (alias == null || alias.trim().isEmpty()) { - this.configurationOverlay.setKeyStoreAlias(STRING_EMPTY); + this.configurationOverlay.keystoreAlias = STRING_EMPTY; } else { - this.configurationOverlay.setKeyStoreAlias(alias); + this.configurationOverlay.keystoreAlias = alias; } } @@ -1265,7 +1264,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public String getKeyStoreAlias() { - String alias = this.configurationOverlay.getKeyStoreAlias(); + String alias = this.configurationOverlay.keystoreAlias; if (alias == null) alias = getKeyStoreAliasPersistent(); return alias; @@ -1276,7 +1275,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public String getKeyStoreAliasPersistent() { - String alias = this.configuration.getKeyStoreAlias(); + String alias = this.configuration.keystoreAlias; if (alias == null) alias = STRING_EMPTY; return alias; @@ -1288,9 +1287,9 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, @Override public void setKeyStoreStorePass(String storePass) { if (storePass == null || storePass.trim().isEmpty()) { - this.configuration.setKeyStoreStorePass(STRING_EMPTY); + this.configuration.keystoreStorePass = STRING_EMPTY; } else { - this.configuration.setKeyStoreStorePass(storePass); + this.configuration.keystoreStorePass = storePass; } } @@ -1300,9 +1299,9 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, @Override public void setKeyStoreStorePassOverlay(String storePass) { if (storePass == null || storePass.trim().isEmpty()) { - this.configurationOverlay.setKeyStoreStorePass(STRING_EMPTY); + this.configurationOverlay.keystoreStorePass = STRING_EMPTY; } else { - this.configurationOverlay.setKeyStoreStorePass(storePass); + this.configurationOverlay.keystoreStorePass = storePass; } } @@ -1311,7 +1310,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public String getKeyStoreStorePass() { - String storePass = this.configurationOverlay.getKeyStoreStorePass(); + String storePass = this.configurationOverlay.keystoreStorePass; if (storePass != null) return storePass; return getKeyStoreStorePassPersistent(); @@ -1322,7 +1321,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public String getKeyStoreStorePassPersistent() { - String storePass = this.configuration.getKeyStoreStorePass(); + String storePass = this.configuration.keystoreStorePass; if (storePass == null) storePass = STRING_EMPTY; return storePass; @@ -1334,9 +1333,9 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, @Override public void setKeyStoreKeyPass(String keyPass) { if (keyPass == null || keyPass.trim().isEmpty()) { - this.configuration.setKeyStoreKeyPass(STRING_EMPTY); + this.configuration.keystoreKeyPass = STRING_EMPTY; } else { - this.configuration.setKeyStoreKeyPass(keyPass); + this.configuration.keystoreKeyPass = keyPass; } } @@ -1346,9 +1345,9 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, @Override public void setKeyStoreKeyPassOverlay(String keyPass) { if (keyPass == null || keyPass.trim().isEmpty()) { - this.configurationOverlay.setKeyStoreKeyPass(STRING_EMPTY); + this.configurationOverlay.keystoreKeyPass = STRING_EMPTY; } else { - this.configurationOverlay.setKeyStoreKeyPass(keyPass); + this.configurationOverlay.keystoreKeyPass = keyPass; } } @@ -1357,7 +1356,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public String getKeyStoreKeyPass() { - String keyPass = this.configurationOverlay.getKeyStoreKeyPass(); + String keyPass = this.configurationOverlay.keystoreKeyPass; if (keyPass != null) return keyPass; return getKeyStoreKeyPassPersistent(); @@ -1368,7 +1367,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public String getKeyStoreKeyPassPersistent() { - String keyPass = this.configuration.getKeyStoreKeyPass(); + String keyPass = this.configuration.keystoreKeyPass; if (keyPass == null) keyPass = STRING_EMPTY; return keyPass; @@ -1379,7 +1378,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public void setUpdateCheck(boolean checkUpdate) { - this.configuration.setUpdateCheck(checkUpdate); + this.configuration.updateCheck = checkUpdate; } /* (non-Javadoc) @@ -1387,7 +1386,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public boolean getUpdateCheck() { - return this.configuration.getUpdateCheck(); + return this.configuration.updateCheck; } /* (non-Javadoc) @@ -1395,7 +1394,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public void setMainWindowSize(Point size) { - this.configuration.setMainWindowSize(size); + this.configuration.mainWindowSize = size; } /* (non-Javadoc) @@ -1403,7 +1402,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public Point getMainWindowSize() { - return this.configuration.getMainWindowSize(); + return this.configuration.mainWindowSize; } /* (non-Javadoc) @@ -1411,7 +1410,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public boolean getSkipFinish() { - return this.configurationOverlay.getSkipFinish(); + return this.configurationOverlay.skipFinish; } /* (non-Javadoc) @@ -1419,7 +1418,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public void setSkipFinishOverlay(boolean skipFinish) { - this.configurationOverlay.setSkipFinish(skipFinish); + this.configurationOverlay.skipFinish = skipFinish; } /* @@ -1468,12 +1467,12 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, @Override public void setSaveFilePostFix(String postFix) { - this.configurationOverlay.setSaveFilePostFix(postFix); + this.configurationOverlay.saveFilePostFix = postFix; } @Override public String getSaveFilePostFix(){ - return this.configurationOverlay.getSaveFilePostFix(); + return this.configurationOverlay.saveFilePostFix; } @Override @@ -1484,12 +1483,12 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, @Override public void setEnablePlaceholderUsage(boolean bool) { - this.configurationOverlay.setEnablePlaceholderUsage(bool); + this.configurationOverlay.enabledPlaceholderUsage = bool; } @Override public boolean getEnablePlaceholderUsage() { - return this.configurationOverlay.getEnablePlaceholderUsage(); + return this.configurationOverlay.enabledPlaceholderUsage; } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainer.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainer.java index 70661f3d..b238da01 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainer.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainer.java @@ -15,11 +15,21 @@ */ package at.asit.pdfover.gui.workflow.config; +// Imports +import java.io.File; +import java.io.FileNotFoundException; import java.util.Locale; import at.asit.pdfover.commons.Profile; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.ImageData; import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.widgets.Display; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import at.asit.pdfover.commons.Constants; +import at.asit.pdfover.gui.bku.mobile.MobileBKUHelper; import at.asit.pdfover.gui.bku.mobile.MobileBKUs; import at.asit.pdfover.gui.exceptions.InvalidEmblemFile; import at.asit.pdfover.gui.exceptions.InvalidPortException; @@ -27,402 +37,158 @@ import at.asit.pdfover.signator.BKUs; import at.asit.pdfover.signator.SignaturePosition; /** - * Configuration container + * Implementation of the configuration container */ -public interface ConfigurationContainer { - /** - * Gets the configured emblem - * @return the configured emblem - */ - public String getEmblem(); - - /** - * Sets the emblem - * @param emblem the emblem - * @throws InvalidEmblemFile - */ - public void setEmblem(String emblem) throws InvalidEmblemFile; - - /** - * Gets the mobile phone number - * @return the mobile phone number - */ - public String getMobileNumber(); - - /** - * Sets the mobile phone number - * @param number the mobile phone number - */ - public void setMobileNumber(String number); - - /** - * Gets the mobile phone number - * @return the mobile phone number - */ - public String getMobilePassword(); - - /** - * Sets the mobile phone password - * @param password the mobile phone password - */ - public void setMobilePassword(String password); - - /** - * Gets the proxy host - * @return the proxy host - */ - public String getProxyHost(); - - /** - * Sets the proxy host - * @param host the proxy host - */ - public void setProxyHost(String host); - - /** - * Gets the proxy port - * - * if port is -1 no port is selected - * - * @return the proxy port - */ - public int getProxyPort(); - - /** - * Sets the proxy port - * - * set to -1 for no port - * - * @param port the proxy port - * @throws InvalidPortException - */ - public void setProxyPort(int port) throws InvalidPortException; - - /** - * Gets the proxy username - * @return the proxy username - */ - public String getProxyUser(); - - /** - * Sets the proxy username - * @param user the proxy username - */ - public void setProxyUser(String user); - - /** - * Gets the proxy password - * @return the proxy password - */ - public String getProxyPass(); - - /** - * Sets the proxy password - * @param pass the proxy password - */ - public void setProxyPass(String pass); - - /** - * Gets the signature note - * @return the signature note - */ - public String getSignatureNote(); - - /** - * Sets the signature note - * @param note the signature note - */ - public void setSignatureNote(String note); - - /** - * Gets the transparency of the placeholder - * @return transparency of the placeholder (0-255) - */ - public int getPlaceholderTransparency(); - - /** - * Sets the transparency of the placeholder - * @param transparency transparency of the placeholder (0-255) - */ - public void setPlaceholderTransparency(int transparency); - - /** - * Gets the default BKU - * @return the default BKU - */ - public BKUs getDefaultBKU(); - - /** - * Sets the default BKU - * @param defaultBKU the default BKU - */ - public void setDefaultBKU(BKUs defaultBKU); - - /** - * Gets the default output folder - * @return the default output folder - */ - public String getOutputFolder(); - - /** - * Sets the default output folder - * @param folder the default output folder - */ - public void setOutputFolder(String folder); - - /** - * Gets the locale - * @return the locale - */ - public Locale getLocale(); - - /** - * Sets the locale - * @param locale the locale - */ - public void setLocale(Locale locale); - - /** - * Gets the signature locale - * @return the signature locale - */ - public Locale getSignatureLocale(); - - /** - * Sets the signature locale - * @param locale the signature locale - */ - public void setSignatureLocale(Locale locale); - - /** - * Gets the signature PDF/A compatibility setting - * @return the signature PDF/A compatibility setting - */ - public boolean getSignaturePdfACompat(); - - /** - * Sets the signature PDF/A compatibility setting - * @param compat the signature PDF/A compatibility setting - */ - public void setSignaturePdfACompat(boolean compat); - - /** - * Gets the mobile BKU URL - * @return the mobile BKU URL - */ - public String getMobileBKUURL(); - - /** - * Sets the mobile BKU URL - * @param bkuUrl the mobile BKU URL - */ - public void setMobileBKUURL(String bkuUrl); - - /** - * Gets the mobile BKU type - * @return the mobile BKU type - */ - public MobileBKUs getMobileBKUType(); - - /** - * Sets the mobile BKU type - * @param bkuType the mobile BKU type - */ - public void setMobileBKUType(MobileBKUs bkuType); - - /** - * Gets the mobile BKU BASE64 setting - * @return the mobile BKU BASE64 setting - */ - public boolean getMobileBKUBase64(); - - /** - * Sets the mobile BKU BASE64 setting - * @param useBase64 the mobile BKU BASE64 setting - */ - public void setMobileBKUBase64(boolean useBase64); - - /** - * Gets the default signature position - * @return the default signature position - */ - public SignaturePosition getDefaultSignaturePosition(); - - /** - * Sets the default signature position - * @param signaturePosition the default signature position - */ - public void setDefaultSignaturePosition(SignaturePosition signaturePosition); - - /** - * Gets whether keystore signing is enabled - * @return whether keystore signing is enabled - */ - public Boolean getKeyStoreEnabled(); - - /** - * Sets whether keystore signing is enabled - * @param enabled whether keystore signing is enabled - */ - public void setKeyStoreEnabled(Boolean enabled); - - /** - * Gets the keystore file - * @return the keystore file - */ - public String getKeyStoreFile(); - - /** - * Sets the keystore file - * @param file the keystore file - */ - public void setKeyStoreFile(String file); - - /** - * Gets the keystore type - * @return the keystore type - */ - public String getKeyStoreType(); - - /** - * Sets the keystore type - * @param type the keystore type - */ - public void setKeyStoreType(String type); - - /** - * Gets the keystore alias - * @return the keystore alias - */ - public String getKeyStoreAlias(); - - /** - * Sets the keystore alias - * @param alias the keystore alias - */ - public void setKeyStoreAlias(String alias); - - /** - * Gets the keystore store password - * @return the keystore store password - */ - public String getKeyStoreStorePass(); - - /** - * Sets the keystore store password - * @param storePass the keystore store password - */ - public void setKeyStoreStorePass(String storePass); - - /** - * Gets the keystore key password - * @return the keystore key password - */ - public String getKeyStoreKeyPass(); - - /** - * Sets the keystore key password - * @param keyPass the keystore key password - */ - public void setKeyStoreKeyPass(String keyPass); - - /** - * Gets whether to automatically check for application updates - * @return whether to automatically check for application updates - */ - public boolean getUpdateCheck(); - - /** - * Sets whether to automatically check for application updates - * @param checkUpdate whether to automatically check for application updates - */ - public void setUpdateCheck(boolean checkUpdate); - - /** - * Gets the main window size - * @return the main window size - */ - public Point getMainWindowSize(); - - /** - * Sets the main window size - * @param size the main window size - */ - public void setMainWindowSize(Point size); - - /** - * Gets whether to skip the finish screen - * @return whether to skip the finish screen - */ - public boolean getSkipFinish(); - - /** - * Sets whether to skip the finish screen - * @param skipFinish whether to skip the finish screen - */ - public void setSkipFinish(boolean skipFinish); - - - /** - * Gets theCertificate-Download URL - * @return the Certificate-Download URL - */ - public String getDownloadURL(); - - - - /** - * Gets whether to use an existing signature marker. - * - * @return whether to use an existing signature marker - */ - public boolean getUseMarker(); - - /** - * Sets whether to use an existing signature marker. - * - * @param useMarker - * whether to use an existing signature marker - */ - public void setUseMarker(boolean useMarker); - - - /*** - * Extension to the standard use marker implementation - * @param useFields - */ - public void setUseSignatureFields(boolean useFields); - - - /** - * @return if the usage of signatureFields is enabled - */ - public boolean getUseSignatureFields(); - - /** - * @param bool - */ - public void setEnablePlaceholderUsage(boolean bool); - - /** - * @return boolean - */ - public boolean getEnablePlaceholderUsage(); - - - /** - * @param profile set the selected profile - */ - public void setSignatureProfile(Profile profile); - - - /** - * @return selected signature profile as string - */ - public Profile getSignatureProfile(); - - - public void setSaveFilePostFix(String postFix); +public class ConfigurationContainer { + /** + * SLF4J Logger instance + **/ + @SuppressWarnings("unused") + private static final Logger log = LoggerFactory.getLogger(ConfigurationContainer.class); + + /** the emblem File */ + protected String emblemFile = null; + public String getEmblem() { return this.emblemFile; } + public void setEmblem(String emblemFile) throws InvalidEmblemFile { + if (emblemFile == null || emblemFile.trim().isEmpty()) { + // Ok to set no file ... + } else { + File imageFile = new File(emblemFile); + if (!imageFile.exists()) { + throw new InvalidEmblemFile(imageFile, + new FileNotFoundException(emblemFile)); + } + + try { + Image img = new Image(Display.getDefault(), new ImageData( + emblemFile)); + + img.dispose(); + } catch (Exception ex) { + throw new InvalidEmblemFile(imageFile, ex); + } + } + + this.emblemFile = emblemFile; + } + + /** The mobile phone number */ + protected String mobileNumber = null; + public String getMobileNumber() { return this.mobileNumber; } + public void setMobileNumber(String number) { + if(number == null || number.trim().isEmpty()) { + this.mobileNumber = null; + return; + } + this.mobileNumber = MobileBKUHelper.normalizeMobileNumber(number); + } + + /** The mobile phone password */ + public String mobilePassword = null; + + /** Holds the proxy host */ + public String proxyHost = null; + + /** Holds the proxy port number */ + protected int proxyPort = -1; + public int getProxyPort() { return this.proxyPort; } + public void setProxyPort(int port) throws InvalidPortException { + if(port > 0 && port <= 0xFFFF) { + this.proxyPort = port; + return; + } + if(port == -1) { + this.proxyPort = -1; + return; + } + throw new InvalidPortException(port); + } + + /** Holds the proxy username */ + public String proxyUser = null; + + /** Holds the proxy password */ + public String proxyPass = null; + + /** Holds the transparency of the signature placeholder */ + public int placeholderTransparency = Constants.DEFAULT_SIGNATURE_PLACEHOLDER_TRANSPARENCY; + + /** Holds the default BKU to use */ + public BKUs defaultBKU = BKUs.NONE; + + /** Holds the output folder */ + public String outputFolder = null; + + /** Holds the signatureNote */ + public String signatureNote = null; + + /** Holds the locale */ + public Locale locale = null; + + /** Holds the signature locale */ + public Locale signatureLocale = null; + + /** Holds the PDF/A compatibility setting */ + public boolean signaturePDFACompat = false; + + /** Holds the mobile BKU URL */ + public String mobileBKUURL = Constants.DEFAULT_MOBILE_BKU_URL; + + /** Holds the mobile BKU type */ + public MobileBKUs mobileBKUType = ConfigProviderImpl.DEFAULT_MOBILE_BKU_TYPE; + + /** Holds the mobile BKU BASE64 setting */ + protected boolean mobileBKUBase64 = false; + + /** Holds the default signature position */ + public SignaturePosition defaultSignaturePosition = null; + + /** Keystore signing options */ + public Boolean keystoreEnabled = null; + public String keystoreFile = null; + public String keystoreType = null; + public String keystoreAlias = null; + public String keystoreStorePass = null; + public String keystoreKeyPass = null; + + /** Whether to automatically check for updates */ + public boolean updateCheck = true; + + /** Holds the main window size */ + public Point mainWindowSize = null; + + /** Whether to skip the output state */ + public boolean skipFinish = false; + + /** Whether to use an existing signature marker. */ + protected boolean useMarker = false; + public boolean getUseMarker() { return this.useMarker; } + public void setUseMarker(boolean useMarker) { + this.useMarker = useMarker; + if (useMarker) setUseSignatureFields(false); + } + + /** Either QR-Code or signature fields as marker */ + protected boolean useSignatureFields = false; + public boolean getUseSignatureFields() { return this.useSignatureFields; } + public void setUseSignatureFields(boolean useFields) { + this.useSignatureFields = useFields; + if (useFields) setUseMarker(false); + } + + /** describes if the placeholder search is enabled */ + public boolean enabledPlaceholderUsage = false; + + /** The Signature Profile */ + protected Profile signatureProfile = null; + public Profile getSignatureProfile() { + if (this.signatureProfile == null) { + this.signatureProfile = Profile.SIGNATURBLOCK_SMALL; + } + return this.signatureProfile; + } + public void setSignatureProfile(Profile profile) { this.signatureProfile = profile; } + + public String saveFilePostFix = "_signed"; - public String getSaveFilePostFix(); } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainerImpl.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainerImpl.java deleted file mode 100644 index c0c84054..00000000 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainerImpl.java +++ /dev/null @@ -1,751 +0,0 @@ -/* - * Copyright 2012 by A-SIT, Secure Information Technology Center Austria - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://joinup.ec.europa.eu/software/page/eupl - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - */ -package at.asit.pdfover.gui.workflow.config; - -// Imports -import java.io.File; -import java.io.FileNotFoundException; -import java.util.Locale; - -import at.asit.pdfover.commons.Profile; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.ImageData; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.widgets.Display; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import at.asit.pdfover.commons.Constants; -import at.asit.pdfover.gui.bku.mobile.MobileBKUHelper; -import at.asit.pdfover.gui.bku.mobile.MobileBKUs; -import at.asit.pdfover.gui.exceptions.InvalidEmblemFile; -import at.asit.pdfover.gui.exceptions.InvalidPortException; -import at.asit.pdfover.signator.BKUs; -import at.asit.pdfover.signator.SignaturePosition; - -/** - * Implementation of the configuration container - */ -public class ConfigurationContainerImpl implements ConfigurationContainer { - /** - * SLF4J Logger instance - **/ - @SuppressWarnings("unused") - private static final Logger log = LoggerFactory - .getLogger(ConfigurationContainerImpl.class); - - - /** the emblem File */ - protected String emblemFile = null; - - /** The mobile phone number */ - protected String mobileNumber = null; - - /** The mobile phone password */ - protected String mobilePassword = null; - - /** Holds the proxy host */ - protected String proxyHost = null; - - /** Holds the proxy port number */ - protected int proxyPort = -1; - - /** Holds the proxy username */ - protected String proxyUser = null; - - /** Holds the proxy password */ - protected String proxyPass = null; - - /** Holds the signatureNote */ - protected String signatureNote = null; - - /** Holds the locale */ - protected Locale locale = null; - - /** Holds the signature locale */ - protected Locale signatureLocale = null; - - /** Holds the PDF/A compatibility setting */ - protected boolean pdfACompat = false; - - /** Holds the output folder */ - protected String folder = null; - - /** Holds the default BKU to use */ - protected BKUs defaultBKU = BKUs.NONE; - - /** Holds the automatic positioning value */ - protected boolean automaticPositioning = false; - - /** Holds the transparency of the signature placeholder */ - protected int placeholderTransparency = Constants.DEFAULT_SIGNATURE_PLACEHOLDER_TRANSPARENCY; - - /** Holds the mobile BKU URL */ - protected String mobileBKUURL = Constants.DEFAULT_MOBILE_BKU_URL; - - /** Holds the mobile BKU type */ - protected MobileBKUs mobileBKUType = ConfigProviderImpl.DEFAULT_MOBILE_BKU_TYPE; - - /** Holds the mobile BKU BASE64 setting */ - protected boolean mobileBKUBase64 = false; - - /** Holds the main window size */ - protected Point mainWindowSize = null; - - /** Holds the default signature position */ - protected SignaturePosition defaultSignaturePosition = null; - - /** Whether keystore signing is enabled */ - protected Boolean keystoreEnabled = null; - - /** Keystore file */ - protected String keystoreFile = null; - - /** Keystore type */ - protected String keystoreType = null; - - /** Keystore alias */ - protected String keystoreAlias = null; - - /** Keystore store password */ - protected String keystoreStorePass = null; - - /** Keystore key password */ - protected String keystoreKeyPass = null; - - /** Whether to automatically check for updates */ - protected boolean updateCheck = true; - - /** Whether to skip the output state */ - protected boolean skipFinish = false; - - /** Default Download URL for certificates*/ - protected String downloadURL = null; - - /** describes if the placeholder search is enabled */ - protected boolean enabledPlaceholderUsage = false; - - /** Whether to use an existing signature marker. */ - protected boolean useMarker = false; - - /** Either QR-Code or signature fields as marker */ - protected boolean useSignatureFields = false; - - /** The Signature Profile */ - protected Profile signatureProfile = null; - - protected String saveFilePostFix = "_signed"; - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.composites.ConfigurationContainer#getEmblem() - */ - @Override - public String getEmblem() { - return this.emblemFile; - } - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.composites.ConfigurationContainer#setEmblem(java.lang.String) - */ - @Override - public void setEmblem(String emblemFile) throws InvalidEmblemFile { - if (emblemFile == null || emblemFile.trim().isEmpty()) { - // Ok to set no file ... - } else { - File imageFile = new File(emblemFile); - if (!imageFile.exists()) { - throw new InvalidEmblemFile(imageFile, - new FileNotFoundException(emblemFile)); - } - - try { - Image img = new Image(Display.getDefault(), new ImageData( - emblemFile)); - - img.dispose(); - } catch (Exception ex) { - throw new InvalidEmblemFile(imageFile, ex); - } - } - - this.emblemFile = emblemFile; - } - - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.composites.ConfigurationContainer#getNumber() - */ - @Override - public String getMobileNumber() { - return this.mobileNumber; - } - - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.composites.ConfigurationContainer#setNumber(java.lang.String) - */ - @Override - public void setMobileNumber(String number) { - if(number == null || number.trim().isEmpty()) { - this.mobileNumber = null; - return; - } - this.mobileNumber = MobileBKUHelper.normalizeMobileNumber(number); - } - - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.ConfigurationContainer#getDefaultMobilePassword() - */ - @Override - public String getMobilePassword() { - return this.mobilePassword; - } - - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.ConfigurationContainer#setDefaultMobilePassword(java.lang.String) - */ - @Override - public void setMobilePassword(String password) { - this.mobilePassword = password; - } - - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.composites.ConfigurationContainer#getProxyHost() - */ - @Override - public String getProxyHost() { - return this.proxyHost; - } - - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.composites.ConfigurationContainer#setProxyHost(java.lang.String) - */ - @Override - public void setProxyHost(String host) { - this.proxyHost = host; - } - - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.composites.ConfigurationContainer#getProxyPort() - */ - @Override - public int getProxyPort() { - return this.proxyPort; - } - - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.composites.ConfigurationContainer#setProxyPort(int) - */ - @Override - public void setProxyPort(int port) throws InvalidPortException { - if(port > 0 && port <= 0xFFFF) { - this.proxyPort = port; - return; - } - if(port == -1) { - this.proxyPort = -1; - return; - } - throw new InvalidPortException(port); - } - - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#getProxyUser() - */ - @Override - public String getProxyUser() { - return this.proxyUser; - } - - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#setProxyUser(java.lang.String) - */ - @Override - public void setProxyUser(String user) { - this.proxyUser = user; - } - - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#getProxyPass() - */ - @Override - public String getProxyPass() { - return this.proxyPass; - } - - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#setProxyPass(java.lang.String) - */ - @Override - public void setProxyPass(String pass) { - this.proxyPass = pass; - } - - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.ConfigurationContainer#getPlaceholderTransparency() - */ - @Override - public int getPlaceholderTransparency() { - return this.placeholderTransparency; - } - - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.ConfigurationContainer#setPlaceholderTransparency(int) - */ - @Override - public void setPlaceholderTransparency(int transparency) { - this.placeholderTransparency = transparency; - } - - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.composites.ConfigurationContainer#getBKUSelection() - */ - @Override - public BKUs getDefaultBKU() { - return this.defaultBKU; - } - - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.composites.ConfigurationContainer#setBKUSelection(at.asit.pdfover.signator.BKUs) - */ - @Override - public void setDefaultBKU(BKUs bkuSelection) { - this.defaultBKU = bkuSelection; - } - - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.composites.ConfigurationContainer#getOutputFolder() - */ - @Override - public String getOutputFolder() { - return this.folder; - } - - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.composites.ConfigurationContainer#setOutputFolder(java.lang.String) - */ - @Override - public void setOutputFolder(String folder) { - this.folder = folder; - } - - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.ConfigurationContainer#getSignatureNote() - */ - @Override - public String getSignatureNote() { - return this.signatureNote; - } - - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.ConfigurationContainer#setSignatureNote(java.lang.String) - */ - @Override - public void setSignatureNote(String note) { - this.signatureNote = note; - } - - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.ConfigurationContainer#getLocale() - */ - @Override - public Locale getLocale() { - return this.locale; - } - - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.ConfigurationContainer#setLocale(java.util.Locale) - */ - @Override - public void setLocale(Locale locale) { - this.locale = locale; - } - - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.ConfigurationContainer#getSignatureLocale() - */ - @Override - public Locale getSignatureLocale() { - return this.signatureLocale; - } - - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.ConfigurationContainer#setSignatureLocale(java.util.Locale) - */ - @Override - public void setSignatureLocale(Locale locale) { - this.signatureLocale = locale; - } - - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#getSignaturePdfACompat() - */ - @Override - public boolean getSignaturePdfACompat() { - return this.pdfACompat; - } - - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#setSignaturePdfACompat(boolean) - */ - @Override - public void setSignaturePdfACompat(boolean compat) { - this.pdfACompat = compat; - } - - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.ConfigurationContainer#getMobileBkURL() - */ - @Override - public String getMobileBKUURL() { - return this.mobileBKUURL; - } - - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.ConfigurationContainer#setMobileBkURL(java.lang.String) - */ - @Override - public void setMobileBKUURL(String bkuUrl) { - this.mobileBKUURL = bkuUrl; - } - - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.ConfigurationContainer#getMobileBKUType() - */ - @Override - public MobileBKUs getMobileBKUType() { - return this.mobileBKUType; - } - - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.ConfigurationContainer#setMobileBKUType(at.asit.pdfover.gui.workflow.states.mobilebku.MobileBKUs) - */ - @Override - public void setMobileBKUType(MobileBKUs bkuType) { - this.mobileBKUType = bkuType; - } - - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#getMobileBKUBase64() - */ - @Override - public boolean getMobileBKUBase64() { - return this.mobileBKUBase64; - } - - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#getMobileBKUBase64(boolean) - */ - @Override - public void setMobileBKUBase64(boolean useBase64) { - this.mobileBKUBase64 = useBase64; - } - - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.ConfigurationContainer#getSignaturePosition() - */ - @Override - public SignaturePosition getDefaultSignaturePosition() { - return this.defaultSignaturePosition; - } - - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.ConfigurationContainer#setSignaturePosition(at.asit.pdfover.signator.SignaturePosition) - */ - @Override - public void setDefaultSignaturePosition(SignaturePosition signaturePosition) { - this.defaultSignaturePosition = signaturePosition; - } - - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#getKeyStoreEnabled() - */ - @Override - public Boolean getKeyStoreEnabled() { - return this.keystoreEnabled; - } - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#setKeyStoreEnabled(boolean) - */ - @Override - public void setKeyStoreEnabled(Boolean enabled) { - this.keystoreEnabled = enabled; - } - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#getKeyStoreFile() - */ - @Override - public String getKeyStoreFile() { - return this.keystoreFile; - } - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#setKeyStoreFile(java.lang.String) - */ - @Override - public void setKeyStoreFile(String file) { - this.keystoreFile = file; - } - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#getKeyStoreType() - */ - @Override - public String getKeyStoreType() { - return this.keystoreType; - } - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#setKeyStoreType(java.lang.String) - */ - @Override - public void setKeyStoreType(String type) { - this.keystoreType = type; - } - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#getKeyStoreAlias() - */ - @Override - public String getKeyStoreAlias() { - return this.keystoreAlias; - } - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#setKeyStoreAlias(java.lang.String) - */ - @Override - public void setKeyStoreAlias(String alias) { - this.keystoreAlias = alias; - } - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#getKeyStoreStorePass() - */ - @Override - public String getKeyStoreStorePass() { - return this.keystoreStorePass; - } - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#setKeyStoreStorePass(java.lang.String) - */ - @Override - public void setKeyStoreStorePass(String storePass) { - this.keystoreStorePass = storePass; - } - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#getKeyStoreKeyPass() - */ - @Override - public String getKeyStoreKeyPass() { - return this.keystoreKeyPass; - } - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#setKeyStoreKeyPass(java.lang.String) - */ - @Override - public void setKeyStoreKeyPass(String keyPass) { - this.keystoreKeyPass = keyPass; - } - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#getUpdateCheck() - */ - @Override - public boolean getUpdateCheck() { - return this.updateCheck; - } - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#setUpdateCheck(boolean) - */ - @Override - public void setUpdateCheck(boolean checkUpdate) { - this.updateCheck = checkUpdate; - } - - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.ConfigurationContainer#getMainWindowSize() - */ - @Override - public Point getMainWindowSize() { - return this.mainWindowSize; - } - - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.ConfigurationContainer#setMainWindowSize(org.eclipse.swt.graphics.Point) - */ - @Override - public void setMainWindowSize(Point size) { - this.mainWindowSize = size; - } - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#getSkipFinish() - */ - @Override - public boolean getSkipFinish() { - return this.skipFinish; - } - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#setSkipFinish(boolean) - */ - @Override - public void setSkipFinish(boolean skipFinish) { - this.skipFinish = skipFinish; - } - - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#setDownloadURL(java.lang.String) - - @Override - public void setDownloadURL(String downloadURL) { - this.downloadURL = downloadURL; - - - }*/ - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#getDownloadURL() - */ - @Override - public String getDownloadURL() { - return this.downloadURL; - } - - /* - * (non-Javadoc) - * - * @see - * at.asit.pdfover.gui.workflow.config.ConfigurationContainer#getUseMarker() - */ - @Override - public boolean getUseMarker() { - return this.useMarker; - } - - /* - * (non-Javadoc) - * - * @see - * at.asit.pdfover.gui.workflow.config.ConfigurationContainer#setUseMarker( - * boolean) - */ - @Override - public void setUseMarker(boolean useMarker) { - this.useMarker = useMarker; - if (useMarker) setUseSignatureFields(false); - } - - - @Override - public void setUseSignatureFields(boolean useFields) { - this.useSignatureFields = useFields; - if (useFields) setUseMarker(false); - } - - - - @Override - public boolean getUseSignatureFields() { - return this.useSignatureFields; - } - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#setEnablePlaceholderUsage(boolean) - */ - @Override - public void setEnablePlaceholderUsage(boolean bool) { - this.enabledPlaceholderUsage = bool; - - } - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#getEnablePlaceholderUsage() - */ - @Override - public boolean getEnablePlaceholderUsage() { - return this.enabledPlaceholderUsage; - } - - - @Override - public Profile getSignatureProfile() { - if (this.signatureProfile == null) { - this.signatureProfile = Profile.SIGNATURBLOCK_SMALL; - } - return this.signatureProfile; - } - - @Override - public String getSaveFilePostFix() { - return this.saveFilePostFix; - } - - @Override - public void setSaveFilePostFix(String postfix){ - this.saveFilePostFix = postfix; - } - - - @Override - public void setSignatureProfile(Profile profile) { - this.signatureProfile = profile; - } - -} |