From f6347baf693c8246091dca498ee9349f4486d04f Mon Sep 17 00:00:00 2001 From: yvesf Date: Mon, 28 Feb 2011 21:10:43 +0100 Subject: Lade auch den folgenden Monat (closes gh-2) --- .../dhbw/horb/calendar/dualis/DualisConnection.java | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/dhbw/horb/calendar/dualis/DualisConnection.java b/src/main/java/de/dhbw/horb/calendar/dualis/DualisConnection.java index 7d13c47..224bd82 100644 --- a/src/main/java/de/dhbw/horb/calendar/dualis/DualisConnection.java +++ b/src/main/java/de/dhbw/horb/calendar/dualis/DualisConnection.java @@ -103,12 +103,23 @@ public class DualisConnection { anchorMonat = page.getAnchorByText("Monat"); } catch (ElementNotFoundException e) { throw new DualisException.DualisScrapingException( - "Link Studenplan 'Woche' nicht gefunden", e); + "Link Studenplan 'Monat' nicht gefunden", e); } page = anchorMonat.click(); getEventsFromPage(page, events); + HtmlAnchor anchorNextMonth; + try { + anchorNextMonth = page.getAnchorByName("skipForward_btn"); + } catch (ElementNotFoundException e) { + throw new DualisException.DualisScrapingException( + "Link Studenplan 'Nächster Monat' nicht gefunden", e); + } + page = anchorNextMonth.click(); + + getEventsFromPage(page, events); + return events; } @@ -157,11 +168,13 @@ public class DualisConnection { cstart.setTimeZone(TimeZone.getTimeZone("Europe/Berlin")); cend.setTimeZone(TimeZone.getTimeZone("Europe/Berlin")); VEvent event = new VEvent.Builder().dtstart(cstart) - .dtstamp(cstart).dtend(cend).summary(title).description(title) - .location(room).status("CONFIRMED").build(); + .dtstamp(cstart).dtend(cend).summary(title) + .description(title).location(room) + .status("CONFIRMED").build(); events.add(event); } else { - System.err.println("Skip: " + desc + " at day " + cday.getTime()); + System.err.println("Skip: " + desc + " at day " + + cday.getTime()); } } } -- cgit v1.2.1