Package org.apache.wookie.beans.util

Examples of org.apache.wookie.beans.util.IPersistenceManager.findByValues()


  public IParticipant getViewer(IWidgetInstance widgetInstance){
    IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    Map<String, Object> map = new HashMap<String, Object>();
    map.put("sharedDataKey", this.sharedDataKey);//$NON-NLS-1$
    map.put("participantId", widgetInstance.getUserId());//$NON-NLS-1$
    IParticipant [] participants = persistenceManager.findByValues(IParticipant.class, map);
    if(participants != null && participants.length == 1) return participants[0];
    return null;
  }
}
View Full Code Here


        IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    Map<String, Object> map = new HashMap<String, Object>();
    map.put("sharedDataKey", instance.getSharedDataKey());//$NON-NLS-1$
    map.put("widget", instance.getWidget());//$NON-NLS-1$
    map.put("participantId", participantId);//$NON-NLS-1$
    if (persistenceManager.findByValues(IParticipant.class, map).length != 0) return false;   

    // Add participant
    IParticipant participant = persistenceManager.newInstance(IParticipant.class);
    participant.setParticipantId(participantId);
    participant.setParticipantDisplayName(participantDisplayName);
View Full Code Here

        IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    Map<String, Object> map = new HashMap<String, Object>();
    map.put("sharedDataKey", instance.getSharedDataKey());//$NON-NLS-1$
    map.put("widget", instance.getWidget());//$NON-NLS-1$
    map.put("participantId", participantId);//$NON-NLS-1$
    participants = persistenceManager.findByValues(IParticipant.class, map);
    if (participants.length != 1) return false
    // Remove participant
    persistenceManager.delete(participants[0]);
    return true;
  }
View Full Code Here

        // test generic findByValues methods
        Map<String,Object> values = new HashMap<String,Object>();
        values.put("height", allWidgets[0].getHeight());
        values.put("width", allWidgets[0].getWidth());
        values.put("widgetAuthor", allWidgets[0].getWidgetAuthor());
        IWidget [] widgetsByValues = persistenceManager.findByValues(IWidget.class, values);
        assertNotNull(widgetsByValues);
        assertEquals(1, widgetsByValues.length);
        assertEquals(allWidgets[0], widgetsByValues[0]);
       
        // test custom widget query methods
View Full Code Here

        IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
        IWidget widget = persistenceManager.findById(IWidget.class, widgetKey);
    Map<String, Object> map = new HashMap<String, Object>();
    map.put("widget", widget);
    map.put("widgetContext", serviceType);
        IWidgetDefault[] widgetDefaults = persistenceManager.findByValues(IWidgetDefault.class, map);
    persistenceManager.delete(widgetDefaults);
  }
 
  private boolean doesServiceExistForWidget(Object dbkey, String serviceType){
        IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
View Full Code Here

        //
        // removed for now as this is a deprecated method, and can't be called
        // at this point due to transaction boundaries.
        //
        //values.put("widgetAuthor", allWidgets[0].getWidgetAuthor());
        IWidget [] widgetsByValues = persistenceManager.findByValues(IWidget.class, values);
        assertNotNull(widgetsByValues);
        assertEquals(1, widgetsByValues.length);
        assertEquals(allWidgets[0], widgetsByValues[0]);
       
        //
View Full Code Here

        //
        // removed for now as this is a deprecated method, and can't be called
        // at this point due to transaction boundaries.
        //
        //values.put("widgetAuthor", allWidgets[0].getWidgetAuthor());
        IWidget [] widgetsByValues = persistenceManager.findByValues(IWidget.class, values);
        assertNotNull(widgetsByValues);
        assertEquals(1, widgetsByValues.length);
        assertEquals(allWidgets[0], widgetsByValues[0]);
       
        //
View Full Code Here

   
    //
    // Execute the query and obtain array of results
    // We assert that there are never duplicates.
    //
    ISharedData[] results = (ISharedData[]) persistenceManager.findByValues(ISharedData.class, params);
    assert(results.length <= 1);
   
    //
    // If the result contains a single item, return it, otherwise return null.
    //
View Full Code Here

  public IParticipant getParticipant(String participantId){
    IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    Map<String, Object> map = new HashMap<String, Object>();
    map.put("sharedDataKey", this.sharedDataKey);//$NON-NLS-1$
    map.put("participantId", participantId);//$NON-NLS-1$
    IParticipant[] participants = persistenceManager.findByValues(IParticipant.class, map);
    if (participants.length == 1) return participants[0];
    return null;    
  }
 
  /**
 
View Full Code Here

  public IParticipant getViewer(IWidgetInstance widgetInstance){
    IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    Map<String, Object> map = new HashMap<String, Object>();
    map.put("sharedDataKey", this.sharedDataKey);//$NON-NLS-1$
    map.put("participantId", widgetInstance.getUserId());//$NON-NLS-1$
    IParticipant [] participants = persistenceManager.findByValues(IParticipant.class, map);
    if(participants != null && participants.length == 1) return participants[0];
    return null;
  }
 
  /**
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.