Package org.apache.cocoon.portal

Examples of org.apache.cocoon.portal.LinkService$ParameterDescription


                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 ) {
                    if ( event != null ) {
                        this.collectedEvents.add(event);
                    }
                } else {
                    final String href = linkService.getLinkURI(event);
                    this.output(href, format, newAttrs );
                }
            }
        } else if (name.equals(PARAMETER_ELEM)) {
            if (this.insideLinks) {
View Full Code Here


                }
            }
        } else if ( name.equals(LINKS_ELEM) ) {
            this.insideLinks = false;
            final String format = (String)this.stack.pop();
            final LinkService linkService = this.getPortalService().getComponentManager().getLinkService();
            String href = linkService.getLinkURI(this.collectedEvents);

            AttributesImpl newAttrs = (AttributesImpl)this.stack.pop();
            // test for alternate base url
            final String baseURL = newAttrs.getValue("base-url");
            if ( baseURL != null ) {
View Full Code Here

                    String link = attr.getValue(index);

                    // if attribute found that contains a link
                    if (link != null) {
                        CopletInstanceData cid = this.getCopletInstanceData(attr.getValue("coplet"));                      
                        LinkService linkService = this.getPortalService().getComponentManager().getLinkService();
       
                        // create event link
                        CopletLinkEvent event = new CopletLinkEvent(cid, link);
                        String eventLink = linkService.getLinkURI(event);
   
                        // insert event link
                        attr.setValue(index, eventLink);
                    }
                }
               
                String eventLink = null;
                DocumentFragment fragment = null;
                               
                // process element that contains link
                if (this.elementName != null && name.equals(this.elementName)) {
                    String link = this.endTextRecording();

                    CopletInstanceData cid = this.getCopletInstanceData();                      
                    LinkService linkService = this.getPortalService().getComponentManager().getLinkService();

                    // create event link
                    CopletLinkEvent event = new CopletLinkEvent(cid, link);
                    eventLink = linkService.getLinkURI(event);
                } else {
                    fragment = this.endRecording();
                }
               
                // stream element
View Full Code Here

            e = new ChangeAspectDataEvent( owner, aspectName, data );
        }
        if ( this.requestParameterName != null ) {
            e.setRequestParameterName( this.requestParameterName );
        }
        LinkService service = null;
        try {
            service = (LinkService)this.manager.lookup(LinkService.ROLE);
            service.addEventToLink( e );
        } catch (ServiceException ce) {
            throw new CascadingRuntimeException("Unable to lookup link service.", ce);
        } finally {
            this.manager.release( service );
        }
View Full Code Here

                }
            }
            PortalService service = null;
            try {
                service = (PortalService) this.manager.lookup(PortalService.ROLE);
                LinkService linkService = service.getComponentManager().getLinkService();
               
                //TODO - secure
                List l = new ArrayList();
                if ( sizingEvent != null ) {
                    l.add(sizingEvent);
                }
                l.add(this);
                this.generatedURL = linkService.getLinkURI(l);
               
            } catch (ServiceException se) {
                throw new CascadingRuntimeException("Unable to lookup portal service.", se);
            } finally {
                this.manager.release(service);
View Full Code Here

            Basket basket = this.basketManager.getBasket();
   
            PortalService service = null;
            try {
                service = (PortalService)this.manager.lookup(PortalService.ROLE);
                LinkService linkService = service.getComponentManager().getLinkService();
               
                XMLUtils.startElement(this.xmlConsumer, "basket-content");
   
                XMLUtils.startElement(this.xmlConsumer, "item-count");
                XMLUtils.data(this.xmlConsumer, String.valueOf(basket.size()));
                XMLUtils.endElement(this.xmlConsumer, "item-count");
                XMLUtils.startElement(this.xmlConsumer, "persist-url");
                final Event saveEvent = new SaveBasketEvent();
                XMLUtils.data(this.xmlConsumer, linkService.getLinkURI(saveEvent));
                XMLUtils.endElement(this.xmlConsumer, "persist-url");
               
                if ( basket.size() > 0 ) {
                    ProfileManager profileManager = service.getComponentManager().getProfileManager();
                   
                    XMLUtils.startElement(this.xmlConsumer, "items");
                    for(int i=0; i<basket.size();i++) {
                        Object item = basket.getItem(i);
                        XMLUtils.startElement(this.xmlConsumer, "item");
                        XMLUtils.startElement(this.xmlConsumer, "id");
                        XMLUtils.data(this.xmlConsumer, item.toString());
                        XMLUtils.endElement(this.xmlConsumer, "id");
                        if ( item instanceof ContentItem ) {
                            ContentItem ci = (ContentItem)item;
                            Event e = new ShowItemEvent(item, profileManager.getPortalLayout(null, this.showLayoutId), this.showCopletId);
                            XMLUtils.startElement(this.xmlConsumer, "show-url");
                            XMLUtils.data(this.xmlConsumer, linkService.getLinkURI(e));
                            XMLUtils.endElement(this.xmlConsumer, "show-url");
                            if (ci.size() != -1 ) {
                                XMLUtils.startElement(this.xmlConsumer, "size");
                                XMLUtils.data(this.xmlConsumer, String.valueOf(ci.size()));
                                XMLUtils.endElement(this.xmlConsumer, "size");
                            }                       
                        }
                        Event removeEvent = new RemoveItemEvent(item);
                        XMLUtils.startElement(this.xmlConsumer, "remove-url");
                        XMLUtils.data(this.xmlConsumer, linkService.getLinkURI(removeEvent));
                        XMLUtils.endElement(this.xmlConsumer, "remove-url");
                        XMLUtils.endElement(this.xmlConsumer, "item");
                    }
                    XMLUtils.endElement(this.xmlConsumer, "items");
                }
View Full Code Here

        List baskets = this.basketManager.getBaskets();

        PortalService service = null;
        try {
            service = (PortalService)this.manager.lookup(PortalService.ROLE);
            LinkService linkService = service.getComponentManager().getLinkService();
            XMLUtils.startElement(this.xmlConsumer, "basket-admin");
            if ( baskets.size() > 0 ) {
                XMLUtils.startElement(this.xmlConsumer, "baskets");
                for(int i=0; i<baskets.size();i++) {
                    BasketManager.BasketDescription item = (BasketManager.BasketDescription)baskets.get(i);
                    XMLUtils.startElement(this.xmlConsumer, "basket");

                    XMLUtils.startElement(this.xmlConsumer, "id");
                    XMLUtils.data(this.xmlConsumer, item.id);
                    XMLUtils.endElement(this.xmlConsumer, "id");
                   
                    XMLUtils.startElement(this.xmlConsumer, "size");
                    XMLUtils.data(this.xmlConsumer, String.valueOf(item.size));
                    XMLUtils.endElement(this.xmlConsumer, "size");
                   
                    Event event = new CleanBasketEvent(item.id);
                    XMLUtils.startElement(this.xmlConsumer, "remove-url");
                    XMLUtils.data(this.xmlConsumer, linkService.getLinkURI(event));
                    XMLUtils.endElement(this.xmlConsumer, "remove-url");
                   
                    event = new ShowBasketEvent(item.id);
                    XMLUtils.startElement(this.xmlConsumer, "show-url");
                    XMLUtils.data(this.xmlConsumer, linkService.getLinkURI(event));
                    XMLUtils.endElement(this.xmlConsumer, "show-url");

                    XMLUtils.endElement(this.xmlConsumer, "basket");
                }
                XMLUtils.endElement(this.xmlConsumer, "baskets");
            }
            Event e;
            e = new RefreshBasketEvent();
            XMLUtils.startElement(this.xmlConsumer, "refresh-url");
            XMLUtils.data(this.xmlConsumer, linkService.getLinkURI(e));
            XMLUtils.endElement(this.xmlConsumer, "refresh-url");
           
            e = new CleanBasketEvent();
            XMLUtils.startElement(this.xmlConsumer, "clean-url");
            XMLUtils.data(this.xmlConsumer, linkService.getLinkURI(e));
            XMLUtils.endElement(this.xmlConsumer, "clean-url");
           
            XMLUtils.endElement(this.xmlConsumer, "basket-admin");
        } catch (ServiceException se) {
            throw new SAXException("Unable to lookup portal service.", se);
View Full Code Here

                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 ) {
                    if ( event != null ) {
                        this.collectedEvents.add(event);
                    }
                } else {
                    final String href = linkService.getLinkURI(event);
                    this.output(href, format, newAttrs );
                }
            }
        } else if (name.equals(LINKS_ELEM) ) {
            this.insideLinks = true;
View Full Code Here

                }
            }
        } else if ( name.equals(LINKS_ELEM) ) {
            this.insideLinks = false;
            final String format = (String)this.stack.pop();
            final LinkService linkService = this.getPortalService().getComponentManager().getLinkService();
           
            final String href = linkService.getLinkURI(this.collectedEvents);
            final AttributesImpl newAttrs = new AttributesImpl();
            this.output(href, format, newAttrs );

            this.collectedEvents.clear();
            if ( this.content != null ) {
View Full Code Here

                    String link = attr.getValue(index);

                    // if attribute found that contains a link
                    if (link != null) {
                        CopletInstanceData cid = this.getCopletInstanceData();                      
                        LinkService linkService = this.getPortalService().getComponentManager().getLinkService();
       
                        // create event link
                        CopletLinkEvent event = new CopletLinkEvent(cid, link);
                        String eventLink = linkService.getLinkURI(event);
   
                        // insert event link
                        attr.setValue(index, eventLink);
                    }
                }
               
                String eventLink = null;
                DocumentFragment fragment = null;
                               
                // process element that contains link
                if (this.elementName != null && name.equals(this.elementName)) {
                    String link = this.endTextRecording();

                    CopletInstanceData cid = this.getCopletInstanceData();                      
                    LinkService linkService = this.getPortalService().getComponentManager().getLinkService();

                    // create event link
                    CopletLinkEvent event = new CopletLinkEvent(cid, link);
                    eventLink = linkService.getLinkURI(event);
                } else {
                    fragment = this.endRecording();
                }
               
                // stream element
View Full Code Here

TOP

Related Classes of org.apache.cocoon.portal.LinkService$ParameterDescription

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.