Zitat von udo1toni
Beitrag anzeigen
<?xml version="1.0" encoding="UTF-8"?>
<tns:Configuration hierarchy="de" description="Germany" xmlns:tns="http://www.example.org/Holiday"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.example.org/Holiday /Holiday.xsd">
<tns:Holidays>
<tns:RelativeToFixed descriptionPropertiesKey="FOURTH_ADVENT">
<tns:Weekday>SUNDAY</tns:Weekday>
<tns:When>BEFORE</tns:When>
<tns:date month="DECEMBER" day="25"/>
</tns:RelativeToFixed>
</tns:Holidays>
</tns:Configuration>
<tns:Configuration hierarchy="de" description="Germany" xmlns:tns="http://www.example.org/Holiday"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.example.org/Holiday /Holiday.xsd">
<tns:Holidays>
<tns:RelativeToFixed descriptionPropertiesKey="FOURTH_ADVENT">
<tns:Weekday>SUNDAY</tns:Weekday>
<tns:When>BEFORE</tns:When>
<tns:date month="DECEMBER" day="25"/>
</tns:RelativeToFixed>
</tns:Holidays>
</tns:Configuration>
<?xml version="1.0" encoding="UTF-8"?>
<tns:Configuration hierarchy="de" description="Germany" xmlns:tns="http://www.example.org/Holiday"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.example.org/Holiday /Holiday.xsd">
<tns:Holidays>
<tns:RelativeToFixed descriptionPropertiesKey="FIRST_ADVENT">
<tns:Which>FOURTH</tns:Which>
<tns:Weekday>SUNDAY</tns:Weekday>
<tns:When>BEFORE</tns:When>
<tns:date month="DECEMBER" day="25"/>
</tns:RelativeToFixed>
<tns:RelativeToFixed descriptionPropertiesKey="SECOND_ADVENT">
<tns:Which>THIRD</tns:Which>
<tns:Weekday>SUNDAY</tns:Weekday>
<tns:When>BEFORE</tns:When>
<tns:date month="DECEMBER" day="25"/>
</tns:RelativeToFixed>
<tns:RelativeToFixed descriptionPropertiesKey="THIRD_ADVENT">
<tns:Which>SECOND</tns:Which>
<tns:Weekday>SUNDAY</tns:Weekday>
<tns:When>BEFORE</tns:When>
<tns:date month="DECEMBER" day="25"/>
</tns:RelativeToFixed>
<tns:RelativeToFixed descriptionPropertiesKey="FOURTH_ADVENT">
<tns:Which>FIRST</tns:Which>
<tns:Weekday>SUNDAY</tns:Weekday>
<tns:When>BEFORE</tns:When>
<tns:date month="DECEMBER" day="25"/>
</tns:RelativeToFixed>
</tns:Holidays>
</tns:Configuration>
<tns:Configuration hierarchy="de" description="Germany" xmlns:tns="http://www.example.org/Holiday"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.example.org/Holiday /Holiday.xsd">
<tns:Holidays>
<tns:RelativeToFixed descriptionPropertiesKey="FIRST_ADVENT">
<tns:Which>FOURTH</tns:Which>
<tns:Weekday>SUNDAY</tns:Weekday>
<tns:When>BEFORE</tns:When>
<tns:date month="DECEMBER" day="25"/>
</tns:RelativeToFixed>
<tns:RelativeToFixed descriptionPropertiesKey="SECOND_ADVENT">
<tns:Which>THIRD</tns:Which>
<tns:Weekday>SUNDAY</tns:Weekday>
<tns:When>BEFORE</tns:When>
<tns:date month="DECEMBER" day="25"/>
</tns:RelativeToFixed>
<tns:RelativeToFixed descriptionPropertiesKey="THIRD_ADVENT">
<tns:Which>SECOND</tns:Which>
<tns:Weekday>SUNDAY</tns:Weekday>
<tns:When>BEFORE</tns:When>
<tns:date month="DECEMBER" day="25"/>
</tns:RelativeToFixed>
<tns:RelativeToFixed descriptionPropertiesKey="FOURTH_ADVENT">
<tns:Which>FIRST</tns:Which>
<tns:Weekday>SUNDAY</tns:Weekday>
<tns:When>BEFORE</tns:When>
<tns:date month="DECEMBER" day="25"/>
</tns:RelativeToFixed>
</tns:Holidays>
</tns:Configuration>
Code:
logInfo("Test", "Erster {}", Ephemeris.getBankHolidayName(new DateTimeType("2020-11-29").zonedDateTime, 'd:/OpenHAB/conf/services/specialdays.xml')) logInfo("Test", "Zweiter {}", Ephemeris.getBankHolidayName(new DateTimeType("2020-12-06").zonedDateTime, 'd:/OpenHAB/conf/services/specialdays.xml')) logInfo("Test", "Dritter {}", Ephemeris.getBankHolidayName(new DateTimeType("2020-12-13").zonedDateTime, 'd:/OpenHAB/conf/services/specialdays.xml')) logInfo("Test", "Vierter {}", Ephemeris.getBankHolidayName(new DateTimeType("2020-12-20").zonedDateTime, 'd:/OpenHAB/conf/services/specialdays.xml'))
00:34:23.807 [INFO ] [g.eclipse.smarthome.model.script.Test] - Erster {}
00:34:23.823 [INFO ] [g.eclipse.smarthome.model.script.Test] - Zweiter {}
00:34:23.823 [INFO ] [g.eclipse.smarthome.model.script.Test] - Dritter {}
00:34:23.854 [INFO ] [g.eclipse.smarthome.model.script.Test] - Vierter THIRD_ADVENT
00:34:23.823 [INFO ] [g.eclipse.smarthome.model.script.Test] - Zweiter {}
00:34:23.823 [INFO ] [g.eclipse.smarthome.model.script.Test] - Dritter {}
00:34:23.854 [INFO ] [g.eclipse.smarthome.model.script.Test] - Vierter THIRD_ADVENT
Kommentar