How to fetch Modified baselineHandles after a certain date using i baseline serach criteria with only modifiedafter as a search criteria.
Satyam Prateek (11●2)
| asked Jan 12 '16, 11:44 p.m.
edited Jan 13 '16, 4:39 a.m. by Ralph Schoon (63.4k●3●36●46)
Hi All,
I have been trying to fetch modified baselineHandles after a certain date so i used IBaselineSearchCriteria my method is below public static List<IBaselineHandle> getModifiedBaselinesAfterDate(final Date after, final ITeamRepository repository, final IProgressMonitor monitor) throws TeamRepositoryException { IBaselineSearchCriteria baselineSearchCriteria = IBaselineSearchCriteria.FACTORY.newInstance(); baselineSearchCriteria.setModifiedAfterOptional(after); List<IBaselineHandle> listIBaselineHandles = getWorkSpaceManager(repository).findBaselines(baselineSearchCriteria, Integer.MAX_VALUE, monitor); if (CollectionUtils.isEmpty(listIBaselineHandles)) { return (Collections.EMPTY_LIST); } return listIBaselineHandles; } But it fails with following exception java.lang.IllegalArgumentException at com.ibm.team.scm.client.internal.WorkspaceManager.findBaselines(WorkspaceManager.java:2082) ~[com.ibm.team.scm.client-5.0.2.jar:?] So i found out that i should also set the component handle ebfore i can use the IBaseline searchcriteria for the baseline.This is difficult to do for me as in my scenario I have a lot of components and then I would have to get all the handles and then iterate through them as I don't know which component has changed baselines which will be a performance hit . Could you please suggest some better alternative way.Thanks in advance. |
One answer
I think you will need to go with the alternative you have already thought about. Baselines are created for a component and therefore findBaselines() won't work without a component.
When you are searching for baselines based on a date range, and if a component does not have a baseline in that date range, the result should be empty. If you have a list of components, running the search on each one of them and combining the result should give you the desired baselines. |
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.