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

Creating Iterations using java api

Hi,

 I want to create Iterations using java client library. I saw a post in jazz forum where is it explained.
https://jazz.net/forum/questions/65253/create-or-delete-iteration-and-timelines-programatically

But my question is do I need to set up a plugin development project for this? Can't I do the same as java project where I will import required jars and create iterations? If yes, Please show me an example.

Thanks!
Sud

0 votes


Accepted answer

Permanent link
Yes, you can only setup a "standalone" enviroment to create iterations on the RTC. You need to download the RTC SDK and use the jars, like you said.

This post explain how to setup you enviroment using Maven:
https://www.ibm.com/developerworks/community/blogs/cbe857dd-5392-4111-b0ea-6827c54f2e66/entry/setting_up_rtc_java_plain_api_dev_enviroment_with_maven_and_eclipse?lang=en

Sudipto Sarkar selected this answer as the correct answer

1 vote

Comments

 It worked. Thanks.


One other answer

Permanent link
If somebody is looking for an live example , here is :
public void createIteration(ITeamRepository repo,
 IProgressMonitor monitor,
            String iterationName, String id, String startDate, String endDate)
            throws TeamRepositoryException {
        IAuditableClient fAuditableClient;
        fAuditableClient = (IAuditableClient) repo
                .getClientLibrary(IAuditableClient.class);

        CreateWI wi = new CreateWI();
        Date start = almDateFormat(startDate);
        Date end = almDateFormat(endDate);
        IProcessItemService service = (IProcessItemService) repo
                .getClientLibrary(IProcessItemService.class);
        List<IProjectArea> activeProjectAreas = new ArrayList();
        List<IProjectArea> allProjectAreas;
        IProjectArea iProjectArea = null;
        allProjectAreas = service.findAllProjectAreas(service.ALL_PROPERTIES,
                monitor);
        Iterator<IProjectArea> iterator = allProjectAreas.iterator();
        while (iterator.hasNext()) {
            iProjectArea = iterator.next();
            if (CommonString.PROJECT_AREA_NAME.equals(iProjectArea.getName())) {
                break;
            }
        }
        System.out.println(iProjectArea.getName());

        IDevelopmentLineHandle developmentLineHandler = iProjectArea
                .getProjectDevelopmentLine();
        IDevelopmentLine developmentLine = fAuditableClient.resolveAuditable(
                developmentLineHandler, ItemProfile.DEVELOPMENT_LINE_DEFAULT,
                monitor);

        IIterationHandle[] iterationHandle = developmentLine.getIterations();
        for (int i = 0; i < iterationHandle.length; i++) {
            IIterationHandle iterationList = iterationHandle[i];
            List handle = new ArrayList();
            handle.add(iterationList);
            IFetchResult result = repo.itemManager()
                    .fetchCompleteItemsPermissionAware(handle,
                            IItemManager.REFRESH, monitor);
            IIteration iteration = (IIteration) result.getRetrievedItems().get(
                    0);
            if (iteration.getName().equals(iterationName)) {
                System.out.println("Iterations already exist. cannot create. Iteration name: "+iteration.getName());
            }
        }
        IIteration newIteration = (IIteration) IIteration.ITEM_TYPE
                .createItem();
        newIteration.setName(iterationName);
        newIteration.setId(id);
        newIteration.setStartDate(start);
        newIteration.setEndDate(end);

        IDevelopmentLine workingDevLine = (IDevelopmentLine) developmentLine
                .getWorkingCopy();
        workingDevLine.addIteration((IIterationHandle) newIteration
                .getItemHandle());

        newIteration.setDevelopmentLine(workingDevLine);

        service.save(new IProcessItem[] { workingDevLine, newIteration },
                monitor);

    }

}

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,936
× 411

Question asked: May 15 '15, 1:35 a.m.

Question was seen: 5,640 times

Last updated: May 19 '15, 12:52 a.m.

Confirmation Cancel Confirm