Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How to read details of all the Iterations in any RTC Project Area programatically.

Hi,

How to read details of all the Iterations in any RTC Project Area programmatically.

If anyone has achieved this. please let me know.

Thanks
Vaibhav


0 votes



One answer

Permanent link

Hi,

I found this code online. This does the required operation:


private void storeIterationVals(MigrationDetailsBean migDetailsBean, RTCServerConfig rtcServerConfig,
                     Object srcValue, IProgressMonitor monitor) throws TeamRepositoryException {
              PathHelper ph = new PathHelper(rtcServerConfig.getSrcRepo(), monitor);
              ph.calculateIterationPath((IterationHandle) srcValue);

              String paths = "IDPath: [" + ph.toIDPathString() + "] NamePath: (" + ph.toNamePathString() + ")";
              logger.info("Path to Iteration : " + ph.toIDPathString());

              DevelopmentLineHelper devLineUtil = new DevelopmentLineHelper(rtcServerConfig.getSrcRepo(), monitor);
              String iterationPath = ph.toNamePathString();
              IProjectAreaHandle targetPAHandle = migDetailsBean.getTargetProjArea().getProjectArea();
              List path = Arrays.asList(iterationPath.split("/"));

              // map by ID
              IIteration found = devLineUtil.findIteration(targetPAHandle, path, DevelopmentLineHelper.BYID);

              if (found == null) {
                     found = devLineUtil.findIteration(targetPAHandle, path, DevelopmentLineHelper.BYNAME);
              }

              // IIterationHandle found =
              // devLineUtil.fetchIterations(migDetailsBean.getTargetProjArea(), repo,
              // monitor, iterationPath);
              migDetailsBean.getTargetWI().setValue(migDetailsBean.getTargetAttribute(), found);
       }



public IIteration findIteration(IProjectAreaHandle iProjectAreaHandle,
                     List<String> path, Comparemode comparemode) throws TeamRepositoryException {
              fAuditableClient = (IAuditableClient) fTeamRepository
                           .getClientLibrary(IAuditableClient.class);
              IIteration foundIteration = null;
             
              IProjectArea projectArea = (IProjectArea) fTeamRepository.itemManager()
                           .fetchCompleteItem(iProjectAreaHandle, IItemManager.REFRESH,
                                         fMonitor);
              IDevelopmentLine developmentLine = findDevelopmentLine(projectArea,
                           path, comparemode);
              if (developmentLine != null) {
                     foundIteration = findIteration(developmentLine.getIterations(),
                                  path, 1, comparemode);
              }
              return foundIteration;
       }

public IDevelopmentLine findDevelopmentLine(IProjectArea projectArea,
                     List<String> path, Comparemode comparemode) throws TeamRepositoryException {
              int level = 0;
              String fookFor = path.get(level);
              IDevelopmentLineHandle[] developmentLineHandles = projectArea
                           .getDevelopmentLines();
              for (IDevelopmentLineHandle developmentLineHandle : developmentLineHandles) {
                     IDevelopmentLine developmentLine = fAuditableClient
                                  .resolveAuditable(developmentLineHandle,
                                                ItemProfile.DEVELOPMENT_LINE_DEFAULT, fMonitor);
                     String compare = "";
                     switch(comparemode){
                     case BYID:
                           compare = developmentLine.getId();
                           break;
                     case BYNAME:
                           compare = developmentLine.getName();
                           break;
                     case BYLABEL:
                           compare = developmentLine.getLabel();
                           break;
                     }
                     if (fookFor.equals(compare)) {
                           return developmentLine;
                     }
              }
              return null;
       }

      

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,954

Question asked: Aug 30 '18, 2:09 a.m.

Question was seen: 1,936 times

Last updated: Aug 30 '18, 5:30 a.m.

Confirmation Cancel Confirm