public boolean isSemiCenteralized() {
   ResultPage result =
       NliUserManagementServiceProxy.getInstance()
           .findAllOrganizationUnits(0, 100, new GridFilter());
   if (result.getCount() == 1) return true;
   else return false;
 }
Beispiel #2
0
 public PagedResult fetchResult(
     Object parentNode,
     int firstResult,
     int maxResultSet,
     boolean countTotalRecords,
     List orderKeys) {
   List result = new ArrayList();
   NliMyLibraryServiceProxy service = NliMyLibraryServiceProxy.getInstance();
   if (parentNode instanceof Groups) {
     ResultPage resultPage =
         service.findChilds((Groups) parentNode, firstResult, maxResultSet, new GridFilter());
     result = resultPage.getResult();
     return new PagedResult(result, resultPage.getCount());
   }
   return new PagedResult(result, result.size());
 }
  public ResultPage findRealProfilePersonBySearchCriteria(
      RealProfilePerson realPerson,
      AbstractWorkGroup workGroup,
      Role roles,
      UserGroup userGroup,
      boolean checkChildren,
      int offset,
      int fetchSize,
      GridFilter gridFilter) {
    StringBuffer query =
        new StringBuffer(
            "SELECT realPerson.id FROM " + getPersistentClass().getName() + " realPerson");

    java.util.List<Object> params = new ArrayList<Object>();

    //		if (userGroup != null) {
    //            query.append("  JOIN realPerson.profile.userGroups userUserGroup"
    //                    + "  JOIN userUserGroup.userGroup userGroup ");
    //        }

    //        if (roles != null) {
    //            query.append("  JOIN realPerson.profile.userRoles as userRole "
    //                    + "  JOIN userRole.role role ");
    //        }

    //        if (workGroup != null) {
    //            query.append(", RegisterationUnit unit ");
    //        }

    query.append(" WHERE 1=1 ");

    setRealProfileCondition(realPerson, query, params);

    if (workGroup != null) {
      //            query.append("AND unit.profilePerson = realPerson.profile AND ");
      //            if(checkChildren){
      //            	query.append("(unit.workGroup = ? or unit.workGroup.parent= ?)");
      //            	params.add(workGroup);
      //            }else{
      //            	query.append("unit.workGroup = ?");
      //            }
      query.append(
          " AND realPerson.profile in (  select unit.profilePerson from RegisterationUnit unit where ");
      if (checkChildren) {
        query.append("(unit.workGroup = ? or unit.workGroup.parent= ?)) ");
        params.add(workGroup);
      } else {
        query.append("unit.workGroup = ?) ");
      }
      params.add(workGroup);
    }

    if (roles != null) {
      //            query.append(" AND role = ?");
      query.append(
          " AND realPerson.profile in (select r.profilePerson from UserRole r where r.role = ?) ");
      params.add(roles);
    }
    if (userGroup != null) {
      //            query.append(" AND userGroup = ?");
      query.append(
          " AND realPerson.profile in (select g.profilePerson from UserUserGroup g where g.userGroup = ?) ");

      params.add(userGroup);
    }

    if (StringUtils.isNotEmpty(realPerson.getFirstName())) {
      query.append(" AND UPPER(realPerson.firstName) LIKE ?");
      params.add("%" + realPerson.getFirstName() + "%");
    }

    if (StringUtils.isNotEmpty(realPerson.getLastName())) {
      query.append(" AND UPPER(realPerson.lastName) LIKE ?");
      params.add("%" + realPerson.getLastName() + "%");
    }

    if (StringUtils.isNotEmpty(realPerson.getNationalCode())) {
      query.append(" AND realPerson.nationalCode = ?");
      params.add(realPerson.getNationalCode());
    }

    if (StringUtils.isNotEmpty(realPerson.getStudentNumber())) {
      query.append(" AND realPerson.studentNumber = ?");
      params.add(realPerson.getStudentNumber());
    }

    if (StringUtils.isNotEmpty(realPerson.getCollegeName())) {
      query.append(" AND realPerson.collegeName LIKE ?");
      params.add("%" + realPerson.getCollegeName() + "%");
    }

    if (StringUtils.isNotEmpty(realPerson.getPersonelNumber())) {
      query.append(" AND realPerson.personelNumber = ?");
      params.add(realPerson.getPersonelNumber());
    }

    if (StringUtils.isNotEmpty(realPerson.getParent())) {
      query.append(" AND UPPER(realPerson.parent) LIKE ?");
      params.add("%" + realPerson.getParent() + "%");
    }

    if (StringUtils.isNotEmpty(realPerson.getRealNo())) {
      query.append(" AND realPerson.realNo = ?");
      params.add(realPerson.getRealNo());
    }

    query.append(" ORDER bY realPerson.id");
    ResultPage pageByCriteria =
        findPageByCriteria(
            query.toString(), params.toArray(), offset, fetchSize, gridFilter, "realPerson");
    return new ResultPage(
        getByIdList(getPersistentClass(), pageByCriteria.getResult()), pageByCriteria.getCount());
  }