Example #1
0
  /**
   * プロジェクトオブジェクトよりプロジェクトResult情報を返す
   *
   * @param model プロジェクトオブジェクト
   * @return プロジェクトResult情報
   */
  public static ProjectResultData getProjectResultData(EipTProject model) {

    try {
      // 登録者
      ALEipUser adminUser = ALEipUtils.getALEipUser(model.getAdminUserId());

      ProjectResultData data = new ProjectResultData();
      data.initField();
      data.setProjectId(model.getProjectId()); // プロジェクトID
      data.setProjectName(model.getProjectName()); // プロジェクト名
      data.setExplanation(model.getExplanation()); // 説明
      data.setAdminUserId(model.getAdminUserId()); // 管理者ID
      data.setAdminUserName(adminUser.getAliasName().getValue()); // 管理者名
      data.setProgressFlg(model.getProgressFlg()); // 進捗率入力フラグ
      data.setProgressRate(model.getProgressRate()); // 進捗率
      data.setCreateDate(model.getCreateDate()); // 作成日
      data.setUpdateDate(model.getUpdateDate()); // 更新日
      data.setTaskUpdateDate(model.getUpdateDate()); // タスク更新日(初期値)
      return data;

    } catch (Exception ex) {
      logger.error("Exception", ex);
      return null;
    }
  }
Example #2
0
  /**
   * タスク担当者を返す
   *
   * @param taskId タスクID
   * @return タスク担当者のリスト
   */
  public static List<ProjectTaskMemberResultData> getProjectTaskMembers(String taskId) {
    List<ProjectTaskMemberResultData> members = new ArrayList<ProjectTaskMemberResultData>();

    try {
      SelectQuery<EipTProjectTaskMember> query = Database.query(EipTProjectTaskMember.class);
      query.setQualifier(
          ExpressionFactory.matchExp(EipTProjectTaskMember.EIP_TPROJECT_TASK_PROPERTY, taskId));
      query.orderAscending(EipTProjectTaskMember.USER_ID_PROPERTY);

      List<EipTProjectTaskMember> list = query.fetchList();

      for (EipTProjectTaskMember member : list) {
        ALEipUser user = ALEipUtils.getALEipUser(member.getUserId());
        ProjectTaskMemberResultData data = new ProjectTaskMemberResultData();
        data.initField();
        data.setUserId(user.getUserId().getValue());
        data.setUserName(user.getAliasName().getValue());
        BigDecimal workload = new BigDecimal(df.format(member.getWorkload()));
        data.setWorkload(workload);
        members.add(data);
      }
    } catch (Exception ex) {
      logger.error("Exception", ex);
    }

    return members;
  }
Example #3
0
 /**
  * @param userId
  * @return
  */
 public String getUserFullName(String userId) {
   try {
     ALEipUser user = ALEipUtils.getALEipUser(Integer.valueOf(userId).intValue());
     return user.getAliasName().getValue();
   } catch (Exception e) {
     return "";
   }
 }
Example #4
0
  /**
   * @param map
   * @return
   */
  @Override
  protected Object getResultData(EipTNoteMap map) {
    try {
      EipTNote record = map.getEipTNote();

      NoteClientResultData rd = new NoteClientResultData();
      rd.initField();
      rd.setNoteId(record.getNoteId().intValue());
      rd.setClientName(ALCommonUtils.compressString(record.getClientName(), getStrLength()));
      rd.setCompanyName(ALCommonUtils.compressString(record.getCompanyName(), getStrLength()));
      rd.setNoteStat(map.getNoteStat());
      rd.setAcceptDate(record.getAcceptDate());

      String subject = "";
      if (record.getSubjectType().equals("0")) {
        subject = ALCommonUtils.compressString(record.getCustomSubject(), getStrLength());
      } else if (record.getSubjectType().equals("1")) {
        subject = ALLocalizationUtils.getl10n("NOTE_CALL_AGAIN_NO_PERIOD");
      } else if (record.getSubjectType().equals("2")) {
        subject = ALLocalizationUtils.getl10n("NOTE_MAIL_CALL_BACK");
      } else if (record.getSubjectType().equals("3")) {
        subject = ALLocalizationUtils.getl10n("NOTE_MAIL_TELL_ME");
      } else if (record.getSubjectType().equals("4")) {
        subject = ALLocalizationUtils.getl10n("NOTE_MAIL_TAKE_A_MESSAGE");
      }

      rd.setSubject(subject);

      if (NoteUtils.NOTE_STAT_NEW.equals(map.getNoteStat())) {
        rd.setNoteStat(NoteUtils.NOTE_STAT_NEW);
        rd.setNoteStatImage("images/note/note_new_message.gif");
        rd.setNoteStatImageDescription(ALLocalizationUtils.getl10n("NOTE_NEW_MESSAGE"));
      } else if (NoteUtils.NOTE_STAT_UNREAD.equals(map.getNoteStat())) {
        rd.setNoteStat(NoteUtils.NOTE_STAT_UNREAD);
        rd.setNoteStatImage("images/note/note_unread_message.gif");
        rd.setNoteStatImageDescription(ALLocalizationUtils.getl10n("NOTE_UNREAD_MESSAGE"));
      } else {
        rd.setNoteStat(NoteUtils.NOTE_STAT_READ);
        rd.setNoteStatImage("images/note/note_read_message.gif");
        rd.setNoteStatImageDescription(ALLocalizationUtils.getl10n("NOTE_READ_MESSAGE"));
      }

      ALEipUser user = ALEipUtils.getALEipUser(Integer.valueOf(record.getOwnerId()).intValue());
      rd.setSrcUserId(record.getOwnerId());
      rd.setSrcUserFullName(user.getAliasName().getValue());

      return rd;
    } catch (RuntimeException e) {
      logger.error("note", e);
      return null;
    } catch (Exception ex) {
      logger.error("note", ex);
      return null;
    }
  }
Example #5
0
  /**
   * ロールをデータベースから読み出します。 <br>
   *
   * @param rundata
   * @param context
   * @param msgList
   * @return TRUE 成功 FALSE 失敗
   */
  @Override
  protected boolean loadFormData(RunData rundata, Context context, List<String> msgList) {
    try {
      // オブジェクトモデルを取得
      EipTAclRole aclrole = AccessControlUtils.getEipTAclRole(rundata, context);
      if (aclrole == null) {
        return false;
      }

      // ロール名
      acl_role_name.setValue(aclrole.getRoleName());

      List<EipTAclUserRoleMap> aclUserRoleMaps =
          AccessControlUtils.getEipTAclUserRoleMaps(aclrole.getRoleId().intValue());
      if (aclUserRoleMaps != null && aclUserRoleMaps.size() > 0) {
        EipTAclUserRoleMap rolemap = null;
        TurbineUser tuser = null;
        int size = aclUserRoleMaps.size();
        for (int i = 0; i < size; i++) {
          rolemap = aclUserRoleMaps.get(i);
          tuser = rolemap.getTurbineUser();
          ALEipUser user = new ALEipUser();
          user.initField();
          user.setUserId(tuser.getUserId().intValue());
          user.setName(tuser.getLoginName());
          user.setAliasName(tuser.getFirstName(), tuser.getLastName());
          // 招待中ユーザでなければ追加
          if (!JetspeedResources.CONFIRM_VALUE_PENDING.equals(tuser.getConfirmValue())) {
            memberList.add(user);
          }
        }
      }

      EipTAclPortletFeature feature = aclrole.getEipTAclPortletFeature();
      feature_id.setValue(feature.getFeatureId().intValue());
      defineAclType = feature.getAclType().intValue();

      // メモ
      note.setValue(aclrole.getNote());

      // アクセス権限
      int tmpAclType = aclrole.getAclType();
      AccessControlUtils.setupAcl(ALAccessControlConstants.VALUE_ACL_LIST, tmpAclType, acllist);
      AccessControlUtils.setupAcl(ALAccessControlConstants.VALUE_ACL_DETAIL, tmpAclType, acldetail);
      AccessControlUtils.setupAcl(ALAccessControlConstants.VALUE_ACL_INSERT, tmpAclType, aclinsert);
      AccessControlUtils.setupAcl(ALAccessControlConstants.VALUE_ACL_UPDATE, tmpAclType, aclupdate);
      AccessControlUtils.setupAcl(ALAccessControlConstants.VALUE_ACL_DELETE, tmpAclType, acldelete);
      AccessControlUtils.setupAcl(ALAccessControlConstants.VALUE_ACL_EXPORT, tmpAclType, aclexport);

    } catch (Exception ex) {
      logger.error("AccessControlFormData.loadFormData", ex);
      return false;
    }
    return true;
  }
Example #6
0
 private void insertEipTAclUserRoleMap(EipTAclRole aclrole, ALEipUser user) {
   EipTAclUserRoleMap map = Database.create(EipTAclUserRoleMap.class);
   int userid = (int) user.getUserId().getValue();
   // ユーザーID
   TurbineUser tuser = Database.get(TurbineUser.class, Integer.valueOf(userid));
   map.setEipTAclRole(aclrole);
   map.setTurbineUser(tuser);
 }
Example #7
0
  /**
   * タスクコメントリストを返す
   *
   * @param taskId タスクID
   * @return タスクコメントのリスト
   */
  public static List<ProjectTaskCommentResultData> getProjectTaskCommentList(String taskId) {
    List<ProjectTaskCommentResultData> commentList = new ArrayList<ProjectTaskCommentResultData>();

    try {
      SelectQuery<EipTProjectTaskComment> query = Database.query(EipTProjectTaskComment.class);
      query.setQualifier(
          ExpressionFactory.matchExp(EipTProjectTaskComment.EIP_TPROJECT_TASK_PROPERTY, taskId));

      List<EipTProjectTaskComment> list = query.fetchList();

      /** ファイル操作オブジェクト */
      ProjectFile<EipTProjectTaskCommentFile, EipTProjectTaskComment> pfile =
          new ProjectFile<EipTProjectTaskCommentFile, EipTProjectTaskComment>(
              EipTProjectTaskCommentFile.class);

      for (EipTProjectTaskComment comment : list) {
        ALEipUser user = ALEipUtils.getALEipUser(comment.getTurbineUser().getUserId());
        ProjectTaskCommentResultData data = new ProjectTaskCommentResultData();
        data.initField();
        data.setCommentId(comment.getCommentId());
        data.setTaskId(comment.getTaskId());
        data.setComment(comment.getComment());
        data.setCreateUserId(user.getUserId().getValue());
        data.setCreateUser(user.getAliasName().getValue());
        data.setCreateDate(comment.getCreateDate());
        data.setUpdateDate(comment.getUpdateDate());
        data.setHasPhoto(user.hasPhoto());

        // ファイルリスト
        List<EipTProjectTaskCommentFile> filelist =
            pfile
                .getSelectQueryForFiles(
                    EipTProjectTaskComment.COMMENT_ID_PK_COLUMN,
                    Integer.valueOf(comment.getCommentId()))
                .fetchList();
        data.setAttachmentFiles(pfile.getFileList(filelist));

        commentList.add(data);
      }
    } catch (Exception ex) {
      logger.error("Exception", ex);
    }

    return commentList;
  }
Example #8
0
 public static Map<String, String> getProjectMemberMap(Integer projectId) {
   Map<String, String> map = new HashMap<String, String>();
   List<EipTProjectMember> result = getProjectMember(projectId);
   if (result.isEmpty()) {
     return map;
   }
   List<Integer> idList = new ArrayList<Integer>();
   for (EipTProjectMember member : result) {
     idList.add(member.getUserId());
   }
   List<ALEipUser> users = getALEipUsers(idList);
   for (EipTProjectMember member : result) {
     for (ALEipUser user : users) {
       if (user.getUserId().getValueWithInt() == member.getUserId().intValue()) {
         map.put(user.getUserId().toString(), user.getAliasName().toString());
         continue;
       }
     }
   }
   return map;
 }
  /**
   * @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);
    if (res) {
      int tmp_access_flag = (int) access_flag.getValue();
      if (tmp_access_flag == MsgboardUtils.ACCESS_PUBLIC_ALL
          || tmp_access_flag == MsgboardUtils.ACCESS_SEACRET_SELF) {
        memberList.add(login_user);
      } else {
        String str[] = rundata.getParameters().getStrings("member_to");
        if (str == null || str.length == 0) {
          return res;
        }

        boolean containsLoginUser = false;
        String str_loginuserid = login_user.getName().getValue();
        int strsize = str.length;
        for (int i = 0; i < strsize; i++) {
          if (str_loginuserid.equals(str[i])) {
            containsLoginUser = true;
            break;
          }
        }
        if (!containsLoginUser) {
          memberList.add(login_user);
        }

        SelectQuery<TurbineUser> query = Database.query(TurbineUser.class);
        Expression exp = ExpressionFactory.inExp(TurbineUser.LOGIN_NAME_PROPERTY, str);
        query.setQualifier(exp);
        memberList.addAll(ALEipUtils.getUsersFromSelectQuery(query));
      }
    }
    return res;
  }
Example #10
0
  /**
   * データベースに格納されている掲示板カテゴリを更新します。 <br>
   *
   * @param rundata
   * @param context
   * @param msgList
   * @return
   */
  @Override
  protected boolean updateFormData(RunData rundata, Context context, List<String> msgList)
      throws ALPageNotFoundException, ALDBErrorException {
    try {
      // オブジェクトモデルを取得
      EipTMsgboardCategory category = MsgboardUtils.getEipTMsgboardCategory(rundata, context, true);
      if (category == null) {
        return false;
      }

      // カテゴリ名
      category.setCategoryName(category_name.getValue());
      // メモ
      category.setNote(note.getValue());
      // 閲覧返信フラグ
      int accessFlag = (int) access_flag.getValue();
      if (accessFlag == MsgboardUtils.ACCESS_PUBLIC_ALL
          || accessFlag == MsgboardUtils.ACCESS_PUBLIC_MEMBER) {
        category.setPublicFlag(MsgboardUtils.PUBLIC_FLG_VALUE_PUBLIC);
      } else {
        category.setPublicFlag(MsgboardUtils.PUBLIC_FLG_VALUE_NONPUBLIC);
      }
      // ユーザーID
      // category.setTurbineUser(tuser);
      // 更新日
      category.setUpdateDate(Calendar.getInstance().getTime());

      SelectQuery<EipTMsgboardCategoryMap> mapquery = Database.query(EipTMsgboardCategoryMap.class);
      Expression mapexp =
          ExpressionFactory.matchExp(
              EipTMsgboardCategoryMap.CATEGORY_ID_PROPERTY, category.getCategoryId());
      mapquery.setQualifier(mapexp);

      List<EipTMsgboardCategoryMap> maplist = mapquery.fetchList();
      Database.deleteAll(maplist);

      int size = memberList.size();
      for (int i = 0; i < size; i++) {
        EipTMsgboardCategoryMap map = Database.create(EipTMsgboardCategoryMap.class);
        ALEipUser user = memberList.get(i);
        int userid = (int) user.getUserId().getValue();
        map.setEipTMsgboardCategory(category);
        map.setUserId(Integer.valueOf(userid));
        // O: 自カテゴリ S: 共有カテゴリ(Share)
        if (userid == ALEipUtils.getUserId(rundata)) {
          if (accessFlag == MsgboardUtils.ACCESS_PUBLIC_ALL
              || accessFlag == MsgboardUtils.ACCESS_SEACRET_SELF) {
            // 所属メンバーがログインユーザのみの場合
            map.setStatus(MsgboardUtils.STAT_VALUE_ALL);
          } else {
            map.setStatus(MsgboardUtils.STAT_VALUE_OWNER);
          }
        } else {
          map.setStatus(MsgboardUtils.STAT_VALUE_SHARE);
        }
      }
      Database.commit();

      // イベントログに保存
      ALEventlogFactoryService.getInstance()
          .getEventlogHandler()
          .log(
              category.getCategoryId(),
              ALEventlogConstants.PORTLET_TYPE_MSGBOARD_CATEGORY,
              category.getCategoryName());

    } catch (Exception e) {
      Database.rollback();
      logger.error("[MsgboardFormData]", e);
      throw new ALDBErrorException();
    }
    return true;
  }
Example #11
0
  /**
   * 掲示板カテゴリをデータベースに格納します。 <br>
   *
   * @param rundata
   * @param context
   * @param msgList
   * @return
   */
  @Override
  protected boolean insertFormData(RunData rundata, Context context, List<String> msgList)
      throws ALPageNotFoundException, ALDBErrorException {
    try {
      TurbineUser tuser =
          Database.get(TurbineUser.class, Integer.valueOf(ALEipUtils.getUserId(rundata)));

      // 新規オブジェクトモデル
      EipTMsgboardCategory category = Database.create(EipTMsgboardCategory.class);
      // カテゴリ名
      category.setCategoryName(category_name.getValue());
      // メモ
      category.setNote(note.getValue());
      int accessFlag = (int) access_flag.getValue();
      if (accessFlag == MsgboardUtils.ACCESS_PUBLIC_ALL
          || accessFlag == MsgboardUtils.ACCESS_PUBLIC_MEMBER) {
        category.setPublicFlag(MsgboardUtils.PUBLIC_FLG_VALUE_PUBLIC);
      } else {
        category.setPublicFlag(MsgboardUtils.PUBLIC_FLG_VALUE_NONPUBLIC);
      }

      // ユーザーID
      category.setTurbineUser(tuser);
      // 作成日
      category.setCreateDate(Calendar.getInstance().getTime());
      // 更新日
      category.setUpdateDate(Calendar.getInstance().getTime());

      int size = memberList.size();
      for (int i = 0; i < size; i++) {
        EipTMsgboardCategoryMap map = Database.create(EipTMsgboardCategoryMap.class);
        ALEipUser user = memberList.get(i);
        int userid = (int) user.getUserId().getValue();
        map.setEipTMsgboardCategory(category);
        map.setUserId(Integer.valueOf(userid));
        // O: 自カテゴリ S: 共有カテゴリ(Share)
        if (userid == ALEipUtils.getUserId(rundata)) {
          if (accessFlag == MsgboardUtils.ACCESS_PUBLIC_ALL
              || accessFlag == MsgboardUtils.ACCESS_SEACRET_SELF) {
            // 所属メンバーがログインユーザのみの場合
            map.setStatus(MsgboardUtils.STAT_VALUE_ALL);
          } else {
            map.setStatus(MsgboardUtils.STAT_VALUE_OWNER);
          }
        } else {
          map.setStatus(MsgboardUtils.STAT_VALUE_SHARE);
        }
      }

      // 掲示板カテゴリを登録
      Database.commit();

      // イベントログに保存
      ALEventlogFactoryService.getInstance()
          .getEventlogHandler()
          .log(
              category.getCategoryId(),
              ALEventlogConstants.PORTLET_TYPE_MSGBOARD_CATEGORY,
              category.getCategoryName());

    } catch (Exception e) {
      Database.rollback();
      logger.error("[MsgboardFormData]", e);
      throw new ALDBErrorException();
    }
    return true;
  }
Example #12
0
  /**
   * 掲示板カテゴリをデータベースから読み出します。 <br>
   *
   * @param rundata
   * @param context
   * @param msgList
   * @return
   */
  @Override
  protected boolean loadFormData(RunData rundata, Context context, List<String> msgList)
      throws ALPageNotFoundException, ALDBErrorException {
    try {
      String loginUserStatus = null;
      int uid = (int) login_user.getUserId().getValue();

      // オブジェクトモデルを取得
      EipTMsgboardCategory category = MsgboardUtils.getEipTMsgboardCategory(rundata, context, true);
      if (category == null) {
        return false;
      }
      // カテゴリ名
      category_name.setValue(category.getCategoryName());
      // メモ
      note.setValue(category.getNote());
      // 公開区分
      boolean public_flag =
          (MsgboardUtils.PUBLIC_FLG_VALUE_PUBLIC).equals(category.getPublicFlag());

      // このカテゴリを共有しているメンバーを取得
      SelectQuery<EipTMsgboardCategoryMap> mapquery = Database.query(EipTMsgboardCategoryMap.class);
      Expression mapexp =
          ExpressionFactory.matchDbExp(
              EipTMsgboardCategory.CATEGORY_ID_PK_COLUMN, category.getCategoryId());
      mapquery.setQualifier(mapexp);

      List<EipTMsgboardCategoryMap> list = mapquery.fetchList();

      List<Integer> users = new ArrayList<Integer>();
      int size = list.size();
      for (int i = 0; i < size; i++) {
        EipTMsgboardCategoryMap map = list.get(i);
        users.add(map.getUserId());
        if (uid == map.getUserId().intValue()) {
          loginUserStatus = map.getStatus();
        }
      }

      SelectQuery<TurbineUser> query = Database.query(TurbineUser.class);
      Expression exp = ExpressionFactory.inDbExp(TurbineUser.USER_ID_PK_COLUMN, users);
      Expression nonDisabledexp = ExpressionFactory.noMatchExp(TurbineUser.DISABLED_PROPERTY, "T");
      query.setQualifier(exp.andExp(nonDisabledexp));
      memberList.addAll(ALEipUtils.getUsersFromSelectQuery(query));

      if (public_flag) {
        if ((MsgboardUtils.STAT_VALUE_ALL).equals(loginUserStatus)) {
          access_flag.setValue(MsgboardUtils.ACCESS_PUBLIC_ALL);
          is_member = false;
        } else {
          access_flag.setValue(MsgboardUtils.ACCESS_PUBLIC_MEMBER);
          is_member = true;
        }
      } else {
        if ((MsgboardUtils.STAT_VALUE_ALL).equals(loginUserStatus)) {
          access_flag.setValue(MsgboardUtils.ACCESS_SEACRET_SELF);
          is_member = false;
        } else {
          access_flag.setValue(MsgboardUtils.ACCESS_SEACRET_MEMBER);
          is_member = true;
        }
      }

    } catch (Exception e) {
      logger.error("[MsgboardFormData]", e);
      throw new ALDBErrorException();
    }
    return true;
  }
Example #13
0
  @SuppressWarnings("unchecked")
  public Map<Integer, ALEipUser> getUsers(List<Integer> users) {
    Map<Integer, ALEipUser> results = new HashMap<Integer, ALEipUser>(users.size());
    Map<Integer, ALEipUser> map = new HashMap<Integer, ALEipUser>(users.size());

    List<Integer> fetchUsers = new ArrayList<Integer>(users.size());

    HttpServletRequest request = HttpServletRequestLocator.get();

    if (request != null) {
      map = (Map<Integer, ALEipUser>) request.getAttribute(USERS_KEY);
      if (map != null) {
        for (Integer userId : users) {
          ALEipUser user = map.get(userId);
          if (user != null) {
            results.put(userId, user);
          } else {
            fetchUsers.add(userId);
          }
        }
      } else {
        map = new HashMap<Integer, ALEipUser>(users.size());
        fetchUsers.addAll(users);
      }
    } else {
      fetchUsers.addAll(users);
    }

    if (fetchUsers.size() > 0) {

      StringBuilder select = new StringBuilder();

      select.append("SELECT");
      select.append(" turbine_user.user_id,");
      select.append(" turbine_user.last_name,");
      select.append(" turbine_user.first_name,");
      select.append(" turbine_user.login_name,");
      select.append(" turbine_user.has_photo,");
      select.append(" turbine_user.photo_modified");

      StringBuilder body = new StringBuilder();
      body.append(" FROM turbine_user WHERE ");
      body.append(" turbine_user.user_id IN (");
      boolean isFirst = true;
      for (Integer num : fetchUsers) {
        if (!isFirst) {
          body.append(",");
        }
        body.append(num.intValue());
        isFirst = false;
      }
      body.append(")");

      SQLTemplate<VTurbineUserLite> query =
          Database.sql(VTurbineUserLite.class, select.toString() + body.toString());
      List<VTurbineUserLite> list = query.fetchList();

      for (VTurbineUserLite model : list) {
        ALEipUser eipUser = new ALEipUser();
        eipUser.initField();
        eipUser.setAliasName(model.getFirstName(), model.getLastName());
        eipUser.setName(model.getLoginName());
        eipUser.setUserId(model.getUserId());
        eipUser.setHasPhoto("T".equals(model.getHasPhoto()) || "N".equals(model.getHasPhoto()));
        eipUser.setPhotoModified(
            model.getPhotoModified() != null ? model.getPhotoModified().getTime() : 0);

        results.put(model.getUserId(), eipUser);
        map.put(model.getUserId(), eipUser);
      }
    }

    // requestに登録
    if (request != null) {
      request.setAttribute(USERS_KEY, map);
    }

    return results;
  }
Example #14
0
 public void setUpdateUser(ALEipUser user) {
   update_user = user.getName();
 }
Example #15
0
 public void setCreateUser(ALEipUser user) {
   create_user = user.getName();
 }
  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);
  }
Example #17
0
  /**
   * フォームに入力されたデータの妥当性検証を行います。 <br>
   *
   * @param msgList
   * @return TRUE 成功 FALSE 失敗
   */
  @Override
  protected boolean validate(List<String> msgList) {
    String tmp_acl_role_name = acl_role_name.getValue();
    if (tmp_acl_role_name != null && !"".equals(tmp_acl_role_name)) {
      // ロール名の重複をチェックする
      try {
        SelectQuery<EipTAclRole> query = Database.query(EipTAclRole.class);
        if (ALEipConstants.MODE_INSERT.equals(getMode())) {
          Expression exp =
              ExpressionFactory.matchExp(EipTAclRole.ROLE_NAME_PROPERTY, tmp_acl_role_name);
          query.setQualifier(exp);
        } else if (ALEipConstants.MODE_UPDATE.equals(getMode())) {
          Expression exp1 =
              ExpressionFactory.matchExp(EipTAclRole.ROLE_NAME_PROPERTY, tmp_acl_role_name);
          query.setQualifier(exp1);
          Expression exp2 =
              ExpressionFactory.noMatchDbExp(
                  EipTAclRole.ROLE_ID_PK_COLUMN, Integer.valueOf(acl_role_id));
          query.andQualifier(exp2);
        }

        if (query.fetchList().size() != 0) {
          msgList.add(
              ALLocalizationUtils.getl10nFormat(
                  "ACCESSCTL_ALERT_ALREADY_CREATED", acl_role_name.toString()));
        }
      } catch (Exception ex) {
        logger.error("AccessControlFormData.validate", ex);
        return false;
      }
    }

    // ロール名
    acl_role_name.validate(msgList);
    // メモ
    note.validate(msgList);

    acllist.validate(msgList);
    acldetail.validate(msgList);
    aclinsert.validate(msgList);
    aclupdate.validate(msgList);
    acldelete.validate(msgList);
    aclexport.validate(msgList);

    // アクセス権限
    if (acllist.getValue() == 0
        && acldetail.getValue() == 0
        && aclinsert.getValue() == 0
        && aclupdate.getValue() == 0
        && acldelete.getValue() == 0
        && aclexport.getValue() == 0) {
      msgList.add(ALLocalizationUtils.getl10n("ACCESSCTL_ALERT_NO_FEATURE_SELECTED"));
    }

    // 所属メンバー
    if (memberList.size() == 0) {
      msgList.add(ALLocalizationUtils.getl10n("ACCESSCTL_ALERT_NO_MEMBER_SELECTED"));
    } else {
      try {
        // 同一機能の他ロールには所属できないようにする

        List<Integer> uids = new ArrayList<Integer>();
        int msize = memberList.size();
        for (int i = 0; i < msize; i++) {
          ALEipUser user = memberList.get(i);
          uids.add(Integer.valueOf((int) user.getUserId().getValue()));
        }

        SelectQuery<EipTAclRole> rolequery = Database.query(EipTAclRole.class);
        Expression exp11 =
            ExpressionFactory.matchDbExp(
                EipTAclRole.EIP_TACL_PORTLET_FEATURE_PROPERTY
                    + "."
                    + EipTAclPortletFeature.FEATURE_ID_PK_COLUMN,
                Integer.valueOf((int) feature_id.getValue()));
        Expression exp12 =
            ExpressionFactory.inDbExp(
                EipTAclRole.EIP_TACL_USER_ROLE_MAPS_PROPERTY
                    + "."
                    + EipTAclUserRoleMap.TURBINE_USER_PROPERTY
                    + "."
                    + TurbineUser.USER_ID_PK_COLUMN,
                uids);
        rolequery.setQualifier(exp11.andExp(exp12));

        if (ALEipConstants.MODE_UPDATE.equals(getMode())) {
          Expression exp13 =
              ExpressionFactory.noMatchDbExp(
                  EipTAclRole.ROLE_ID_PK_COLUMN, Integer.valueOf(acl_role_id));
          rolequery.andQualifier(exp13);
        }

        List<EipTAclRole> roleList = rolequery.fetchList();
        if (roleList != null && roleList.size() != 0) {
          msgList.add(ALLocalizationUtils.getl10n("ACCESSCTL_ALERT_OTHER_ROLE"));
        }
      } catch (Exception ex) {
        logger.error("AccessControlFormData.validate", ex);
        return false;
      }
    }

    return (msgList.size() == 0);
  }