Bug: createViewNavFromCategory does not return the correct category

10. August 2016 Posted by Ikuru Otomo

 

The createViewNavFromCategory method in the NotesView class has the following bug:

if the user has no rights to read all documents in the category you specified,
this method does NOT return an empty view navigator but a navigator FOR ALL SUBSEQUENT CATEGORIES IN THE VIEW.


Example:

You have a categorized view by company names.
Some documents in this view has a reader field, and you are not authorized to see the documents in the category "ITWU".
The view will look like this:

 

 

Now, you write the following Java code:

Database db = DominoUtils.getCurrentDatabase();
View view = db.getView("myview");
ViewNavigator nav = view.createViewNavFromCategory( "ITWU" );

You probably suppose to get an empty view navigator but that's where you are wrong;
the view navigator is for all entries in the categories Microsoft and SAP

This phenomenon does not happen in the getAllEntriesByKey method.


Workaround:

Check the first entry in the view navigator again if you have the correct category.
Attention: if the column is a multi-value field, you have to check it too.

ViewEntry entry = nav.getFirst();
if( entry != null )
{
    if( !"ITWU".equals( entry.getColumnValues().get(0).toString() ) )
    {
        System.out.println("not found");
        return;
    }
}

 

Bug: createViewNavFromCategory does not return the correct category

10. August 2016 Posted by Ikuru Otomo

 

The createViewNavFromCategory method in the NotesView class has the following bug:

if the user has no rights to read all documents in the category you specified,
this method does NOT return an empty view navigator but a navigator FOR ALL SUBSEQUENT CATEGORIES IN THE VIEW.


Example:

You have a categorized view by company names.
Some documents in this view has a reader field, and you are not authorized to see the documents in the category "ITWU".
The view will look like this:

 

 

Now, you write the following Java code:

Database db = DominoUtils.getCurrentDatabase();
View view = db.getView("myview");
ViewNavigator nav = view.createViewNavFromCategory( "ITWU" );

You probably suppose to get an empty view navigator but that's where you are wrong;
the view navigator is for all entries in the categories Microsoft and SAP

This phenomenon does not happen in the getAllEntriesByKey method.


Workaround:

Check the first entry in the view navigator again if you have the correct category.
Attention: if the column is a multi-value field, you have to check it too.

ViewEntry entry = nav.getFirst();
if( entry != null )
{
    if( !"ITWU".equals( entry.getColumnValues().get(0).toString() ) )
    {
        System.out.println("not found");
        return;
    }
}