AnsweredAssumed Answered

How get noderef in Bean XML

Question asked by samjeff on Aug 14, 2008
Dear all,

I would like to pass a noderef in my transformation, but I don't know how to access current noderef in Bean XML configuration.
I have a file in \Alfresco\tomcat\shared\classes\alfresco\extension\my-transformers-context.xml
Here is the code:

<property name="transformCommand">
  <bean class="org.alfresco.util.exec.RuntimeExec">
         <property name="commandMap">
                <map>
                    <entry key="Windows.*">
                        <value>myconvert.bat ${source} ${target} ${option}</value>
                    </entry>
                </map>
         </property>
    <property name="defaultProperties">
                <props>
         <prop key="option">${serviceRegistry.getFileFolderService().getReader(nodeRef)}</prop>
      </props>
          </property>         
   </bean>
</property>
So when I run this: <prop key="option">${serviceRegistry.getFileFolderService().getReader(nodeRef)}</prop>
The contain of $option is nothing.
I need to get the noderef  to pass in the transformation. How the syntax?
Would you please to help me?
I really appreciate for your help.

The complete code like this:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>
   <bean id="transformer.Ocr.Pdf2Txt" class="org.alfresco.repo.content.transform.RuntimeExecutableContentTransformer" parent="baseContentTransformer">
      <property name="checkCommand">
         <bean class="org.alfresco.util.exec.RuntimeExec">
            <property name="commandMap">
                <map>
                    <entry key=".*">
                        <value>myconvert.bat -about</value>
                    </entry>
                </map>
            </property>
            <property name="errorCodes">
               <value>1,2</value>
            </property>
         </bean>
      </property>
      <property name="transformCommand">
         <bean class="org.alfresco.util.exec.RuntimeExec">
            <property name="commandMap">
                <map>
                    <entry key="Windows.*">
                        <value>myconvert.bat ${source} ${target} ${option}</value>
                    </entry>
                </map>
            </property>
      <property name="defaultProperties">
                <props>
         <prop key="option">${serviceRegistry.getFileFolderService().getReader(nodeRef)}</prop>
      </props>
            </property>         
         </bean>
      </property>
    
      <property name="explicitTransformations">
         <list>
            <bean class="org.alfresco.repo.content.transform.ContentTransformerRegistry$TransformationKey" >
                <constructor-arg><value>application/pdf</value></constructor-arg>
                <constructor-arg><value>text/plain</value></constructor-arg>
            </bean>
         </list>
      </property>
   </bean>
</beans>

Outcomes