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

hey123
Champ in-the-making
Champ in-the-making
couldn't we use the actionLink defined here ?
http://wiki.alfresco.com/wiki/ActionLink


Hi,
in fact I don't know whether this works, I will look into action links.
I solved my problem not by writing a new component, but by changing the alfresco source code of related component, namely UIChildAssociationEditor. If you need it you can also change it, or if you want I may send it to you.

Have a nice day.

aznk
Champ in-the-making
Champ in-the-making
Hi,
Sounds weird that we have to all this fuss just to show the path as a link.
Yes it would be very nice if you could sent it to me, or tell me which files you changed/added.
Thanks a lot and have a nice day.

hey123
Champ in-the-making
Champ in-the-making
Hi,
Sounds weird that we have to all this fuss just to show the path as a link.
Yes it would be very nice if you could sent it to me, or tell me which files you changed/added.
Thanks a lot and have a nice day.

Hello,
this is the file that I changed,
but please note that since this was just a demo, I solved the problem in a quick and dirty way, i.e. by just adding the "http://...vs" line. (hardcoded)
So it needs more work.

FileName:UIChildAssociationEditor.java
/*
* Copyright (C) 2005 Alfresco, Inc.
*
* Licensed under the GNU Lesser General Public License as
* published by the Free Software Foundation; either version
* 2.1 of the License, or (at your option) any later version.
* You may obtain a copy of the License at
*
*     http://www.gnu.org/licenses/lgpl.txt
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*/
package org.alfresco.web.ui.repo.component.property;

import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;

import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.repository.User;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
* Component that allows child associations to be edited
* i.e. new associations to be added, existing ones to be
* removed whilst following the rules in the data dictionary
*
* @author gavinc
*/
public class UIChildAssociationEditor extends BaseAssociationEditor
{
   private static final Log logger = LogFactory.getLog(UIChildAssociationEditor.class);
  
   // ——————————————————————————
   // Component implementation
  
   /**
    * @see javax.faces.component.UIComponent#getFamily()
    */
   public String getFamily()
   {
      return "org.alfresco.faces.ChildAssociationEditor";
   }
  
   /**
    * @see org.alfresco.web.ui.repo.component.property.BaseAssociationEditor#populateAssocationMaps(org.alfresco.web.bean.repository.Node)
    */
   @SuppressWarnings("unchecked")
   protected void populateAssocationMaps(Node node)
   {
      // we need to remember the original set of associations (if there are any)
      // and place them in a map keyed by the id of the child node
      if (this.originalAssocs == null)
      {
         this.originalAssocs = new HashMap<String, Object>();

         List assocs = (List)node.getChildAssociations().get(this.associationName);
         if (assocs != null)
         {
            Iterator iter = assocs.iterator();
            while (iter.hasNext())
            {
               ChildAssociationRef assoc = (ChildAssociationRef)iter.next();
              
               // add the association to the map
               this.originalAssocs.put(assoc.getChildRef().getId(), assoc);
            }
         }
      }
     
      // get the map of added associations for this node and association type
      this.added = (Map)node.getAddedChildAssociations().get(this.associationName);
      if (added == null)
      {
         // if there aren't any added associations for 'associationName' create a map and add it
         added = new HashMap<String, Object>();
         node.getAddedChildAssociations().put(this.associationName, (Map)added);
      }
     
      // get the map of removed associations for this node and association type
      this.removed = (Map)node.getRemovedChildAssociations().get(this.associationName);
      if (removed == null)
      {
         // if there aren't any added associations for 'associationName' create a map and add it
         removed = new HashMap<String, Object>();
         node.getRemovedChildAssociations().put(this.associationName, (Map)removed);
      }
   }
  
   /**
    * @see org.alfresco.web.ui.repo.component.property.BaseAssociationEditor#renderExistingAssociations(javax.faces.context.FacesContext, javax.faces.context.ResponseWriter, org.alfresco.service.cmr.repository.NodeService, boolean)
    */
   protected void renderExistingAssociations(FacesContext context, ResponseWriter out,
         NodeService nodeService, boolean allowMany) throws IOException
   {
      boolean itemsRendered = false;
     
      // show the associations from the original list if they are not in the removed list
      Iterator iter = this.originalAssocs.values().iterator();
      while (iter.hasNext())
      {
         ChildAssociationRef assoc = (ChildAssociationRef)iter.next();
         if (removed.containsKey(assoc.getChildRef().getId()) == false)
         {
            renderExistingAssociation(context, out, nodeService, assoc.getChildRef(), allowMany);
            itemsRendered = true;
         }
      }
     
      // also show any associations added in this session
      iter = this.added.values().iterator();
      while (iter.hasNext())
      {
         ChildAssociationRef assoc = (ChildAssociationRef)iter.next();
         renderExistingAssociation(context, out, nodeService, assoc.getChildRef(), allowMany);
         itemsRendered = true;
      }
     
      // show the none selected message if no items were rendered
      if (itemsRendered == false && allowMany == true)
      {
         renderNone(context, out);
      }
   }
  
   /**
    * @see org.alfresco.web.ui.repo.component.property.BaseAssociationEditor#renderReadOnlyAssociations(javax.faces.context.FacesContext, javax.faces.context.ResponseWriter, org.alfresco.service.cmr.repository.NodeService)
    */
   protected void renderReadOnlyAssociations(FacesContext context, ResponseWriter out, NodeService nodeService) throws IOException
   {
      if (this.originalAssocs.size() > 0)
      {
         out.write("<table cellspacing='0' cellpadding='2' border='0'>");
        
         Iterator iter = this.originalAssocs.values().iterator();
         while (iter.hasNext())
         {
            out.write("<tr><td>");
            ChildAssociationRef assoc = (ChildAssociationRef)iter.next();
            NodeRef targetNode = assoc.getChildRef();
            // if the node represents a person, show the username instead of the name
            if (ContentModel.TYPE_PERSON.equals(nodeService.getType(targetNode)))
            {
               out.write(User.getFullName(nodeService, targetNode));
            }
            /*else  if (ContentModel.TYPE_CONTENT.equals(nodeService.getType(targetNode)))
            {
                out.write(User.getFullName(nodeService, targetNode));
             }*/
            else
            {           
               //I added the following text, but I am sure there exist a method of alfresco that returns the following
               out.write("<a href="http://localhost:8080/alfresco/download/direct/workspace/SpacesStore/");              
               out.write(targetNode.getId());             
               out.write("/");
               out.write(Repository.getNameForNode(nodeService, targetNode));
               out.write("">");
               out.write(Repository.getNameForNode(nodeService, targetNode));
               out.write("</a>");                               
            }
           
            out.write("</tr></td>");
         }
        
         out.write("</table>");
      }
   }

   /**
    * @see org.alfresco.web.ui.repo.component.property.BaseAssociationEditor#removeTarget(org.alfresco.web.bean.repository.Node, java.lang.String)
    */
   protected void removeTarget(Node node, String childId)
   {
      if (node != null && childId != null)
      {
         QName assocQName = Repository.resolveToQName(this.associationName);
         ChildAssociationRef childAssoc = new ChildAssociationRef(assocQName,
            node.getNodeRef(), assocQName, new NodeRef(Repository.getStoreRef(), childId));
        
         // update the node so it knows to remove the association, but only if the association
         // was one of the original ones
         if (this.originalAssocs.containsKey(childId))
         {
            Map<String, ChildAssociationRef> removed = node.getRemovedChildAssociations().get(this.associationName);
            removed.put(childId, childAssoc);
           
            if (logger.isDebugEnabled())
               logger.debug("Added association to " + childId + " to the removed list");
         }
        
         // if this association was previously added in this session it will still be
         // in the added list so remove it if it is
         Map<String, ChildAssociationRef> added = node.getAddedChildAssociations().get(this.associationName);
         if (added.containsKey(childId))
         {
            added.remove(childId);
           
            if (logger.isDebugEnabled())
               logger.debug("Removed association to " + childId + " from the added list");
         }
      }
   }
  
   /**
    * @see org.alfresco.web.ui.repo.component.property.BaseAssociationEditor#addTarget(org.alfresco.web.bean.repository.Node, java.lang.String[])
    */
   protected void addTarget(Node node, String[] toAdd)
   {
      if (node != null && toAdd != null && toAdd.length > 0)
      {
         for (int x = 0; x < toAdd.length; x++)
         {
            String childId = toAdd[x];
           
            // update the node so it knows to add the association
            if (this.originalAssocs.containsKey(childId) == false)
            {
               QName assocQName = Repository.resolveToQName(this.associationName);
               ChildAssociationRef childAssoc = new ChildAssociationRef(assocQName,
                     node.getNodeRef(), assocQName, new NodeRef(Repository.getStoreRef(), childId));
           
               Map<String, ChildAssociationRef> added = node.getAddedChildAssociations().get(this.associationName);
               added.put(childId, childAssoc);
           
               if (logger.isDebugEnabled())
                  logger.debug("Added association to " + childId + " to the added list");
            }
           
            // if the association was previously removed and has now been re-added it
            // will still be in the "to be removed" list so remove it if it is
            Map<String, ChildAssociationRef> removed = node.getRemovedChildAssociations().get(this.associationName);
            if (removed.containsKey(childId))
            {
               removed.remove(childId);
              
               if (logger.isDebugEnabled())
                  logger.debug("Removed association to " + childId + " from the removed list");
            }
         }
      }
   }
}

aznk
Champ in-the-making
Champ in-the-making
Thanx for your code. Btw did you use SVN for developing ? Because I'm currently working with SDK, I wondered if it was possible to develop easily component generators, because deploying with SVN takes a lot of time…

aznk
Champ in-the-making
Champ in-the-making
hey thank you so much, I finally managed to make it work.
have a nice day.

aznk
Champ in-the-making
Champ in-the-making
Hi !
Does your files still work under Alfresco 2.0 ?
It seems like there is a problem (Faces exception) with this UIChildAssociationEditor.java file :
javax.faces.FacesException: Node does not exist: workspace://SpacesStore/workspace://SpacesStore/43c9774e-ce4a-11db-b30c-619b57f4bb3c
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: Node does not exist: workspace://SpacesStore/workspace://SpacesStore/43c9774e-ce4a-11db-b30c-619b57f4bb3c
at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:512)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
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)

Did you also experienced this ?

aznk
Champ in-the-making
Champ in-the-making
Solved, got the latest file on SVN :
/*
* Copyright (C) 2005-2007 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.

* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.

* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception.  You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing"
*/
package org.alfresco.web.ui.repo.component.property;

import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;

import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.repository.User;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
* Component that allows child associations to be edited
* i.e. new associations to be added, existing ones to be
* removed whilst following the rules in the data dictionary
*
* @author gavinc
*/
public class UIChildAssociationEditor extends BaseAssociationEditor
{
   private static final Log logger = LogFactory.getLog(UIChildAssociationEditor.class);
  
   // ——————————————————————————
   // Component implementation
  
   /**
    * @see javax.faces.component.UIComponent#getFamily()
    */
   public String getFamily()
   {
      return "org.alfresco.faces.ChildAssociationEditor";
   }
  
   /**
    * @see org.alfresco.web.ui.repo.component.property.BaseAssociationEditor#populateAssocationMaps(org.alfresco.web.bean.repository.Node)
    */
   @SuppressWarnings("unchecked")
   protected void populateAssocationMaps(Node node)
   {
      // we need to remember the original set of associations (if there are any)
      // and place them in a map keyed by the noderef of the child node
      if (this.originalAssocs == null)
      {
         this.originalAssocs = new LinkedHashMap<String, Object>();

         List assocs = (List)node.getChildAssociations().get(this.associationName);
         if (assocs != null)
         {
            Iterator iter = assocs.iterator();
            while (iter.hasNext())
            {
               ChildAssociationRef assoc = (ChildAssociationRef)iter.next();
              
               // add the association to the map
               this.originalAssocs.put(assoc.getChildRef().toString(), assoc);
            }
         }
      }
     
      // get the map of added associations for this node and association type
      this.added = (Map)node.getAddedChildAssociations().get(this.associationName);
      if (added == null)
      {
         // if there aren't any added associations for 'associationName' create a map and add it
         added = new LinkedHashMap<String, Object>();
         node.getAddedChildAssociations().put(this.associationName, (Map)added);
      }
     
      // get the map of removed associations for this node and association type
      this.removed = (Map)node.getRemovedChildAssociations().get(this.associationName);
      if (removed == null)
      {
         // if there aren't any added associations for 'associationName' create a map and add it
         removed = new LinkedHashMap<String, Object>();
         node.getRemovedChildAssociations().put(this.associationName, (Map)removed);
      }
   }
  
   /**
    * @see org.alfresco.web.ui.repo.component.property.BaseAssociationEditor#renderExistingAssociations(javax.faces.context.FacesContext, javax.faces.context.ResponseWriter, org.alfresco.service.cmr.repository.NodeService, boolean)
    */
   protected void renderExistingAssociations(FacesContext context, ResponseWriter out,
         NodeService nodeService, boolean allowMany) throws IOException
   {
      boolean itemsRendered = false;
     
      // show the associations from the original list if they are not in the removed list
      Iterator iter = this.originalAssocs.values().iterator();
      while (iter.hasNext())
      {
         ChildAssociationRef assoc = (ChildAssociationRef)iter.next();
         if (removed.containsKey(assoc.getChildRef().toString()) == false)
         {
            renderExistingAssociation(context, out, nodeService, assoc.getChildRef(), allowMany);
            itemsRendered = true;
         }
      }
     
      // also show any associations added in this session
      iter = this.added.values().iterator();
      while (iter.hasNext())
      {
         ChildAssociationRef assoc = (ChildAssociationRef)iter.next();
         renderExistingAssociation(context, out, nodeService, assoc.getChildRef(), allowMany);
         itemsRendered = true;
      }
     
      // show the none selected message if no items were rendered
      if (itemsRendered == false && allowMany == true)
      {
         renderNone(context, out);
      }
   }
  
   /**
    * @see org.alfresco.web.ui.repo.component.property.BaseAssociationEditor#renderReadOnlyAssociations(javax.faces.context.FacesContext, javax.faces.context.ResponseWriter, org.alfresco.service.cmr.repository.NodeService)
    */
   protected void renderReadOnlyAssociations(FacesContext context, ResponseWriter out, NodeService nodeService) throws IOException
   {
      if (this.originalAssocs.size() > 0)
      {
         out.write("<table cellspacing='0' cellpadding='2' border='0'>");
        
         Iterator iter = this.originalAssocs.values().iterator();
         while (iter.hasNext())
         {
            out.write("<tr><td>");
            ChildAssociationRef assoc = (ChildAssociationRef)iter.next();
            NodeRef targetNode = assoc.getChildRef();
            // if the node represents a person, show the username instead of the name
            if (ContentModel.TYPE_PERSON.equals(nodeService.getType(targetNode)))
            {
               out.write(User.getFullName(nodeService, targetNode));
            }
            /**else if (ContentModel.TYPE_AUTHORITY_CONTAINER.equals(nodeService.getType(targetNode)))
            {
               // if the node represents a group, show the group name instead of the name
               int offset = PermissionService.GROUP_PREFIX.length();
               String group = (String)nodeService.getProperty(targetNode,
                     ContentModel.PROP_AUTHORITY_NAME);
               out.write(group.substring(offset));
            }*/
            else
            {
               /**out.write(Repository.getDisplayPath(nodeService.getPath(targetNode)));
               out.write("/");
               out.write(Repository.getNameForNode(nodeService, targetNode));*/
              
               out.write("<a href=\"http://localhost:8080/alfresco/download/direct/workspace/SpacesStore/");
               out.write(targetNode.getId());
               out.write("/");
               out.write(Repository.getNameForNode(nodeService, targetNode));
               out.write("\">");
               out.write(Repository.getNameForNode(nodeService, targetNode));
               out.write("</a>");
            }
           
            out.write("</tr></td>");
         }
        
         out.write("</table>");
      }
   }

   /**
    * @see org.alfresco.web.ui.repo.component.property.BaseAssociationEditor#removeTarget(org.alfresco.web.bean.repository.Node, java.lang.String)
    */
   protected void removeTarget(Node node, String childRef)
   {
      if (node != null && childRef != null)
      {
         QName assocQName = Repository.resolveToQName(this.associationName);
         ChildAssociationRef childAssoc = new ChildAssociationRef(assocQName,
            node.getNodeRef(), assocQName, new NodeRef(childRef));
        
         // update the node so it knows to remove the association, but only if the association
         // was one of the original ones
         if (this.originalAssocs.containsKey(childRef))
         {
            Map<String, ChildAssociationRef> removed = node.getRemovedChildAssociations().get(this.associationName);
            removed.put(childRef, childAssoc);
           
            if (logger.isDebugEnabled())
               logger.debug("Added association to " + childRef + " to the removed list");
         }
        
         // if this association was previously added in this session it will still be
         // in the added list so remove it if it is
         Map<String, ChildAssociationRef> added = node.getAddedChildAssociations().get(this.associationName);
         if (added.containsKey(childRef))
         {
            added.remove(childRef);
           
            if (logger.isDebugEnabled())
               logger.debug("Removed association to " + childRef + " from the added list");
         }
      }
   }
  
   /**
    * @see org.alfresco.web.ui.repo.component.property.BaseAssociationEditor#addTarget(org.alfresco.web.bean.repository.Node, java.lang.String[])
    */
   protected void addTarget(Node node, String[] toAdd)
   {
      if (node != null && toAdd != null && toAdd.length > 0)
      {
         for (int x = 0; x < toAdd.length; x++)
         {
            String childRef = toAdd[x];
           
            // update the node so it knows to add the association
            if (this.originalAssocs.containsKey(childRef) == false)
            {
               QName assocQName = Repository.resolveToQName(this.associationName);
               ChildAssociationRef childAssoc = new ChildAssociationRef(assocQName,
                     node.getNodeRef(), assocQName, new NodeRef(childRef));
           
               Map<String, ChildAssociationRef> added = node.getAddedChildAssociations().get(this.associationName);
               added.put(childRef, childAssoc);
           
               if (logger.isDebugEnabled())
                  logger.debug("Added association to " + childRef + " to the added list");
            }
           
            // if the association was previously removed and has now been re-added it
            // will still be in the "to be removed" list so remove it if it is
            Map<String, ChildAssociationRef> removed = node.getRemovedChildAssociations().get(this.associationName);
            if (removed.containsKey(childRef))
            {
               removed.remove(childRef);
              
               if (logger.isDebugEnabled())
                  logger.debug("Removed association to " + childRef + " from the removed list");
            }
         }
      }
   }
}

dleeuwen
Champ in-the-making
Champ in-the-making
Can someone please tell me where I could find UIChildAssociationEditor.java so I can replace it with the one here on the forum. I did a search for it but couldn't find it. I use Alfresco 2.0 Enterprise Edition, if that is any help.

Hope you can help me out, thanks!!

frederick
Champ in-the-making
Champ in-the-making
While trying to do the same thing (making child-associations clickable in the property sheet), I noticed that the UIChildAssociation class ignores overridden "component-generator" attributes (RepoConstants.GENERATOR_CHILD_ASSOCIATION is used instead).
The UIProperty class on the other hand does allow overriding of this attribute (this.getComponentGenerator()).

Is there any chance that the "component-generator" attribute will be overridable for show-association and show-child-association tags as well in a future release?

Since my project must be packaged as a module, I cannot alter the UIChildAssociationEditor class, nor can I override the managed bean ChildAssociationGenerator or the component org.alfresco.faces.ChildAssociationEditor.
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.