How to fetch Modified baselineHandles after a certain date using i baseline serach criteria with only modifiedafter as a search criteria.
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
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.
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.
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.