Welcome to the Jazz Community Forum
is it possible to get dependency?

One answer

Hi,
The following snippets of code will help you.
Current planned for value of single workitem
public static String getPlannedForValue(IWorkItem workitem)
{
IItemManager itm = teamRepository.itemManager();
IIteration contributor = null;
try {
contributor = (IIteration) itm.fetchCompleteItem(workitem.getTarget(), IItemManager.DEFAULT, null);
} catch (TeamRepositoryException e) {
e.printStackTrace();
}
return contributor.getName();
}
PlannedFor combo box values:
public String[] getPlannedForList() {
ArrayList<String> list = new ArrayList<String>();
ArrayList<ArrayList<String>> listall = new ArrayList<ArrayList<String>>();
IDevelopmentLineHandle[] developmentHandles = ((IProjectArea) projectArea)
.getDevelopmentLines();
IDevelopmentLine line = null;
if (developmentHandles != null) {
List developmentLines = null;
try {
developmentLines = teamRepository.itemManager()
.fetchCompleteItems(Arrays.asList(developmentHandles),
IItemManager.DEFAULT, null);
} catch (TeamRepositoryException e1) {
e1.printStackTrace();
}
for (Iterator e = developmentLines.iterator(); e.hasNext();) {
line = (IDevelopmentLine) e.next();
IIterationHandle[] iterationHandles = line.getIterations();
list = PlannedForRecursive(iterationHandles);
if (list != null)
listall.add(list);
}
}
int size = listall.size();
int i = 1;
for (ArrayList<String> lis : listall) {
if (lis != null) {
for (String s : lis) {
if (s != null) {
i++;
}
}
}
}
String[] data = new String[i];
data[0] = "Unassigned";
i = 1;
for (ArrayList<String> lis : listall) {
if (lis != null) {
for (String s : lis) {
if (s != null) {
data[i] = s;
i++;
}
}
}
}
return data;
}
PlannedForRecursive
public static ArrayList<String> PlannedForRecursive(
IIterationHandle[] iterationHandles) {
ArrayList<String> interation_name = new ArrayList<String>();
int i = 0;
if (iterationHandles != null) {
List iterationlines = null;
try {
iterationlines = teamRepository.itemManager()
.fetchCompleteItems(Arrays.asList(iterationHandles),
IItemManager.DEFAULT, null);
} catch (TeamRepositoryException e) {
e.printStackTrace();
}
IIteration iteration = null;
for (Iterator e1 = iterationlines.iterator(); e1.hasNext();) {
iteration = (IIteration) e1.next();
if (iteration.getName() != null&&!iteration.isArchived())
interation_name.add(iteration.getName());
i++;
ArrayList<String> templist = null;
if (iteration.getChildren() != null) {
templist = PlannedForRecursive(iteration.getChildren());
}
if (templist != null)
for (String s : templist) {
if (s != null) {
interation_name.add(s);
// System.out.println("planned for recursive :"+s);
}
// i++;
}
}
}
return interation_name;
}
Thanks,
Pugazh s
The following snippets of code will help you.
Current planned for value of single workitem
public static String getPlannedForValue(IWorkItem workitem)
{
IItemManager itm = teamRepository.itemManager();
IIteration contributor = null;
try {
contributor = (IIteration) itm.fetchCompleteItem(workitem.getTarget(), IItemManager.DEFAULT, null);
} catch (TeamRepositoryException e) {
e.printStackTrace();
}
return contributor.getName();
}
PlannedFor combo box values:
public String[] getPlannedForList() {
ArrayList<String> list = new ArrayList<String>();
ArrayList<ArrayList<String>> listall = new ArrayList<ArrayList<String>>();
IDevelopmentLineHandle[] developmentHandles = ((IProjectArea) projectArea)
.getDevelopmentLines();
IDevelopmentLine line = null;
if (developmentHandles != null) {
List developmentLines = null;
try {
developmentLines = teamRepository.itemManager()
.fetchCompleteItems(Arrays.asList(developmentHandles),
IItemManager.DEFAULT, null);
} catch (TeamRepositoryException e1) {
e1.printStackTrace();
}
for (Iterator e = developmentLines.iterator(); e.hasNext();) {
line = (IDevelopmentLine) e.next();
IIterationHandle[] iterationHandles = line.getIterations();
list = PlannedForRecursive(iterationHandles);
if (list != null)
listall.add(list);
}
}
int size = listall.size();
int i = 1;
for (ArrayList<String> lis : listall) {
if (lis != null) {
for (String s : lis) {
if (s != null) {
i++;
}
}
}
}
String[] data = new String[i];
data[0] = "Unassigned";
i = 1;
for (ArrayList<String> lis : listall) {
if (lis != null) {
for (String s : lis) {
if (s != null) {
data[i] = s;
i++;
}
}
}
}
return data;
}
PlannedForRecursive
public static ArrayList<String> PlannedForRecursive(
IIterationHandle[] iterationHandles) {
ArrayList<String> interation_name = new ArrayList<String>();
int i = 0;
if (iterationHandles != null) {
List iterationlines = null;
try {
iterationlines = teamRepository.itemManager()
.fetchCompleteItems(Arrays.asList(iterationHandles),
IItemManager.DEFAULT, null);
} catch (TeamRepositoryException e) {
e.printStackTrace();
}
IIteration iteration = null;
for (Iterator e1 = iterationlines.iterator(); e1.hasNext();) {
iteration = (IIteration) e1.next();
if (iteration.getName() != null&&!iteration.isArchived())
interation_name.add(iteration.getName());
i++;
ArrayList<String> templist = null;
if (iteration.getChildren() != null) {
templist = PlannedForRecursive(iteration.getChildren());
}
if (templist != null)
for (String s : templist) {
if (s != null) {
interation_name.add(s);
// System.out.println("planned for recursive :"+s);
}
// i++;
}
}
}
return interation_name;
}
Thanks,
Pugazh s