Examples of OqlBuilder


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

    return CollectUtils.newArrayList(resources);
  }

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

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

   */
  @SuppressWarnings({ "unchecked", "rawtypes" })
  public Set<String> getResourceNamesByGroup(String group) {
    String hql = "select m.name from " + Group.class.getName() + " as r join r.authorities as a"
        + " join a.resource as m where  r.name = :groupName and m.enabled = true";
    OqlBuilder query = OqlBuilder.hql(hql).param("groupName", group).cacheable();
    return (Set<String>) new HashSet(entityDao.search(query));
  }
View Full Code Here

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

    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

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

  }

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

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

   */
  @SuppressWarnings({ "unchecked", "rawtypes" })
  public Set<String> getResourceNamesByGroup(String group) {
    String hql = "select m.name from " + Group.class.getName() + " as r join r.authorities as a"
        + " join a.resource as m where  r.name = :groupName and m.enabled = true";
    OqlBuilder query = OqlBuilder.hql(hql).param("groupName", group).cacheable();
    return (Set<String>) new HashSet(entityDao.search(query));
  }
View Full Code Here

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

   */
  @SuppressWarnings({ "unchecked", "rawtypes" })
  public Set<String> getResourceNamesByGroup(Long groupId) {
    String hql = "select m.name from " + Group.class.getName() + " as r join r.authorities as a"
        + " join a.resource as m where  r.id = :groupId and m.enabled = true";
    OqlBuilder query = OqlBuilder.hql(hql).param("groupId", groupId).cacheable();
    return (Set<String>) new HashSet(entityDao.search(query));
  }
View Full Code Here

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

    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

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

  }

  @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

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

    CategoryPrincipal principal = (CategoryPrincipal) auth.getPrincipal();
    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

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

  }

  // 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
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.