Is Plugin applicable for Attributes?

Hello,
I want to use plugin for setting the value of an attribute.
To do this I add this text to the xapplication.xml
where Registration is the name of an attribute of my Documents root.

<action name=“setValue”
method=“hitit.HPlugin.setRegistration”>
arg
variables



But this doesnt invoke the HPlugin.setRegistration method :frowning:
Can somebody help me please ?
Ps : I have also tried as it didnt work either…


X-Application Version: 3.1.3
Tamino Version : 3.1.1
Platform : Win2k
WebContainer : Tomcat 3.3a
JDK Version : 1.3.1

Hello,

I checked the code for the plugins. What I found out is for X-Application 3.1.3:

- The attribute is wrapped as a BusinessNode.
- The target context for BusinessNodes is the name of the element the BusinessNode belongs to. This means the target name for the attribute the name of the element it belongs to.

As a solution for your problem you could try out the following approach that overwrites the standard element action ‘setValue’ for elements

Within the xapplication.xml add the action setValue with the arguments you need:

  <element>
    <action name="setValue"
            method="...yourSetMethod">
      <arg>arg</arg>
      ...
    </action>
  </element>
</pre><BR><BR>For your Plugin Code:<BR><pre class="ip-ubbcode-code-pre">
public static void yourSetMethod(BusinessNode node, String newValue, ...) {
   if (node instanceof AttributeNode) {
     String attrName = ((AttributeNode)node).getName();
     if (attrName.equals("Registration") {
        // invoke your method and pass the arguments to it what ever you need
        return;
     }
     // dispatch other attributes
   }
   // do the normal work for the nodes that are not filtered out 
   StandardElementPlugin.setValue(node, newValue);
}



The basic idea of this approach is: use a plugin method to extend the behavior of the dispatcher by your own delegation.

This is only a proposal and I never tried it out by myself. If you have problems to implement this approach, write a new post and I will have a closer look at it.

Also for the next version X-Application 4.1.1 we are currently developing we didn’t extend the plugin module to support more target context than workspace, document and element. I didn’t check if the same approach is applicable for this version.

Bye,
Christian.