Package org.apache.wookie.beans.util

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


        assertNotNull(widgetServices);
        assertEquals(5, widgetServices.length);

        // test generic findById methods
        Object widgetId = allWidgets[0].getId();
        IWidget widgetById = persistenceManager.findById(IWidget.class, widgetId);
        assertNotNull(widgetById);
        assertEquals(allWidgets[0], widgetById);
        Object widgetDefaultId = allWidgetDefaults[0].getId();
        IWidgetDefault widgetDefaultById = persistenceManager.findById(IWidgetDefault.class, widgetDefaultId);
        assertNotNull(widgetDefaultById);
View Full Code Here


  private void removeWhiteListEntry(HttpServletRequest request) {
    Messages localizedMessages = LocaleHandler.localizeMessages(request);
    String entryId = request.getParameter("entryId"); //$NON-NLS-1$
        IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    IWhitelist entry = persistenceManager.findById(IWhitelist.class, entryId);
    if(persistenceManager.delete(entry)){
      request.setAttribute("message_value", localizedMessages.getString("WidgetAdminServlet.10"));          //$NON-NLS-1$ //$NON-NLS-2$
    }
    else{
      request.setAttribute("error_value", localizedMessages.getString("WidgetAdminServlet.11")); //$NON-NLS-1$ //$NON-NLS-2$
View Full Code Here

  private void removeWidget(HttpServletRequest request, Configuration properties, IWidgetAdminManager manager) {
    final String WIDGETFOLDER = getServletContext().getRealPath(properties.getString("widget.widgetfolder"));//$NON-NLS-1$
    Messages localizedMessages = LocaleHandler.localizeMessages(request);
    String widgetId = request.getParameter("widgetId"); //$NON-NLS-1$
        IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    IWidget widget = persistenceManager.findById(IWidget.class, widgetId);
    String guid = widget.getGuid();
    if(WidgetFactory.destroy(widgetId)){
      if(WidgetFileUtils.removeWidgetResources(WIDGETFOLDER, guid)){     
        request.setAttribute("message_value", localizedMessages.getString("WidgetAdminServlet.12"));       //$NON-NLS-1$ //$NON-NLS-2$
      }
View Full Code Here

        //
        // test findById  for IWidget
        //
        Object widgetId = allWidgets[0].getId();
        IWidget widgetById = persistenceManager.findById(IWidget.class, widgetId);
        assertNotNull(widgetById);
        assertEquals(allWidgets[0], widgetById);
       
        //
        // test findById  for IWidgetDefault
View Full Code Here

       
        //
        // test findById  for IWidgetDefault
        //
        Object widgetDefaultId = allWidgetDefaults[0].getId();
        IWidgetDefault widgetDefaultById = persistenceManager.findById(IWidgetDefault.class, widgetDefaultId);
        assertNotNull(widgetDefaultById);
        assertEquals(allWidgetDefaults[0], widgetDefaultById);

        //
        // test findByValue method for IWidget
View Full Code Here

    IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    IWidget widget = persistenceManager.findWidgetByGuid(resourceId);
    // attempt to get specific widget by id
    if (widget == null) {
      persistenceManager = PersistenceManagerFactory.getPersistenceManager();
      widget = persistenceManager.findById(IWidget.class, resourceId);
    }
    // return widget result
    if (widget == null) throw new ResourceNotFoundException();
   
    try {
View Full Code Here

    // attempt to get specific widget by URI
    IWidget widget = persistenceManager.findWidgetByGuid(resourceId);
    // attempt to get specific widget by id
    if (widget == null) {
      persistenceManager = PersistenceManagerFactory.getPersistenceManager();
      widget = persistenceManager.findById(IWidget.class, resourceId);
    }
    // return widget result
    if (widget == null)
      throw new ResourceNotFoundException();
View Full Code Here

    IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    IWidget widget = persistenceManager.findWidgetByGuid(resourceId);
    // attempt to get specific widget by id
    if (widget == null) {
      persistenceManager = PersistenceManagerFactory.getPersistenceManager();
      widget = persistenceManager.findById(IWidget.class, resourceId);
    }
   
    if (widget == null) throw new ResourceNotFoundException();
   
    //
View Full Code Here

      HttpServletResponse response) throws ResourceNotFoundException,
      UnauthorizedAccessException, IOException {
    // attempt to get specific widget by id; note that this is the internal
    // widget integer ID and not the widget URI
    IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    IWidget widget = persistenceManager.findById(IWidget.class, resourceId);
    if (widget == null) throw new ResourceNotFoundException();
    // redirect to the UDD
    if (widget.getUpdateLocation() ==  null) throw new ResourceNotFoundException();
    response.sendRedirect(widget.getUpdateLocation());
  }
View Full Code Here

  protected void update(String resourceId, HttpServletRequest request, HttpServletResponse response)
      throws ResourceNotFoundException, InvalidParametersException,
      UnauthorizedAccessException {
      // attempt to get specific widget by id
      IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
      IWidget widget = persistenceManager.findById(IWidget.class, resourceId);
      if (widget == null) throw new ResourceNotFoundException();
     
      // Check to see if we're requiring updates over HTTPS - if not output a warning
      boolean onlyUseHttps = Boolean.parseBoolean(request.getParameter("use-https"));
      if (!onlyUseHttps) _logger.warn("checking for updates using non-secure method");
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.