You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2003/12/11 16:36:04 UTC

cvs commit: cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/transformation CopletTransformer.java AbstractCopletTransformer.java

cziegeler    2003/12/11 07:36:04

  Modified:    src/blocks/portal/java/org/apache/cocoon/portal/transformation
                        CopletTransformer.java
                        AbstractCopletTransformer.java
  Log:
  Enhancing coplet transformer for inter coplet communication
  
  Revision  Changes    Path
  1.11      +4 -4      cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/transformation/CopletTransformer.java
  
  Index: CopletTransformer.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/transformation/CopletTransformer.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- CopletTransformer.java	11 Dec 2003 14:41:32 -0000	1.10
  +++ CopletTransformer.java	11 Dec 2003 15:36:04 -0000	1.11
  @@ -83,8 +83,6 @@
    * Please see also the documentation of superclass AbstractCopletTransformer for how
    * the coplet instance data are acquired.
    *
  - * FIXME - Don't create <a> elements for links!
  - * 
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
    * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj&ouml;rn L&uuml;tkemeier</a>
    * @version CVS $Id$
  @@ -177,7 +175,9 @@
                           Object layout = portalService.getComponentManager().getProfileManager().getPortalLayout(null, layoutId);
                           event = new JXPathEvent(layout, path, value);
                       } else {
  -                        final CopletInstanceData cid = this.getCopletInstanceData();
  +                        String copletId = attr.getValue("coplet");
  +                        newAttrs.removeAttribute("coplet");
  +                        final CopletInstanceData cid = this.getCopletInstanceData(copletId);
                           event = new CopletJXPathEvent(cid, path, value);
                       }
                       final String href = linkService.getLinkURI(event);
  
  
  
  1.5       +22 -12    cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/transformation/AbstractCopletTransformer.java
  
  Index: AbstractCopletTransformer.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/transformation/AbstractCopletTransformer.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AbstractCopletTransformer.java	21 Oct 2003 12:39:16 -0000	1.4
  +++ AbstractCopletTransformer.java	11 Dec 2003 15:36:04 -0000	1.5
  @@ -93,27 +93,37 @@
   
       protected CopletInstanceData getCopletInstanceData() 
       throws SAXException {
  +        return this.getCopletInstanceData(null);
  +    }
  +    
  +    protected CopletInstanceData getCopletInstanceData(String copletId) 
  +    throws SAXException {
           PortalService portalService = null;
           try {
   
               portalService = (PortalService)this.manager.lookup(PortalService.ROLE);
   
               // determine coplet id
  -            String copletId = null;            
               Map context = (Map)objectModel.get(ObjectModelHelper.PARENT_CONTEXT);
  -            if (context != null) {
  -                copletId = (String)context.get(Constants.COPLET_ID_KEY);
  -            } else {
  +            if ( context == null ) {
  +                // set portal name
                   try {
  -                    copletId = this.parameters.getParameter(COPLET_ID_PARAM);
  -                        
  -                    // set portal name
  +                    portalService.setPortalName(this.parameters.getParameter(PORTAL_NAME_PARAM));
  +                } catch (ParameterException e) {
  +                    throw new SAXException("portalName must be passed as parameter or in the object model within the parent context.");
  +                }
  +            }
  +            
  +            if ( copletId == null ) {
  +                if (context != null) {
  +                    copletId = (String)context.get(Constants.COPLET_ID_KEY);
  +                } else {
                       try {
  -                        portalService.setPortalName(this.parameters.getParameter(PORTAL_NAME_PARAM));
  -                    } finally {
  +                        copletId = this.parameters.getParameter(COPLET_ID_PARAM);
  +                            
  +                    } catch (ParameterException e) {
  +                        throw new SAXException("copletId must be passed as parameter or in the object model within the parent context.");
                       }
  -                } catch (ParameterException e) {
  -                    throw new SAXException("copletId and portalName must be passed as parameter or in the object model within the parent context.");
                   }
               }
               if (copletId == null) {