[Yanel-commits] rev 25095 - public/yanel/trunk/src/contributions/resources/resource-creator/src/java/org/wyona/yanel/impl/resources

michi at wyona.com michi at wyona.com
Wed Jun 13 13:55:56 CEST 2007


Author: michi
Date: 2007-06-13 13:55:55 +0200 (Wed, 13 Jun 2007)
New Revision: 25095

Modified:
   public/yanel/trunk/src/contributions/resources/resource-creator/src/java/org/wyona/yanel/impl/resources/ResourceCreatorResource.java
Log:
lookin fixed and rc node creation fixed whereas recursice creation is still missing

Modified: public/yanel/trunk/src/contributions/resources/resource-creator/src/java/org/wyona/yanel/impl/resources/ResourceCreatorResource.java
===================================================================
--- public/yanel/trunk/src/contributions/resources/resource-creator/src/java/org/wyona/yanel/impl/resources/ResourceCreatorResource.java	2007-06-13 11:31:21 UTC (rev 25094)
+++ public/yanel/trunk/src/contributions/resources/resource-creator/src/java/org/wyona/yanel/impl/resources/ResourceCreatorResource.java	2007-06-13 11:55:55 UTC (rev 25095)
@@ -315,6 +315,7 @@
                     sb.append("<tr><td colspan=\"2\" align=\"right\"><input type=\"submit\" value=\"Save new resource\" name=\"save\"/></td></tr>");
 		    sb.append("</table>");
 
+                    sb.append("<input type=\"hidden\" name=\"lookin\" value=\"" + node.getPath() + "\"/>");
                     sb.append("</form>");
 
                     // TODO: Display realm navigation (sitetree, topic map, ...) resp. introduce another step
@@ -338,13 +339,14 @@
         Path pathOfNewResource = null;
         String createName = getRequest().getParameter("create-name");
         
+        String lookinPath = getRequest().getParameter("lookin");
         if(parent.equals("null")) {
             // if pathOfResourceCreator is ROOT
-            pathOfNewResource = new Path("/" + createName);
+            pathOfNewResource = new Path("/" + lookinPath + "/" + createName);
         } else if(parent.toString().equals("/")){
-            pathOfNewResource = new Path(parent + createName);
+            pathOfNewResource = new Path(parent + "/" + lookinPath + "/" + createName);
         } else {
-            pathOfNewResource = new Path(parent + "/" + createName);            
+            pathOfNewResource = new Path(parent + "/" + lookinPath + "/" + createName);            
         }
         
         log.error("DEBUG: Path of new resource: " + pathOfNewResource);
@@ -396,7 +398,7 @@
         log.error("DEBUG: " + newRCPath);
         if (!rcRepo.existsNode(newRCPath.toString())) {
             // TODO: create node recursively ...
-            rcRepo.getRootNode().addNode(newRCPath.getName(), org.wyona.yarep.core.NodeType.RESOURCE);
+            org.wyona.yarep.core.Node newNode = rcRepo.getNode(newRCPath.getParent().toString()).addNode(newRCPath.getName(), org.wyona.yarep.core.NodeType.RESOURCE);
 	    log.warn("Node has been created: " + newRCPath);
         } else {
 	    log.error("Node already exists: " + newRCPath);




More information about the Yanel-commits mailing list