As long as your are using them in an XPage application, this is possible. I am not sure what benefits you will have instead of accessing a view directly, but here is the code:
1.You need a helper class to access the tabular data model
/**
* Returns the tabular data model from a datasource
*
* @author Christian Guedemann, Sven Hasselbach
* @param dsCurrent
* datasource to get the tdm from
* @param context
* current FacesContext instance
* @return
* TabularDataModel
*/
public static TabularDataModel getTDM(DataSource dsCurrent, FacesContext context) {
try {
if (dsCurrent instanceof ModelDataSource) {
ModelDataSource mds = (ModelDataSource) dsCurrent;
AbstractDataSource ads = (AbstractDataSource) mds;
ads.load(context);
DataModel tdm = mds.getDataModel();
if (tdm instanceof TabularDataModel) {
TabularDataModel tds = (TabularDataModel) tdm;
return tds;
}
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
2.You have to create your datasource and add them to a component, f.e. the view root
DominoViewData dvd = new DominoViewData();
dvd.setViewName( "YOUR VIEW NAME" );
dvd.setComponent( FacesContext.getCurrentInstance().getViewRoot() );
3.Now you can add the filter options or any additional options to your datasource, f.e. these:
dvd.setSortOrder( "ascending" );
dvd.setSortColumn( "NAME OF COLUMN" );
4.Then access the TDM of the datasource, get the first entry and you have a handle to the parent, a ViewNavigator
TabularDataModel tdm = getTDM( dvd, FacesContext.getCurrentInstance() );
tdm.setDataControl( new UIDataEx() );
Entry noiEntry = (Entry) tdm.getRowData();
ViewNavigator nav = null;
try {
nav = (ViewNavigator) noiEntry.getParent();
System.out.println( "NAV COUNT: " + nav.getCount() );
nav.recylce();
} catch (NotesException e) {
e.printStackTrace();
}
(OK, you now have a ViewNavigator instead of a ViewEntryCollection)