diff options
11 files changed, 94 insertions, 80 deletions
diff --git a/pdf-over-commons/pdf-over-commons.iml b/pdf-over-commons/pdf-over-commons.iml index c035f0b0..597cd8e6 100644 --- a/pdf-over-commons/pdf-over-commons.iml +++ b/pdf-over-commons/pdf-over-commons.iml @@ -6,7 +6,6 @@ <content url="file://$MODULE_DIR$"> <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> - <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" /> <excludeFolder url="file://$MODULE_DIR$/target" /> </content> <orderEntry type="inheritedJdk" /> diff --git a/pdf-over-commons/src/main/java/at/asit/pdfover/commons/Profile.java b/pdf-over-commons/src/main/java/at/asit/pdfover/commons/Profile.java new file mode 100644 index 00000000..84de1aaa --- /dev/null +++ b/pdf-over-commons/src/main/java/at/asit/pdfover/commons/Profile.java @@ -0,0 +1,58 @@ +package at.asit.pdfover.commons; + +public enum Profile { + + SIGNATURBLOCK("Signaturblock Normal") , //$NON-NLS-1$ + SIGNATURBLOCK_SMALL("Signaturblock Klein"), //$NON-NLS-1$ + AMTSSIGNATURBLOCK("Amtssignatur"), //$NON-NLS-1$ + LOGO_ONLY("Nur Bildmarke"), //$NON-NLS-1$ + INVISIBLE("Unsichtbar"); + + public static int length = 5; + private String name; + + Profile(String profile){ + this.name = profile; + } + + public static String[] getProfileStrings() { + String[] profiles = new String[Profile.length]; + int i = 0; + for (Profile profile : Profile.values()) { + profiles[i] = profile.getName(); + i++; + } + return profiles; + } + + public static Profile getProfileByIndex(int index) { + String[] profiles = getProfileStrings(); + if (profiles.length < index) { + return null; + } + return getProfile(profiles[index]); + } + + public String getName() { + return this.name; + } + + public static Profile getProfile(String profile) { + if (SIGNATURBLOCK.getName().equals(profile)) { + return SIGNATURBLOCK; + } else if (SIGNATURBLOCK_SMALL.getName().equals(profile)) { + return SIGNATURBLOCK_SMALL; + } else if (AMTSSIGNATURBLOCK.getName().equals(profile)) { + return AMTSSIGNATURBLOCK; + } else if (LOGO_ONLY.getName().equals(profile)) { + return LOGO_ONLY; + } else if (INVISIBLE.getName().equals(profile)){ + return INVISIBLE; + } + return null; + } + + + + +} diff --git a/pdf-over-gui/pom.xml b/pdf-over-gui/pom.xml index 3c108817..37d35469 100644 --- a/pdf-over-gui/pom.xml +++ b/pdf-over-gui/pom.xml @@ -66,6 +66,12 @@ <artifactId>commons-configuration</artifactId>
<version>1.10</version>
</dependency>
+ <dependency>
+ <groupId>at.a-sit</groupId>
+ <artifactId>pdf-over-commons</artifactId>
+ <version>4.2.4-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
</dependencies>
<dependencyManagement>
<dependencies>
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java index d6f83973..ed007cb8 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java @@ -23,8 +23,7 @@ import java.util.Properties; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.widgets.Display; -import at.asit.pdfover.gui.Constants.PROFILE; -import at.asit.pdfover.gui.bku.mobile.MobileBKUHelper; + import at.asit.pdfover.gui.bku.mobile.MobileBKUs; /** @@ -59,58 +58,6 @@ public class Constants { /** Supported locales */ public static final Locale[] SUPPORTED_LOCALES = { Locale.GERMAN, Locale.ENGLISH }; - public static enum PROFILE { - SIGNATURBLOCK("Signaturblock Normal") , //$NON-NLS-1$ - SIGNATURBLOCK_SMALL("Signaturblock Klein"), //$NON-NLS-1$ - AMTSSIGNATURBLOCK("Amtssignatur"), //$NON-NLS-1$ - LOGO_ONLY("Nur Bildmarke"), //$NON-NLS-1$ - INVISIBLE("Unsichtbar"); - - public static int length = 5; - private String name; - - PROFILE(String profile){ - this.name = profile; - } - - public static String[] getProfileStrings() { - String[] profiles = new String[PROFILE.length]; - int i = 0; - for (PROFILE profile : PROFILE.values()) { - profiles[i] = profile.getName(); - i++; - } - return profiles; - } - - public static PROFILE getProfileByIndex(int index) { - String[] profiles = getProfileStrings(); - if (profiles.length < index) { - return null; - } - return getProfile(profiles[index]); - } - - public String getName() { - return this.name; - } - - public static PROFILE getProfile(String profile) { - if (SIGNATURBLOCK.getName().equals(profile)) { - return SIGNATURBLOCK; - } else if (SIGNATURBLOCK_SMALL.getName().equals(profile)) { - return SIGNATURBLOCK_SMALL; - } else if (AMTSSIGNATURBLOCK.getName().equals(profile)) { - return AMTSSIGNATURBLOCK; - } else if (LOGO_ONLY.getName().equals(profile)) { - return LOGO_ONLY; - } else if (INVISIBLE.getName().equals(profile)){ - return INVISIBLE; - } - return null; - } - } - /** Configuration directory */ public static final String CONFIG_DIRECTORY = System.getProperty("user.home") + File.separator + ".pdf-over"; //$NON-NLS-1$ //$NON-NLS-2$ diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java index e9ed5316..f4b3ae0b 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java @@ -48,7 +48,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import at.asit.pdfover.gui.Constants; -import at.asit.pdfover.gui.Constants.PROFILE; +import at.asit.pdfover.commons.Profile; import at.asit.pdfover.gui.controls.ErrorDialog; import at.asit.pdfover.gui.controls.ErrorMarker; import at.asit.pdfover.gui.controls.Dialog.BUTTONS; @@ -953,7 +953,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { provider.getProxyUserPersistent()); this.configurationContainer.setProxyPass( provider.getProxyPassPersistent()); - this.configurationContainer.setSignatureProfile(PROFILE.getProfile(provider.getSignatureProfile())); + this.configurationContainer.setSignatureProfile(Profile.getProfile(provider.getSignatureProfile())); } /* @@ -1001,7 +1001,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { * @param profile * */ - public void performSetSignatureProfile(PROFILE profile) { + public void performSetSignatureProfile(Profile profile) { this.configurationContainer.setSignatureProfile(profile); } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java index d65c45a5..7941bc9a 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java @@ -62,7 +62,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import at.asit.pdfover.gui.Constants; -import at.asit.pdfover.gui.Constants.PROFILE; +import at.asit.pdfover.commons.Profile; import at.asit.pdfover.gui.controls.Dialog.BUTTONS; import at.asit.pdfover.gui.controls.ErrorDialog; import at.asit.pdfover.gui.controls.ErrorMarker; @@ -236,13 +236,13 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { fD_cmbSignatureProfile[0].setHeight(Constants.TEXT_SIZE_NORMAL); this.cmbSingatureProfiles.setFont(new Font(Display.getCurrent(), fD_cmbSignatureProfile[0])); - this.cmbSingatureProfiles.setItems(PROFILE.getProfileStrings()); + this.cmbSingatureProfiles.setItems(Profile.getProfileStrings()); //this.cmbSingatureProfiles.select(this.configurationContainer.getSignatureProfile().ordinal()); this.cmbSingatureProfiles.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - PROFILE current = SimpleConfigurationComposite.this.configurationContainer.getSignatureProfile(); - PROFILE selected = PROFILE.getProfileByIndex(SimpleConfigurationComposite.this.cmbSingatureProfiles + Profile current = SimpleConfigurationComposite.this.configurationContainer.getSignatureProfile(); + Profile selected = Profile.getProfileByIndex(SimpleConfigurationComposite.this.cmbSingatureProfiles .getSelectionIndex()); if (!current.equals(selected)) { preformProfileSelectionChanged(selected); @@ -755,7 +755,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { } } - void preformProfileSelectionChanged(PROFILE selected) { + void preformProfileSelectionChanged(Profile selected) { log.debug("Signature Profile {} was selected", selected.getName()); //$NON-NLS-1$ this.configurationContainer.setSignatureProfile(selected); this.cmbSingatureProfiles.select(selected.ordinal()); 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 f1461809..92a64103 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 @@ -25,12 +25,12 @@ import java.util.Properties; import java.util.regex.Matcher; import java.util.regex.Pattern; +import at.asit.pdfover.commons.Profile; import org.eclipse.swt.graphics.Point; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import at.asit.pdfover.gui.Constants; -import at.asit.pdfover.gui.Constants.PROFILE; import at.asit.pdfover.gui.bku.mobile.MobileBKUs; import at.asit.pdfover.gui.exceptions.InvalidEmblemFile; import at.asit.pdfover.gui.exceptions.InvalidNumberException; @@ -144,8 +144,8 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, String signatureProfile = config.getProperty(Constants.SIGNATURE_PROFILE); if (signatureProfile != null) { - this.configuration.setSignatureProfile(PROFILE.getProfile(signatureProfile)); - this.configurationOverlay.setSignatureProfile(PROFILE.getProfile(signatureProfile)); + this.configuration.setSignatureProfile(Profile.getProfile(signatureProfile)); + this.configurationOverlay.setSignatureProfile(Profile.getProfile(signatureProfile)); } String compat = config.getProperty(Constants.CFG_SIGNATURE_PDFA_COMPAT); @@ -1508,7 +1508,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, @Override public void setSignatureProfile(String profile) { - this.configurationOverlay.setSignatureProfile(PROFILE.getProfile(profile)); + this.configurationOverlay.setSignatureProfile(Profile.getProfile(profile)); } @Override 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 8b08ba9f..bed44da1 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 @@ -17,9 +17,9 @@ package at.asit.pdfover.gui.workflow.config; import java.util.Locale; +import at.asit.pdfover.commons.Profile; import org.eclipse.swt.graphics.Point; -import at.asit.pdfover.gui.Constants.PROFILE; import at.asit.pdfover.gui.bku.mobile.MobileBKUs; import at.asit.pdfover.gui.exceptions.InvalidEmblemFile; import at.asit.pdfover.gui.exceptions.InvalidNumberException; @@ -414,11 +414,11 @@ public interface ConfigurationContainer { /** * @param profile set the selected profile */ - public void setSignatureProfile(PROFILE profile); + public void setSignatureProfile(Profile profile); /** * @return selected signature profile as string */ - public PROFILE getSignatureProfile(); + public Profile getSignatureProfile(); } 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 index 300e2df1..7d2c77c4 100644 --- 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 @@ -20,6 +20,7 @@ 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; @@ -28,7 +29,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import at.asit.pdfover.gui.Constants; -import at.asit.pdfover.gui.Constants.PROFILE; import at.asit.pdfover.gui.bku.mobile.MobileBKUHelper; import at.asit.pdfover.gui.bku.mobile.MobileBKUs; import at.asit.pdfover.gui.exceptions.InvalidEmblemFile; @@ -147,7 +147,7 @@ public class ConfigurationContainerImpl implements ConfigurationContainer { protected boolean useSignatureFields = false; /** The Signature Profile */ - protected PROFILE signatureProfile = null; + protected Profile signatureProfile = null; /* (non-Javadoc) * @see at.asit.pdfover.gui.composites.ConfigurationContainer#getEmblem() @@ -729,15 +729,15 @@ public class ConfigurationContainerImpl implements ConfigurationContainer { @Override - public PROFILE getSignatureProfile() { + public Profile getSignatureProfile() { if (this.signatureProfile == null) { - this.signatureProfile = PROFILE.SIGNATURBLOCK; + this.signatureProfile = Profile.SIGNATURBLOCK; } return this.signatureProfile; } @Override - public void setSignatureProfile(PROFILE profile) { + public void setSignatureProfile(Profile profile) { this.signatureProfile = profile; } diff --git a/pdf-over-signer/pdf-over-sigpdfas4/pom.xml b/pdf-over-signer/pdf-over-sigpdfas4/pom.xml index 41054f48..dbcb4f9f 100644 --- a/pdf-over-signer/pdf-over-sigpdfas4/pom.xml +++ b/pdf-over-signer/pdf-over-sigpdfas4/pom.xml @@ -53,6 +53,12 @@ <artifactId>iaik_eccelerate_cms</artifactId>
<version>3.01</version>
</dependency>
+ <dependency>
+ <groupId>at.a-sit</groupId>
+ <artifactId>pdf-over-commons</artifactId>
+ <version>4.2.4-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
</dependencies>
<repositories>
<repository>
diff --git a/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java b/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java index 5d286d44..62533868 100644 --- a/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java +++ b/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java @@ -34,7 +34,7 @@ import at.gv.egiz.pdfas.lib.api.Configuration; import at.gv.egiz.pdfas.lib.api.PdfAs; import at.gv.egiz.pdfas.lib.api.PdfAsFactory; import at.gv.egiz.pdfas.lib.api.sign.SignParameter; -import at.asit.pdfover.gui.Constants; +import at.asit.pdfover.commons.Profile; /** * Implementation of SignatureParameter for PDF-AS 4 Library @@ -172,13 +172,11 @@ public class PdfAs4SignatureParameter extends SignatureParameter { - if (!PROFILE_VISIBILITY || this.profile.equals("Unsichtbar")) + if (!PROFILE_VISIBILITY || this.profile.equals("Unsichtbar") || Profile.getProfile(this.profile).equals(Profile.INVISIBLE)) { - //TODO set base profile id using the this.profile - //TODO verifiy profileId = "INVISIBLE"; } else { - profileId = Constants.PROFILE.getProfile(this.profile).name();//PROFILE_ID_BASE; + profileId = Profile.getProfile(this.profile).name(); profileId += (lang != null && lang.equals("en")) ? PROFILE_ID_LANG_EN : PROFILE_ID_LANG_DE; } |