summaryrefslogtreecommitdiff
path: root/src/main/java/at/gv/util
diff options
context:
space:
mode:
authorThomas Lenz <thomas.lenz@egiz.gv.at>2018-03-05 11:08:39 +0100
committerThomas Lenz <thomas.lenz@egiz.gv.at>2018-03-05 11:08:39 +0100
commit9c93f4b9958045be167bb367013a9eff9253fdb3 (patch)
tree6777157cae18e2a5884cc17b532334b2ed7782cc /src/main/java/at/gv/util
parentae94463cce9b26ca26d7075d386b0724a2cb34a8 (diff)
downloadegovutils-9c93f4b9958045be167bb367013a9eff9253fdb3.tar.gz
egovutils-9c93f4b9958045be167bb367013a9eff9253fdb3.tar.bz2
egovutils-9c93f4b9958045be167bb367013a9eff9253fdb3.zip
some more small changes for OVS
switch to 2.0.4
Diffstat (limited to 'src/main/java/at/gv/util')
-rw-r--r--src/main/java/at/gv/util/MiscUtil.java16
-rw-r--r--src/main/java/at/gv/util/data/ElectronicIdentity.java5
2 files changed, 19 insertions, 2 deletions
diff --git a/src/main/java/at/gv/util/MiscUtil.java b/src/main/java/at/gv/util/MiscUtil.java
index 7ad055e..c0095f8 100644
--- a/src/main/java/at/gv/util/MiscUtil.java
+++ b/src/main/java/at/gv/util/MiscUtil.java
@@ -276,11 +276,27 @@ public class MiscUtil {
}
}
+ /**
+ * Parse XML date in date object in UTC timezone
+ *
+ * @param xmlDate String based date with pattern "yyyy-MM-dd"
+ * @return
+ * @throws EgovUtilException
+ */
public static Date parseXMLDate(String xmlDate) throws EgovUtilException {
+ return parseXMLDate(xmlDate, TimeZone.getTimeZone("UTC"));
+
+ }
+
+ public static Date parseXMLDate(String xmlDate, TimeZone zone) throws EgovUtilException {
if (xmlDate == null) {
return null;
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+
+ if (zone != null)
+ sdf.setTimeZone(zone);
+
try {
return sdf.parse(xmlDate);
} catch (ParseException e) {
diff --git a/src/main/java/at/gv/util/data/ElectronicIdentity.java b/src/main/java/at/gv/util/data/ElectronicIdentity.java
index 4483e86..ea5bd25 100644
--- a/src/main/java/at/gv/util/data/ElectronicIdentity.java
+++ b/src/main/java/at/gv/util/data/ElectronicIdentity.java
@@ -30,6 +30,7 @@ import java.util.List;
import java.util.Properties;
import java.util.Set;
import java.util.StringTokenizer;
+import java.util.TimeZone;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
@@ -378,7 +379,7 @@ public final class ElectronicIdentity implements Serializable, Empty, RoleContai
this.baseId = ppt.getIdentification().get(0).getValue().getValue();
this.firstName = ppt.getName().getGivenName().get(0);
this.lastName = ppt.getName().getFamilyName().get(0).getValue();
- this.dateOfBirth = MiscUtil.parseXMLDate(ppt.getDateOfBirth());
+ this.dateOfBirth = MiscUtil.parseXMLDate(ppt.getDateOfBirth(), TimeZone.getTimeZone("UTC"));
}
}
}
@@ -451,7 +452,7 @@ public final class ElectronicIdentity implements Serializable, Empty, RoleContai
this.setBaseId(baseId);
this.setZbpk(BpkUtil.calcZBPK(baseId));
this.setVzbpk(BpkUtil.calcVZBPK(baseId));
- this.setDateOfBirth(MiscUtil.parseXMLDate(ppt.getDateOfBirth()));
+ this.setDateOfBirth(MiscUtil.parseXMLDate(ppt.getDateOfBirth(), TimeZone.getTimeZone("UTC")));
this.setFirstName(ppt.getName().getGivenName().get(0));
this.setLastName(ppt.getName().getFamilyName().get(0).getValue());
} else if ("bkuURL".equals(attr.getAttributeName())) {