Package org.beangle.model.query.builder

Examples of org.beangle.model.query.builder.OqlBuilder.select()


  @SuppressWarnings({ "unchecked", "rawtypes" })
  public Set<String> getResourceNames(int scope) {
    OqlBuilder query = OqlBuilder.from(Resource.class, "resource");
    query.where("resource.scope=:scope and resource.enabled=true", Integer.valueOf(scope));
    query.select("resource.name");
    return CollectUtils.newHashSet(entityDao.search(query));
  }

  /**
   * 找到该组内激活的资源id
 
View Full Code Here


  @SuppressWarnings({ "rawtypes", "unchecked" })
  public Collection<Group> filter(Collection<Group> groups, Resource resource) {
    OqlBuilder builder = OqlBuilder.from(Authority.class, "au");
    builder.where("au.group in (:groups) and au.resource = :resource", groups, resource);
    builder.select("au.group");
    return entityDao.search(builder);
  }

  public Authority getAuthority(Group group, Resource resource) {
    if (null == group || null == resource) return null;
View Full Code Here

  }

  @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

  @SuppressWarnings({ "rawtypes", "unchecked" })
  public int getMaxSessions(Authentication auth) {
    String category = ((CategoryPrincipal) auth.getPrincipal()).getCategory();
    OqlBuilder builder = OqlBuilder.from(CategorySessionStat.class, "stat");
    builder.select("stat.userMaxSessions")
        .where("stat.category=:category and stat.serverName=:server", category, getServerName())
        .cacheable();
    List nums = entityDao.search(builder);
    if (nums.isEmpty()) return 1;
    else return ((Number) nums.get(0)).intValue();
View Full Code Here

  @SuppressWarnings({"unchecked","rawtypes"})
  public Set<String> getResourceNames(int scope) {
    OqlBuilder query = OqlBuilder.from(Resource.class, "resource");
    query.where("resource.scope=:scope and resource.enabled=true", Integer.valueOf(scope));
    query.select("resource.name");
    return CollectUtils.newHashSet(entityDao.search(query));
  }

  /**
   * 找到该组内激活的资源id
 
View Full Code Here

  @SuppressWarnings({ "unchecked", "rawtypes" })
  public Set<String> getResourceNames(int scope) {
    OqlBuilder query = OqlBuilder.from(Resource.class, "resource");
    query.where("resource.scope=:scope and resource.enabled=true", Integer.valueOf(scope));
    query.select("resource.name");
    return CollectUtils.newHashSet(entityDao.search(query));
  }

  /**
   * 找到该组内激活的资源id
 
View Full Code Here

  @SuppressWarnings({ "rawtypes", "unchecked" })
  public Collection<Group> filter(Collection<Group> groups, Resource resource) {
    OqlBuilder builder = OqlBuilder.from(Authority.class, "au");
    builder.where("au.group in (:groups) and au.resource = :resource", groups, resource);
    builder.select("au.group");
    return entityDao.search(builder);
  }

  public Authority getAuthority(Group group, Resource resource) {
    if (null == group || null == resource) return null;
View Full Code Here

  @SuppressWarnings({ "unchecked", "rawtypes" })
  public Set<String> getResourceNames(int scope) {
    OqlBuilder query = OqlBuilder.from(Resource.class, "resource");
    query.where("resource.scope=:scope and resource.enabled=true", Integer.valueOf(scope));
    query.select("resource.name");
    return CollectUtils.newHashSet(entityDao.search(query));
  }

  /**
   * 找到该组内激活的资源id
 
View Full Code Here

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

  public Authority getAuthority(Group group, Resource resource) {
    if (null == group || null == resource) return null;
View Full Code Here

    if (Principals.ROOT.equals(principal.getId())) {
      return -1;
    } else {
      String category = principal.getCategory();
      OqlBuilder builder = OqlBuilder.from(SessionStat.class, "stat");
      builder.select("stat.userMaxSessions")
          .where("stat.category=:category and stat.serverName=:server", category, getServerName())
          .cacheable();
      List nums = entityDao.search(builder);
      if (nums.isEmpty()) return 1;
      else return ((Number) nums.get(0)).intValue();
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.