[Yanel-commits] rev 31935 - public/yanel/contributions/resources/redirect/src/java/org/wyona/yanel/impl/resources/redirect

michi at wyona.com michi at wyona.com
Thu Feb 14 14:59:43 CET 2008


Author: michi
Date: 2008-02-14 14:59:42 +0100 (Thu, 14 Feb 2008)
New Revision: 31935

Modified:
   public/yanel/contributions/resources/redirect/src/java/org/wyona/yanel/impl/resources/redirect/RedirectResource.java
Log:
CreatableV2 implemented

Modified: public/yanel/contributions/resources/redirect/src/java/org/wyona/yanel/impl/resources/redirect/RedirectResource.java
===================================================================
--- public/yanel/contributions/resources/redirect/src/java/org/wyona/yanel/impl/resources/redirect/RedirectResource.java	2008-02-14 13:33:21 UTC (rev 31934)
+++ public/yanel/contributions/resources/redirect/src/java/org/wyona/yanel/impl/resources/redirect/RedirectResource.java	2008-02-14 13:59:42 UTC (rev 31935)
@@ -22,6 +22,7 @@
 import org.wyona.yanel.core.ResourceConfiguration;
 import org.wyona.yanel.core.Yanel;
 
+import org.wyona.yanel.core.api.attributes.CreatableV2;
 import org.wyona.yanel.core.api.attributes.ViewableV2;
 import org.wyona.yanel.core.attributes.viewable.View;
 import org.wyona.yanel.core.attributes.viewable.ViewDescriptor;
@@ -30,6 +31,8 @@
 
 import org.wyona.security.core.api.Identity;
 
+import java.util.HashMap;
+
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -45,7 +48,7 @@
 /**
  *
  */
-public class RedirectResource extends Resource implements ViewableV2 {
+public class RedirectResource extends Resource implements ViewableV2, CreatableV2 {
 
     private static Category log = Category.getInstance(RedirectResource.class);
     
@@ -54,12 +57,6 @@
     /**
      *
      */
-    public RedirectResource() {
-    }
-
-    /**
-     *
-     */
     public ViewDescriptor[] getViewDescriptors() {
         ViewDescriptor[] vd = new ViewDescriptor[1];
         vd[0] = new ViewDescriptor("default");
@@ -168,4 +165,63 @@
     private Identity getIdentity(HttpServletRequest request) throws Exception {
         return getEnvironment().getIdentity();
     }
+
+    // All methods below are re CreatableV2 and CreatableV1 interface implementations
+
+    /**
+     *
+     */
+    public void create(HttpServletRequest request) {
+        log.warn("Not implemented yet!");
+    }
+
+    /**
+     *
+     */
+    public String getPropertyType(String propertyName) {
+        return CreatableV2.TYPE_STRING;
+    }
+
+    /**
+     *
+     */
+    public String getCreateName(String suggestedName) {
+        return suggestedName;
+    }
+
+    /**
+     * @see org.wyona.yanel.core.api.attributes.CreatableV2#createRTIProperties(HttpServletRequest)
+     */
+    public HashMap createRTIProperties(HttpServletRequest request) {
+        HashMap map = new HashMap();
+        map.put("href", request.getParameter("rp.redirectURL"));
+        return map;
+    }
+
+    /**
+     * @see org.wyona.yanel.core.api.attributes.CreatableV1#getProperty(String)
+     */
+    public Object getProperty(String name) {
+        return null;
+/*
+Object property = properties.get(name);
+return property;
+*/
+    }
+
+    /**
+     * @see org.wyona.yanel.core.api.attributes.CreatableV1#setProperty(String, Object)
+     */
+    public void setProperty(String name, Object value) {
+        log.warn("Not implemented yet!");
+    }
+
+    /**
+     * @see org.wyona.yanel.core.api.attributes.CreatableV1#getPropertyNames()
+     */
+    public String[] getPropertyNames() {
+        String[] pn = new String[1];
+        pn[0] = "redirectURL";
+        return pn;
+    }
 }



More information about the Yanel-commits mailing list