Examples of findById()


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

      index(resourceId, request, response);
      return;
    }
    // attempt to get specific widget by id
    IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    IWidget widget = persistenceManager.findById(IWidget.class, resourceId);
    // support queries by type
    if (widget == null) {
      IWidgetService[] services = persistenceManager.findByValue(IWidgetService.class, "serviceName", resourceId);
        if (services != null && services.length == 1) {
          IWidget[] widgets = persistenceManager.findWidgetsByType(resourceId);
View Full Code Here

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

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

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

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

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

   * @param id the id of the widget
   * @return true if the widget is destroyed successfully
   */
  public static boolean destroy(Object id){
      IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    IWidget widget = persistenceManager.findById(IWidget.class, id);
    return destroy(widget);
  }

  /**
   * Destroy a widget and all dependent objects and references
View Full Code Here

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

        if (widgetId == null){
            accessRequests = persistenceManager.findAll(IAccessRequest.class);
        }
    if (widgetId != null && widgetId.trim().length()>0){
      // Filter by widgetId
      IWidget widget = persistenceManager.findById(IWidget.class, widgetId);
            if (widget != null) accessRequests = persistenceManager.findByValue(IAccessRequest.class, "widget", widget);
    }
   
    switch (format(request)) {
      case XML: returnXml(AccessRequestHelper.createXMLAccessRequestDocument(accessRequests),response);break;
View Full Code Here

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

  @Override
  protected void show(String resourceId, HttpServletRequest request,
      HttpServletResponse response) throws ResourceNotFoundException,
      UnauthorizedAccessException, IOException {
        IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    IAccessRequest ar = persistenceManager.findById(IAccessRequest.class, resourceId);
    if (ar == null) throw new ResourceNotFoundException();
   
    switch (format(request)) {
      case XML: returnXml(AccessRequestHelper.createXMLAccessRequestDocument(new IAccessRequest[]{ar}),response);break;
      case HTML: returnHtml(AccessRequestHelper.createAccessRequestHTMLTable(new IAccessRequest[]{ar}),response);break;
View Full Code Here

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

  @Override
  protected void update(String resourceId, HttpServletRequest request)
      throws ResourceNotFoundException, InvalidParametersException,
      UnauthorizedAccessException {
        IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
        IAccessRequest ar = persistenceManager.findById(IAccessRequest.class, resourceId);
    if (ar == null) throw new ResourceNotFoundException();
    String granted = request.getParameter("granted");
    if (granted == null) throw new InvalidParametersException();
    if (!granted.equals("true") && !granted.equals("false")) throw new InvalidParametersException();
    if (granted.equals("true")) grantAccess(persistenceManager, ar);
View Full Code Here

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

   
    String subdomains = request.getParameter("subdomains");
   
    String widgetId = request.getParameter("widgetId");
        IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    IWidget widget = persistenceManager.findById(IWidget.class, widgetId);
    if (widget == null) throw new InvalidParametersException();
   
    IAccessRequest ar = persistenceManager.newInstance(IAccessRequest.class);
    ar.setOrigin(origin);
    if (subdomains.equals("true")) ar.setSubdomains(true);
View Full Code Here

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

  @Override
  protected boolean remove(String resourceId, HttpServletRequest request)
      throws ResourceNotFoundException, UnauthorizedAccessException,
      InvalidParametersException {
        IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
        IAccessRequest ar = persistenceManager.findById(IAccessRequest.class, resourceId);
    if (ar == null) throw new ResourceNotFoundException();
    return persistenceManager.delete(ar);
  }

  private void grantAccess(IPersistenceManager persistenceManager, IAccessRequest ar){
View Full Code Here

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

  @Override
  protected boolean remove(String resourceId, HttpServletRequest request)
      throws ResourceNotFoundException, UnauthorizedAccessException,
      InvalidParametersException {
        IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
        IWhitelist entry = persistenceManager.findById(IWhitelist.class, resourceId);
        if (entry == null)throw new ResourceNotFoundException();
        return persistenceManager.delete(entry);      
  }
 
 
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.