From 1a6392fdb9f6edb1b915a05234daa033a4285d77 Mon Sep 17 00:00:00 2001 From: Miciele Ghiorghis Date: Thu, 17 Jan 2013 10:03:38 +0100 Subject: [PATCH] Tim-connector: Data object models for request and response --- .../org/libreplan/importers/tim/Data.java | 44 ++++ .../libreplan/importers/tim/Department.java | 45 ++++ .../org/libreplan/importers/tim/Duration.java | 57 +++++ .../org/libreplan/importers/tim/Filter.java | 77 ++++++ .../org/libreplan/importers/tim/Period.java | 54 ++++ .../org/libreplan/importers/tim/Person.java | 83 ++++++ .../org/libreplan/importers/tim/Product.java | 69 +++++ .../importers/tim/RegistrationDate.java | 56 ++++ .../org/libreplan/importers/tim/Roster.java | 240 ++++++++++++++++++ .../importers/tim/RosterCategory.java | 71 ++++++ .../importers/tim/RosterRequest.java | 42 +++ .../importers/tim/RosterResponse.java | 46 ++++ .../importers/tim/TimDateTimeAdapter.java | 42 +++ .../importers/tim/TimDoubleAdapter.java | 42 +++ .../importers/tim/TimLocalDateAdapter.java | 41 +++ .../libreplan/importers/tim/TimOptions.java | 38 +++ .../importers/tim/TimTimeAdapter.java | 38 +++ .../importers/tim/TimeRegistration.java | 74 ++++++ .../tim/TimeRegistrationRequest.java | 45 ++++ .../tim/TimeRegistrationResponse.java | 46 ++++ .../libreplan/importers/tim/package-info.java | 29 +++ 21 files changed, 1279 insertions(+) create mode 100644 libreplan-webapp/src/main/java/org/libreplan/importers/tim/Data.java create mode 100644 libreplan-webapp/src/main/java/org/libreplan/importers/tim/Department.java create mode 100644 libreplan-webapp/src/main/java/org/libreplan/importers/tim/Duration.java create mode 100644 libreplan-webapp/src/main/java/org/libreplan/importers/tim/Filter.java create mode 100644 libreplan-webapp/src/main/java/org/libreplan/importers/tim/Period.java create mode 100644 libreplan-webapp/src/main/java/org/libreplan/importers/tim/Person.java create mode 100644 libreplan-webapp/src/main/java/org/libreplan/importers/tim/Product.java create mode 100644 libreplan-webapp/src/main/java/org/libreplan/importers/tim/RegistrationDate.java create mode 100644 libreplan-webapp/src/main/java/org/libreplan/importers/tim/Roster.java create mode 100644 libreplan-webapp/src/main/java/org/libreplan/importers/tim/RosterCategory.java create mode 100644 libreplan-webapp/src/main/java/org/libreplan/importers/tim/RosterRequest.java create mode 100644 libreplan-webapp/src/main/java/org/libreplan/importers/tim/RosterResponse.java create mode 100644 libreplan-webapp/src/main/java/org/libreplan/importers/tim/TimDateTimeAdapter.java create mode 100644 libreplan-webapp/src/main/java/org/libreplan/importers/tim/TimDoubleAdapter.java create mode 100644 libreplan-webapp/src/main/java/org/libreplan/importers/tim/TimLocalDateAdapter.java create mode 100644 libreplan-webapp/src/main/java/org/libreplan/importers/tim/TimOptions.java create mode 100644 libreplan-webapp/src/main/java/org/libreplan/importers/tim/TimTimeAdapter.java create mode 100644 libreplan-webapp/src/main/java/org/libreplan/importers/tim/TimeRegistration.java create mode 100644 libreplan-webapp/src/main/java/org/libreplan/importers/tim/TimeRegistrationRequest.java create mode 100644 libreplan-webapp/src/main/java/org/libreplan/importers/tim/TimeRegistrationResponse.java create mode 100644 libreplan-webapp/src/main/java/org/libreplan/importers/tim/package-info.java diff --git a/libreplan-webapp/src/main/java/org/libreplan/importers/tim/Data.java b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/Data.java new file mode 100644 index 000000000..b94b4c728 --- /dev/null +++ b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/Data.java @@ -0,0 +1,44 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2013 St. Antoniusziekenhuis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package org.libreplan.importers.tim; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlSeeAlso; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement +@XmlSeeAlso({ Roster.class }) +public class Data { + + @XmlAnyElement + private T data; + + public T getData() { + return data; + } + + public void setData(T data) { + this.data = data; + } + +} diff --git a/libreplan-webapp/src/main/java/org/libreplan/importers/tim/Department.java b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/Department.java new file mode 100644 index 000000000..88ca422e9 --- /dev/null +++ b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/Department.java @@ -0,0 +1,45 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2013 St. Antoniusziekenhuis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package org.libreplan.importers.tim; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement(name = "Afdeling") +public class Department { + + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlElement + private String ref; + + public String getRef() { + return ref; + } + + public void setRef(String ref) { + this.ref = ref; + } + +} diff --git a/libreplan-webapp/src/main/java/org/libreplan/importers/tim/Duration.java b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/Duration.java new file mode 100644 index 000000000..6ebd5125b --- /dev/null +++ b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/Duration.java @@ -0,0 +1,57 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2013 St. Antoniusziekenhuis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package org.libreplan.importers.tim; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlValue; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement +public class Duration { + + @XmlAttribute(name = "options", required = true) + private String options; + + + @XmlValue + @XmlJavaTypeAdapter(TimDoubleAdapter.class) + private Double duration; + + public String getOptions() { + return options; + } + + public void setOptions(String options) { + this.options = options; + } + + public Double getDuration() { + return duration; + } + + public void setDuration(Double duration) { + this.duration = duration; + } + +} diff --git a/libreplan-webapp/src/main/java/org/libreplan/importers/tim/Filter.java b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/Filter.java new file mode 100644 index 000000000..fc83d82fa --- /dev/null +++ b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/Filter.java @@ -0,0 +1,77 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2013 St. Antoniusziekenhuis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package org.libreplan.importers.tim; + +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement +public class Filter { + + @XmlElement(name = "persoon") + private Person person; + + @XmlElement(name = "periode") + private List periods; + + @XmlElement(name = "Afdeling") + private Department department; + + @XmlElement(name = "roostercategorie") + private RosterCategory rosterCategory; + + public Person getPerson() { + return person; + } + + public void setPerson(Person person) { + this.person = person; + } + + public List getPeriods() { + return periods; + } + + public void setPeriods(List periods) { + this.periods = periods; + } + + public Department getDepartment() { + return department; + } + + public void setDepartment(Department department) { + this.department = department; + } + + public RosterCategory getRosterCategory() { + return rosterCategory; + } + + public void setRosterCategory(RosterCategory rosterCategory) { + this.rosterCategory = rosterCategory; + } + +} diff --git a/libreplan-webapp/src/main/java/org/libreplan/importers/tim/Period.java b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/Period.java new file mode 100644 index 000000000..1819a6bd5 --- /dev/null +++ b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/Period.java @@ -0,0 +1,54 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2013 St. Antoniusziekenhuis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package org.libreplan.importers.tim; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +import org.joda.time.DateTime; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement +public class Period { + + @XmlElement(name = "startdate", required = true, nillable = true) + private DateTime start; + + @XmlElement(name = "enddate", required = true, nillable = true) + private DateTime end; + + public DateTime getStart() { + return start; + } + + public void setStart(DateTime start) { + this.start = start; + } + + public DateTime getEnd() { + return end; + } + + public void setEnd(DateTime end) { + this.end = end; + } +} diff --git a/libreplan-webapp/src/main/java/org/libreplan/importers/tim/Person.java b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/Person.java new file mode 100644 index 000000000..3339764fd --- /dev/null +++ b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/Person.java @@ -0,0 +1,83 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2013 St. Antoniusziekenhuis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package org.libreplan.importers.tim; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement(name = "Persoon") +@XmlType(propOrder = { "networkName", "name", "emailAddress" }) +public class Person { + + @XmlAttribute(name = "options") + private String options; + + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlElement(name = "naam", nillable = true) + private String name; + + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlElement(name = "emaladres", nillable = true) + private String emailAddress; + + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlElement(name = "netwerknaam", nillable = true) + private String networkName; + + public String getOptions() { + return options; + } + + public void setOptions(String options) { + this.options = options; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getEmailAddress() { + return emailAddress; + } + + public void setEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + } + + public String getNetworkName() { + return networkName; + } + + public void setNetworkName(String networkName) { + this.networkName = networkName; + } + +} diff --git a/libreplan-webapp/src/main/java/org/libreplan/importers/tim/Product.java b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/Product.java new file mode 100644 index 000000000..677be7552 --- /dev/null +++ b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/Product.java @@ -0,0 +1,69 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2013 St. Antoniusziekenhuis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package org.libreplan.importers.tim; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement +public class Product { + + @XmlAttribute(required = true) + private String options; + + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlElement + private String code; + + // @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + // @XmlElement(name = "naam", nillable = true) + private String name; + + public String getOptions() { + return options; + } + + public void setOptions(String options) { + this.options = options; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + +} diff --git a/libreplan-webapp/src/main/java/org/libreplan/importers/tim/RegistrationDate.java b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/RegistrationDate.java new file mode 100644 index 000000000..c216878db --- /dev/null +++ b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/RegistrationDate.java @@ -0,0 +1,56 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2013 St. Antoniusziekenhuis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package org.libreplan.importers.tim; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlValue; + +import org.joda.time.LocalDate; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement(name = "datum") +public class RegistrationDate { + + @XmlAttribute(name = "options", required = true) + private String options; + + @XmlValue + private LocalDate date; + + public String getOptions() { + return options; + } + + public void setOptions(String options) { + this.options = options; + } + + public LocalDate getDate() { + return date; + } + + public void setDate(LocalDate date) { + this.date = date; + } + +} diff --git a/libreplan-webapp/src/main/java/org/libreplan/importers/tim/Roster.java b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/Roster.java new file mode 100644 index 000000000..5f452e3da --- /dev/null +++ b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/Roster.java @@ -0,0 +1,240 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2013 St. Antoniusziekenhuis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package org.libreplan.importers.tim; + +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + +import org.joda.time.LocalDate; +import org.joda.time.LocalTime; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement(name = "bezettingblok") +public class Roster { + + @XmlAttribute(name = "startdate", required = true) + private LocalDate startDate; + + @XmlAttribute(name = "enddate", required = true) + private LocalDate endDate; + + @XmlAttribute(name = "resource_planning") + private Boolean resourcePlanning; + + @XmlAttribute(name = "day_planning") + private Boolean dayPlanning; + + @XmlAttribute + private Boolean calendar; + + @XmlAttribute(name = "non_planned") + private Boolean nonPlaned; + + @XmlAttribute(name = "full_day") + private Boolean fullDay; + + @XmlAttribute + private Boolean concept; + + @XmlElement + private Filter filter; + + @XmlElement(name = "Persoon") + private List persons; + + @XmlElement(name = "Roostercategorie") + private List rosterCategories; + + @XmlElement(name = "Afdeling") + private Department department; + + @XmlElement(name = "Datum", required = true, nillable = true) + private LocalDate date; + + @XmlElement(name = "Tijd", required = true, nillable = true) + private LocalTime time; + + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlElement(name = "duur", required = true, nillable = true) + private String duration; + + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlElement(name = "aanwezigheid") + private String precence; + + @XmlElement(name = "periode") + private List periods; + + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlElement(name = "status") + private String status; + + public LocalDate getStartDate() { + return startDate; + } + + public void setStartDate(LocalDate startDate) { + this.startDate = startDate; + } + + public LocalDate getEndDate() { + return endDate; + } + + public void setEndDate(LocalDate endDate) { + this.endDate = endDate; + } + + public Boolean getResourcePlanning() { + return resourcePlanning; + } + + public void setResourcePlanning(Boolean resourcePlanning) { + this.resourcePlanning = resourcePlanning; + } + + public Boolean getDayPlanning() { + return dayPlanning; + } + + public void setDayPlanning(Boolean dayPlanning) { + this.dayPlanning = dayPlanning; + } + + public Boolean getCalendar() { + return calendar; + } + + public void setCalendar(Boolean calendar) { + this.calendar = calendar; + } + + public Boolean getNonPlaned() { + return nonPlaned; + } + + public void setNonPlaned(Boolean nonPlaned) { + this.nonPlaned = nonPlaned; + } + + public Boolean getFullDay() { + return fullDay; + } + + public void setFullDay(Boolean fullDay) { + this.fullDay = fullDay; + } + + public Boolean getConcept() { + return concept; + } + + public void setConcept(Boolean concept) { + this.concept = concept; + } + + public Filter getFilter() { + return filter; + } + + public void setFilter(Filter filter) { + this.filter = filter; + } + + public List getPersons() { + return persons; + } + + public void setPersons(List persons) { + this.persons = persons; + } + + public List getRosterCategories() { + return rosterCategories; + } + + public void setRosterCategories(List rosterCategories) { + this.rosterCategories = rosterCategories; + } + + public Department getDepartment() { + return department; + } + + public void setDepartment(Department department) { + this.department = department; + } + + public LocalDate getDate() { + return date; + } + + public void setDate(LocalDate date) { + this.date = date; + } + + public LocalTime getTime() { + return time; + } + + public void setTime(LocalTime time) { + this.time = time; + } + + public String getDuration() { + return duration; + } + + public void setDuration(String duration) { + this.duration = duration; + } + + public String getPrecence() { + return precence; + } + + public void setPrecence(String precence) { + this.precence = precence; + } + + public List getPeriods() { + return periods; + } + + public void setPeriods(List periods) { + this.periods = periods; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + +} diff --git a/libreplan-webapp/src/main/java/org/libreplan/importers/tim/RosterCategory.java b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/RosterCategory.java new file mode 100644 index 000000000..1038c5ed9 --- /dev/null +++ b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/RosterCategory.java @@ -0,0 +1,71 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2013 St. Antoniusziekenhuis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package org.libreplan.importers.tim; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement(name = "roostercategorie") +@XmlType(propOrder = { "name", "presence", "status" }) +public class RosterCategory { + + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlElement(name = "naam", required = true, nillable = true) + private String name; + + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlElement(name = "aanwezigheid", required = true, nillable = true) + private String presence; + + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlElement(required = true, nillable = true) + private String status; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPresence() { + return presence; + } + + public void setPresence(String presence) { + this.presence = presence; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + +} diff --git a/libreplan-webapp/src/main/java/org/libreplan/importers/tim/RosterRequest.java b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/RosterRequest.java new file mode 100644 index 000000000..5aacb8cf2 --- /dev/null +++ b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/RosterRequest.java @@ -0,0 +1,42 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2013 St. Antoniusziekenhuis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package org.libreplan.importers.tim; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement(name = "export", namespace = "impexp.timn.aenova.nl") +public class RosterRequest { + + @XmlElement + private Data data; + + public Data getData() { + return data; + } + + public void setData(Data data) { + this.data = data; + } + +} diff --git a/libreplan-webapp/src/main/java/org/libreplan/importers/tim/RosterResponse.java b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/RosterResponse.java new file mode 100644 index 000000000..8dabe6db9 --- /dev/null +++ b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/RosterResponse.java @@ -0,0 +1,46 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2013 St. Antoniusziekenhuis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package org.libreplan.importers.tim; + +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement(name = "exportResponse", namespace = "impexp.timn.aenova.nl") +public class RosterResponse { + + @XmlElementWrapper(name = "return") + @XmlElement(name = "bezettingblok") + private List rosters; + + public List getRosters() { + return rosters; + } + + public void setRosters(List rosters) { + this.rosters = rosters; + } + +} diff --git a/libreplan-webapp/src/main/java/org/libreplan/importers/tim/TimDateTimeAdapter.java b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/TimDateTimeAdapter.java new file mode 100644 index 000000000..d36afd714 --- /dev/null +++ b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/TimDateTimeAdapter.java @@ -0,0 +1,42 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2013 St. Antoniusziekenhuis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package org.libreplan.importers.tim; + +import javax.xml.bind.annotation.adapters.XmlAdapter; + +import org.joda.time.DateTime; +import org.joda.time.format.DateTimeFormat; +import org.joda.time.format.DateTimeFormatter; + +public class TimDateTimeAdapter extends XmlAdapter { + + @Override + public String marshal(DateTime dateTime) throws Exception { + return dateTime.toString("dd-MM-yyyy"); + } + + @Override + public DateTime unmarshal(String dateTimeStr) throws Exception { + DateTimeFormatter fmt = DateTimeFormat + .forPattern("dd-MM-yyyy HH:mm:ss.SSS"); + return fmt.parseDateTime(dateTimeStr); + } + +} diff --git a/libreplan-webapp/src/main/java/org/libreplan/importers/tim/TimDoubleAdapter.java b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/TimDoubleAdapter.java new file mode 100644 index 000000000..f9c3f8f50 --- /dev/null +++ b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/TimDoubleAdapter.java @@ -0,0 +1,42 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2013 St. Antoniusziekenhuis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package org.libreplan.importers.tim; + +import java.util.Locale; + +import javax.xml.bind.DatatypeConverter; +import javax.xml.bind.annotation.adapters.XmlAdapter; + +public class TimDoubleAdapter extends XmlAdapter { + + @Override + public String marshal(Double value) throws Exception { + if(value == null) { + return null; + } + return String.format(Locale.GERMAN, "%1$,.2f", value); + } + + @Override + public Double unmarshal(String value) throws Exception { + return DatatypeConverter.parseDouble(value); + } + +} diff --git a/libreplan-webapp/src/main/java/org/libreplan/importers/tim/TimLocalDateAdapter.java b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/TimLocalDateAdapter.java new file mode 100644 index 000000000..5fe698f88 --- /dev/null +++ b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/TimLocalDateAdapter.java @@ -0,0 +1,41 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2013 St. Antoniusziekenhuis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package org.libreplan.importers.tim; + +import javax.xml.bind.annotation.adapters.XmlAdapter; + +import org.joda.time.LocalDate; +import org.joda.time.format.DateTimeFormat; +import org.joda.time.format.DateTimeFormatter; + +public class TimLocalDateAdapter extends XmlAdapter { + + @Override + public String marshal(LocalDate localDate) throws Exception { + return localDate.toString("dd-MM-yyyy"); + } + + @Override + public LocalDate unmarshal(String dateStr) throws Exception { + final DateTimeFormatter fmt = DateTimeFormat.forPattern("dd-MM-yyyy"); + return fmt.parseDateTime(dateStr).toLocalDate(); + } + +} diff --git a/libreplan-webapp/src/main/java/org/libreplan/importers/tim/TimOptions.java b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/TimOptions.java new file mode 100644 index 000000000..0e038bb8e --- /dev/null +++ b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/TimOptions.java @@ -0,0 +1,38 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2013 St. Antoniusziekenhuis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package org.libreplan.importers.tim; + +public class TimOptions { + + private TimOptions() { + + } + + public static final String UPDATE_OR_INSERT = "@"; + public static final String UPDATE = "%"; + public static final String AUTO_INSERT = "!"; + public static final String QUOTED = "''"; + public static final String DECIMAL = "#"; + public static final String SUM_DOUBLE = "+"; + public static final String SUM_LONG = "&"; + public static final String PARENT = "^"; + public static final String ANY_PARENT = "~"; + +} diff --git a/libreplan-webapp/src/main/java/org/libreplan/importers/tim/TimTimeAdapter.java b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/TimTimeAdapter.java new file mode 100644 index 000000000..417513315 --- /dev/null +++ b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/TimTimeAdapter.java @@ -0,0 +1,38 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2013 St. Antoniusziekenhuis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package org.libreplan.importers.tim; + +import javax.xml.bind.annotation.adapters.XmlAdapter; + +import org.joda.time.LocalTime; + +public class TimTimeAdapter extends XmlAdapter { + + @Override + public String marshal(LocalTime localTime) throws Exception { + return localTime.toString(); + } + + @Override + public LocalTime unmarshal(String localTimeStr) throws Exception { + return new LocalTime(localTimeStr); + } + +} diff --git a/libreplan-webapp/src/main/java/org/libreplan/importers/tim/TimeRegistration.java b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/TimeRegistration.java new file mode 100644 index 000000000..0f0374864 --- /dev/null +++ b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/TimeRegistration.java @@ -0,0 +1,74 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2013 St. Antoniusziekenhuis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package org.libreplan.importers.tim; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement(name = "tijdregistratie") +public class TimeRegistration { + + @XmlElement(name = "persoon") + private Person person; + + private Product product; + + @XmlElement(name = "datum") + private RegistrationDate registrationDate; + + @XmlElement(name = "duur") + private Duration duration; + + public Person getPerson() { + return person; + } + + public void setPerson(Person person) { + this.person = person; + } + + public Product getProduct() { + return product; + } + + public void setProduct(Product product) { + this.product = product; + } + + public RegistrationDate getRegistrationDate() { + return registrationDate; + } + + public void setRegistrationDate(RegistrationDate registrationDate) { + this.registrationDate = registrationDate; + } + + public Duration getDuration() { + return duration; + } + + public void setDuration(Duration duration) { + this.duration = duration; + } + +} diff --git a/libreplan-webapp/src/main/java/org/libreplan/importers/tim/TimeRegistrationRequest.java b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/TimeRegistrationRequest.java new file mode 100644 index 000000000..6f9afebfb --- /dev/null +++ b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/TimeRegistrationRequest.java @@ -0,0 +1,45 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2013 St. Antoniusziekenhuis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package org.libreplan.importers.tim; + +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement(name = "import", namespace = "impexp.timn.aenova.nl") +public class TimeRegistrationRequest { + + @XmlElementWrapper(name = "data") + @XmlElement(name = "tijdregistratie") + private List timeRegistrations; + + public List getTimeRegistrations() { + return timeRegistrations; + } + + public void setTimeRegistrations(List timeRegistrations) { + this.timeRegistrations = timeRegistrations; + } +} diff --git a/libreplan-webapp/src/main/java/org/libreplan/importers/tim/TimeRegistrationResponse.java b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/TimeRegistrationResponse.java new file mode 100644 index 000000000..214cae8e0 --- /dev/null +++ b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/TimeRegistrationResponse.java @@ -0,0 +1,46 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2013 St. Antoniusziekenhuis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package org.libreplan.importers.tim; + +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement(name = "importResponse", namespace = "impexp.timn.aenova.nl") +public class TimeRegistrationResponse { + + @XmlElementWrapper(name = "return") + @XmlElement(name = "ref") + private List ref; + + public List getRefs() { + return ref; + } + + public void setRefs(List ref) { + this.ref = ref; + } + +} diff --git a/libreplan-webapp/src/main/java/org/libreplan/importers/tim/package-info.java b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/package-info.java new file mode 100644 index 000000000..677a210e5 --- /dev/null +++ b/libreplan-webapp/src/main/java/org/libreplan/importers/tim/package-info.java @@ -0,0 +1,29 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2013 St. Antoniusziekenhuis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +@javax.xml.bind.annotation.adapters.XmlJavaTypeAdapters({ + @javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter(type = DateTime.class, value = org.libreplan.importers.tim.TimDateTimeAdapter.class), + @javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter(type = LocalDate.class, value = org.libreplan.importers.tim.TimLocalDateAdapter.class), + @javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter(type = Date.class, value = org.libreplan.importers.tim.TimTimeAdapter.class) }) +package org.libreplan.importers.tim; + +import java.util.Date; + +import org.joda.time.DateTime; +import org.joda.time.LocalDate;