Exemplo n.º 1
0
  /**
   * @param rundata
   * @param context
   * @param values
   * @param msgList
   * @return
   * @throws ALPageNotFoundException
   * @throws ALDBErrorException
   */
  @Override
  protected boolean action(
      RunData rundata, Context context, List<String> values, List<String> msgList)
      throws ALPageNotFoundException, ALDBErrorException {
    try {

      Expression exp1 =
          ExpressionFactory.matchExp(
              EipTNoteMap.USER_ID_PROPERTY, Integer.valueOf(ALEipUtils.getUserId(rundata)));
      Expression exp2 = ExpressionFactory.inDbExp(EipTNote.NOTE_ID_PK_COLUMN, values);

      List<EipTNoteMap> list =
          Database.query(EipTNoteMap.class, exp1).andQualifier(exp2).fetchList();

      if (list == null || list.size() <= 0) {
        return false;
      }

      for (EipTNoteMap notemap : list) {
        notemap.setNoteStat(NoteUtils.NOTE_STAT_READ);
      }

      Database.commit();
    } catch (Exception ex) {
      Database.rollback();
      logger.error("note", ex);
      return false;
    }
    return true;
  }
Exemplo n.º 2
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;
    }
  }
Exemplo n.º 3
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;
    }
  }
Exemplo n.º 4
0
  /**
   * 自分がオーナのグループを取得しID/Objectのマップを返却する。
   *
   * @param rundata
   * @param context
   * @return
   */
  public static Map<Integer, AddressBookGroup> getGroupMap(RunData rundata, Context context) {
    try {
      Map<Integer, AddressBookGroup> groupMap = new LinkedHashMap<Integer, AddressBookGroup>();

      SelectQuery<EipMAddressGroup> query = Database.query(EipMAddressGroup.class);
      Expression exp =
          ExpressionFactory.matchExp(
              EipMAddressGroup.OWNER_ID_PROPERTY, Integer.valueOf(ALEipUtils.getUserId(rundata)));
      query.setQualifier(exp);

      List<EipMAddressGroup> list = query.fetchList();
      int size = list.size();
      for (int i = 0; i < size; i++) {
        EipMAddressGroup record = list.get(i);
        AddressBookGroup group = new AddressBookGroup();
        group.initField();
        group.setGroupId(record.getGroupId().intValue());
        group.setGroupName(record.getGroupName());
        groupMap.put(record.getGroupId(), group);
      }
      return groupMap;
    } catch (Exception ex) {
      logger.error("AddressBookUtils.getGroupMap", ex);
      return null;
    }
  }
  @Override
  protected String getJSONString(RunData rundata, Context context) throws Exception {
    String result = "";
    JSONArray json;

    try {

      String mode = rundata.getParameters().getString("mode");
      if ("group".equals(mode)) {
        String groupname = rundata.getParameters().getString("groupname");

        json =
            JSONArray.fromObject(
                AddressBookUserUtils.getAddressBookUserLiteBeansFromGroup(
                    groupname, ALEipUtils.getUserId(rundata)));
      } else {
        json = new JSONArray();
      }
      result = json.toString();
    } catch (Exception e) {
      logger.error("AddressBookUserLiteJSONScreen.getJSONString", e);
    }

    return result;
  }
Exemplo n.º 6
0
  /**
   * タスク担当者へ通知メールを送る
   *
   * @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;
  }
  @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);
  }
Exemplo n.º 8
0
  /**
   * @param rundata
   * @param context
   * @return
   */
  @Override
  protected ResultList<EipTNoteMap> selectList(RunData rundata, Context context) {

    try {
      userId = Integer.toString(ALEipUtils.getUserId(rundata));
      newNoteAllSum = NoteUtils.getNewReceivedNoteAllSum(rundata, userId);
      unreadReceivedNotesAllSum = NoteUtils.getUnreadReceivedNotesAllSum(rundata, userId);

      SelectQuery<EipTNoteMap> query = getSelectQuery(rundata, context);
      buildSelectQueryForListView(query);
      buildSelectQueryForListViewSort(query, rundata, context);

      return query.getResultList();
    } catch (Exception ex) {
      logger.error("note", ex);
      return null;
    }
  }
Exemplo n.º 9
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);
  }
Exemplo n.º 10
0
 /**
  * 自分がオーナーのグループを取得します
  *
  * @param rundata
  * @return
  */
 public static List<AddressBookGroupResultData> getMyGroups(RunData rundata) {
   List<AddressBookGroupResultData> res = new ArrayList<AddressBookGroupResultData>();
   try {
     // 自分がオーナのグループ指定
     SelectQuery<EipMAddressGroup> query = Database.query(EipMAddressGroup.class);
     Expression exp =
         ExpressionFactory.matchExp(
             EipMAddressGroup.OWNER_ID_PROPERTY, Integer.valueOf(ALEipUtils.getUserId(rundata)));
     query.orderAscending(EipMAddressGroup.GROUP_NAME_PROPERTY);
     query.setQualifier(exp);
     List<EipMAddressGroup> aList = query.fetchList();
     for (EipMAddressGroup record : aList) {
       AddressBookGroupResultData rd = new AddressBookGroupResultData();
       rd.initField();
       rd.setGroupId(record.getGroupId().longValue());
       rd.setGroupName(record.getGroupName());
       res.add(rd);
     }
   } catch (Exception ex) {
     logger.error("AddressBookUtils.getMyGroups", ex);
   }
   return res;
 }
Exemplo n.º 11
0
  /**
   * @param action
   * @param rundata
   * @param context
   * @throws ALPageNotFoundException
   * @throws ALDBErrorException
   */
  @Override
  public void init(ALAction action, RunData rundata, Context context)
      throws ALPageNotFoundException, ALDBErrorException {

    uid = ALEipUtils.getUserId(rundata);

    authority_list =
        CommonCategoryUtils.checkPermission(
            rundata,
            context,
            ALAccessControlConstants.VALUE_ACL_LIST,
            ALAccessControlConstants.POERTLET_FEATURE_MANHOUR_COMMON_CATEGORY_OTHER);

    authority_detail =
        CommonCategoryUtils.checkPermission(
            rundata,
            context,
            ALAccessControlConstants.VALUE_ACL_DETAIL,
            ALAccessControlConstants.POERTLET_FEATURE_MANHOUR_COMMON_CATEGORY_OTHER);

    authority_edit =
        CommonCategoryUtils.checkPermission(
            rundata,
            context,
            ALAccessControlConstants.VALUE_ACL_UPDATE,
            ALAccessControlConstants.POERTLET_FEATURE_MANHOUR_COMMON_CATEGORY_OTHER);

    authority_delete =
        CommonCategoryUtils.checkPermission(
            rundata,
            context,
            ALAccessControlConstants.VALUE_ACL_DELETE,
            ALAccessControlConstants.POERTLET_FEATURE_MANHOUR_COMMON_CATEGORY_OTHER);

    super.init(action, rundata, context);
  }
  /**
   * 初期化処理を行います。
   *
   * @param action
   * @param rundata
   * @param context
   */
  @Override
  public void init(RunData rundata, Context context)
      throws ALPageNotFoundException, ALDBErrorException {

    String target_user_id = rundata.getParameters().getString("target_user_id" /*
                                                         * AddressBookUtils.
                                                         * TARGET_USER_ID
                                                         */);
    userid = Integer.toString(ALEipUtils.getUserId(rundata));

    // アクセス権
    if (
    // target_user_id == null || "".equals(target_user_id)
    // ||
    userid.equals(target_user_id)) {
      aclPortletFeature = ALAccessControlConstants.POERTLET_FEATURE_ADDRESSBOOK_ADDRESS_OUTSIDE;
    }
    // else {
    // aclPortletFeature =
    // ALAccessControlConstants.POERTLET_FEATURE_TIMECARD_TIMECARD_OTHER;
    // }

    super.init(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);
  }
  /**
   * @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);
    }
  }
  private void setupAddressBookSheet(RunData rundata, Context context, HSSFWorkbook wb)
      throws Exception {

    String sheet_name = "アドレスブック(会社情報)";
    // ヘッダ部作成
    String[] headers = {"会社名", "会社名(フリガナ)", "部署名", "郵便番号", "住所", "電話番号", "FAX", "URL"};
    // 0:日本語,1:英数字
    short[] cell_enc_types = {
      HSSFCell.ENCODING_UTF_16,
      HSSFCell.ENCODING_UTF_16,
      HSSFCell.ENCODING_UTF_16,
      HSSFCell.ENCODING_UTF_16,
      HSSFCell.ENCODING_UTF_16,
      HSSFCell.ENCODING_UTF_16,
      HSSFCell.ENCODING_UTF_16,
      HSSFCell.ENCODING_UTF_16
    };
    HSSFSheet sheet = createHSSFSheet(wb, sheet_name, headers, cell_enc_types);

    int rowcount = 0;

    // スタイルの設定
    HSSFCellStyle style_col = wb.createCellStyle();
    style_col.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
    style_col.setAlignment(HSSFCellStyle.ALIGN_JUSTIFY);

    AddressBookCompanySelectData listData = new AddressBookCompanySelectData();

    listData.initField();
    listData.setRowsNum(1000);
    listData.doSelectList(this, rundata, context);
    int page_num = listData.getPagesNum();
    int current_page = 1;
    while (true) {
      int listsize = listData.getList().size();
      AddressBookCompanyResultData rd;
      for (int j = 0; j < listsize; j++) {
        rd = (AddressBookCompanyResultData) listData.getList().get(j);
        String[] rows = {
          rd.getCompanyName().getValue(),
          rd.getCompanyNameKana().getValue(),
          rd.getPostName().getValue(),
          rd.getZipcode().getValue(),
          rd.getAddress().getValue(),
          rd.getTelephone().getValue(),
          rd.getFaxNumber().getValue(),
          rd.getUrl().getValue()
        };

        rowcount = rowcount + 1;
        addRow(sheet.createRow(rowcount), cell_enc_types, rows);
      }

      current_page++;
      if (current_page > page_num) {
        break;
      }
      listData.setCurrentPage(current_page);
      listData.doSelectList(this, rundata, context);
    }

    int uid = ALEipUtils.getUserId(rundata);
    ALEventlogFactoryService.getInstance()
        .getEventlogHandler()
        .logXlsScreen(
            uid,
            "アドレスブック(会社情報)出力",
            163 /* ALEventlogConstants.PORTLET_TYPE_ADDRESSBOOK_XLS_SCREEN */);
  }
Exemplo n.º 16
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;
  }
Exemplo n.º 17
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;
  }