Package org.apache.wookie.beans

Examples of org.apache.wookie.beans.IWidgetInstance


   * UNlocks a widget insa
   * @param request
   * @throws InvalidParametersException
   */
  public static void doResumeWidget(HttpServletRequest request) throws InvalidParametersException{         
    IWidgetInstance instance = WidgetInstancesController.findWidgetInstance(request);
    if(instance!=null){
      unlockWidgetInstance(instance);
      Notifier.notifyWidgets(request.getSession(), instance, Notifier.STATE_UPDATED);
    }else{
      throw new InvalidParametersException();
View Full Code Here


    String widgetId = request.getParameter("widgetid"); //$NON-NLS-1$
    sharedDataKey = SharedDataHelper.getInternalSharedDataKey(apiKey, widgetId, sharedDataKey);
    if(userId==null || sharedDataKey==null || (serviceType==null && widgetId==null)){
      throw new InvalidParametersException();
    }
    IWidgetInstance instance = WidgetInstancesController.findWidgetInstance(request);
    if(instance==null){
      throw new ResourceNotFoundException();
    }
    else{
      WidgetInstanceFactory.destroy(instance);
View Full Code Here

      return;
    }

    checkProxy(request);
   
    IWidgetInstance instance = WidgetInstancesController.getLocalizedWidgetInstance(request);
        String locale = request.getParameter("locale");//$NON-NLS-1$
   
    // Widget exists
    if(instance==null){
      instance = WidgetInstanceFactory.getWidgetFactory(session, localizedMessages).newInstance(apiKey, userId, sharedDataKey, serviceType, widgetId, locale);
View Full Code Here

   * Create a clone of the instance
   * @param request
   * @throws InvalidParametersException
   */
  public static void cloneSharedData(HttpServletRequest request) throws InvalidParametersException{
    IWidgetInstance instance = WidgetInstancesController.findWidgetInstance(request)
    if (instance == null){
      throw new InvalidParametersException();   
    }
    String sharedDataKey = request.getParameter("shareddatakey");   //$NON-NLS-1$; 
    String cloneSharedDataKey = request.getParameter("cloneshareddatakey");
    if (sharedDataKey == null || sharedDataKey.trim().equals("") || cloneSharedDataKey == null || cloneSharedDataKey.trim().equals("")){//$NON-NLS-1$ //$NON-NLS-2$
      throw new InvalidParametersException();
    }
    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());
View Full Code Here

   * the locale if the user has changed it.
   * @param request
   * @return the widget instance
   */
  private static IWidgetInstance getLocalizedWidgetInstance(HttpServletRequest request){
    IWidgetInstance instance = WidgetInstancesController.findWidgetInstance(request);
    if (instance != null){
      String locale = request.getParameter("locale");//$NON-NLS-1$
      // If the requested locale is different to the saved locale, update the "lang" attribute
      // of the widget instance and save it
      if (
          (locale == null && instance.getLang()!=null) ||
          (locale != null && instance.getLang()==null) ||          
          (locale != null && !instance.getLang().equals(locale))
      ){
        IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
        instance.setLang(locale);
        persistenceManager.save(instance);
      }
    }
    return instance;
  }
View Full Code Here

   * even to the WidgetInstance ActiveRecord class.
   * @param request
   * @return
   */
  public static IWidgetInstance findWidgetInstance(HttpServletRequest request){
    IWidgetInstance instance;
    IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();

    // Try using the id_key parameter
    String id_key = request.getParameter("id_key"); //$NON-NLS-1$
   
View Full Code Here

   * @param widgetId
   * @return the widget instance, or null if there is no matching instance
   * @throws UnsupportedEncodingException
   */
  public static IWidgetInstance findWidgetInstance(String apiKey, String userId, String sharedDataKey, String widgetId) throws UnsupportedEncodingException{
    IWidgetInstance instance = null;
    IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    if (widgetId != null){
      widgetId = URLDecoder.decode(widgetId, "UTF-8"); //$NON-NLS-1$
      _logger.debug("Looking for widget instance with widgetid of " + widgetId);
      instance = persistenceManager.findWidgetInstanceByGuid(apiKey, userId, sharedDataKey, widgetId);
View Full Code Here

 
  // Implementation
 
  @Override
  public void show(String resourceId,HttpServletRequest request, HttpServletResponse response) throws UnauthorizedAccessException,ResourceNotFoundException, IOException{
    IWidgetInstance instance = WidgetInstancesController.findWidgetInstance(request);
    if (instance == null) throw new ResourceNotFoundException();
    IParticipant[] participants = new SharedContext(instance).getParticipants();
    switch (format(request)) {
       case XML: returnXml(ParticipantHelper.createXMLParticipantsDocument(participants),response);break;
       case JSON: returnJson(ParticipantHelper.createJSONParticipantsDocument(participants),response);break;
View Full Code Here

   */
  public static boolean create(HttpServletRequest request)
      throws ResourceDuplicationException, InvalidParametersException,
      UnauthorizedAccessException {

    IWidgetInstance instance = WidgetInstancesController.findWidgetInstance(request);
    if (instance == null) throw new InvalidParametersException();
   
    HttpSession session = request.getSession(true);           
    String participantId = request.getParameter("participant_id"); //$NON-NLS-1$
    String participantDisplayName = request.getParameter("participant_display_name"); //$NON-NLS-1$
View Full Code Here

    return remove(request);
  }
  public static boolean remove(HttpServletRequest request)
      throws ResourceNotFoundException, UnauthorizedAccessException,
      InvalidParametersException {
    IWidgetInstance instance = WidgetInstancesController.findWidgetInstance(request);
    if (instance == null) throw new InvalidParametersException();
    HttpSession session = request.getSession(true);           
    String participantId = request.getParameter("participant_id"); //$NON-NLS-1$
    if(new SharedContext(instance).removeParticipant(participantId)){
      Notifier.notifyWidgets(session, instance, Notifier.PARTICIPANTS_UPDATED);
View Full Code Here

TOP

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

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.