1

我正在尝试使用 jazz api 通过 java 应用程序在 RTC 中创建工作项。

我与存储库的连接成功。现在我需要通过 java 代码设置所有必填字段以保存/运行工作项。真的不知道如何在下面的代码中设置这些值。

   String repositoryURI= args[0];
        String userId= args[1];
        String password= args[2];
        String projectAreaName= args[3];
        String typeIdentifier= args[4];
        String summary= args[5];
        String categoryName= args[6];

        ITeamRepository teamRepository= TeamPlatform.getTeamRepositoryService().getTeamRepository(repositoryURI);
        teamRepository.registerLoginHandler(new LoginHandler(userId, password));
        teamRepository.login(null);

        IProcessClientService processClient= (IProcessClientService) teamRepository.getClientLibrary(IProcessClientService.class);
        IAuditableClient auditableClient= (IAuditableClient) teamRepository.getClientLibrary(IAuditableClient.class);
        IWorkItemClient workItemClient= (IWorkItemClient) teamRepository.getClientLibrary(IWorkItemClient.class);

        URI uri= URI.create(projectAreaName.replaceAll(" ", "%20"));
        IProjectAreaHandle projectArea= (IProjectAreaHandle) processClient.findProcessArea(uri, null, null);
        //IProjectAreaHandle projectArea = teamArea.getProjectArea();
        if (projectArea == null) {
            System.out.println("Project area not found.");
            return false;
        }
        //IWorkItemType workItemType = service.findWorkItemType(projectArea, "defect", monitor);
        IWorkItemType workItemType= workItemClient.findWorkItemType((IProjectAreaHandle) projectArea, typeIdentifier, null);
              //  findWorkItemType(projectArea, typeIdentifier, null);
        if (workItemType == null) {
            System.out.println("Work item type not found.");
            return false;
        }
        System.out.println("Category not found.: " + categoryName );

        List path= Arrays.asList(categoryName.split("/"));

        System.out.println("Category not found.: " + path );
        ICategoryHandle category= workItemClient.findCategoryByNamePath((IProjectAreaHandle) projectArea, path, null);
        //ICategoryHandle category= 
        if (category == null) {
            System.out.println("Category not found.: " + category );
            return false;
        }


        WorkItemInitialization operation= new WorkItemInitialization(summary, category);


        IWorkItemHandle handle= operation.run(workItemType, null);

        IWorkItem workItem= auditableClient.resolveAuditable(handle, IWorkItem.FULL_PROFILE, null);

        System.out.println("Created work item " + workItem.getId() + ".");

        teamRepository.logout();

在运行代码时,我收到以下错误。由于未分配必填字段。任何人都可以帮助我将属性值(联系电话)从 java 传递给 jazz。收到错误:

严重性:错误摘要:未设置属性“联系电话号码”说明:需要设置“联系电话号码”属性(工作项 <09:13:03>)。

4

0 回答 0