Package org.beangle.model.query.builder

Examples of org.beangle.model.query.builder.OqlBuilder


    Validate.notNull(sessioninfoBuilder, "sessioninfoBuilder must set");
  }

  @SuppressWarnings({ "rawtypes", "unchecked" })
  public boolean isRegisted(String principal) {
    OqlBuilder builder = OqlBuilder.from(sessioninfoBuilder.getSessioninfoClass(), "info");
    builder.where("info.username=:username and info.expiredAt is null", principal).select("info.id")
        .cacheable();
    return !entityDao.search(builder).isEmpty();
  }
View Full Code Here


    remove(event.getId());
  }

  @SuppressWarnings({ "rawtypes", "unchecked" })
  public int count() {
    OqlBuilder builder = OqlBuilder.from(Sessioninfo.class, "info");
    builder.select("count(id)");
    List<Number> numbers = entityDao.search(builder);
    if (numbers.isEmpty()) return 0;
    else return (numbers.get(0)).intValue();
  }
View Full Code Here

  /** 找到该组内激活的资源id */
  @SuppressWarnings({ "unchecked", "rawtypes" })
  public Set<String> getResourceNamesByGroup(Long groupId) {
    String hql = "select a.resource.name from " + Authority.class.getName()
        + " as a where a.group.id= :groupId and a.resource.enabled = true";
    OqlBuilder query = OqlBuilder.hql(hql).param("groupId", groupId).cacheable();
    return (Set<String>) new HashSet(entityDao.search(query));
  }
View Full Code Here

  }

  /** 找到该组内激活的资源id */
  @SuppressWarnings({ "unchecked", "rawtypes" })
  public Set<String> getResourceNamesByScope(Resource.Scope scope) {
    OqlBuilder builder = OqlBuilder.from(Resource.class, "r").where("r.scope=:scope", scope)
        .select("r.name").cacheable();
    return (Set<String>) new HashSet(entityDao.search(builder));
  }
View Full Code Here

    publish(new GroupAuthorityEvent(group));
  }

  @SuppressWarnings({ "unchecked", "rawtypes" })
  public void updateState(Long[] resourceIds, boolean isEnabled) {
    OqlBuilder query = OqlBuilder.from(Resource.class, "resource");
    query.where("resource.id in (:ids)", resourceIds);
    List<Resource> resources = entityDao.search(query);
    for (Resource resource : resources) {
      resource.setEnabled(isEnabled);
    }
    entityDao.saveOrUpdate(resources);
View Full Code Here

  }

  @Override
  @SuppressWarnings({ "rawtypes", "unchecked" })
  protected List<GroupBean> getTopNodes(GroupBean m) {
    OqlBuilder builder = OqlBuilder.from(Group.class, "g");
    builder.where("g.parent is null");
    return entityDao.search(builder);
  }
View Full Code Here

  }

  // workground for no session
  @SuppressWarnings({ "rawtypes", "unchecked" })
  public List<Group> getGroups(User user) {
    OqlBuilder builder = OqlBuilder.from(GroupMember.class, "gm");
    builder.where("gm.user=:user and gm.member=true", user).select("gm.group").orderBy("gm.group.code");
    builder.cacheable();
    return entityDao.search(builder);
  }
View Full Code Here

  }

  @SuppressWarnings({ "rawtypes", "unchecked" })
  public Collection<GroupProfile> getProfiles(Collection<Group> groups, Resource resource) {
    if (groups.isEmpty()) return Collections.EMPTY_LIST;
    OqlBuilder builder = OqlBuilder.from("from "+ Authority.class.getName() + " au,"+GroupProfile.class.getName()+" gp");
    builder.where("au.group in (:groups) and au.resource = :resource and au.group=gp.group", groups, resource);
    builder.select("gp");
    return entityDao.search(builder);
  }
View Full Code Here

TOP

Related Classes of org.beangle.model.query.builder.OqlBuilder

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.