cancel
Showing results for 
Search instead for 
Did you mean: 

URGENT HELP !!! showing the association as a hyperlink

hey123
Champ in-the-making
Champ in-the-making
Hello,
I am defining a new content type with a child content association. But, when I want to view the properties of an object of this content type, child associations are shown like  below:

Incoming Documents:      /company_home/README.txt
                                     /company_home/11111111README_mysql.txt

(not a hyperlink, just the text version of the xpath of the documents)

But I want to make these association contents (can be text or jpeg files) viewable when I click on them.

Thank you in advance,

My Model Definition:
<type name="my:iadeDosyasi">
         <title>Standard Operating Procedure</title>
         <parent>cm:content</parent>
          <properties>
           <property name="my:EvrakNumarasi">
               <type>d:text</type>
            </property>
</properties>
         <associations>
            <child-association name="my:gelenEvraklar">
               <source>                 
                  <mandatory>true</mandatory>
                  <many>false</many>
               </source>
               <target>
                  <class>cm:content</class>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </target>
            </child-association>
        </associations>
      </type>

My Web Client Configuration :
<config evaluator="node-type" condition="my:iadeDosyasi">
      <property-sheet>
     <show-property name="my:EvrakNumarasi" />
                  <show-child-association name="my:gelenEvraklar" display-                   label="offfff yaaa off" converter="org.alfresco.faces.DisplayPathConverter"/>
    </property-sheet>
   </config>
24 REPLIES 24

gavinc
Champ in-the-making
Champ in-the-making
Hi,

You are indeed correct, the association editors do not pick up the component generator specified in config. I have raised an improvement on JIRA for this: http://issues.alfresco.com/browse/AWC-1174. So yes, it should get done in a future release.

Meanwhile, you should still be able to override this. What you'll need to do is override the managed bean definition for "ChildAssociationGenerator". You can re-define the managed bean with your class in the faces-config-custom.xml file as mentioned in http://wiki.alfresco.com/wiki/Packaging_And_Deploying_Extensions. This file is located in WEB-INF so you should be able to include this in your module. The file that is present by default is empty so it's OK to overwrite it (MyFaces needs a file to be present so we had to supply an empty one).

Hope this helps.

serv
Champ in-the-making
Champ in-the-making
Hi everybody !

I'm trying to make my own model too with a chil-association rendered as a link.
However I didn't manage to make it work.

I have created my CustomNodePathGenerator, put the needed properties in the configuration files as follow (I have my own packages) :

<managed-bean>
<managed-bean-name>ChildAssociationGenerator</managed-bean-name>
<managed-bean-class>com.test.web.bean.generator.CustomNodePathGenerator</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>disabled </property-name>
<value>true</value>
</managed-property>
</managed-bean>

In  web-client-config-custom.xml
<show-child-association name="my:auteurs" component-generator="CustomNodePathGenerator" />

I have then created a new UIChildAssociationEditor still in my own package (com.test.web.ui.repo.component.property) with the file version of Alfresco 2.0.

In faces-config-custom.xml I have added :
<component>
      <component-type>com.euriware.test.web.bean.generator.CustomNodePathEditor</component-type>
      <component-class>com.euriware.test.web.ui.repo.component.property.UIChildAssociationEditor</component-class>
   </component>
And in web-client-config-custom.xml :
<show-child-association name="my:auteurs" component-generator="com.euriware.test.web.bean.generator.CustomNodePathGenerator"/>

When I run Alfresco and I try to see the details, I have the following error :
ERROR [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/alfresco].[jsp]] "Servlet.service()" pour la servlet jsp a lancé une exception
java.lang.ClassCastException: org.alfresco.web.ui.repo.component.UINodePath
   at org.alfresco.web.bean.generator.BaseComponentGenerator.setupAssociation(BaseComponentGenerator.java:288)
   at org.alfresco.web.bean.generator.BaseComponentGenerator.generateAndAdd(BaseComponentGenerator.java:127)
   at org.alfresco.web.ui.repo.component.property.UIChildAssociation.generateControl(UIChildAssociation.java:124)
   at org.alfresco.web.ui.repo.component.property.UIChildAssociation.generateItem(UIChildAssociation.java:109)
   at org.alfresco.web.ui.repo.component.property.PropertySheetItem.encodeBegin(PropertySheetItem.java:74)
   at org.apache.myfaces.renderkit.RendererUtils.renderChild(RendererUtils.java:441)
   at org.apache.myfaces.renderkit.html.HtmlGridRendererBase.renderChildren(HtmlGridRendererBase.java:203)
   at org.apache.myfaces.renderkit.html.HtmlGridRendererBase.encodeEnd(HtmlGridRendererBase.java:85)
   at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:331)
   at org.alfresco.web.ui.repo.component.property.UIPropertySheet.encodeEnd(UIPropertySheet.java:200)
   at javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:349)
   at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:253)
   at org.apache.jsp.jsp.dialog.document_002ddetails_jsp._jspx_meth_r_propertySheetGrid_0(document_002ddetails_jsp.java:2336)
   at org.apache.jsp.jsp.dialog.document_002ddetails_jsp._jspService(document_002ddetails_jsp.java:768)
   at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
   at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
   at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
   at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
   at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
   at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
   at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:415)
   at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
   at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:352)
   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:106)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.alfresco.web.app.servlet.AuthenticationFilter.doFilter(AuthenticationFilter.java:81)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
   at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
   at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
   at java.lang.Thread.run(Thread.java:595)
16:52:41,420 ERROR [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/alfresco].[Faces Servlet]] "Servlet.service()" pour la servlet Faces Servlet a généré une exception
javax.faces.FacesException: org.alfresco.web.ui.repo.component.UINodePath
   at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:421)
   at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
   at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:352)
   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:106)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.alfresco.web.app.servlet.AuthenticationFilter.doFilter(AuthenticationFilter.java:81)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
   at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
   at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
   at java.lang.Thread.run(Thread.java:595)
Caused by: org.apache.jasper.JasperException: org.alfresco.web.ui.repo.component.UINodePath
   at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:512)
   at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:395)
   at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
   at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
   at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
   at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
   at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
   at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:415)
   … 20 more

I don't understand where the problem is. Could you please help me ?

serv
Champ in-the-making
Champ in-the-making
Hello again !

I have tried to put my UIChildAssociationEditor in the web-client.jar within the WEB-INF/lib folder.
However, I still have the same error. In conclusion, the package is not the problem… Any other idea ?

gavinc
Champ in-the-making
Champ in-the-making
Does your implementation of UIChildAssociation extend BaseAssociationEditor?

The ClassCastException you are getting suggests that it's not!

serv
Champ in-the-making
Champ in-the-making
My UIChildAssociation class does actually extend BaseAssociationEditor.

I have solved my problem by adding the UIChildAssociation.class in the web-client.jar within the WEB-INF/lib folder with the right package (org.alfresco.web.ui.repo.component.property).
I have then modified the method generate of CustomNodePathGenerator.java as follow :
public UIComponent generate(FacesContext context, String id) {
      UIComponent component = context.getApplication().createComponent(RepoConstants.ALFRESCO_FACES_CHILD_ASSOC_EDITOR);
      FacesHelper.setupComponentId(context, component, id);
      logger.error("CustomNodePathGenerator generate "+component.toString());
      return component;
   }
Now, it works well.
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.