Examples of IWidgetService


Examples of org.apache.wookie.beans.IWidgetService

                // WidgetService
                if (initializing && (persistenceManager.findAll(IWidgetService.class).length == 0))
                {
                    // optional: create only if initializing
                    IWidgetService chatWidgetService = persistenceManager.newInstance(IWidgetService.class);
                    chatWidgetService.setServiceName("chat");
                    persistenceManager.save(chatWidgetService);
                    IWidgetService gamesWidgetService = persistenceManager.newInstance(IWidgetService.class);
                    gamesWidgetService.setServiceName("games");
                    persistenceManager.save(gamesWidgetService);
                    IWidgetService votingWidgetService = persistenceManager.newInstance(IWidgetService.class);
                    votingWidgetService.setServiceName("voting");
                    persistenceManager.save(votingWidgetService);
                    IWidgetService weatherWidgetService = persistenceManager.newInstance(IWidgetService.class);
                    weatherWidgetService.setServiceName("weather");
                    persistenceManager.save(weatherWidgetService);
                }
                else
                {
                    initializing = false;
                }
                if (persistenceManager.findByValue(IWidgetService.class, "serviceName", "unsupported").length == 0)
                {
                    // required: always create if not found
                    IWidgetService unsupportedWidgetService = persistenceManager.newInstance(IWidgetService.class);
                    unsupportedWidgetService.setServiceName("unsupported");
                    persistenceManager.save(unsupportedWidgetService);
                }
                else
                {
                    initializing = false;
View Full Code Here

Examples of org.apache.wookie.beans.IWidgetService

  /* (non-Javadoc)
   * @see org.apache.wookie.controller.Controller#show(java.lang.String, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
   */
  protected void show(String resourceId, HttpServletRequest request, HttpServletResponse response) throws ResourceNotFoundException, IOException{
    IWidgetService ws = getWidgetService(resourceId);
    returnXml(WidgetServiceHelper.createXMLWidgetServiceDocument(ws, getLocalPath(request),getLocales(request)), response);
  }
View Full Code Here

Examples of org.apache.wookie.beans.IWidgetService

   * @return
   * @throws ResourceDuplicationException
   */
  public static boolean create(String resourceId) throws ResourceDuplicationException,InvalidParametersException{
    if (resourceId == null || resourceId.trim().equals("")) throw new InvalidParametersException();
    IWidgetService ws;
    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

Examples of org.apache.wookie.beans.IWidgetService

   * @param resourceId
   * @return true if successfully deleted
   * @throws ResourceNotFoundException
   */
  public static boolean remove(String resourceId) throws ResourceNotFoundException {
    IWidgetService service = getWidgetService(resourceId);
    if (service == null) throw new ResourceNotFoundException();
    String serviceName = service.getServiceName();
   
    // if exists, remove from widget default table
    IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    IWidgetDefault[] widgetDefaults = persistenceManager.findByValue(IWidgetDefault.class, "widgetContext", serviceName);
    persistenceManager.delete(widgetDefaults);
View Full Code Here

Examples of org.apache.wookie.beans.IWidgetService

  @Override
  protected void update(String resourceId, HttpServletRequest request)
      throws ResourceNotFoundException,InvalidParametersException {
    String name = request.getParameter("name");
    if (name == null || name.trim().equals("")) throw new InvalidParametersException();
    IWidgetService ws = getWidgetService(resourceId);
    if (ws == null) throw new ResourceNotFoundException();
    ws.setServiceName(name);
    IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    persistenceManager.save(ws);
  }
View Full Code Here

Examples of org.apache.wookie.beans.IWidgetService

   * @return
   */
  private static IWidgetService getWidgetService(String resourceId) throws ResourceNotFoundException{
    if (resourceId == null) throw new ResourceNotFoundException();
    IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    IWidgetService ws = persistenceManager.findById(IWidgetService.class, resourceId);
    if (ws == null) {
      IWidgetService[] wsa = persistenceManager.findByValue(IWidgetService.class, "serviceName", resourceId);
      if (wsa != null && wsa.length == 1) ws = wsa[0];
    }
    if (ws == null) throw new ResourceNotFoundException();
View Full Code Here

Examples of org.apache.wookie.beans.IWidgetService

  /* (non-Javadoc)
   * @see org.apache.wookie.controller.Controller#show(java.lang.String, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
   */
  protected void show(String resourceId, HttpServletRequest request, HttpServletResponse response) throws ResourceNotFoundException, IOException{
    IWidgetService ws = getWidgetService(resourceId);
    returnXml(WidgetServiceHelper.createXMLWidgetServiceDocument(ws, getLocalPath(request),getLocales(request)), response);
  }
View Full Code Here

Examples of org.apache.wookie.beans.IWidgetService

   * @return
   * @throws ResourceDuplicationException
   */
  public static boolean create(String resourceId) throws ResourceDuplicationException,InvalidParametersException{
    if (resourceId == null || resourceId.trim().equals("")) throw new InvalidParametersException();
    IWidgetService ws;
    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

Examples of org.apache.wookie.beans.IWidgetService

   * @param resourceId
   * @return true if successfully deleted
   * @throws ResourceNotFoundException
   */
  public static boolean remove(String resourceId) throws ResourceNotFoundException {
    IWidgetService service = getWidgetService(resourceId);
    if (service == null) throw new ResourceNotFoundException();
    String serviceName = service.getServiceName();
   
    // if exists, remove from widget default table
    IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    IWidgetDefault[] widgetDefaults = persistenceManager.findByValue(IWidgetDefault.class, "widgetContext", serviceName);
    persistenceManager.delete(widgetDefaults);
View Full Code Here

Examples of org.apache.wookie.beans.IWidgetService

  @Override
  protected void update(String resourceId, HttpServletRequest request)
      throws ResourceNotFoundException,InvalidParametersException {
    String name = request.getParameter("name");
    if (name == null || name.trim().equals("")) throw new InvalidParametersException();
    IWidgetService ws = getWidgetService(resourceId);
    if (ws == null) throw new ResourceNotFoundException();
    ws.setServiceName(name);
    IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    persistenceManager.save(ws);
  }
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.