lenya/src/java/org/apache/lenya/cms/publication SiteTreeNodeImpl.java,1.3,1.4 SiteTreeNode.java,1.1,1.2

Christian Egli <[email protected]> Wed, 14 May 2003 18:31:59 +0200
Newsgroups gmane.comp.cms.wyona.cvs
Message-ID <[email protected]>
Update of /repository/lenya/src/java/org/apache/lenya/cms/publication
In directory erbium:/tmp/cvs-serv30360/src/java/org/apache/lenya/cms/publication

Modified Files:
	SiteTreeNodeImpl.java SiteTreeNode.java 
Log Message:
Added a new method getAbsoluteParentId which returns the entire
parentId. This is used for inerting nodes into the sitetree where we
have to specify the whole parentid.


Index: SiteTreeNodeImpl.java
===================================================================
RCS file: /repository/lenya/src/java/org/apache/lenya/cms/publication/SiteTreeNodeImpl.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** SiteTreeNodeImpl.java	14 May 2003 13:55:11 -0000	1.3
--- SiteTreeNodeImpl.java	14 May 2003 16:31:56 -0000	1.4
***************
*** 91,97 ****
      }
  
      public String getId() {
  	return node.getAttributes().getNamedItem(ID_ATTRIBUTE_NAME).getNodeValue();
! }
  
      public Label[] getLabels() {
--- 91,118 ----
      }
  
+     public String getAbsoluteParentId() {
+ 	String absoluteId = "";
+ 	Node parent = node.getParentNode();
+ 	NamedNodeMap attributes = null;
+ 	Node idAttribute = null;
+ 	
+ 	while (parent != null) {
+ 	    attributes = parent.getAttributes();
+ 	    if (attributes == null) {
+ 		break;
+ 	    }
+ 	    idAttribute = attributes.getNamedItem(ID_ATTRIBUTE_NAME);
+ 	    if (idAttribute == null) {
+ 		break;
+ 	    }
+ 	    absoluteId = "/" + idAttribute.getNodeValue() + absoluteId;
+ 	    parent = parent.getParentNode();
+ 	}
+ 	return absoluteId;
+     }
+ 
      public String getId() {
  	return node.getAttributes().getNamedItem(ID_ATTRIBUTE_NAME).getNodeValue();
!     }
  
      public Label[] getLabels() {

Index: SiteTreeNode.java
===================================================================
RCS file: /repository/lenya/src/java/org/apache/lenya/cms/publication/SiteTreeNode.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** SiteTreeNode.java	13 May 2003 12:25:05 -0000	1.1
--- SiteTreeNode.java	14 May 2003 16:31:56 -0000	1.2
***************
*** 48,51 ****
--- 48,53 ----
      String getParentId();
  
+     String getAbsoluteParentId();
+ 
      String getId();