Пример #1
0
  /**
   * @param rundata
   * @param context
   * @param msgList
   * @return
   */
  @Override
  protected boolean deleteFormData(RunData rundata, Context context, List<String> msgList) {
    try {
      int index;
      try {
        index = Integer.parseInt(ALEipUtils.getTemp(rundata, context, ALEipConstants.ENTITY_ID));
      } catch (Exception e) {
        return false;
      }

      String currentTab = ALEipUtils.getTemp(rundata, context, "tab");
      int type_mail =
          (WebMailUtils.TAB_RECEIVE.equals(currentTab))
              ? ALFolder.TYPE_RECEIVE
              : ALFolder.TYPE_SEND;
      ALMailHandler handler = ALMailFactoryService.getInstance().getMailHandler();
      ALFolder folder = handler.getALFolder(type_mail, orgId, userId, Integer.valueOf(accountId));
      folder.deleteMail(index);

    } catch (Exception e) {
      logger.error("webmail", e);
      return false;
    }
    return true;
  }
Пример #2
0
  /**
   * フィルタ用の <code>Criteria</code> を構築します。
   *
   * @param crt
   * @param rundata
   * @param context
   * @return
   */
  @Override
  protected SelectQuery<TurbineUser> buildSelectQueryForFilter(
      SelectQuery<TurbineUser> query, RunData rundata, Context context) {
    // 指定部署IDの取得
    String filter = ALEipUtils.getTemp(rundata, context, LIST_FILTER_STR);
    String filter_role = ALEipUtils.getTemp(rundata, context, LIST_FILTER_ROLE_STR);

    // 指定部署が存在しているかを確認し、存在していなければ値を削除する
    Map<Integer, ALEipPost> gMap = ALEipManager.getInstance().getPostMap();
    if (filter != null
        && filter.trim().length() != 0
        && !gMap.containsKey(Integer.valueOf(filter))) {
      filter = null;
    }

    String filter_type = ALEipUtils.getTemp(rundata, context, LIST_FILTER_TYPE_STR);
    String crt_key = null;
    Attributes map = getColumnMap();
    if (filter == null || filter_type == null || filter.equals("")) {
      return query;
    }
    crt_key = map.getValue(filter_type);
    if (crt_key == null) {
      return query;
    }

    Expression exp = ExpressionFactory.matchDbExp(crt_key, filter);
    query.andQualifier(exp);

    currentPost = filter;
    currentRole = filter_role;
    return query;
  }
Пример #3
0
  /**
   * @param rundata
   * @param context
   * @param msgList
   * @return
   * @throws ALPageNotFoundException
   * @throws ALDBErrorException
   */
  @Override
  protected boolean setFormData(RunData rundata, Context context, List<String> msgList)
      throws ALPageNotFoundException, ALDBErrorException {
    boolean res = super.setFormData(rundata, context, msgList);
    try {
      if (res) {
        if (ALEipConstants.MODE_UPDATE.equals(getMode())) {
          acl_role_id = ALEipUtils.getTemp(rundata, context, ALEipConstants.ENTITY_ID);
        }

        String[] str = rundata.getParameters().getStrings("member_to");
        if (str != null && str.length > 0) {
          SelectQuery<TurbineUser> query = Database.query(TurbineUser.class);
          Expression exp = ExpressionFactory.inExp(TurbineUser.LOGIN_NAME_PROPERTY, str);
          query.setQualifier(exp);
          memberList.addAll(ALEipUtils.getUsersFromSelectQuery(query));
        }
      }
    } catch (Exception ex) {
      logger.error("AccessControlFormData.setFormData", ex);
      res = false;
    }

    return res;
  }
Пример #4
0
  /**
   * セッションで指定されたアドレスIDを持つアドレス情報を取得する。
   *
   * @param rundata
   * @param context
   * @return
   */
  public static EipMAddressbook getEipMAddressbook(RunData rundata, Context context) {
    // セッションから指定された アドレスID を取得
    String addressid = ALEipUtils.getTemp(rundata, context, ALEipConstants.ENTITY_ID);
    try {
      if (addressid == null || Integer.valueOf(addressid) == null) {
        logger.debug("[AddressBook] Address ID...");
        return null;
      }

      SelectQuery<EipMAddressbook> query = Database.query(EipMAddressbook.class);
      Expression exp11 =
          ExpressionFactory.matchDbExp(
              EipMAddressbook.ADDRESS_ID_PK_COLUMN, Integer.valueOf(addressid));
      query.setQualifier(exp11);

      Expression exp21 = ExpressionFactory.matchExp(EipMAddressbook.PUBLIC_FLAG_PROPERTY, "T");
      Expression exp22 =
          ExpressionFactory.matchExp(
              EipMAddressbook.OWNER_ID_PROPERTY, ALEipUtils.getUserId(rundata));
      Expression exp23 = ExpressionFactory.matchExp(EipMAddressbook.PUBLIC_FLAG_PROPERTY, "F");
      query.andQualifier(exp21.orExp(exp22.andExp(exp23)));

      List<EipMAddressbook> addresses = query.fetchList();

      if (addresses == null || addresses.size() == 0) {
        logger.debug("[AddressBook] Not found Address ID...");
        return null;
      }
      return addresses.get(0);
    } catch (Exception ex) {
      logger.error("AddressBookUtils.getEipMAddressbook", ex);
      return null;
    }
  }
Пример #5
0
  public static EipMAddressGroup getEipMAddressGroup(RunData rundata, Context context) {
    String groupid = ALEipUtils.getTemp(rundata, context, ALEipConstants.ENTITY_ID);
    try {
      if (groupid == null || Integer.valueOf(groupid) == null) {
        // グループIDが空の場合
        logger.debug("[AddressBook] Group ID...");
        return null;
      }
      SelectQuery<EipMAddressGroup> query = Database.query(EipMAddressGroup.class);
      Expression exp1 =
          ExpressionFactory.matchDbExp(
              EipMAddressGroup.GROUP_ID_PK_COLUMN, Integer.valueOf(groupid));
      query.setQualifier(exp1);
      Expression exp2 =
          ExpressionFactory.matchExp(
              EipMAddressGroup.OWNER_ID_PROPERTY, Integer.valueOf(ALEipUtils.getUserId(rundata)));
      query.andQualifier(exp2);

      List<EipMAddressGroup> groups = query.fetchList();
      if (groups == null || groups.size() == 0) {
        // 指定したカテゴリIDのレコードが見つからない場合
        logger.debug("[AddressBook] Not found Group ID...");
        return null;
      }
      return groups.get(0);
    } catch (Exception ex) {
      logger.error("AddressBookUtils.getEipMAddressGroup", ex);
      return null;
    }
  }
Пример #6
0
  /**
   * 指定した取引先情報の取得
   *
   * @param rundata
   * @param context
   * @return
   */
  public static EipMAddressbookCompany getEipMAddressbookCompany(RunData rundata, Context context) {
    // セッションから指定された 取引先ID を取得
    String companyid = ALEipUtils.getTemp(rundata, context, ALEipConstants.ENTITY_ID);
    try {
      if (companyid == null || Integer.valueOf(companyid) == null) {
        logger.debug("[AddressBook] Company ID...");
        return null;
      }

      SelectQuery<EipMAddressbookCompany> query = Database.query(EipMAddressbookCompany.class);
      Expression exp =
          ExpressionFactory.matchDbExp(
              EipMAddressbookCompany.COMPANY_ID_PK_COLUMN, Integer.valueOf(companyid));
      query.setQualifier(exp);

      List<EipMAddressbookCompany> companys = query.fetchList();
      if (companys == null || companys.size() == 0) {
        logger.debug("[AddressBook] Not found Company ID...");
        return null;
      }
      return companys.get(0);
    } catch (Exception ex) {
      logger.error("AddressBookUtils.getEipMAddressbookCompany", ex);
      return null;
    }
  }
Пример #7
0
 /**
  * 入力値を取得する。フォーム値、セッション値の順で取得する。
  *
  * @param rundata Rundata
  * @param context Context
  * @param key フォーム名
  * @return 値
  */
 public static String getParameter(RunData rundata, Context context, String key) {
   String val = rundata.getParameters().getString(key);
   if (val == null) {
     val = ALEipUtils.getTemp(rundata, context, key);
   } else {
     ALEipUtils.setTemp(rundata, context, key, val);
   }
   return val;
 }
Пример #8
0
 /**
  * 現在表示させているタブが「社外」であるかどうか調べます。
  *
  * @param rundata
  * @param context
  * @return
  */
 public static boolean isSyagai(RunData rundata, Context context) {
   String tabParam = rundata.getParameters().getString("tab");
   String currentTab = ALEipUtils.getTemp(rundata, context, "tab");
   if (tabParam == null) {
     if (currentTab == null || currentTab.trim().length() == 0 || "syagai".equals(currentTab)) {
       return true;
     }
     return false;
   } else {
     if ("syagai".equals(tabParam)) {
       return true;
     }
     return false;
   }
 }
Пример #9
0
 /**
  * @param rundata
  * @param context
  * @param msgList
  * @return
  */
 @Override
 protected boolean setFormData(RunData rundata, Context context, List<String> msgList)
     throws ALPageNotFoundException, ALDBErrorException {
   boolean res = super.setFormData(rundata, context, msgList);
   if (res) {
     try {
       if (ALEipConstants.MODE_UPDATE.equals(getMode())) {
         position_id =
             Integer.parseInt(ALEipUtils.getTemp(rundata, context, ALEipConstants.ENTITY_ID));
       }
     } catch (Exception ex) {
       logger.error("AccountPositionFormData.setFormData", ex);
     }
   }
   return res;
 }
Пример #10
0
  /**
   * @param rundata
   * @param context
   * @throws Exception
   */
  @Override
  protected void doOutput(RunData rundata, Context context) throws Exception {
    try {
      UserSelectData detailData = new UserSelectData();
      detailData.initField();
      detailData.doViewDetail(this, rundata, context);

      String entityid = ALEipUtils.getTemp(rundata, context, ALEipConstants.ENTITY_ID);
      context.put(ALEipConstants.ENTITY_ID, entityid);

      String layout_template = "portlets/html/ajax-userlist-detail.vm";
      setTemplate(rundata, context, layout_template);
    } catch (Exception ex) {
      logger.error("[AccountUserDetailScreen] Exception.", ex);
      ALEipUtils.redirectDBError(rundata);
    }
  }
Пример #11
0
  @Override
  public void init(ALAction action, RunData rundata, Context context)
      throws ALPageNotFoundException, ALDBErrorException {
    super.init(action, rundata, context);

    userId = ALEipUtils.getUserId(rundata);
    try {
      accountId = Integer.parseInt(ALEipUtils.getTemp(rundata, context, WebMailUtils.ACCOUNT_ID));
    } catch (Exception e) {
      accountId = 0;
    }

    folderName = rundata.getParameters().getString("folderName");

    orgId = Database.getDomainName();

    mailAccountList = WebMailUtils.getMailAccountList(rundata, context);
  }
Пример #12
0
  /**
   * ロールをデータベースから削除します。 <br>
   *
   * @param rundata
   * @param context
   * @param msgList
   * @return TRUE 成功 FALSE 失敗
   */
  @Override
  protected boolean deleteFormData(RunData rundata, Context context, List<String> msgList) {
    try {

      String aclroleid = ALEipUtils.getTemp(rundata, context, ALEipConstants.ENTITY_ID);
      if (aclroleid == null || Integer.valueOf(aclroleid) == null) {
        // IDが空の場合
        logger.debug("[AccessControlUtils] Empty ID...");
        return false;
      }

      Expression exp = ExpressionFactory.matchDbExp(EipTAclRole.ROLE_ID_PK_COLUMN, aclroleid);
      SelectQuery<EipTAclRole> query = Database.query(EipTAclRole.class, exp);
      List<EipTAclRole> aclroles = query.fetchList();
      if (aclroles == null || aclroles.size() == 0) {
        // 指定したIDのレコードが見つからない場合
        logger.debug("[AccessControlUtils] Not found ID...");
        return false;
      }

      // オブジェクトを削除(Cayenneのカスケード設定でEipTAclUserRoleMapも同時に削除)
      Database.delete(aclroles.get(0));

      Database.commit();

      // イベントログに保存
      for (EipTAclRole role : aclroles) {
        ALEventlogFactoryService.getInstance()
            .getEventlogHandler()
            .log(
                role.getRoleId(),
                ALEventlogConstants.PORTLET_TYPE_ACCESSCTL,
                ALLocalizationUtils.getl10nFormat("ACCESSCTL_EVENTLOG_DELETE", role.getRoleName()));
      }

    } catch (Exception ex) {
      Database.rollback();
      logger.error("AccessControlFormData.deleteFormData", ex);
      return false;
    }
    return true;
  }
Пример #13
0
  /** 初期化します。 */
  @Override
  public void init(ALAction action, RunData rundata, Context context)
      throws ALPageNotFoundException, ALDBErrorException {
    String sort = ALEipUtils.getTemp(rundata, context, LIST_SORT_STR);
    if (sort == null || sort.equals("")) {
      ALEipUtils.setTemp(rundata, context, LIST_SORT_STR, "userposition");
    }

    if (rundata.getParameters().containsKey(LIST_FILTER_ROLE)) {
      ALEipUtils.setTemp(
          rundata,
          context,
          LIST_FILTER_ROLE_STR,
          rundata.getParameters().getString(LIST_FILTER_ROLE));
    }

    target_keyword = new ALStringField();

    super.init(action, rundata, context);
  }
Пример #14
0
  /**
   * @param action
   * @param rundata
   * @param context
   * @throws ALPageNotFoundException
   * @throws ALDBErrorException
   */
  @Override
  public void init(ALAction action, RunData rundata, Context context)
      throws ALPageNotFoundException, ALDBErrorException {

    String sort = ALEipUtils.getTemp(rundata, context, LIST_SORT_STR);
    if (sort == null || sort.equals("")) {
      ALEipUtils.setTemp(
          rundata,
          context,
          LIST_SORT_STR,
          ALEipUtils.getPortlet(rundata, context).getPortletConfig().getInitParameter("p2a-sort"));
      logger.debug(
          "Init Parameter (Note) : "
              + ALEipUtils.getPortlet(rundata, context)
                  .getPortletConfig()
                  .getInitParameter("p2a-sort"));
    }

    super.init(action, rundata, context);
  }
Пример #15
0
  private boolean deleteEipTAclUserRoleMap(RunData rundata, Context context) {
    String aclroleid = ALEipUtils.getTemp(rundata, context, ALEipConstants.ENTITY_ID);
    if (aclroleid == null || Integer.valueOf(aclroleid) == null) {
      // IDが空の場合
      logger.debug("[AccessControlFormData] Empty ID...");
      return false;
    }

    SelectQuery<EipTAclUserRoleMap> query = Database.query(EipTAclUserRoleMap.class);
    Expression exp =
        ExpressionFactory.matchDbExp(
            EipTAclUserRoleMap.EIP_TACL_ROLE_PROPERTY + "." + EipTAclRole.ROLE_ID_PK_COLUMN,
            aclroleid);
    query.setQualifier(exp);
    List<EipTAclUserRoleMap> maps = query.fetchList();
    if (maps == null || maps.size() == 0) {
      return true;
    }

    Database.deleteAll(maps);
    return true;
  }
  /**
   * @param action
   * @param rundata
   * @param context
   * @throws ALPageNotFoundException
   * @throws ALDBErrorException
   */
  @Override
  public void init(ALAction action, RunData rundata, Context context)
      throws ALPageNotFoundException, ALDBErrorException {
    super.init(action, rundata, context);

    if (rundata.getParameters().containsKey(ALEipConstants.LIST_FILTER)) {
      ALEipUtils.setTemp(
          rundata,
          context,
          ScheduleUtils.FILTER_NAMESPACE,
          rundata.getParameters().getString(ALEipConstants.LIST_FILTER));
    }
    if (rundata.getParameters().containsKey(ALEipConstants.LIST_FILTER_TYPE)) {
      ALEipUtils.setTemp(
          rundata,
          context,
          ScheduleUtils.FILTER_NAMESPACE_TYPE,
          rundata.getParameters().getString(ALEipConstants.LIST_FILTER_TYPE));
    }

    viewtype = "oneday-group";
    try {
      termmap = new LinkedHashMap<Integer, List<ScheduleOnedayResultData>>();
      map = new LinkedHashMap<Integer, ScheduleOnedayContainer>();
      todomap = new LinkedHashMap<Integer, List<ScheduleToDoResultData>>();
      facilitymap = new LinkedHashMap<Integer, ScheduleOnedayContainer>();

      groups = ALEipUtils.getMyGroups(rundata);
      facilitiyGroups = ALEipUtils.getALEipGroups();
      userid = ALEipUtils.getUserId(rundata);
      rows = new int[(endHour - startHour) * 12 + 1];
      int size = rows.length;
      for (int i = 0; i < size; i++) {
        rows[i] = 1;
      }
      String filter = ALEipUtils.getTemp(rundata, context, ScheduleUtils.FILTER_NAMESPACE);

      target_group_name = getGroup(filter);

      if (filter == null) {
        VelocityPortlet portlet = ALEipUtils.getPortlet(rundata, context);
        String groupName = portlet.getPortletConfig().getInitParameter("p3a-group");
        if (groupName != null) {
          ALEipUtils.setTemp(rundata, context, ScheduleUtils.FILTER_NAMESPACE, groupName);
          ALEipUtils.setTemp(rundata, context, ScheduleUtils.FILTER_NAMESPACE_TYPE, "group");
        }
      }

      // ポートレット MyGroup のへのリンクを取得する.
      myGroupURI = ScheduleUtils.getPortletURIinPersonalConfigPane(rundata, "MyGroup");

      // アクセス権限
      ALAccessControlFactoryService aclservice =
          (ALAccessControlFactoryService)
              ((TurbineServices) TurbineServices.getInstance())
                  .getService(ALAccessControlFactoryService.SERVICE_NAME);
      ALAccessControlHandler aclhandler = aclservice.getAccessControlHandler();

      hasAclviewOther =
          aclhandler.hasAuthority(
              userid,
              ALAccessControlConstants.POERTLET_FEATURE_SCHEDULE_OTHER,
              ALAccessControlConstants.VALUE_ACL_LIST);

      hasAuthoritySelfInsert =
          aclhandler.hasAuthority(
              userid,
              ALAccessControlConstants.POERTLET_FEATURE_SCHEDULE_SELF,
              ALAccessControlConstants.VALUE_ACL_INSERT);

      hasAuthorityFacilityInsert =
          aclhandler.hasAuthority(
              userid,
              ALAccessControlConstants.POERTLET_FEATURE_SCHEDULE_FACILITY,
              ALAccessControlConstants.VALUE_ACL_INSERT);

    } catch (Exception ex) {
      logger.error("[ScheduleOnedayGroupSelectData]", ex);
    }
  }
Пример #17
0
 /**
  * タスクコメントオブジェクトモデルを取得します。
  *
  * @param rundata RunData
  * @param context Context
  * @return プロジェクト情報オブジェクトモデル
  */
 public static EipTProjectTaskComment getEipTProjectTaskComment(RunData rundata, Context context) {
   String commentId = ALEipUtils.getTemp(rundata, context, ALEipConstants.ENTITY_ID);
   return getEipTProjectTaskComment(commentId);
 }
Пример #18
0
 /**
  * プロジェクト情報オブジェクトモデルを取得します。
  *
  * @param rundata RunData
  * @param context Context
  * @return プロジェクト情報オブジェクトモデル
  */
 public static EipTProject getEipTProject(RunData rundata, Context context) {
   Integer projectId =
       Integer.valueOf(ALEipUtils.getTemp(rundata, context, ALEipConstants.ENTITY_ID));
   return getEipTProject(projectId);
 }
Пример #19
0
 /**
  * タスクオブジェクトモデルを取得します。
  *
  * @param rundata RunData
  * @param context Context
  * @return プロジェクト情報オブジェクトモデル
  */
 public static EipTProjectTask getEipTProjectTask(RunData rundata, Context context) {
   String taskId = ALEipUtils.getTemp(rundata, context, ALEipConstants.ENTITY_ID);
   return getEipTProjectTask(taskId);
 }
  protected List<VEipTScheduleList> getScheduleList(RunData rundata, Context context) {

    Calendar cal = Calendar.getInstance();
    cal.setTime(getViewDate().getValue());
    cal.add(Calendar.DATE, 1);
    cal.add(Calendar.MILLISECOND, -1);
    ALDateTimeField field = new ALDateTimeField();
    field.setValue(cal.getTime());

    String filter = ALEipUtils.getTemp(rundata, context, ScheduleUtils.FILTER_NAMESPACE);
    String filter_type = ALEipUtils.getTemp(rundata, context, ScheduleUtils.FILTER_NAMESPACE_TYPE);

    if ("all".equals(filter)) {
      filter = filter_type = null;
      ALEipUtils.removeTemp(rundata, context, ScheduleUtils.FILTER_NAMESPACE);
      ALEipUtils.removeTemp(rundata, context, ScheduleUtils.FILTER_NAMESPACE_TYPE);
    }

    if (filter == null || filter_type == null || filter.equals("") || tmpViewDate2 != null) {

      members = new ArrayList<ALEipUser>();
      members.add(ALEipUtils.getALEipUser(rundata));
      ScheduleOnedayContainer con = new ScheduleOnedayContainer();
      con.initField();
      con.initHour(startHour, endHour);
      Integer uid = Integer.valueOf(ALEipUtils.getUserId(rundata));
      this.termmap.put(uid, new ArrayList<ScheduleOnedayResultData>());
      this.map.put(uid, con);
      this.todomap.put(uid, new ArrayList<ScheduleToDoResultData>());
      return ScheduleUtils.getScheduleList(
          userid, getViewDate().getValue(), field.getValue(), Arrays.asList(userid), null);
    }

    // グループ名からユーザを取得
    List<Integer> ulist = ALEipUtils.getUserIds(filter);

    // グループにユーザが存在しない場合はダミーユーザを設定し、検索します。(0件ヒット)
    // ダミーユーザーID = -1
    int size = ulist.size();
    if (size == 0) {
      ulist.add(Integer.valueOf(-1));
    } else {
      for (int i = 0; i < size; i++) {
        Integer id = ulist.get(i);
        ScheduleOnedayContainer con = new ScheduleOnedayContainer();
        con.initField();
        con.initHour(startHour, endHour);
        this.termmap.put(id, new ArrayList<ScheduleOnedayResultData>());
        this.map.put(id, con);
        this.todomap.put(id, new ArrayList<ScheduleToDoResultData>());
      }
    }

    // List facilityIds = FacilitiesUtils.getFacilityIds(filter);
    List<Integer> facilityIds = null;
    String[] filteres = filter.split(";");
    if ("Facility".equals(filter)) {
      facilityIds = getFacilityIdAllList();
    } else if (("group".equals(filter_type)) && !("f".equals(filteres[0]))) {
      facilityIds = FacilitiesUtils.getFacilityIds(filteres[0]);
    } else {
      if ("f".equals(filteres[0])) {
        facilityIds = FacilitiesUtils.getFacilityGroupIds(Integer.valueOf(filteres[1]));
      } else {
        if (ScheduleUtils.isNumberValue(filter)) {
          facilityIds = FacilitiesUtils.getFacilityGroupIds(Integer.valueOf(filter));
        } else {
          facilityIds = new ArrayList<Integer>();
          String[] split = filter.split(",");
          if (split.length == 2) {
            // URLパラメータにfilterが含まれてしまっていた場合
            // デフォルト値のセットしなおし
            // facilityIds初期化
            VelocityPortlet portlet = ALEipUtils.getPortlet(rundata, context);
            String groupName = portlet.getPortletConfig().getInitParameter("p3a-group");
            if (groupName != null) {
              ALEipUtils.setTemp(rundata, context, ScheduleUtils.FILTER_NAMESPACE, groupName);
              ALEipUtils.setTemp(rundata, context, ScheduleUtils.FILTER_NAMESPACE_TYPE, "group");
            }
          }
        }
      }
    }

    int f_size = facilityIds.size();
    if (f_size == 0) {
      facilityIds.add(Integer.valueOf(-1));
    } else {
      for (int i = 0; i < f_size; i++) {
        Integer id = facilityIds.get(i);
        ScheduleOnedayContainer con = new ScheduleOnedayContainer();
        con.initField();
        con.initHour(startHour, endHour);
        this.facilitymap.put(id, con);
      }
    }

    members = ALEipUtils.getUsers(filter);

    String flag_changeturn =
        ALEipUtils.getTemp(rundata, context, ScheduleUtils.FLAG_CHANGE_TURN_STR);
    if ("0".equals(flag_changeturn)) {
      // ログインユーザの行けジュールを一番上に表示させるため,
      // メンバリストの初めの要素にログインユーザを配置する.
      ALEipUser eipUser = null;
      int memberSize = members.size();
      for (int i = 0; i < memberSize; i++) {
        eipUser = members.get(i);
        if (eipUser.getUserId().getValue() == userid) {
          members.remove(i);
          members.add(0, eipUser);
        }
      }
    }
    if ("Facility".equals(filter)) {
      facilityList = FacilitiesUtils.getFacilityList(filter);
    } else if ("facilitygroup".equals(filter_type) || "f".equals(filteres[0])) {
      if ("f".equals(filteres[0])) {
        facilityList = FacilitiesUtils.getFacilityGroupList(Integer.valueOf(filteres[1]));

      } else {

        if (ScheduleUtils.isNumberValue(filter)) {
          facilityList = FacilitiesUtils.getFacilityGroupList(Integer.valueOf(filter));
        }
      }
    } else {
      facilityList = FacilitiesUtils.getFacilityList(filter);
    }
    if (!("f".equals(filteres[0]))) {
      current_filter = filter;
    } else {
      current_filter = filteres[1];
    }
    current_filter_type = filter_type;
    return ScheduleUtils.getScheduleList(
        userid, getViewDate().getValue(), field.getValue(), ulist, facilityIds);
  }
Пример #21
0
  /**
   * 検索条件を設定した SelectQuery を返します。 <br>
   *
   * @param rundata
   * @param context
   * @return
   */
  protected SelectQuery<TurbineUser> getSelectQuery(RunData rundata, Context context) {

    ObjectId oid = new ObjectId("TurbineUser", TurbineUser.USER_ID_PK_COLUMN, 3);

    Expression exp_base =
        ExpressionFactory.matchAllDbExp(oid.getIdSnapshot(), Expression.GREATER_THAN);

    SelectQuery<TurbineUser> query =
        Database.query(TurbineUser.class, exp_base)
            .where(
                Operations.eq(TurbineUser.COMPANY_ID_PROPERTY, Integer.valueOf(1)),
                Operations.ne(TurbineUser.DISABLED_PROPERTY, "T"));

    String filter = ALEipUtils.getTemp(rundata, context, LIST_FILTER_STR);
    String filter_role = ALEipUtils.getTemp(rundata, context, LIST_FILTER_ROLE_STR);
    currentPost = filter;
    currentRole = filter_role;

    if (target_keyword != null && !target_keyword.getValue().equals("")) {
      String transWord =
          ALStringUtil.convertHiragana2Katakana(
              ALStringUtil.convertH2ZKana(target_keyword.getValue()));
      transWord = transWord.replace(" ", "").replace(" ", ""); // 全角/半角スペースを削除
      String[] transWords = transWord.split(""); // 1文字ずつに分解

      for (int i = 0; i < transWords.length; i++) {
        Expression exp11 =
            ExpressionFactory.likeExp(
                TurbineUser.FIRST_NAME_PROPERTY, "%" + target_keyword.getValue() + "%");
        Expression exp12 =
            ExpressionFactory.likeExp(
                TurbineUser.LAST_NAME_PROPERTY, "%" + target_keyword.getValue() + "%");
        Expression exp13 =
            ExpressionFactory.likeExp(
                TurbineUser.FIRST_NAME_KANA_PROPERTY, "%" + target_keyword.getValue() + "%");
        Expression exp14 =
            ExpressionFactory.likeExp(
                TurbineUser.LAST_NAME_KANA_PROPERTY, "%" + target_keyword.getValue() + "%");
        Expression exp15 =
            ExpressionFactory.likeExp(
                TurbineUser.EMAIL_PROPERTY, "%" + target_keyword.getValue() + "%");
        Expression exp16 =
            ExpressionFactory.likeExp(
                TurbineUser.TURBINE_USER_GROUP_ROLE_PROPERTY
                    + "."
                    + TurbineUserGroupRole.TURBINE_GROUP_PROPERTY
                    + "."
                    + TurbineGroup.GROUP_ALIAS_NAME_PROPERTY,
                "%" + target_keyword.getValue() + "%");
        Expression exp17 =
            ExpressionFactory.likeExp(
                TurbineUser.LOGIN_NAME_PROPERTY, "%" + target_keyword.getValue() + "%");
        Expression exp21 =
            ExpressionFactory.likeExp(
                TurbineUser.OUT_TELEPHONE_PROPERTY, "%" + target_keyword.getValue() + "%");
        Expression exp22 =
            ExpressionFactory.likeExp(
                TurbineUser.IN_TELEPHONE_PROPERTY, "%" + target_keyword.getValue() + "%");
        Expression exp23 =
            ExpressionFactory.likeExp(
                TurbineUser.CELLULAR_PHONE_PROPERTY, "%" + target_keyword.getValue() + "%");
        Expression exp31 =
            ExpressionFactory.likeExp(TurbineUser.FIRST_NAME_PROPERTY, "%" + transWords[i] + "%");
        Expression exp32 =
            ExpressionFactory.likeExp(TurbineUser.LAST_NAME_PROPERTY, "%" + transWords[i] + "%");
        Expression exp33 =
            ExpressionFactory.likeExp(
                TurbineUser.FIRST_NAME_KANA_PROPERTY, "%" + transWords[i] + "%");
        Expression exp34 =
            ExpressionFactory.likeExp(
                TurbineUser.LAST_NAME_KANA_PROPERTY, "%" + transWords[i] + "%");
        Expression exp35 =
            ExpressionFactory.likeExp(
                TurbineUser.TURBINE_USER_GROUP_ROLE_PROPERTY
                    + "."
                    + TurbineUserGroupRole.TURBINE_GROUP_PROPERTY
                    + "."
                    + TurbineGroup.GROUP_ALIAS_NAME_PROPERTY,
                "%" + transWords[i] + "%");

        query.andQualifier(
            exp11
                .orExp(exp12)
                .orExp(exp13)
                .orExp(exp14)
                .orExp(exp15)
                .orExp(exp16)
                .orExp(exp17)
                .orExp(exp21)
                .orExp(exp22)
                .orExp(exp23)
                .orExp(exp31)
                .orExp(exp32)
                .orExp(exp33)
                .orExp(exp34)
                .orExp(exp35));
      }
    }

    // ユーザーの状態によるフィルターが指定されている場合。
    if (filter_role != null && !filter_role.equals("")) {

      // 管理者かどうか
      if (filter_role.equals(AccountUtils.ROLE_ADMIN.toString())) {
        try {
          Group group = JetspeedSecurity.getGroup("LoginUser");
          Role adminrole = JetspeedSecurity.getRole("admin");
          List<TurbineUserGroupRole> admins =
              Database.query(TurbineUserGroupRole.class)
                  .where(
                      Operations.eq(TurbineUserGroupRole.TURBINE_ROLE_PROPERTY, adminrole.getId()),
                      Operations.eq(TurbineUserGroupRole.TURBINE_GROUP_PROPERTY, group.getId()),
                      Operations.ne(TurbineUserGroupRole.TURBINE_USER_PROPERTY, 1))
                  .distinct(true)
                  .fetchList();
          List<Integer> admin_ids = new ArrayList<Integer>();
          admin_ids.add(Integer.valueOf(1));
          for (TurbineUserGroupRole tugr : admins) {
            admin_ids.add(tugr.getTurbineUser().getUserId());
          }
          query.andQualifier(ExpressionFactory.inDbExp(TurbineUser.USER_ID_PK_COLUMN, admin_ids));

        } catch (Exception ex) {
          logger.error("AccountUserSelectData.getSelectQuery", ex);
        }
      }

      // 有効ユーザーかどうか
      if (filter_role.equals(AccountUtils.ROLE_ACTIVE.toString())) {
        query.andQualifier(ExpressionFactory.matchExp(TurbineUser.DISABLED_PROPERTY, "F"));
      }

      // 有効ユーザーかどうか
      if (filter_role.equals(AccountUtils.ROLE_IN_ACTIVE.toString())) {
        query.andQualifier(ExpressionFactory.matchExp(TurbineUser.DISABLED_PROPERTY, "N"));
      }
    }

    // 部署によるフィルターが指定されている場合。
    if (filter != null && !filter.equals("")) {

      String groupName =
          (ALEipManager.getInstance().getPostMap().get(Integer.valueOf(filter)))
              .getGroupName()
              .getValue();

      query.where(
          Operations.eq(
              TurbineUser.TURBINE_USER_GROUP_ROLE_PROPERTY
                  + "."
                  + TurbineUserGroupRole.TURBINE_GROUP_PROPERTY
                  + "."
                  + TurbineGroup.GROUP_NAME_PROPERTY,
              groupName));
    }

    query.distinct();

    return query;
  }