Package org.beangle.model.query.builder

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


   */
  @SuppressWarnings({"unchecked","rawtypes"})
  public Set<String> getResourceNamesByGroup(String group) {
    String hql = "select m.name from Group 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


    entityDao.saveOrUpdate(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

      context.put("metadatas", metadatas);
      String[] keyArray = StringUtils.split(keys, ',');
      String[] titleArray = StringUtils.split(titles, ',');
      for (String codeName : codeNames) {
        CodeMeta CodeMeta = entityDao.get(CodeMeta.class, "className", codeName).get(0);
        OqlBuilder b = OqlBuilder.hql("from " + codeName
            + " as basecode order by basecode.updatedAt desc,basecode.code");
        datas.add(entityDao.search(b));
        metadatas.add(new MultiEntityExporter.Metadata(CodeMeta.getName(), keyArray, titleArray));
      }
      context.put("items", datas);
View Full Code Here

    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

   */
  @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

    entityDao.saveOrUpdate(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

    entityDao.saveOrUpdate(resources);
  }

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

      context.put("metadatas", metadatas);
      String[] keyArray = StringUtils.split(keys, ',');
      String[] titleArray = StringUtils.split(titles, ',');
      for (String codeName : codeNames) {
        CodeMeta CodeMeta = entityDao.get(CodeMeta.class, "className", codeName).get(0);
        OqlBuilder b = OqlBuilder.hql("from " + codeName
            + " as basecode order by basecode.updatedAt desc,basecode.code");
        datas.add(entityDao.search(b));
        metadatas.add(new MultiEntityExporter.Metadata(CodeMeta.getName(), keyArray, titleArray));
      }
      context.put("items", datas);
View Full Code Here

  // workground for no session
  @SuppressWarnings({ "rawtypes", "unchecked" })
  public List<Group> getGroups(User user, GroupMember.Ship ship) {
    if (isAdmin(user) && !ObjectUtils.equals(ship, GroupMember.Ship.MEMBER)) return entityDao
        .getAll(Group.class);
    OqlBuilder builder = OqlBuilder.from(GroupMember.class, "gm");
    builder.where("gm.user=:user", user).select("gm.group");
    if (null != ship) {
      if (ship.equals(GroupMember.Ship.MEMBER)) builder.where("gm.member=true");
      if (ship.equals(GroupMember.Ship.MANAGER)) builder.where("gm.manager=true");
      if (ship.equals(GroupMember.Ship.GRANTER)) builder.where("gm.granter=true");
    }
    return entityDao.search(builder);
  }
View Full Code Here

  // workground for no session
  @SuppressWarnings({ "rawtypes", "unchecked" })
  public List<Group> getGroups(User user, GroupMember.Ship ship) {
    if (isAdmin(user) && !ObjectUtils.equals(ship, GroupMember.Ship.MEMBER)) return entityDao
        .getAll(Group.class);
    OqlBuilder builder = OqlBuilder.from(GroupMember.class, "gm");
    builder.where("gm.user=:user", user).select("gm.group");
    if (null != ship) {
      if (ship.equals(GroupMember.Ship.MEMBER)) builder.where("gm.member=true");
      if (ship.equals(GroupMember.Ship.MANAGER)) builder.where("gm.manager=true");
      if (ship.equals(GroupMember.Ship.GRANTER)) builder.where("gm.granter=true");
    }
    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.