Package org.apache.cocoon.portal.coplet

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


               
                ContentItem ci = (ContentItem)event.getItem();
                CopletLayout layout = (CopletLayout) event.getLayout();
                CopletInstanceData cid = null;
                if ( ci.isContent() ) {
                    CopletData copletData = service.getComponentManager().getProfileManager().getCopletData(event.getCopletDataId());
                    cid = service.getComponentManager().getCopletFactory().newInstance(copletData);
                    cid.setAttribute("item-content", ci.getContent());               
                } else {
                    if ( ci.getURL() != null ) {
                        SourceResolver resolver = null;
                        Source source = null;
                        String url = null;
                        try {
                            resolver = (SourceResolver)this.manager.lookup(SourceResolver.ROLE);
                            url = ci.getURL();
                            source = resolver.resolveURI(url);
                            CopletData copletData = service.getComponentManager().getProfileManager().getCopletData(event.getCopletDataId());
                            cid = service.getComponentManager().getCopletFactory().newInstance(copletData);
                            cid.setAttribute("item-content", IOUtils.toByteArray(source.getInputStream()));
                        } catch (IOException se) {
                            this.getLogger().warn("Unable to get content for " + url, se);
                        } catch (ServiceException se) {
                            this.getLogger().warn("Unable to get source resolver.", se);
                        } finally {
                            if ( source != null ) {
                                resolver.release(source);
                            }
                            this.manager.release(resolver);
                        }
                       
                    } else {
                        final CopletInstanceData original = service.getComponentManager().getProfileManager().getCopletInstanceData(ci.getCopletId());
                        final CopletData copletData = original.getCopletData();
                        cid = service.getComponentManager().getCopletFactory().newInstance(copletData);
                        Map attributes = (Map) ci.getAttribute("coplet-attributes");
                        Iterator i = attributes.entrySet().iterator();
                        while ( i.hasNext() ) {
                            Map.Entry entry = (Map.Entry)i.next();
View Full Code Here


            copletInstanceDataManager = (CopletInstanceDataManager) adapter.loadProfile(map, parameters);

            CopletFactory copletFactory = service.getComponentManager().getCopletFactory();
            Iterator iterator = copletDataManager.getCopletData().values().iterator();
            while (iterator.hasNext()) {
                CopletData cd = (CopletData) iterator.next();
                copletFactory.prepare(cd);
            }
            iterator = copletInstanceDataManager.getCopletInstanceData().values().iterator();
            while (iterator.hasNext()){
                CopletInstanceData cid = (CopletInstanceData) iterator.next();
View Full Code Here

        ((LayoutFactory)factory).prepareLayout((Layout)object);
      } else if (object instanceof CopletDataManager) {
        CopletFactory copletFactory = (CopletFactory)factory;
        Iterator iterator = ((CopletDataManager)object).getCopletData().values().iterator();
        while (iterator.hasNext()) {
          CopletData cd = (CopletData)iterator.next();
          copletFactory.prepare(cd);
        }
      } else if (object instanceof CopletInstanceDataManager) {
        CopletFactory copletFactory = (CopletFactory)factory;
        Iterator iterator = ((CopletInstanceDataManager)object).getCopletInstanceData().values().iterator();
View Full Code Here

    CopletDataManager manager = (CopletDataManager)object;
   
    this.deltaApplied = true;

    Iterator iterator = manager.getCopletData().values().iterator();
    CopletData data, delta;
    while (iterator.hasNext()) {
      delta = (CopletData)iterator.next();
      data = this.getCopletData(delta.getId());
      if (data == null) {
        this.putCopletData(delta);
      } else {
        data.applyDelta(delta);
      }
    }
   
    return true;
  }
View Full Code Here

* @version CVS $Id: CopletDataReferenceFieldHandler.java,v 1.4 2003/08/19 14:09:34 cziegeler Exp $
*/
public class CopletDataReferenceFieldHandler extends ReferenceFieldHandler {

    public Object getValue(Object object) {
        CopletData copletData = ((CopletInstanceData) object).getCopletData();
        if (copletData != null) {
            return copletData.getId();
        } else {
            return null;
        }
    }
View Full Code Here

   */
  public void adjustReferences(Object object) {
    CopletDataManager manager = (CopletDataManager)object;
   
    Iterator iterator = this.copletData.values().iterator();
    CopletData data, other;
    while (iterator.hasNext()) {
      data = (CopletData)iterator.next();
      if (!data.deltaApplied()) {
        other = manager.getCopletData(data.getId());
        if (other != null) {
          this.putCopletData(other);
        }
      }
    }
View Full Code Here

            return null;
        }
    }

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

    public void resetValue(Object object) {
        ((CopletInstanceData) object).setCopletData(null);
    }

    public void setValue(Object object, Object value) {
        CopletData copletData = (CopletData) getObjectMap().get(value);
        if (copletData == null)
            throw new IllegalArgumentException(
                "Referenced Coplet Data " + value + " does not exist.");
        ((CopletInstanceData) object).setCopletData(copletData);
    }
View Full Code Here

        return result;
    }

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

    public void resetValue(Object object) {
        ((CopletDataManager) object).getCopletData().clear();
    }

    public void setValue(Object object, Object value) {
        CopletData data = (CopletData) value;
        ((CopletDataManager) object).getCopletData().put(data.getId(), data);
    }
View Full Code Here

TOP

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

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.