It's all about the answers!

Ask a question

How to create project area programmatically?


Baris Erdemir (1812819) | asked Sep 16 '11, 4:24 a.m.
Hi,
We would like to create a project area programmatically.
The input parameters we have are project name, 2 member, one spesific role for both members and a project area template.
How should we start?
Thanks

2 answers



permanent link
Nicolas Constans (22723) | answered Sep 16 '11, 7:29 a.m.
JAZZ DEVELOPER
Hi Baris,

you could have a look at the Team Proces REST API, which allows to create project areas programmatically.

This API is published at https://jazz.net/wiki/bin/view/Main/DraftTeamProcessRestApi#POST_project_areas_collection


I hope this helps,

Regards,

-Nicolas

permanent link
Vaibhav S (106350) | answered Apr 04 '17, 5:31 a.m.
edited Apr 04 '17, 5:32 a.m.

Hi, this might help you out.
          

           if (!TeamPlatform.isStarted()) {
                     TeamPlatform.startup();
               }
           
            String rtcURL = "https:/****.com:9443/rm";
            String user = "**";
            String pass = "*
";

            ITeamRepository repo = TeamPlatform.getTeamRepositoryService().getTeamRepository(rtcURL);

            IProgressMonitor MONITOR = new NullProgressMonitor();

            repo.registerLoginHandler(new LoginHandler(user, pass));

            repo.login(MONITOR);
            
            IProcessItemService service = (IProcessItemService) repo.getClientLibrary(IProcessItemService.class);
          
            IProcessDefinition[] definitions = null;

            IProcessDefinition processDefinition = service.findProcessDefinition(processId,
                    IProcessItemService.ALL_PROPERTIES, MONITOR);

            IArtifactTypeManager artifactTypeManager;

            if (processDefinition == null) {
                // Create the definition if it does not exist.
                definitions = service.deployPredefinedProcessDefinitions(new String[] { processId }, MONITOR);
             
                if (definitions.length != 0) {
                    processDefinition = definitions[0];
                } else {
                    throw new TeamRepositoryException("Process template " + processId + " does not exist.");
                }
            }

            if (processDefinition == null) {
                throw new TeamRepositoryException("Could not find Predefined Process " + processId);
            }

            // ---- creation of project area code

            IProjectArea project = service.createProjectArea();

            project.setName(name);
            project.setProcessDefinition(processDefinition);
            project.getDescription().setSummary("Test Process Summary");

            // Save project area that uses the provided process

            service.save(project, MONITOR);

            // --------------- Set project access ------------------
            service.initialize(project, MONITOR);


Thanks
Vab

Your answer


Register or 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.