Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8986731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:37:14+00:00 2026-06-15T21:37:14+00:00

For a plugin (like the extension library) I try to access the datasource with

  • 0

For a plugin (like the extension library) I try to access the datasource with a given “var” name. Accessing the Datasource object is very easy with the following code:

m_DataSourceName contains the name (var) of the datasource.

public DataSource getDataSource() {
    if (StringUtil.isNotEmpty(m_DataSourceName)) {

        UIViewRoot vrCurrent = getFacesContext().getViewRoot();
        if (vrCurrent instanceof UIViewRootEx) {
            for (DataSource dsCurrent : ((UIViewRootEx) vrCurrent)
                    .getData()) {
                if (m_DataSourceName.equals(dsCurrent.getVar())) {
                    return dsCurrent;
                }
            }
        }
    }
    System.out.println("Datasource name:" + m_DataSourceName);
    return null;
}

I’m getting the datasource back and I can cast this datasource:

private TabularDataModel getTDM(DataSource dsCurrent, FacesContext context) {
        try {
            if (dsCurrent instanceof ModelDataSource) {
                ModelDataSource mds = (ModelDataSource) dsCurrent;
                AbstractDataSource ads = (AbstractDataSource) mds;
                ads.load(context);
                System.out.println(ads.getBeanId());
                if (ads.getBeanId() == null) {

                }
                DataModel tdm = mds.getDataModel();
                if (tdm instanceof TabularDataModel) {
                    TabularDataModel tds = (TabularDataModel) tdm;
                    return tds;
                }
            }
            return null;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

And now I wanna access the TDM.getRowCount() and this point I’m getting a nullpointer exception. The datasource contains a notes view. Did I miss anything to initialize the datasource?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T21:37:15+00:00Added an answer on June 15, 2026 at 9:37 pm

    Here is a solution for your problem:

    This will give you all lines of a view, not the entry count*. F.e. if you have a categorized view with 5 categories and 1 entry for each category, this will result in 10 lines. The entry count is 5.

    First, create a dummy class which implements FacesDataIterator

    public class DummyDataIterator implements com.ibm.xsp.component.FacesDataIterator{
    
        public DataModel getDataModel() {
            return null;
        }
    
        public int getFirst() {
            return 0;
        }
    
        public int getRowIndex() {
            return 0;
        }
    
        public int getRows() {
            return 0;
        }
    
        public void setFirst(int paramInt) {}
    
        public void setRows(int paramInt) {}
    }
    

    And then you have to do the following:

    1. Set the data iterator

      tdm.setDataControl( new DummyDataIterator() );
      
    2. Init the row counter for the first time

      tdm.getRowCount();   
      
    3. Calculate the exact row count with a navigator

      (( com.ibm.xsp.model.domino.viewnavigator.NOIViewNavigatorEx) tdm.getDominoViewDataContainer().getNavigator()).calculateExactCount(tdm.getView());
      

    Now your row count is initialized, you can get the result with a normal getRowCount:

    System.out.println("Rows: " +  tdm.getRowCount() );
    

    Hope this helps!

    *:

    tdm.getView().getAllEntries().getCount()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to access Google Chrome's cache from within an extension? I'd like
We are developing an eclipse plugin and we have an extension like say, .xyz
I have the following jQuery extension: (function ($) { //jQuery plugin extension jQuery.fn.rotate =
Question Given a Classpath Container I've written as a plugin/extension, how do I add
Does anyone know of a jQuery plugin that has 'helpers' or extensions like those
I'm attempting to build a simple plugin like this (function($) { $.fn.gpSlideOut = function(options,
Can i use any joomla plugin like visg in my component ? if yes
Is it possible in IE8 without using third party plugin like Java?
We are using the facebook like plugin with the share button. The URL points
Is there a Visual Studio like plugin for Eclipse that will allow me create

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.