Package org.apache.wookie.beans

Examples of org.apache.wookie.beans.ISharedData


    String cloneKey = SharedDataHelper.getInternalSharedDataKey(instance, cloneSharedDataKey);
        IWidget widget = instance.getWidget();
        IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    for (ISharedData sharedData : new SharedContext(instance).getSharedData())
    {
        ISharedData clone = persistenceManager.newInstance(ISharedData.class);
            clone.setDkey(sharedData.getDkey());
            clone.setDvalue(sharedData.getDvalue());
            clone.setSharedDataKey(cloneKey);
            persistenceManager.save(clone);
    }
    boolean ok = persistenceManager.save(widget);
    if (!ok) throw new InvalidParametersException();
  }
View Full Code Here


    String value = null;
    // Note that preferences and shared data keys may be the same!
    // We let the shared data values override.
    IPreference pref = instance.getPreference(name);
    if (pref != null) value = pref.getDvalue();
    ISharedData data = new SharedContext(instance).getSharedData(name);
    if (data != null) value = data.getDvalue();
    if (value == null) throw new ResourceNotFoundException();
    PrintWriter out = response.getWriter();
    out.write(value);
  }
View Full Code Here

    if(id_key==null) return localizedMessages.getString("WidgetAPIImpl.0");
    if(key==null) return localizedMessages.getString("WidgetAPIImpl.1");
        IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
        IWidgetInstance widgetInstance = persistenceManager.findWidgetInstanceByIdKey(id_key);
    if (widgetInstance == null) return localizedMessages.getString("WidgetAPIImpl.0");
    ISharedData data = SharedDataHelper.findSharedData(widgetInstance, key);
    if (data == null) return localizedMessages.getString("WidgetAPIImpl.1");
    return data.getDvalue();
  }
View Full Code Here

    String value = null;
    // Note that preferences and shared data keys may be the same!
    // We let the shared data values override.
    IPreference pref = instance.getPreference(name);
    if (pref != null) value = pref.getDvalue();
    ISharedData data = SharedDataHelper.findSharedData(instance, name);
    if (data != null) value = data.getDvalue();
    if (value == null) throw new ResourceNotFoundException();
    PrintWriter out = response.getWriter();
    out.write(value);
  }
View Full Code Here

   */
  public synchronized static boolean updateSharedDataEntry(IWidgetInstance widgetInstance, String name, String value, boolean append){
    IWidget widget = widgetInstance.getWidget();
        IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
        boolean found=false;
        ISharedData sharedData = SharedDataHelper.findSharedData(widgetInstance, name);
        if (sharedData != null)
        {
            if(value==null || value.equalsIgnoreCase("null")){
              persistenceManager.delete(sharedData);
            }
            else{   
                if(append){
                    sharedData.setDvalue(sharedData.getDvalue() + value);
                }
                else{
                    sharedData.setDvalue(value);
                }
            }
            found=true;
        }
    if(!found){    
      if(value!=null){
        String sharedDataKey = SharedDataHelper.getInternalSharedDataKey(widgetInstance);   
        sharedData = persistenceManager.newInstance(ISharedData.class);
        sharedData.setSharedDataKey(sharedDataKey);
        sharedData.setDkey(name);
        sharedData.setDvalue(value);
        persistenceManager.save(sharedData);
      }
    }
        persistenceManager.save(widget);
        return found;
View Full Code Here

    String cloneKey = SharedDataHelper.getInternalSharedDataKey(instance, cloneSharedDataKey);
        IWidget widget = instance.getWidget();
        IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    for (ISharedData sharedData : SharedDataHelper.findSharedData(instance))
    {
        ISharedData clone = persistenceManager.newInstance(ISharedData.class);
            clone.setDkey(sharedData.getDkey());
            clone.setDvalue(sharedData.getDvalue());
            clone.setSharedDataKey(cloneKey);
            persistenceManager.save(clone);
    }
    boolean ok = persistenceManager.save(widget);
    if (!ok) throw new InvalidParametersException();
  }
View Full Code Here

    if(id_key==null) return localizedMessages.getString("WidgetAPIImpl.0");
    if(key==null) return localizedMessages.getString("WidgetAPIImpl.1");
        IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
        IWidgetInstance widgetInstance = persistenceManager.findWidgetInstanceByIdKey(id_key);
    if (widgetInstance == null) return localizedMessages.getString("WidgetAPIImpl.0");
    ISharedData data = widgetInstance.getSharedData(key);
    if (data == null) return localizedMessages.getString("WidgetAPIImpl.1");
    return data.getDvalue();
  }
View Full Code Here

    String cloneKey = SharedDataHelper.getInternalSharedDataKey(instance, cloneSharedDataKey);
        IWidget widget = instance.getWidget();
        IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    for (ISharedData sharedData : new SharedContext(instance).getSharedData())
    {
        ISharedData clone = persistenceManager.newInstance(ISharedData.class);
            clone.setDkey(sharedData.getDkey());
            clone.setDvalue(sharedData.getDvalue());
            clone.setSharedDataKey(cloneKey);
            persistenceManager.save(clone);
    }
    boolean ok = persistenceManager.save(widget);
    if (!ok) throw new InvalidParametersException();
  }
View Full Code Here

    String value = null;
    // Note that preferences and shared data keys may be the same!
    // We let the shared data values override.
    IPreference pref = instance.getPreference(name);
    if (pref != null) value = pref.getDvalue();
    ISharedData data = instance.getSharedData(name);
    if (data != null) value = data.getDvalue();
    if (value == null) throw new ResourceNotFoundException();
    PrintWriter out = response.getWriter();
    out.write(value);
  }
View Full Code Here

   */
  public synchronized static boolean updateSharedDataEntry(IWidgetInstance widgetInstance, String name, String value, boolean append){
    IWidget widget = widgetInstance.getWidget();
        IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
        boolean found=false;
        ISharedData sharedData = widget.getSharedData(widgetInstance.getSharedDataKey(), name);
        if (sharedData != null)
        {
            if(value==null || value.equalsIgnoreCase("null")){  
                widget.getSharedData().remove(sharedData);
            }
            else{   
                if(append){
                    sharedData.setDvalue(sharedData.getDvalue() + value);
                }
                else{
                    sharedData.setDvalue(value);
                }
            }
            found=true;
        }
    if(!found){    
      if(value!=null){
        String sharedDataKey = widgetInstance.getSharedDataKey();   
        sharedData = persistenceManager.newInstance(ISharedData.class);
        sharedData.setSharedDataKey(sharedDataKey);
        sharedData.setDkey(name);
        sharedData.setDvalue(value);
        widget.getSharedData().add(sharedData);
      }
    }
        persistenceManager.save(widget);
        return found;
View Full Code Here

TOP

Related Classes of org.apache.wookie.beans.ISharedData

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.