• ListObjectDataSource to Excel

    By Damien P Soward 1 decade ago

    Firstly, thanks for doing this project.  I have tested all the features regarding using views and they work fantastic. We are however, having problems with the ObjectDataSoruce to Excel (using a managed java bean). Of course, typically, this is the one that we need to work.

    Would you be able to supply the contactBean class that includes the arraylist and getAllContacts method.  I have created an arraylist and it is populating the spreadsheet, but it is returning null values (similar to if you are missing view title in the view download).

    We suspect it is something to do with how we are populating out ArrayList objects.  I have hunted everywhere for the contactBean class but can't find it anywhere in the example database.

    Of course it could be something else, but I guess we could figure it out if we could view the java class that you used in your example here Click for link to demo

    Thanks in advance.

    Damien.

    ps. Once we get it working, I would be happy to type up further detail instructions.

     

     

     

     

    • The missing Java Classes

      By Christian Güdemann 1 decade ago

      Hello Damien

      Yes the example database contains not the object list data source example. So here are the java classes. We will update the example db also in the next release:

       

      Contact.java

      package biz.webgate.domino.poi.demodb.contact;

      import java.io.Serializable;

      public class Contact implements Serializable {

          /**
           *
           */
          private static final long serialVersionUID = 1L;
          private String m_FirstName;
          private String m_LastName;
          private String m_City;
          private String m_State;
          private String m_EMail;

          public void setLastName(String lastName) {
              m_LastName = lastName;
          }

          public String getLastName() {
              return m_LastName;
          }

          public String getFirstName() {
              return m_FirstName;
          }

          public void setFirstName(String firstName) {
              m_FirstName = firstName;
          }

          public String getCity() {
              return m_City;
          }

          public void setCity(String city) {
              m_City = city;
          }

          public String getState() {
              return m_State;
          }

          public void setState(String state) {
              m_State = state;
          }

          public String getEMail() {
              return m_EMail;
          }

          public void setEMail(String mail) {
              m_EMail = mail;
          }
      }
       

      ContactBean.java

      package biz.webgate.domino.poi.demodb.contact;

      import java.io.Serializable;
      import java.util.ArrayList;
      import java.util.List;

      import lotus.domino.Document;
      import lotus.domino.View;

      import com.ibm.xsp.extlib.util.ExtLibUtil;

      public class ContactBean implements Serializable {

          /**
           *
           */
          private static final long serialVersionUID = 1L;

          public List getAllContacts() {
              List lstRC = new ArrayList();
              try {
                  View viwLUP = ExtLibUtil.getCurrentDatabase().getView("AllContacts");
                  Document docNext = viwLUP.getFirstDocument();
                  while (docNext != null) {
                      Document docProcess = docNext;
                      docNext = viwLUP.getNextDocument(docNext);

                      Contact conCurrent = new Contact();
                      conCurrent.setFirstName(docProcess.getItemValueString("FirstName"));
                      conCurrent.setLastName(docProcess.getItemValueString("LastName"));
                      conCurrent.setCity(docProcess.getItemValueString("City"));
                      conCurrent.setEMail(docProcess.getItemValueString("EMail"));
                      conCurrent.setState(docProcess.getItemValueString("State"));
                      lstRC.add(conCurrent);
                      docProcess.recycle();
                  }
              } catch (Exception e) {
                  e.printStackTrace();
              }
              return lstRC;
          }

      }