Package com.gtp.domain

Examples of com.gtp.domain.Authority


  @Override
  public List<ConfigAttribute> getAttributes(Object object) {
    FilterInvocation fi = (FilterInvocation) object;
    String url = fi.getRequestUrl();
    List<ConfigAttribute> attributes = new ArrayList<ConfigAttribute>();
    Authority authory = null;
    if (url.contains(".xhmtl") || url.contains(".jsf"))
      authory = authoryDao.findByUrl(url);
    if (authory != null)
      attributes.add(new SecurityConfig(authory.getName()));
    else {
      attributes.add(new SecurityConfig("authory_anonymous"));
    }

    return attributes;
View Full Code Here


  private Authority authority = null;

  AuthoryService authorityService;

  public String addAuthority() {
    authority = new Authority();
    authority.setName(name);
    authority.setUrl(url);
    try {
      authorityService.addAuthory(authority);
    } catch (ExistedException e) {
View Full Code Here

    return (Authority)getJpaTemplate().execute(new JpaCallback<Authority>() {
      public Authority doInJpa(EntityManager em) {
        CriteriaBuilder criteriaBuilder =em.getCriteriaBuilder();
        CriteriaQuery<Authority> query= criteriaBuilder.createQuery(Authority.class);
        Root<Authority> auth = query.from(Authority.class);
        Authority authory=null;
        query.select(auth).where(criteriaBuilder.equal(auth.get("name"),name));
        List<Authority> result = em.createQuery(query).getResultList();
        if(result.isEmpty())
          return null;
        authory=(Authority) result.get(0);
View Full Code Here

    return (Authority)getJpaTemplate().execute(new JpaCallback<Authority>() {
      public Authority doInJpa(EntityManager em) {
        CriteriaBuilder criteriaBuilder =em.getCriteriaBuilder();
        CriteriaQuery<Authority> query= criteriaBuilder.createQuery(Authority.class);
        Root<Authority> auth = query.from(Authority.class);
        Authority authory=null;
        query.select(auth).where(criteriaBuilder.equal(auth.get("url"),url));
        List<Authority> result = em.createQuery(query).getResultList();
        if(result.isEmpty())
          return null;
        authory=(Authority) result.get(0);
View Full Code Here

  public Object getAsObject(FacesContext facesContext, UIComponent component, String value) {
     if (value == null || value.equals("")) {
         return null;
        }
        String[] s = value.split("-")
        Authority a= new Authority();
        a.setId(Integer.parseInt(s[0]));
        a.setName(s[1]);
        a.setUrl(s[2]);
        return a;
  }
View Full Code Here

  AuthoryDao authoryDao;
 
  public Authority addAuthory(Authority authory) throws ExistedException{
    if(authory==null)
      throw new NullPointerException("authory should not be null");
    Authority auth=authoryDao.findByName(authory.getName());
    if(auth!=null)
      throw new ExistedException();
    authory=authoryDao.addAuthory(authory);
    return authory;
  }
View Full Code Here

  }
 
  public Authority updateAuthory(Authority authory) throws ExistedException, NotFoundException{
    if(authory==null)
      throw new NullPointerException("authory should not be null");
    Authority auth=authoryDao.findByName(authory.getName());
    if(auth!=null&&authory.getId()!=auth.getId())
      throw new ExistedException();
    authory=authoryDao.updateAuthory(authory);
    return authory;
  }
View Full Code Here

  }
 
  public Authority removeAuthory(Authority a) throws NotFoundException{
    if(a==null)
      throw new NullPointerException("authory should not be null");
    Authority authory=authoryDao.find(a.getId());
    if(authory==null)
      throw new NotFoundException();
    authoryDao.removeAuthroy(a);
    return a;
  }
View Full Code Here

TOP

Related Classes of com.gtp.domain.Authority

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.