[Yanel-commits] rev 21302 - public/yanel/trunk/src/contributions/resources/calendar/src/java/org/wyona/yanel/impl/resources

michi at wyona.com michi at wyona.com
Sun Dec 31 18:06:43 CET 2006


Author: michi
Date: 2006-12-31 18:06:41 +0100 (Sun, 31 Dec 2006)
New Revision: 21302

Modified:
   public/yanel/trunk/src/contributions/resources/calendar/src/java/org/wyona/yanel/impl/resources/CalendarResource.java
Log:
parsing enhanced

Modified: public/yanel/trunk/src/contributions/resources/calendar/src/java/org/wyona/yanel/impl/resources/CalendarResource.java
===================================================================
--- public/yanel/trunk/src/contributions/resources/calendar/src/java/org/wyona/yanel/impl/resources/CalendarResource.java	2006-12-31 17:06:09 UTC (rev 21301)
+++ public/yanel/trunk/src/contributions/resources/calendar/src/java/org/wyona/yanel/impl/resources/CalendarResource.java	2006-12-31 17:06:41 UTC (rev 21302)
@@ -10,6 +10,8 @@
 import org.wyona.yanel.core.attributes.viewable.View;
 import org.wyona.yanel.core.attributes.viewable.ViewDescriptor;
 
+import org.wyona.yanel.impl.resources.CalendarEvent;
+
 import org.apache.log4j.Category;
 
 import java.io.File;
@@ -160,26 +162,38 @@
         log.warn("TODO: Parse ICS and write events as XML into repository ...");
         java.io.BufferedReader br = new java.io.BufferedReader(new java.io.InputStreamReader(in));
         String line;
+        CalendarEvent event = null;
         while ((line = br.readLine()) != null) {
-            log.error("DEBUG: Line: " + line);
+            if (line.startsWith("BEGIN:VEVENT")) {
+                event = new CalendarEvent();
+            } else if (line.startsWith("END:VEVENT")) {
+                log.error("DEBUG: Write event " + event);
+                event = null;
+            } else if (line.startsWith("UID:")) {
+                if (event != null) event.setUID(line.split(":")[1]);
+            } else if (line.startsWith("SUMMARY:")) {
+                if (event != null) event.setSummary(line.split(":")[1]);
+            } else {
+                log.warn("Not implemented yet: " + line);
+            }
         }
     }
 
     /**
      *
      */
-    public InputStream getInputStream() throws Exception {
-        log.warn("Not implemented yet!");
+    public OutputStream getOutputStream() throws Exception {
+        log.warn("Do not use this method but rather write(InputStream)!");
         return null;
+        //return getRealm().getRepository().getOutputStream(new org.wyona.yarep.core.Path("/calendarTODO.ics"));
     }
 
     /**
      *
      */
-    public OutputStream getOutputStream() throws Exception {
-        log.warn("Do not use this method but rather write(InputStream)!");
+    public InputStream getInputStream() throws Exception {
+        log.warn("Not implemented yet!");
         return null;
-        //return getRealm().getRepository().getOutputStream(new org.wyona.yarep.core.Path("/calendarTODO.ics"));
     }
 
     /**




More information about the Yanel-commits mailing list