Package org.apache.wookie.beans.util

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


   * Return the "default widget" instance
   * @return an IWidgetInstance for the default widget, typically the "unsupported widget widget"
   */
  public static IWidgetInstance defaultInstance(String locale){
        IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    IWidgetInstance instance = persistenceManager.newInstance(IWidgetInstance.class);
    instance.setWidget(persistenceManager.findWidgetDefaultByType("unsupported")); //$NON-NLS-1$
    instance.setIdKey("0000");
    instance.setLang(locale);
    instance.setOpensocialToken("");
    return instance;
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);
    }
View Full Code Here

   * @throws SystemUnavailableException if there is a problem generating the key
   */
  public static void createKey(HttpServletRequest request, String email, Messages localizedMessages) throws SystemUnavailableException, EmailException {
     
      IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    IApiKey key = persistenceManager.newInstance(IApiKey.class);
    key.setEmail(email);

    // generate a nonce
    RandomGUID r = new RandomGUID();
    String nonce = "nonce-" + r.toString();         //$NON-NLS-1$
View Full Code Here

    values.put("email", email);
    if (persistenceManager.findByValues(IApiKey.class, values).length > 0){
      throw new ResourceDuplicationException();
    }
   
    IApiKey apiKey = persistenceManager.newInstance(IApiKey.class);
    apiKey.setValue(value);
    apiKey.setEmail(email);
    persistenceManager.save(apiKey);
    _logger.info("New API key registered for "+email);
    return true;
View Full Code Here

            }
            found=true;
        }
        if(!found){ 
          if (value != null){
                preference = persistenceManager.newInstance(IPreference.class);
            preference.setDkey(name);
            preference.setDvalue(value);
            widgetInstance.getPreferences().add(preference);
          }
        } 
View Full Code Here

    try {
      ws = getWidgetService(resourceId);
      throw new ResourceDuplicationException();
    } catch (ResourceNotFoundException e) {
        IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
      ws = persistenceManager.newInstance(IWidgetService.class);
      ws.setServiceName(resourceId);
      return persistenceManager.save(ws);
    }
  }
View Full Code Here

        assertNull(widgetInstance);
       
        //
        // Create the Widget Instance
        //
        widgetInstance = persistenceManager.newInstance(IWidgetInstance.class);
       
        //
        // Set some properties, including preferences
        //
        widgetInstance.setApiKey(apiKey);
View Full Code Here

        widgetInstance.setNonce("nonce-test");
        widgetInstance.setOpensocialToken("");
        widgetInstance.setSharedDataKey("test-shared-data-key");
        widgetInstance.setShown(true);
        widgetInstance.setUserId("test");
        IPreference widgetInstancePreference = persistenceManager.newInstance(IPreference.class);
        widgetInstancePreference.setDkey("sharedDataKey");
        widgetInstancePreference.setDvalue("test-shared-data-key");
        widgetInstancePreference.setReadOnly(true);
        widgetInstance.getPreferences().add(widgetInstancePreference);
        //
View Full Code Here

        persistenceManager.save(widgetInstance);

        //
        // create a participant
        //
        IParticipant participant = persistenceManager.newInstance(IParticipant.class);
        //participant.setWidget(widget);
        participant.setSharedDataKey("test-shared-data-key");
        participant.setParticipantId("test");
        participant.setParticipantDisplayName("");
        participant.setParticipantThumbnailUrl("");
View Full Code Here

        assertNull(widgetInstance);
       
        //
        // Create the Widget Instance
        //
        widgetInstance = persistenceManager.newInstance(IWidgetInstance.class);
       
        //
        // Set some properties, including preferences
        //
        widgetInstance.setApiKey(apiKey);
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.