Beispiel #1
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;
    }
  }
Beispiel #2
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;
 }