/** * タスク担当者を返す * * @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; }
/** * プロジェクトオブジェクトよりプロジェクト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; } }
/** * @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 ""; } }
/** * @param action * @param rundata * @param context * @throws ALPageNotFoundException * @throws ALDBErrorException */ @Override public void init(ALAction action, RunData rundata, Context context) throws ALPageNotFoundException, ALDBErrorException { login_user = ALEipUtils.getALEipUser(rundata); groups = ALEipUtils.getMyGroups(rundata); // スーパークラスのメソッドを呼び出す。 super.init(action, rundata, context); }
/** * @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; } }
private static List<ALEipUser> getALEipUsers(List<Integer> idList) { List<TurbineUser> list = getTurbineUsers(idList); List<ALEipUser> users = new ArrayList<ALEipUser>(); for (TurbineUser user : list) { try { users.add(ALEipUtils.getALEipUser(user)); } catch (ALDBErrorException ignore) { // no occur } } return users; }
/** * タスク担当者へ通知メールを送る * * @param taskId タスクID * @return 成否 */ public static boolean sendMailForTaskMembers( RunData rundata, Context context, EipTProjectTask task, EipTProject project, List<ProjectTaskMemberResultData> mailUserList) { String orgId = Database.getDomainName(); String subject = "[" + ALOrgUtilsService.getAlias() + "]" + ALLocalizationUtils.getl10n("PROJECT_MAIL_TITLE"); try { List<ALEipUser> memberList = new ArrayList<ALEipUser>(); for (ProjectTaskMemberResultData rd : mailUserList) { memberList.add(ALEipUtils.getALEipUser(rd.getUserId().getValueWithInt())); } List<ALEipUserAddr> destMemberList = ALMailUtils.getALEipUserAddrs(memberList, ALEipUtils.getUserId(rundata), false); List<ALAdminMailMessage> messageList = new ArrayList<ALAdminMailMessage>(); for (ALEipUserAddr destMember : destMemberList) { ALAdminMailMessage message = new ALAdminMailMessage(destMember); message.setPcSubject(subject); message.setCellularSubject(subject); message.setPcBody(createTaskMemberMsg(rundata, message.getPcMailAddr(), task, project)); message.setCellularBody( createTaskMemberMsg(rundata, message.getCellMailAddr(), task, project)); messageList.add(message); } ALMailService.sendAdminMailAsync( new ALAdminMailContext( orgId, ALEipUtils.getUserId(rundata), messageList, ALMailUtils.getSendDestType(ALMailUtils.KEY_MSGTYPE_WORKFLOW))); } catch (Exception ex) { logger.error("project", ex); return false; } return true; }
/** * タスクコメントリストを返す * * @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; }
/** * プロジェクトメンバーを返す * * @param projectId プロジェクトID * @return プロジェクトメンバーのリスト */ public static List<ALEipUser> getProjectMembers(Integer projectId) { List<ALEipUser> members = new ArrayList<ALEipUser>(); try { SelectQuery<EipTProjectMember> query = Database.query(EipTProjectMember.class); query.setQualifier( ExpressionFactory.matchExp(EipTProjectMember.EIP_TPROJECT_PROPERTY, projectId)); List<EipTProjectMember> list = query.fetchList(); for (EipTProjectMember member : list) { members.add(ALEipUtils.getALEipUser(member.getUserId())); } } catch (Exception ex) { logger.error("Exception", ex); } return members; }
/** * @param action * @param rundata * @param context * @throws ALPageNotFoundException * @throws ALDBErrorException */ @Override public void init(ALAction action, RunData rundata, Context context) throws ALPageNotFoundException, ALDBErrorException { is_member = rundata.getParameters().getBoolean("is_member"); login_user = ALEipUtils.getALEipUser(rundata); groups = ALEipUtils.getMyGroups(rundata); authority_edit = MsgboardUtils.checkPermission( rundata, context, ALAccessControlConstants.VALUE_ACL_UPDATE, ALAccessControlConstants.POERTLET_FEATURE_MSGBOARD_CATEGORY_OTHER); authority_delete = MsgboardUtils.checkPermission( rundata, context, ALAccessControlConstants.VALUE_ACL_DELETE, ALAccessControlConstants.POERTLET_FEATURE_MSGBOARD_CATEGORY_OTHER); // スーパークラスのメソッドを呼び出す。 super.init(action, rundata, context); }
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); }