aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/knowcenter/wag/egov/egiz/pdf/EGIZDate.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/pdf/EGIZDate.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/pdf/EGIZDate.java')
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/pdf/EGIZDate.java284
1 files changed, 0 insertions, 284 deletions
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/EGIZDate.java b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/EGIZDate.java
deleted file mode 100644
index d2b29b6..0000000
--- a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/EGIZDate.java
+++ /dev/null
@@ -1,284 +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: EGIZDate.java,v 1.1 2006/10/31 08:08:33 wprinz Exp $
- */
-package at.knowcenter.wag.egov.egiz.pdf;
-
-import java.text.ParseException;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.GregorianCalendar;
-
-import org.apache.commons.lang.time.DateUtils;
-import org.apache.log4j.Logger;
-
-/**
- * Represents a signature date and the signing time as can be found in the
- * SIG_DATE field.
- *
- * <p>
- * This is used to compare date values of signatures.
- * </p>
- *
- * @author wprinz
- */
-public class EGIZDate {
-
- private static final Logger LOG = Logger.getLogger(EGIZDate.class);
-
- protected Date date = null;
-
- // TODO remove deprecated old code
-// /**
-// * The year.
-// */
-// protected int year;
-//
-// /**
-// * The month.
-// */
-// protected int month;
-//
-// /**
-// * The day.
-// */
-// protected int day;
-//
-// /**
-// * The hour.
-// */
-// protected int hour;
-//
-// /**
-// * The minute.
-// */
-// protected int minute;
-//
-// /**
-// * The second.
-// */
-// protected int second;
-//
-// /**
-// * Constructor that fills the date with values.
-// *
-// * @param year
-// * The year.
-// * @param month
-// * The month.
-// * @param day
-// * The day.
-// * @param hour
-// * The hour.
-// * @param minute
-// * The minute.
-// * @param second
-// * The second.
-// */
-// public EGIZDate(int year, int month, int day, int hour, int minute,
-// int second) {
-// this.year = year;
-// this.month = month;
-// this.day = day;
-// this.hour = hour;
-// this.minute = minute;
-// this.second = second;
-// }
-
-
- /**
- * @param date
- */
- protected EGIZDate(Date date)
- {
- this.date = date;
- }
-
- /**
- * Parses the date information from a given date value.
- *
- * <p>
- * Usually the date value is one extracted from the value of the SIG_DATE
- * field.
- * </p>
- *
- * @param date_value
- * The date value String.
- * @return Returns the parsed EGIZDate. An IllegalArgumentException is
- * thrown if the date String has an illegal format.
- */
- public static EGIZDate parseFromString(String date_value) {
- Date date = parseDateFromString(date_value);
-// Calendar calendar = new GregorianCalendar();
-// calendar.setTime(date);
-
- LOG.debug("Parsing date string \"" + date_value + "\" returns: " + date);
-
-// return new EGIZDate(calendar.get(Calendar.YEAR), calendar
-// .get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH),
-// calendar.get(Calendar.HOUR), calendar.get(Calendar.MINUTE),
-// calendar.get(Calendar.SECOND));
- return new EGIZDate(date);
-
- }
-
- public static Date parseDateFromString (String date_value)
- {
- // find the according RFC standard and cite it
-
- /*
- * Pattern date_pattern =
- * Pattern.compile("^\\d\\d\\d\\d-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\d(Z|((\\+|\\-)\\d\\d:\\d\\d))?$");
- * Matcher date_matcher = date_pattern.matcher(date_value); if
- * (!date_matcher.matches()) { throw new IllegalArgumentException("The
- * date_value (" + date_value + ") has an illegal format."); } // for
- * some strange reasons capture groups don't work
- *
- * int year = Integer.parseInt(date_value.substring(0, 4)); int month =
- * Integer.parseInt(date_value.substring(5, 7)); int day =
- * Integer.parseInt(date_value.substring(8, 10)); int hour =
- * Integer.parseInt(date_value.substring(11, 13)); int minute =
- * Integer.parseInt(date_value.substring(14, 16)); int second =
- * Integer.parseInt(date_value.substring(17, 19)); return new
- * EGIZDate(year, month, day, hour, minute, second);
- */
-
- String[] parsePatterns = { "yyyy-MM-dd'T'HH:mm:ss",
- "yyyy-MM-dd'T'HH:mm:ssZ", "yyyy-MM-dd'T'HH:mm:ssZZ" };
- if (date_value.length() > 19) {
- int li = date_value.lastIndexOf(":");
- if (li >= 19) {
- date_value = new StringBuffer(date_value).deleteCharAt(li).toString();
- }
- // FIXME: @iaik: wenn man bei UTC+"Z" die letzten -2 Zeichen durch "UTC" ersetzt verliert die Zeit ihre Sekunden-Einerstelle!!!!!!!
- // alter code:
-// if (date_value.endsWith("Z")) {
-// date_value = date_value.substring(0, date_value.length()-2) + "UTC";
-// }
- // neuer code:
- if (date_value.endsWith("ZZ")) {
- date_value = date_value.substring(0, date_value.length()-2) + "UTC";
- }
- if (date_value.endsWith("Z")) {
- date_value = date_value.substring(0, date_value.length()-1) + "UTC";
- }
-
- } else {
- date_value += "UTC";
- }
-
- Date date;
- try {
- date = DateUtils.parseDate(date_value, parsePatterns);
- } catch (ParseException e) {
- throw new IllegalArgumentException("The date_value (" + date_value
- + ") has an illegal format.");
- }
-
-
-// return new EGIZDate(calendar.get(Calendar.YEAR), calendar
-// .get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH),
-// calendar.get(Calendar.HOUR), calendar.get(Calendar.MINUTE),
-// calendar.get(Calendar.SECOND));
-
- // fixed by tknall: really bad bug: Calendar.HOUR means hour in 12-hour-mode instead f 24-hour. !!!!
- // this leads to false comparison of two dates where one date is prior noon and one after noon.
-// return new EGIZDate(calendar.get(Calendar.YEAR), calendar
-// .get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH),
-// calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE),
-// calendar.get(Calendar.SECOND));
- return date;
-
- }
-
- /**
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object obj) {
- if (!(obj instanceof EGIZDate)) {
- return false;
- }
-
- EGIZDate other = (EGIZDate)obj;
- return this.date.equals(other.date);
- }
-
- /**
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- return this.date.hashCode();
- }
-
- /**
- * @see java.lang.Object#toString()
- */
- public String toString()
- {
- return this.date.toString();
- }
-
-
-// /**
-// * Converts the date to a long integer.
-// *
-// * <p>
-// * An earlier date is lower than a later date.
-// * </p>
-// * <p>
-// * E.g. a date in 1999 will get a smaller number than a date in 2006.
-// * </p>
-// *
-// * @return Returns the compareable long.
-// */
-// protected long toCompareableLong() {
-// return +this.year * 12 * 31 * 24 * 60 * 60 + this.month * 31 * 24 * 60
-// * 60 + this.day * 24 * 60 * 60 + this.hour * 60 * 60
-// + this.minute * 60 + this.second;
-// }
-
- /**
- * Compares this EGIZDate to another EXIZDate.
- *
- * @param other
- * The other EGIZDate.
- * @return Returns negative if this date is earlier (lower) than the other
- * date. Returns 0 if both dates are equal. Returns positive if this
- * date is later (higher) than the other date.
- */
- public int compareTo(EGIZDate other) {
- return this.date.compareTo(other.date);
-// long diff = toCompareableLong() - other.toCompareableLong();
-// return (int) diff;
- }
-
- /**
- * @return the date
- */
- public Date getDate()
- {
- return this.date;
- }
-
-}