[Yanel-commits] rev 21485 - in public/yanel/trunk/src:
contributions/resources/calendar/src/java/org/wyona/yanel/impl/resources
contributions/resources/wiki/src/java/org/wyona/yanel/impl/resources
core/java/org/wyona/yanel/core/api/attributes
core/java/org/wyona/yanel/servlet
michi at wyona.com
michi at wyona.com
Sun Jan 7 12:04:49 CET 2007
Author: michi
Date: 2007-01-07 12:04:46 +0100 (Sun, 07 Jan 2007)
New Revision: 21485
Modified:
public/yanel/trunk/src/contributions/resources/calendar/src/java/org/wyona/yanel/impl/resources/CalendarResource.java
public/yanel/trunk/src/contributions/resources/wiki/src/java/org/wyona/yanel/impl/resources/WikiResource.java
public/yanel/trunk/src/core/java/org/wyona/yanel/core/api/attributes/CreatableV2.java
public/yanel/trunk/src/core/java/org/wyona/yanel/servlet/CreateUsecaseHelper.java
Log:
create RTI generalized
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 2007-01-06 23:39:42 UTC (rev 21484)
+++ public/yanel/trunk/src/contributions/resources/calendar/src/java/org/wyona/yanel/impl/resources/CalendarResource.java 2007-01-07 11:04:46 UTC (rev 21485)
@@ -20,12 +20,15 @@
import java.io.OutputStream;
import java.io.Reader;
import java.io.Writer;
+import java.util.HashMap;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.stream.StreamResult;
+import javax.servlet.http.HttpServletRequest;
+
/**
*
*/
@@ -219,7 +222,19 @@
/**
*
*/
- public void create(javax.servlet.http.HttpServletRequest request) {
+ public HashMap createRTIProperties(HttpServletRequest request) {
+ HashMap map = new HashMap();
+ map.put("events-path","/new-calendar");
+ map.put("categories","none");
+ map.put("class","none");
+ map.put("user-ids","none");
+ return map;
+ }
+
+ /**
+ *
+ */
+ public void create(HttpServletRequest request) {
// TODO: Move the major part of the following code into Yanel Core
// Create RTI ...
org.wyona.yanel.core.Path newPath = getPath();
Modified: public/yanel/trunk/src/contributions/resources/wiki/src/java/org/wyona/yanel/impl/resources/WikiResource.java
===================================================================
--- public/yanel/trunk/src/contributions/resources/wiki/src/java/org/wyona/yanel/impl/resources/WikiResource.java 2007-01-06 23:39:42 UTC (rev 21484)
+++ public/yanel/trunk/src/contributions/resources/wiki/src/java/org/wyona/yanel/impl/resources/WikiResource.java 2007-01-07 11:04:46 UTC (rev 21485)
@@ -356,6 +356,13 @@
/**
*
*/
+ public HashMap createRTIProperties(HttpServletRequest request) {
+ return null;
+ }
+
+ /**
+ *
+ */
public void writeRti() {
//TODO: Move the major part of the following code into Yanel core
try {
Modified: public/yanel/trunk/src/core/java/org/wyona/yanel/core/api/attributes/CreatableV2.java
===================================================================
--- public/yanel/trunk/src/core/java/org/wyona/yanel/core/api/attributes/CreatableV2.java 2007-01-06 23:39:42 UTC (rev 21484)
+++ public/yanel/trunk/src/core/java/org/wyona/yanel/core/api/attributes/CreatableV2.java 2007-01-07 11:04:46 UTC (rev 21485)
@@ -21,6 +21,8 @@
import org.wyona.yanel.core.Path;
import org.wyona.yanel.core.api.attributes.CreatableV1;
+import java.util.HashMap;
+
/**
* DEV (not released yet), please be aware that this interface still might change ...
*/
@@ -30,10 +32,14 @@
*
*/
public String getPropertyType(String propertyName);
-
/**
* Creates the resource
*/
public void create(HttpServletRequest request);
+
+ /**
+ * Creates RTI properties
+ */
+ public HashMap createRTIProperties(HttpServletRequest request);
}
Modified: public/yanel/trunk/src/core/java/org/wyona/yanel/servlet/CreateUsecaseHelper.java
===================================================================
--- public/yanel/trunk/src/core/java/org/wyona/yanel/servlet/CreateUsecaseHelper.java 2007-01-06 23:39:42 UTC (rev 21484)
+++ public/yanel/trunk/src/core/java/org/wyona/yanel/servlet/CreateUsecaseHelper.java 2007-01-07 11:04:46 UTC (rev 21485)
@@ -209,32 +209,36 @@
if (newResource != null) {
if (ResourceAttributeHelper.hasAttributeImplemented(newResource, "Creatable", "2")) {
PropertyNames = ((CreatableV2) newResource).getPropertyNames();
-
- ((CreatableV2) newResource).create(request);
+ ((CreatableV2) newResource).create(request);
+ java.util.HashMap rtiProperties = ((CreatableV2) newResource).createRTIProperties(request);
+ if (rtiProperties != null) {
+ log.error("DEBUG: " + rtiProperties + " " + newResource.getPath().getRTIPath());
+ } else {
+ log.warn("No RTI properties: " + newResource.getPath());
+ }
- //response after creation, better would be a redirect to the fresh created resource
- StringBuffer form = new StringBuffer();
- form.append("<?xml version=\"1.0\"?>");
- form.append("<html xmlns=\"http://www.w3.org/1999/xhtml\">");
- form.append("<body>");
- form.append("New resource has been created successfully: <a href=\"" + createName + "\">" + createName + "</a>");
- form.append("</body>");
- responseAfterCreationScreen = form.toString();
- }else{
- //response after creation failed
- StringBuffer form = new StringBuffer();
- form.append("<?xml version=\"1.0\"?>");
- form.append("<html xmlns=\"http://www.w3.org/1999/xhtml\">");
- form.append("<body>");
- form.append("creation NOT successfull!");
- form.append("</body>");
- responseAfterCreationScreen = form.toString();
- }
+ //response after creation, better would be a redirect to the fresh created resource
+ StringBuffer form = new StringBuffer();
+ form.append("<?xml version=\"1.0\"?>");
+ form.append("<html xmlns=\"http://www.w3.org/1999/xhtml\">");
+ form.append("<body>");
+ form.append("New resource has been created successfully: <a href=\"" + createName + "\">" + createName + "</a>");
+ form.append("</body>");
+ responseAfterCreationScreen = form.toString();
+ } else {
+ //response after creation failed
+ StringBuffer form = new StringBuffer();
+ form.append("<?xml version=\"1.0\"?>");
+ form.append("<html xmlns=\"http://www.w3.org/1999/xhtml\">");
+ form.append("<body>");
+ form.append("creation NOT successfull!");
+ form.append("</body>");
+ responseAfterCreationScreen = form.toString();
+ }
return responseAfterCreationScreen;
- }
}
- catch (Exception e) {
+ } catch (Exception e) {
log.error(e.getMessage(), e);
String message = e.toString();
log.error(e.getMessage(), e);
@@ -247,5 +251,4 @@
}
return responseAfterCreationScreen;
}
-
}
More information about the Yanel-commits
mailing list