aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureSeparator.java
diff options
context:
space:
mode:
authortknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2013-01-09 15:41:29 +0000
committertknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2013-01-09 15:41:29 +0000
commit535a04fa05f739ec16dd81666e3b0f82dfbd442d (patch)
tree0804f301c1a9ceb303a8441b7b29244fc8eb7ff0 /src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureSeparator.java
parent1efaf6fd5619dfa95c9d7e8c71eda4c2ffba4998 (diff)
downloadpdf-as-3-535a04fa05f739ec16dd81666e3b0f82dfbd442d.tar.gz
pdf-as-3-535a04fa05f739ec16dd81666e3b0f82dfbd442d.tar.bz2
pdf-as-3-535a04fa05f739ec16dd81666e3b0f82dfbd442d.zip
pdf-as-lib maven project files moved to pdf-as-lib
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/pdf-as/trunk@926 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureSeparator.java')
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureSeparator.java146
1 files changed, 0 insertions, 146 deletions
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureSeparator.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureSeparator.java
deleted file mode 100644
index 5b80490..0000000
--- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureSeparator.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/**
- * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright>
- * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a
- * joint initiative of the Federal Chancellery Austria and Graz University of
- * Technology.
- *
- * 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://www.osor.eu/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.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- *
- * $Id: SignatureSeparator.java,v 1.4 2006/10/31 08:18:56 wprinz Exp $
- */
-package at.knowcenter.wag.egov.egiz.sig;
-
-import java.util.List;
-import java.util.Stack;
-
-import at.knowcenter.wag.egov.egiz.exceptions.SignatureException;
-import at.knowcenter.wag.egov.egiz.exceptions.SignatureTypesException;
-
-/**
- * This class separates all signature blocks in a raw text.
- * @deprecated This process of separating signature blocks is obsolete - use AbsoluteTextSignature etc. instead.
- */
-public class SignatureSeparator {
- /**
- * The signature block stack. On top of the stack is the first signature block that can be
- * extracted. First means nearest to the document text.
- */
- private Stack signatureBlocks_ = null;
- /**
- * A list of signature type definitions.
- */
- private List signatureTypes_ = null;
- /**
- * Indicator that shows that a raw text is signated
- */
- private boolean hasSignatureBlock_ = false;
-
- /**
- * The empty constructor. It loads all signature type infos to extract the signature block from
- * the raw text.
- *
- * @throws SignatureTypesException
- */
- public SignatureSeparator() throws SignatureTypesException {
- SignatureTypes sig_types = SignatureTypes.getInstance();
- signatureTypes_ = sig_types.getSignatureTypeDefinitions();
- }
-
- /**
- * This method takes a raw text as input and trys to separate all signature blocks. It returns
- * true if a signature block is found.
- *
- * @param rawText
- * @return true if a signature block is found false otherwise
- */
- public boolean separateBlock(String rawText) {
- signatureBlocks_ = new Stack();
- hasSignatureBlock_ = separateBlock(rawText, rawText.length());
- return hasSignatureBlock_;
- }
-
- /**
- * This method calls itself rekursively while signature blocks can be extracted. If a signature
- * block is found (search from the bottom of the raw text) the raw text would be reduced by the
- * length of the found signature block text.
- *
- * @param rawText the text to be separated
- * @param endIndex the index to cut the tail from the raw text
- * @return true if a signature block is found false otherwise
- */
- private boolean separateBlock(String rawText, int endIndex) {
- boolean found = false;
- boolean can_separate = true;
- while (can_separate) {
- SignatureBlock sig_block = new SignatureBlock(signatureTypes_);
- String raw_text = rawText.substring(0, endIndex);
- can_separate = sig_block.separateBlockFromRawText(raw_text, true);
- if (can_separate) {
- signatureBlocks_.push(sig_block);
- endIndex = sig_block.getStartIndex();
- found = true;
- }
- }
- return found;
- }
-
- /**
- * This method returns the start index of the first signature block. It is used to separate the
- * real document text from the signature block texts.
- *
- * @return the start index of the first signature block
- */
- public int getStartIndex() {
- int start_index = -1;
- if (signatureBlocks_ != null && signatureBlocks_.size() > 0) {
- SignatureBlock sig_block = (SignatureBlock) signatureBlocks_.peek();
- return sig_block.getStartIndex();
- }
- return start_index;
- }
-
- /**
- * @return the first found signature object in the given raw text or null if the raw text does not
- * contain any signature objects
- */
- public SignatureObject getFirstSignatureObject() {
- if (signatureBlocks_ != null && signatureBlocks_.size() > 0) {
- SignatureBlock sig_block = (SignatureBlock) signatureBlocks_.peek();
- try {
- return sig_block.getSignatureObject();
- } catch (SignatureException e) {
- return null;
- }
- }
- return null;
- }
-
- /**
- * @return all separated signature blocks as stack, first is on top
- */
- public Stack getSignatureBlocks() {
- return signatureBlocks_;
- }
-
- /**
- * @return true if a signature block is found false otherwise
- */
- public boolean hasSignatureBlock() {
- return hasSignatureBlock_;
- }
-} \ No newline at end of file