copy plans in project to a different project, help
sam detweiler (12.5k●6●195●201)
| asked Mar 04 '14, 7:17 a.m.
edited Mar 04 '14, 11:36 p.m. by Sreerupa Sen (1.0k●4)
in our project copy utility, I support copying plans from one project to another. One area not copied is the plan views.
(maybe called Plan Modes). anyone played with accessing these thru a plainjava application? I don't want to 'present' them, just copy their data to another plan. I 'think' based on looking at the plan editor code, I need access to the IterationPlanData object, which can be retrieved thru the IIterationPlan. but attemping this on a Release Backlog plan IterationPlanData prodpd= ((IterationPlanClient)prodplanClient).fetchIterationPlanData((IIterationPlanRecordHandle) prodipr.getItemHandle(), new mylog()); gets me a fatal exception error Reference problem: Unable to find IPlanCheckDescription with id com.ibm.team.apt.plancheck.requiredAttribute. |
3 answers
Hi Sam,
did you resolve your Exception Error? I can't tell you about the Plain Java API but with the RTC SDK the following can be used (may also work with the Plain API). // The iteration plan record of the target plan you created IIterationPlanRecord iterationPlanRecord = ...; and the createSharedPlanMode method could looks like this: private ISharedPlanMode createSharedPlanMode(IterationPlanData data, XMLMemento memento) { ResolvedPlanMode planMode = data.getPlanModes().get(data.getPlanModes().size()-1); Comments
sam detweiler
commented Mar 12 '14, 7:06 a.m.
I have not solved my problem, but thank you SO much.. I will report back as soon as I can..
sam detweiler
commented Mar 12 '14, 9:24 a.m.
I have started integrating you code into my app.. I have some questions/comments
1. as written you function can only work on the same system, not across systems
(only one plan client handle, plan owner not checked across system, target plan loaded from source system.
sharedPlanMode.setOwner(data.getOwner());
sharedPlanMode.setPlan(sharedPlanModeCopy.getPlan());
2. it looks like you only copy 1 plan view.. do u assume only one needs to be copied.
there is no loop around sharedPlanModes.add(targetSharedPlanMode );
3. in the subroutine, I do not undestand
ResolvedPlanMode planMode = data.getPlanModes().get(data.getPlanModes().size()-1);
why get only the last planmode everytime?
Dimitrios Dentsas
commented Mar 12 '14, 10:39 a.m.
Hi Sam,
sam detweiler
commented Mar 12 '14, 10:52 a.m.
yes, indeed 3 depends on info I wouldn't have guessed
but then I don't see the rest of the views.. only 1.
if PlanData.getPlanModes() returns the iterations of a view.
Dimitrios Dentsas
commented Mar 12 '14, 11:13 a.m.
Did you try this out only with newly created plans, or with existing ones (for which you already tampered with the views).
sam detweiler
commented Mar 12 '14, 11:40 a.m.
the source project has a number of custom views, which may have multiple iterations, no way of knowing
I still have the exception trying to load the plandata for the newly created plan.
last thing I did
DTO_IterationPlanSaveResult saveResult = planService.save(project, plan, wiki);
if (saveResult.isSetIterationPlanRecord() == false)
{
System.out.println("Saving failed!");
}
else
{
newplanRecord=saveResult.getIterationPlanRecord();
}
and fetch on the newplanRecord fails
Dimitrios Dentsas
commented Mar 12 '14, 1:33 p.m.
Hmm, I tried creating a Release Plan with your method and it works for me. However I am creating a new IIterationPlanRecord every time.
It would be interesting to see how the IIterationPlanRecord you are trying to save using the planService looks like. Is it fetched from some origin or newly created? Judging from your original answer there seems to be some plancheck reference that cannot be found. Does this plan come with customized plan views?
Another possibility could be a difference of the client/server services we are using. I am working with the SDK and fetching e.g. my IterationPlanClient from
com.ibm.team.apt.internal.client.*. I am not sure how different it is in the Plain API.
my code posted below. this is an arbitrary plan or arbitrary age, in an arbitrary RTC system (first was 3.01, second is 4.0.1, others to come) end system is 4.0.4
the IIterationPlanClient.class will load as a client lib
the IterationPlanClient.class will not load as a client lib.
so this means there is only 1.
the plan classes are not supplied with the plain java libs.. only in the SDK (as they are not published yet) so, there is only one set.
showing 5 of 8
show 3 more comments
|
This is how I am calling your code with setauxdata commented out, sourceRepo = targetRepo and providing "new NullProgressMonitor()" instead of null for the fetchIterationPlanData method:
private IAuditableClient fAuditableClient;
private ImportPlanConfigurationPage fMainPage;
private IProjectAreaHandle fProjectAreaHandle;
private ITeamRepository fTeamRepository;
private IProcessItemService fProcessItemService;
private IterationPlanClient fPlanClient;
// skip irrelevant parts
fProjectAreaHandle = ...; // You have to provide this
fTeamRepository = (ITeamRepository) fProjectAreaHandle.getOrigin();
fAuditableClient = (IAuditableClient) fTeamRepository
.getClientLibrary(IAuditableClient.class);
fProcessItemService = (IProcessItemService) fTeamRepository
.getClientLibrary(IProcessItemService.class);
fPlanClient = (IterationPlanClient) PlanningClientPlugin.getIterationPlanClient(fTeamRepository);
try {
IProjectArea projectArea = (IProjectArea) fTeamRepository.itemManager().fetchCompleteItem(
fProjectAreaHandle, IItemManager.DEFAULT, null);
IContributor contributor = (IContributor) fTeamRepository.itemManager().fetchCompleteItem(
fAuditableClient.getUser(), IItemManager.DEFAULT, null);
// getPlannedForIteration and getTeamArea are just convinience methods you can exchange //them with whatever you have for providing Iteration and ProcessArea/TeamArea
IIterationPlanRecord planRecord = createPlan(fAuditableClient, projectArea, "TestPlan3", getPlannedForIteration(projectArea.getName(), "Implementation"),
PlanTypeIds.PROJECT_RELEASE_PLAN_ID, getTeamArea(fProjectAreaHandle, "TeamAreaC", ITeamArea.class), "abc",
contributor);
IIterationPlanRecord planRecord2 = createPlan(fAuditableClient, projectArea, "TestPlan4", getPlannedForIteration(projectArea.getName(), "Implementation"),
PlanTypeIds.ITERATION_PLAN_ID, getTeamArea(fProjectAreaHandle, "TeamAreaB", ITeamArea.class), "abc",
contributor);
CopyPlanViews(planRecord, planRecord2, fPlanClient, fPlanClient);
} catch (TeamRepositoryException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Comments
sam detweiler
commented Mar 12 '14, 4:17 p.m.
well, isn't that interesting.. I just commented out the plan.setauxdata in createPlan().
I noticed the code I posted has an empty exception handler in the copyplanviews
catch(Exception ex)
{
}
change to
catch(Exception ex)
{
System.out.println("Plan data exception ="+ex.getMessage());
}
sam detweiler
commented Mar 19 '14, 9:18 a.m.
a little more info..
// IterationPlanData of the source plan record
IterationPlanData sourcePlandata = prodplanClient.fetchIterationPlanData((IIterationPlanRecordHandle)sourcePlan.getItemHandle(), null);
MUST have a non-null monitor... else u get null pointer exception
you MUST have the IScriptEngine class accessible
but still I get exception
Plan data exception =Reference problem: Unable to find IPlanModeDescription with id com.ibm.team.apt.viewmodes.internal.backlog.product.
so I am missing some data I think
|
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.
Comments
Unfortunately I never tried that. You are in an area that is mostly internal API today.