Tim-connector: Data object models for request and response

This commit is contained in:
Miciele Ghiorghis 2013-01-17 10:03:38 +01:00 committed by Manuel Rego Casasnovas
parent 85a03ac50d
commit 1a6392fdb9
21 changed files with 1279 additions and 0 deletions

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
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<T> {
@XmlAnyElement
private T data;
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
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;
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
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;
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
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<Period> 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<Period> getPeriods() {
return periods;
}
public void setPeriods(List<Period> 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;
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
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;
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
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;
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
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;
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
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;
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
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<Person> persons;
@XmlElement(name = "Roostercategorie")
private List<RosterCategory> 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<Period> 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<Person> getPersons() {
return persons;
}
public void setPersons(List<Person> persons) {
this.persons = persons;
}
public List<RosterCategory> getRosterCategories() {
return rosterCategories;
}
public void setRosterCategories(List<RosterCategory> 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<Period> getPeriods() {
return periods;
}
public void setPeriods(List<Period> periods) {
this.periods = periods;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
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;
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
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<Roster> data;
public Data<Roster> getData() {
return data;
}
public void setData(Data<Roster> data) {
this.data = data;
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
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<Roster> rosters;
public List<Roster> getRosters() {
return rosters;
}
public void setRosters(List<Roster> rosters) {
this.rosters = rosters;
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
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<String, DateTime> {
@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);
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
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<String, Double> {
@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);
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
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<String, LocalDate> {
@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();
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
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 = "~";
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
package org.libreplan.importers.tim;
import javax.xml.bind.annotation.adapters.XmlAdapter;
import org.joda.time.LocalTime;
public class TimTimeAdapter extends XmlAdapter<String, LocalTime> {
@Override
public String marshal(LocalTime localTime) throws Exception {
return localTime.toString();
}
@Override
public LocalTime unmarshal(String localTimeStr) throws Exception {
return new LocalTime(localTimeStr);
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
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;
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
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<TimeRegistration> timeRegistrations;
public List<TimeRegistration> getTimeRegistrations() {
return timeRegistrations;
}
public void setTimeRegistrations(List<TimeRegistration> timeRegistrations) {
this.timeRegistrations = timeRegistrations;
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
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<Integer> ref;
public List<Integer> getRefs() {
return ref;
}
public void setRefs(List<Integer> ref) {
this.ref = ref;
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
@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;