This page (revision-1) was last changed on 21-Jun-2012 14:31 by Dieter Käppel

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Page revision history

Version Date Modified Size Author Changes ... Change note
1 21-Jun-2012 14:31 3 KB Dieter Käppel

Page References

Incoming links Outgoing links

Version management

Difference between version and

At line 1 added 107 lines
[Intersult Series] ist ein Werkzeug zum Generieren von Termin-Serien. Es kann aus dem [Intersult Maven Repository] bezogen werden.
!!!Hintergrund
In Web- und anderen Anwendungen werden oft Termin-Serien benötigt, die täglich, alle paar Tage, wöchentlich, mehrfach wöchentlich, an einem bestimmten Tag im Monat oder jährlich stattfinden.
!!!Beispiele
!Täglich
{{{
Series series = new Series();
series.setBegin(DateUtil.TIME_FORMAT.parse("13:30"));
series.getPeriod().setBegin(DateUtil.DATE_FORMAT.parse("01.04.2010"));
series.getPeriod().setEnd(DateUtil.DATE_FORMAT.parse("03.04.2010"));
series.setPattern(Pattern.DAILY);
series.getDaily().setDay(1);
if (series.validate()) { // Prüfen ob Serie passt
for (Date date : series.iterable()) {
System.out.println(date);
}
}
}}}
!Wöchentlich
{{{
Series series = new Series();
series.setBegin(DateUtil.TIME_FORMAT.parse("13:30"));
series.getPeriod().setBegin(DateUtil.DATE_FORMAT.parse("01.04.2010"));
series.getPeriod().setEnd(DateUtil.DATE_FORMAT.parse("15.04.2010"));
series.setPattern(Pattern.WEEKLY);
series.getWeekly().setWeek(1);
series.getWeekly().getWeekdays().add(Weekday.TUESDAY);
series.getWeekly().getWeekdays().add(Weekday.THURSDAY);
if (series.validate()) { // Prüfen ob Serie passt
for (Date date : series.iterable()) {
System.out.println(date);
}
}
}}}
!Monatlich
{{{
Series series = new Series();
series.setBegin(DateUtil.TIME_FORMAT.parse("13:30"));
series.getPeriod().setBegin(DateUtil.DATE_FORMAT.parse("01.04.2010"));
series.getPeriod().setEnd(DateUtil.DATE_FORMAT.parse("15.12.2010"));
series.setPattern(Pattern.MONTHLY);
series.getMonthly().setMode(Monthly.Mode.DAY);
series.getMonthly().getMonthDay().setDay(3);
series.getMonthly().getMonthDay().setMonth(2);
if (series.validate()) { // Prüfen ob Serie passt
for (Date date : series.iterable()) {
System.out.println(date);
}
}
}}}
!Wochentag im Monat
{{{
Series series = new Series();
series.setBegin(DateUtil.TIME_FORMAT.parse("13:30"));
series.getPeriod().setBegin(DateUtil.DATE_FORMAT.parse("15.04.2010"));
series.getPeriod().setEnd(DateUtil.DATE_FORMAT.parse("15.12.2010"));
series.setPattern(Pattern.MONTHLY);
series.getMonthly().setMode(Monthly.Mode.WEEKDAY);
series.getMonthly().getMonthWeekday().setWeekOfMonth(WeekOfMonth.TWO);
series.getMonthly().getMonthWeekday().setWeekday(Weekday.WEDNESDAY);
series.getMonthly().getMonthWeekday().setMonth(2);
if (series.validate()) { // Prüfen ob Serie passt
for (Date date : series.iterable()) {
System.out.println(date);
}
}
}}}
!Jährlich
{{{
Series series = new Series();
series.setBegin(DateUtil.TIME_FORMAT.parse("13:30"));
series.getPeriod().setBegin(DateUtil.DATE_FORMAT.parse("15.04.2010"));
series.getPeriod().setEnd(DateUtil.DATE_FORMAT.parse("15.12.2012"));
series.setPattern(Pattern.YEARLY);
series.getYearly().setMode(Yearly.Mode.DAY);
series.getYearly().getYearDay().setDay(4);
series.getYearly().getYearDay().setMonth(Month.AUGUST);
if (series.validate()) { // Prüfen ob Serie passt
for (Date date : series.iterable()) {
System.out.println(date);
}
}
}}}
!Jährlicher Wochentag
{{{
Series series = new Series();
series.setBegin(DateUtil.TIME_FORMAT.parse("13:30"));
series.getPeriod().setBegin(DateUtil.DATE_FORMAT.parse("15.04.2010"));
series.getPeriod().setEnd(DateUtil.DATE_FORMAT.parse("15.12.2012"));
series.setPattern(Pattern.YEARLY);
series.getYearly().setMode(Yearly.Mode.WEEKDAY);
series.getYearly().getYearWeekday().setWeekday(Weekday.THURSDAY);
series.getYearly().getYearWeekday().setWeekOfMonth(WeekOfMonth.THREE);
series.getYearly().getYearWeekday().setMonth(Month.AUGUST);
if (series.validate()) { // Prüfen ob Serie passt
for (Date date : series.iterable()) {
System.out.println(date);
}
}
}}}