Example #1
0
 /**
  * 開始時間を設定します。
  *
  * @param date
  */
 public void setStartDate(Date date) {
   int hh, mm;
   start_date.setValue(date);
   hh = Integer.parseInt(start_date.getHour());
   mm = Integer.parseInt(start_date.getMinute());
   start_date_time = hh * 60 + mm;
 }
Example #2
0
 /**
  * 終了時間を設定します。
  *
  * @param date
  */
 public void setEndDate(Date date) {
   int hh, mm;
   end_date.setValue(date);
   hh = Integer.parseInt(end_date.getHour());
   mm = Integer.parseInt(end_date.getMinute());
   end_date_time = hh * 60 + mm;
 }
  @Override
  protected List<VEipTScheduleList> getScheduleList(RunData rundata, Context context) {

    if (view_date == null || userid <= 0) {
      return new ArrayList<VEipTScheduleList>();
    }

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

    List<Integer> ulist = new ArrayList<Integer>();
    if (ScheduleUtils.SCHEDULEMAP_TYPE_USER.equals(type)) {
      ulist.add(userid);
    }

    List<Integer> flist = new ArrayList<Integer>();
    if (ScheduleUtils.SCHEDULEMAP_TYPE_FACILITY.equals(type)) {
      ulist.add(userid);
    }

    return ScheduleUtils.getScheduleList(
        loginuserid, view_date.getValue(), field.getValue(), ulist, flist);
  }
  @Override
  public void init(ALAction action, RunData rundata, Context context)
      throws ALPageNotFoundException, ALDBErrorException {
    super.init(action, rundata, context);

    loginuserid = ALEipUtils.getUserId(rundata);
    viewtype = "detail";

    if (ALEipUtils.isMatch(rundata, context)) {
      if (rundata.getParameters().containsKey("view_date")) {
        view_date = new ALDateTimeField("yyyy-MM-dd");
        String tmpViewDate = rundata.getParameters().getString("view_date");
        view_date.setValue(tmpViewDate);
        if (!view_date.validate(new ArrayList<String>())) {
          view_date = null;
        }
      }
    }

    if (rundata.getParameters().containsKey("userid")) {
      String tmpid = rundata.getParameters().getString("userid");
      if (tmpid != null && tmpid.startsWith(ScheduleUtils.TARGET_FACILITY_ID)) {
        userid =
            Integer.parseInt(
                tmpid.substring(ScheduleUtils.TARGET_FACILITY_ID.length(), tmpid.length()));
        type = ScheduleUtils.SCHEDULEMAP_TYPE_FACILITY;
      } else {
        userid = rundata.getParameters().getInt("userid");
        type = ScheduleUtils.SCHEDULEMAP_TYPE_USER;
      }
    } else if (rundata.getParameters().containsKey("facilityid")) {
      userid = Integer.parseInt(rundata.getParameters().getString("facilityid"));
      type = ScheduleUtils.SCHEDULEMAP_TYPE_FACILITY;
    }

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

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

    con = new ScheduleOnedayContainer();
    con.initField();
    con.initHour(0, 24);
  }
Example #5
0
 public String getSpanDateText() {
   return ALLocalizationUtils.getl10nFormat(
       "SCHEDULE_UNTIL_SPAN",
       start_date.getYear(),
       start_date.getMonth(),
       start_date.getDay(),
       start_date.getDayOfWeek(),
       end_date.getYear(),
       end_date.getMonth(),
       end_date.getDay(),
       end_date.getDayOfWeek());
 }
 /**
  * 更新日時を設定します。
  *
  * @param date
  */
 public void setUpdateDate(Date date) {
   updateDate.setValue(date);
 }
 /**
  * 作成日を設定します。
  *
  * @param date
  */
 public void setCreateDate(Date date) {
   createDate.setValue(date);
 }
  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 #9
0
 /**
  * 日付を取得します。
  *
  * @return
  */
 public String getDate2() {
   if (start_date.getHour().equals(end_date.getHour())
       && start_date.getMinute().equals(end_date.getMinute())) {
     return start_date.toString();
   } else if ((start_date.getYear().equals(end_date.getYear())
           && start_date.getMonth().equals(end_date.getMonth())
           && start_date.getDay().equals(end_date.getDay()))
       || is_repeat) {
     return new StringBuffer()
         .append(start_date.toString())
         .append(" - ")
         .append(end_date.toString())
         .toString();
   } else {
     return new StringBuffer()
         .append(start_date.toString())
         .append(" - ")
         .append("24:00")
         .toString();
   }
 }
Example #10
0
 public ALDateTimeField getCreateDateKey() {
   ALDateTimeField date = new ALDateTimeField("yyyy-MM-dd");
   date.setValue(createDate.getValue());
   return date;
 }
Example #11
0
 public ALDateTimeField getCreateDateLine() {
   ALDateTimeField date = new ALDateTimeField("yyyy年M月d日(E)");
   date.setValue(createDate.getValue());
   return date;
 }