svn commit: r628508 - in /lenya/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/transformation: AbstractLinkTransformer.java UuidToUrlTransformer.java

[email protected]
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
Author: rfrovarp
Date: Sun Feb 17 08:28:30 2008
New Revision: 628508

URL: http://svn.apache.org/viewvc?rev=628508&view=rev
Log:
Fixes 44416

Modified:
    lenya/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/transformation/AbstractLinkTransformer.java
    lenya/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/transformation/UuidToUrlTransformer.java

Modified: lenya/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/transformation/AbstractLinkTransformer.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/transformation/AbstractLinkTransformer.java?rev=628508&r1=628507&r2=628508&view=diff
==============================================================================
--- lenya/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/transformation/AbstractLinkTransformer.java (original)
+++ lenya/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/transformation/AbstractLinkTransformer.java Sun Feb 17 08:28:30 2008
@@ -23,6 +23,7 @@
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
+import java.util.Stack;
 
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
@@ -160,6 +161,8 @@
 
     protected String indent = "";
     protected boolean ignoreLinkElement = false;
+    private Stack ignoreLinkElementStack = new Stack();
+    protected boolean useIgnore = false;
 
     /**
      * @see org.xml.sax.ContentHandler#startElement(java.lang.String,
@@ -203,15 +206,23 @@
             getLogger().debug(this.indent + "ignoreAElement: " + this.ignoreLinkElement);
         }
 
-        if (!(!configs.isEmpty() && this.ignoreLinkElement)) {
-            if (newAttrs != null) {
-                attrs = newAttrs;
-            }
-            super.startElement(uri, name, qname, attrs);
-            if (getLogger().isDebugEnabled()) {
-                getLogger().debug(this.indent + "<" + qname + "> sent");
+        // use existsMatching to match up with ednElement
+        if (existsMatchingConfiguration(uri,name) && this.useIgnore) {
+            if(this.ignoreLinkElement) { 
+                ignoreLinkElementStack.push(Boolean.TRUE);
+                return;
+            } else { 
+                ignoreLinkElementStack.push(Boolean.FALSE);
             }
         }
+ 
+        if (newAttrs != null) {
+            attrs = newAttrs;
+        }
+        super.startElement(uri, name, qname, attrs);
+        if (getLogger().isDebugEnabled()) {
+            getLogger().debug(this.indent + "<" + qname + "> sent");
+        }
     }
 
     /**
@@ -238,14 +249,17 @@
             this.indent = this.indent.substring(2);
             getLogger().debug(this.indent + "</" + qname + ">");
         }
-        if (existsMatchingConfiguration(uri, name) && this.ignoreLinkElement) {
-            this.ignoreLinkElement = false;
-        } else {
-            if (getLogger().isDebugEnabled()) {
-                getLogger().debug(this.indent + "</" + qname + "> sent");
+        if (existsMatchingConfiguration(uri, name) && this.useIgnore) { 
+            if( ((Boolean)ignoreLinkElementStack.pop()).booleanValue()) { 
+                this.ignoreLinkElement = false;
+                return;
             }
-            super.endElement(uri, name, qname);
         }
+        
+        if (getLogger().isDebugEnabled()) {
+            getLogger().debug(this.indent + "</" + qname + "> sent");
+        }
+        super.endElement(uri, name, qname);
     }
 
     /**

Modified: lenya/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/transformation/UuidToUrlTransformer.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/transformation/UuidToUrlTransformer.java?rev=628508&r1=628507&r2=628508&view=diff
==============================================================================
--- lenya/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/transformation/UuidToUrlTransformer.java (original)
+++ lenya/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/transformation/UuidToUrlTransformer.java Sun Feb 17 08:28:30 2008
@@ -107,6 +107,7 @@
 
         Request _request = ObjectModelHelper.getRequest(_objectModel);
 
+        this.useIgnore = true;
         Source source = null;
         try {
             Session session = RepositoryUtil.getSession(this.manager, _request);
@@ -345,4 +346,4 @@
         return this.validity;
     }
 
-}
\ No newline at end of file
+}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.