java解析rtc_RTC Java API 学习笔记

本文介绍了如何使用RTC Java API进行登录、查询工作项以及获取Development Line和Iteration。通过初始化TeamPlatform,注册登录处理器,获取查询和审计客户端,构建并执行查询表达式来实现工作项的过滤。同时,详细阐述了在服务器和客户端如何获取Iteration对象。
摘要由CSDN通过智能技术生成

1 使用RTC Java API进行登录:

Login的步骤分为以下:

1 初始化启动RTC的平台TeamPlatform:TeamPlatform.startup();

2 获取RTC repository的连接

ITeamRepository teamRepository =

TeamPlatform.getTeamRepositoryService().getTeamRepository(repositoryURI);

其中repositoryURI为你需要连接的jazz server 的URI

3 注册用户:

teamRepository.registerLoginHandler(new LoginHandler(userId, password));

4 登陆:

IProgressMonitor monitor = new NullProgressMonitor();

teamRepository.login(monitor);

范例代码:

private static ITeamRepository login(String repositoryURI, String userId,String password) throws TeamRepositoryException{

ITeamRepository repository= TeamPlatform

.getTeamRepositoryService().getTeamRepository(repositoryURI);

repository.registerLoginHandler(new LoginHandler(userId, password));

repository.login(null);

return repository;

}

0818b9ca8b590ca3270a3433284dd417.png

2 利用API进行查询:

1 获取查询客户端,审计客户端以及过程服务和进程监控;

IQueryClient queryClient= (IQueryClient) repository.getClientLibrary(IQueryClient.class);

IProcessClientService processClient =

(IProcessClientService) repository.getClientLibrary(IProcessClientService.class);

IAuditableClient auditableClient =

(IAuditableClient) repository.getClientLibrary(IAuditableClient.class);

2获取Project Area的引用

URI uri = URI.create(project_name.replace(" ", "%20"));

IProjectArea projectArea = (IProjectArea)processClient.findProcessArea(uri,null,null);

System.out.println(projectArea.getName());

其中project_name是你要查询的project area所对应的name

3 得到Project Area的查询属性对象

IQueryableAttributeFactory factory = QueryableAttributes.getFactory(IWorkItem.ITEM_TYPE);

IQueryableAttribute projectAreaAttribute =

factory.findAttribute(projectArea, IWorkItem.PROJECT_AREA_PROPERTY,

auditableClient, monitor);

4 构建查询表达式:AttributeOperation可以有多种操作符

AttributeExpression projectAreaExpression =

new AttributeExpression(projectAreaAttribute, AttributeOperation.EQUALS, projectArea);

如果有多个查询条件,可以使用Term来进行构建。

如Term term = new Term(Operator.AND);

term.add(projectAreaExpression1);

if (team_area != ""){

term.add(projectAreaExpression2);

}

term.add(projectAreaExpression3);

if (tag_term_and != null){

term.add(tag_term_and);

}

if (iteration_term_or !=null){

term.add(iteration_term_or);

}

5 获取查询结果:

IQueryResult> result =

queryClient.getResolvedExpressionResults(projectArea, term,IWorkItem.FULL_PROFILE);

6 遍历查询对象:

if (result !=null){

result.setLimit(num);

IAttribute type_attr= client.findAttribute(projectArea, IWorkItem.TYPE_PROPERTY,null);

IAttribute id_attr= client.findAttribute(projectArea, IWorkItem.ID_PROPERTY,null);

IAttribute summary_attr= client.findAttribute(projectArea, IWorkItem.SUMMARY_PROPERTY,null);

IAttribute owner_attr= client.findAttribute(projectArea, IWorkItem.OWNER_PROPERTY,null);

IAttribute priority_attr= client.findAttribute(projectArea, IWorkItem.PRIORITY_PROPERTY,null);

IAttribute severity_attr= client.findAttribute(projectArea, IWorkItem.SEVERITY_PROPERTY,null);

IAttribute creation_date_attr= client.findAttribute(projectArea, IWorkItem.CREATION_DATE_PROPERTY,null);

IAttribute modified_attr= client.findAttribute(projectArea, IWorkItem.MODIFIED_PROPERTY,null);

IAttribute tag_attr= client.findAttribute(projectArea, IWorkItem.TAGS_PROPERTY,null);

IAttribute resolution_date_attr= client.findAttribute(projectArea, IWorkItem.RESOLUTION_DATE_PROPERTY,null);

while (result.hasNext(null)) {

IResolvedResult resolved = result.next(null);

IWorkItem iwi = (IWorkItem) repository.itemManager().fetchCompleteItem(resolved.getItem(), IItemManager.DEFAULT, null);

String id = resolved.getItem().getValue(id_attr).toString();

String summary = resolved.getItem().getValue(summary_attr).toString();

......

....

}

0818b9ca8b590ca3270a3433284dd417.png

3 获取development line 和iteration:

In the server side, once we have an item handle com.ibm.team.repository.service.IRepositoryItemService.fetchItem(IItemHandle, String[]) can be used to fetch the item. It would look like

IIteration iteration = getService(IRepositoryItemService.class).fetchItem(iterationHandle, IRepositoryItemService.COMPLETE)

To have access to the getService() method the server side advisor should extend com.ibm.team.repository.service.AbstractService.java. The steps are detailed in https://jazz.net/wiki/bin/view/Main/TeamProcessDeveloperGuide#Adding_New_Operation_Advisors.

In the client side advisor, code to fetch an item using its handle would look like

IProcessArea processArea = operation.getProcessArea(); //operation is the AdvisableOperation instance passed to the client side advisor

ITeamRepository repository = (ITeamRepository) processArea.getOrigin();

IItemManager itemManager = repository.itemManager();

IIteration iteration = (IIteration) itemManager.fetchCompleteItem(iterationHandle, IItemManager.DEFAULT, monitor);

有的时候一个project的development line分为好几个iteration,因此在查询的时候如果指定了plan for 为某个具体的iteration的handle,需要找到对应的iteration然后再构造查询表达式。

IDevelopmentLine line = null;                            if (developmentHandles != null) {                 List developmentLines = repository.itemManager().fetchCompleteItems(Arrays.asList(developmentHandles), IItemManager.DEFAULT, null);                                    for (Iterator e = developmentLines.iterator(); e.hasNext();) {                     line = (IDevelopmentLine) e.next();                     System.out.println("++++++"+line.getName()+"++++++");                     IIterationHandle[] iterationHandles = line.getIterations();                     if (iterationHandles !=null){                         List iterationlines = repository.itemManager().fetchCompleteItems(Arrays.asList(iterationHandles), IItemManager.DEFAULT, null);                         IIteration iteration = null;                         for (Iterator e1 = iterationlines.iterator(); e1.hasNext();) {                             iteration = (IIteration) e1.next();                             String interation_name = iteration.getName();                             System.out.println("===="+interation_name+"====");

WebRTC是一种用于实现实时通信的开放标准,而rtc_base是WebRTC中的一个重要模块。rtc_base模块是WebRTC的基础设施,提供了一套通用的功能和工具,用于支持音频、视频、网络传输和数据处理等方面的操作。 rtc_base模块涵盖了许多关键组件和类,如信号传输、网络套接字、线程管理、事件系统、时间戳等。它们提供了实现WebRTC所需的基本功能和工具集,为应用程序开发人员提供了一种简化复杂操作的方式。 其中,信号传输是rtc_base模块的一个重要组件。通过信号传输,WebRTC能够建立和维护连接,进行媒体流的传输和实时通信的交互。网络套接字则负责处理数据包的发送和接收,保证数据的可靠传输。线程管理模块用于管理多线程操作,提高性能和并发能力。事件系统则负责监听和处理各种事件,如连接建立、数据到达等。时间戳模块则用于记录和同步时间戳,确保数据的时序性和一致性。 通过rtc_base模块,开发人员可以借助WebRTC API构建各种实时通信应用,如音视频会议、在线教育、远程协作等。rtc_base提供了一种可靠、高效的底层基础设施,使得开发人员能够更简单、更高效地构建端到端的实时通信系统。 总之,rtc_base模块是WebRTC的基础设施,为实现实时通信提供了一套通用的功能和工具集。它的存在使得WebRTC能够更好地支持丰富的音视频交互和数据处理操作,在实时通信应用的开发中起到了关键作用。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值