e.g an example how to load info from a document:
package com.proj.test;
import java.io.Serializable;
import lotus.domino.Database;
import lotus.domino.Document;
import lotus.domino.NotesException;
import lotus.domino.View;
import com.ibm.xsp.extlib.util.ExtLibUtil;
public class Config implements Serializable {
private static final long serialVersionUID = 1L;
private String prefLegal;
private Integer numViewRows;
private String documentId;
/**********************
* Constructor *
**********************/
public Config() throws NotesException {
try {
loadConfigurationDocument();
} catch (Exception e) {
e.printStackTrace();
}
}
/**********************
* Methods *
**********************/
public void loadConfigurationDocument() throws NotesException{
try {
System.out.println("finding Configuration document");
System.out.println("finding Configuration document");
Database db = ExtLibUtil.getCurrentSession().getCurrentDatabase();
View view = db.getView("$v-preferences");
Document doc = view.getFirstDocument();
if (null != doc) {
System.out.println("loading Configuration document");
this.setDocumentId(doc.getUniversalID());
System.out.println("id Configuration document:" + this.getDocumentId());
prefLegal = doc.getItemValueString("prefLegal");
// ... read all other items and store them in private fields
numViewRows = doc.getItemValueInteger("prefDefaultNumOfRows");
System.out.print("closing Configuration document");
doc.recycle();
}else{
// add some error logging?
System.out.println("problem finding Configuration document()");
}
view.recycle();
} catch (NotesException e) {
e.printStackTrace();
}
}
/***********************
* Getters and Setters *
***********************/
public void setDocumentId(String documentId) {
this.documentId = documentId;
}
public String getDocumentId() {
return documentId;
}
public String getPrefLegal() {
return prefLegal;
}
public void setPrefLegal(String prefLegal) {
this.prefLegal = prefLegal;
}
public Integer getNumViewRows() {
return numViewRows;
}
public void setNumViewRows(Integer numViewRows) {
this.numViewRows = numViewRows;
}
}
on an xpage I use the code:
<xp:inputTextarea id="inputLegal" value="#{configBean.prefLegal}"></xp:inputTextarea>
I wonder how I can update the document in the preferences view with the information entered on the the xpage? Instead of placing SSJS under a submit button I would like to store the logic into a java class and call a method from the button...
Not clear how to do this...