Package org.apache.cocoon.portal.coplet

Examples of org.apache.cocoon.portal.coplet.CopletInstanceData


  public void resetValue(Object object) {
    ((CopletLayout)object).setCopletInstanceData(null);
  }

  public void setValue(Object object, Object value) {
    CopletInstanceData copletInstanceData = (CopletInstanceData)getObjectMap().get(value);
    if (copletInstanceData == null) {
      throw new ProfileException(
                    "Referenced Coplet Instance Data "+value+" does not exist.");
        }
    ((CopletLayout)object).setCopletInstanceData(copletInstanceData);
View Full Code Here


        try {
            portalService = (PortalService) manager.lookup(PortalService.ROLE);
            portalService.setPortalName(portalName);
               
            ProfileManager profileManager = portalService.getComponentManager().getProfileManager();
            CopletInstanceData data = profileManager.getCopletInstanceData(copletID);
            return data;
        } catch (ServiceException e) {
            throw new ProcessingException("Error getting portal service.", e);
        } finally {
            manager.release(portalService);
View Full Code Here

                    final String path = ((ChangeCopletsJXPathEvent)e).getPath();
                    final Object value = ((ChangeCopletsJXPathEvent)e).getValue();
                   
                    Iterator i = instances.iterator();
                    while ( i.hasNext() ) {
                        CopletInstanceData current = (CopletInstanceData) i.next();
                        Event event = new CopletJXPathEvent(current, path, value);
                        publisher.publish(event);
                    }
                }
            }
View Full Code Here

    public void toSAX(RendererAspectContext context,
                        Layout layout,
                        PortalService service,
                        ContentHandler contenthandler)
    throws SAXException {
        CopletInstanceData cid = ((CopletLayout)layout).getCopletInstanceData();
        Boolean b = (Boolean)cid.getCopletData().getAttribute("basket-content");
        if ( b != null && b.equals(Boolean.TRUE) ) {
            Object item = new ContentItem(cid, true);
            Event event = new AddItemEvent(item);
            XMLUtils.createElement(contenthandler, "basket-add-content", service.getComponentManager().getLinkService().getLinkURI(event));
        }
        b = (Boolean)cid.getCopletData().getAttribute("basket-link");
        if ( b != null && b.equals(Boolean.TRUE) ) {
            Object item = new ContentItem(cid, false);
            Event event = new AddItemEvent(item);
            XMLUtils.createElement(contenthandler, "basket-add-link", service.getComponentManager().getLinkService().getLinkURI(event));           
        }
View Full Code Here

     * This adapter listens for CopletInstanceEvents. Each event sets the cache invalid.
     */
    public void handleCopletInstanceEvent(Event e) {
        final CopletInstanceEvent event = (CopletInstanceEvent) e;

        final CopletInstanceData coplet = (CopletInstanceData) event.getTarget();

        this.setCacheInvalid(coplet);
    }
View Full Code Here

     * @return The coplet instance data
     * @throws SAXException If an errors occurs or the instance data is not available
     */
    protected CopletInstanceData getCopletInstanceData()
    throws SAXException {
        CopletInstanceData cid = this.getCopletInstanceData(null);
        if ( cid == null ) {
            throw new SAXException("Could not find coplet instance data for the current pipeline.");
        }
        return cid;
    }
View Full Code Here

        }
        if (copletId == null) {
            throw new SAXException("copletId must be passed as parameter or in the object model within the parent context.");
        }

        CopletInstanceData object = this.getPortalService().getComponentManager().getProfileManager().getCopletInstanceData( copletId );
           
        return object;
    }
View Full Code Here

        return result;
    }

    public Object newInstance(Object parent) {
        return new CopletInstanceData();
    }
View Full Code Here

    public void resetValue(Object object) {
        ((CopletInstanceDataManager) object).getCopletInstanceData().clear();
    }

    public void setValue(Object object, Object value) {
        CopletInstanceData data = (CopletInstanceData) value;
        ((CopletInstanceDataManager) object).getCopletInstanceData().put(
            data.getId(),
            data);
    }
View Full Code Here

            String expression = attr.getValue(SELECT_ATTR);
            if (expression == null) {
                throw new ProcessingException("Attribute "+SELECT_ATTR+" must be spcified.");
            }
               
            CopletInstanceData cid = this.getCopletInstanceData();
           
            JXPathContext jxpathContext = JXPathContext.newContext( cid );
            Object object = jxpathContext.getValue(expression);
               
            if (object == null) {
                throw new ProcessingException("Could not find value for expression "+expression);
            }
               
        } else if (name.equals(LINK_ELEM)) {

            final LinkService linkService = this.getPortalService().getComponentManager().getLinkService();
            final String format = attr.getValue("format");
            AttributesImpl newAttrs = new AttributesImpl();
            newAttrs.setAttributes(attr);
            newAttrs.removeAttribute("format");

            if ( attr.getValue("href") != null ) {
                final CopletInstanceData cid = this.getCopletInstanceData();
                ChangeCopletInstanceAspectDataEvent event = new ChangeCopletInstanceAspectDataEvent(cid, null, null);
               
                String value = linkService.getLinkURI(event);
                if (value.indexOf('?') == -1) {
                    value = value + '?' + attr.getValue("href");
                } else {
                    value = value + '&' + attr.getValue("href");
                }
                newAttrs.removeAttribute("href");
                this.output(value, format, newAttrs );
            } else {
                final String path = attr.getValue("path");
                final String value = attr.getValue("value");
               
                newAttrs.removeAttribute("path");
                newAttrs.removeAttribute("value");
               
                JXPathEvent event = null;
                if ( attr.getValue("layout") != null ) {
                    newAttrs.removeAttribute("layout");
                    final String layoutId = attr.getValue("layout");
                    Object layout = this.getPortalService().getComponentManager().getProfileManager().getPortalLayout(null, layoutId);
                    if ( layout != null ) {
                        event = new JXPathEvent(layout, path, value);
                    }
                } else {
                    String copletId = attr.getValue("coplet");
                    newAttrs.removeAttribute("coplet");
                    final CopletInstanceData cid = this.getCopletInstanceData(copletId);
                    if ( cid != null ) {
                        event = new CopletJXPathEvent(cid, path, value);
                    }
                }
                if ( this.insideLinks ) {
View Full Code Here

TOP

Related Classes of org.apache.cocoon.portal.coplet.CopletInstanceData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.