现在的位置: 首页 > 综合 > 正文

获取在线用户

2013年04月05日 ⁄ 综合 ⁄ 共 1288字 ⁄ 字号 评论关闭

//获取在线用户
    UserInfo userInfo = SysContext.getSysContext().getCurrentUserInfo();
    IObjectPK userPK = new ObjectUuidPK(userInfo.getId());
//根据组织范围获取在线用户
    List orgList = OrgRangeService.getCUOrgRange(null, userPK);

   OrgRangeService-》PermissionRangeHelper的getCUOrgRange方法
   public static List getCUOrgRange(Context ctx, IObjectPK userPK)
    throws BOSException, EASBizException
   {
    return getUserOrgId(ctx, userPK, OrgRangeType.BIZ_ORG_TYPE);
   }
   //获取用户组织范围
   public static List getUserOrgId(Context ctx, IObjectPK userPK, OrgRangeType orgType)
    throws BOSException, EASBizException
  {
    OrgRangeCollection fullOrgCol = getUserOrgRange(ctx, userPK, orgType);
List cuIdList = ToolUtils.transCol2ListByPeroperty(fullOrgCol, new IObjectCol2List()
    {
      public String getList(Object obj) {
        OrgRangeInfo orgInfo = (OrgRangeInfo)obj;
        return orgInfo.getOrg().getId().toString();
      }
    });
    return cuIdList;
  }

//获取在线用户集合UMRegistryCollection
 
  protected IUserMonitor getBizInterface() throws EASBizException {
    return UserMonitorFactory.getRemoteInstance();
  }
  UserMonitorFactory.getRemoteInstance()
如果ui的话,remote
;
如果facade,local
  UMRegistryCollection regs = ((UMRegistryCollection)getBizInterface().getCollectionByOrgRange(SysContext.getSysContext().getDcName(), orgList));
//UMRegistryCollection是UMRegistryInfo的集合
//UMRegistryInfo是在线用户 里面有用户Id,用户名称等等信息。

抱歉!评论已关闭.