Examples of IWidgetInstance


Examples of org.apache.wookie.beans.IWidgetInstance

   * 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

Examples of org.apache.wookie.beans.IWidgetInstance

   * 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$
    if (id_key != null & id_key != ""){
View Full Code Here

Examples of org.apache.wookie.beans.IWidgetInstance

   * @param serviceType
   * @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, String serviceType) throws UnsupportedEncodingException{
    IWidgetInstance instance;
    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

Examples of org.apache.wookie.beans.IWidgetInstance

 
  // 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();
    returnXml(ParticipantHelper.createXMLParticipantsDocument(participants), response);
  }
View Full Code Here

Examples of org.apache.wookie.beans.IWidgetInstance

   */
  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

Examples of org.apache.wookie.beans.IWidgetInstance

    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

Examples of org.apache.wookie.beans.IWidgetInstance

  @Override
  protected void show(String resourceId, HttpServletRequest request,
      HttpServletResponse response) throws ResourceNotFoundException,
      UnauthorizedAccessException, IOException {
    IWidgetInstance instance = WidgetInstancesController.findWidgetInstance(request);
    if (instance == null) throw new ResourceNotFoundException();
    String name = request.getParameter("propertyname"); //$NON-NLS-1$
    if (name == null || name.trim().equals("")) throw new ResourceNotFoundException();
    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();
View Full Code Here

Examples of org.apache.wookie.beans.IWidgetInstance

  @Override
  protected boolean remove(String resourceId, HttpServletRequest request)
      throws ResourceNotFoundException,UnauthorizedAccessException,InvalidParametersException {
    if (request.getParameter("value") != null) throw new InvalidParametersException();//$NON-NLS-1$
    String name = request.getParameter("propertyname"); //$NON-NLS-1$
    IWidgetInstance instance = WidgetInstancesController.findWidgetInstance(request);
    if (instance == null) throw new InvalidParametersException();
    if (name == null || name.trim().equals("")) throw new InvalidParametersException();
   
    boolean found = false;
    if (isPublic(request)){
View Full Code Here

Examples of org.apache.wookie.beans.IWidgetInstance

   */
  public static void createOrUpdate(HttpServletRequest request)
  throws InvalidParametersException,UnauthorizedAccessException {
    String name = request.getParameter("propertyname"); //$NON-NLS-1$
    String value = request.getParameter("propertyvalue"); //$NON-NLS-1$
    IWidgetInstance instance = WidgetInstancesController.findWidgetInstance(request);
    if (instance == null) throw new InvalidParametersException();
    if (name == null || name.trim().equals("")) throw new InvalidParametersException();
   
    if (isPublic(request)){
      new SharedContext(instance).updateSharedData(name, value, false);
View Full Code Here

Examples of org.apache.wookie.beans.IWidgetInstance

    download = fac.getUnzippedWidgetDirectory(); //download is where we unzipped the widget
   
    //
    // Create an instance of it
    //
    IWidgetInstance instance = new WidgetInstanceMock();
   
    //
    // Flatpack it
    //
    FlatpackFactory flatfac = new FlatpackFactory(instance);
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.