Package org.apache.wookie.beans

Examples of org.apache.wookie.beans.IAccessRequest


    }
  }

  private static void createAccessRequests(IPersistenceManager persistenceManager, W3CWidget model, IWidget widget, boolean grantAccessRequests){
    for(IAccessEntity accessEntity:model.getAccessList()){
            IAccessRequest acc = persistenceManager.newInstance(IAccessRequest.class);
      acc.setOrigin(accessEntity.getOrigin());
      acc.setSubdomains(accessEntity.hasSubDomains());
      acc.setGranted(grantAccessRequests);
      acc.setWidget(widget);
      if (grantAccessRequests){
        _logger.info("access policy granted for "+widget.getWidgetTitle("en")+" to access "+acc.getOrigin());
      }
      persistenceManager.save(acc);
    }
  }
View Full Code Here


  @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

  @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

    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);
    ar.setGranted(false);
    ar.setWidget(widget);
    return persistenceManager.save(ar);
  }
View Full Code Here

  @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);
  }
View Full Code Here

        persistenceManager.save(participant);

        //
        // create access request
        //
        IAccessRequest accessRequest = persistenceManager.newInstance(IAccessRequest.class);
        accessRequest.setOrigin("localhost");
        accessRequest.setSubdomains(false);
        accessRequest.setGranted(true);
        accessRequest.setWidget(widget);
        persistenceManager.save(accessRequest);

        //
        // commit and close persistence manager transaction
        //
View Full Code Here

  @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

  @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

    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);
    ar.setGranted(false);
    ar.setWidget(widget);
    return persistenceManager.save(ar);
  }
View Full Code Here

  @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);
  }
View Full Code Here

TOP

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

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.