It's all about the answers!

Ask a question

How can I create the Notes wiki page during plan creation on server side?


Michele Pegoraro (1.8k12107100) | asked Nov 19 '12, 3:17 p.m.

Hi,

I'm developing a initialization follow up in order to create some pre-defined plans.

I'm using something like this in order to create  a plan:

private void createPlan(ProjectArea projectArea, String name, ITeamAreaHandle teamHandle,IIterationHandle iteration, String type) throws TeamRepositoryException{
        IIterationPlanService planService= getService(IIterationPlanService.class);
        IIterationPlanRecord planRecord= (IIterationPlanRecord) IIterationPlanRecord.ITEM_TYPE.createItem();
        planRecord.setName(name);
        planRecord.setIteration(iteration);
        planRecord.setPlanType(type);
        planRecord.setOwner(teamHandle);
        planService.save(projectArea, planRecord, null);
    }

It seems to works and the plan is created, but it miss the first wiki page called Notes. This causes a problem when I try to open the plan on a browser. In this case the plan cannot be open and this error is given:

TypeError: Cannot read property 'length' of undefined
TypeError: Cannot read property 'length' of undefined
at dojo.declare.readTabDescriptors (https://localhost:9443/jazz/web/_js/?exclude=G&include=com.ibm.team.apt.web.ui.internal.page.PlanningPageMain.js&_proxyURL=%2Fjazz&locale=it-it:70143:12)
at dojo.declare.constructor (https://localhost:9443/jazz/web/_js/?exclude=G&include=com.ibm.team.apt.web.ui.internal.page.PlanningPageMain.js&_proxyURL=%2Fjazz&locale=it-it:69778:54)
at new (https://localhost:9443/jazz/web/_js/?include=G~&etag=shhIu2GMNw_it_IT&_proxyURL=%2Fjazz:15:22499)
at null. (https://localhost:9443/jazz/web/_js/?exclude=G&include=com.ibm.team.apt.web.ui.internal.page.PlanningPageMain.js&_proxyURL=%2Fjazz&locale=it-it:73498:9)
at https://localhost:9443/jazz/web/_js/?include=G~&etag=shhIu2GMNw_it_IT&_proxyURL=%2Fjazz:15:15340
at null. (https://localhost:9443/jazz/web/_js/?exclude=G&include=com.ibm.team.apt.web.ui.internal.page.PlanningPageMain.js&_proxyURL=%2Fjazz&locale=it-it:73512:1)
at null.fCallback (https://localhost:9443/jazz/web/_js/?include=G~&etag=shhIu2GMNw_it_IT&_proxyURL=%2Fjazz:15:15340)
at dojo.declare.callback (https://localhost:9443/jazz/web/_js/?exclude=G&include=com.ibm.team.apt.web.ui.internal.page.PlanningPageMain.js&_proxyURL=%2Fjazz&locale=it-it:561:6)
at dojo.declare.withItem (https://localhost:9443/jazz/web/_js/?exclude=G&include=com.ibm.team.apt.web.ui.internal.page.PlanningPageMain.js&_proxyURL=%2Fjazz&locale=it-it:45109:5)
at dojo.declare.showIterationPlan (https://localhost:9443/jazz/web/_js/?exclude=G&include=com.ibm.team.apt.web.ui.internal.page.PlanningPageMain.js&_proxyURL=%2Fjazz&locale=it-it:73515:5)

Using Eclipse client instead I can correctly open it.

How can I create the Notes page? I've try to create new IWikiPages but they are attached as other pages and not as notes.

Thanks,

Michele

Accepted answer


permanent link
Guido Schneider (3.3k137699) | answered Nov 20 '12, 3:42 a.m.

Have you read my forum entry and my code snippet?

https://jazz.net/forum/questions/82381/how-do-i-create-a-plan-with-the-java-api

See section in the code:

 // setup wiki page
 wiki.setName("");
 wiki.setWikiID(IIterationPlanRecord.OVERVIEW_PAGE_ID);
 wiki.setCreator(creator);
 wiki.setOwner(plan);

Michele Pegoraro selected this answer as the correct answer

Comments
Michele Pegoraro commented Nov 26 '12, 9:26 a.m.

The line

wiki.setWikiID(IIterationPlanRecord.OVERVIEW_PAGE_ID); 

resolved the problem, togheter with a two step save: first I save the plan and then I add the notes. Otherwise as I try to set the plan itself as the owner of the note I got an error.

Thanks,

Michele.

Your answer


Register or to post your answer.