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); }
/** * @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); } }