NotesJob is deprecated in 851
Category plugins java
Bookmark :
The Notesjob and NotesPlatform classes are deprecated in Notes 851. Those classes are needed when you want to access Notes from a plugin.
Notes 851 has some new classes that should be used.
One way to solve this in 851 is with this code:
public class ClassThatRunsANotesSessionJob {
private List content;
public ClassThatRunsANotesSessionJob() {
content = new ArrayList();
}
public void someMethod(){
NotesSessionJob job = new NotesSessionJob("Put job name here"){
protected IStatus runInNotesThread(Session session, IProgressMonitor monitor){
//populate the content instance variable in here
try {
Database db = session.getDatabase("", "names.nsf");
} catch (NotesException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return Status.OK_STATUS;
}
};
job.schedule();
}
}
Another option is to extend the NotesSessionJob class in your own class. You need to implement one method in this case
protected IStatus runInNotesThread(Session s, IProgressMonitor arg1)throws NotesException
In this method a variable is filled.
In the calling class the class(yourclass) that extends NotesSessionJob is scheduled as a job, and a changelistener is added to the job.
The calling class knows when the notes stuff is finished, and calls another method in the yourclass to get some data.
final yourclass job = new yourclass("Put a job name here");
job.addJobChangeListener(new JobChangeAdapter(){
public void done(IJobChangeEvent event){
List content = job.getContent();
//Do some stuff with the content here
}
});
job.schedule();
You cannot use Notes objects out of the session scope. Like in LotusScript, document objects are invalidated when the database object they reside in is gone.
Instead of java objects, or your own classes you can also use the new Data classes in the com.ibm.notes.java.api.data package, see the NotesDocumentData class: http://publib.boulder.ibm.com/infocenter/domhelp/v8r0/topic/com.ibm.designer.domino.javadoc/javauiapi/com/ibm/notes/java/api/data/NotesDocumentData.html
The complete javadoc on the new NotesSessionJob, the new java UI classes, and some other new classes, can be found here
Bookmark :
The Notesjob and NotesPlatform classes are deprecated in Notes 851. Those classes are needed when you want to access Notes from a plugin.
Notes 851 has some new classes that should be used.
One way to solve this in 851 is with this code:
public class ClassThatRunsANotesSessionJob {
private List content;
public ClassThatRunsANotesSessionJob() {
content = new ArrayList();
}
public void someMethod(){
NotesSessionJob job = new NotesSessionJob("Put job name here"){
protected IStatus runInNotesThread(Session session, IProgressMonitor monitor){
//populate the content instance variable in here
try {
Database db = session.getDatabase("", "names.nsf");
} catch (NotesException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return Status.OK_STATUS;
}
};
job.schedule();
}
}
Another option is to extend the NotesSessionJob class in your own class. You need to implement one method in this case
protected IStatus runInNotesThread(Session s, IProgressMonitor arg1)throws NotesException
In this method a variable is filled.
In the calling class the class(yourclass) that extends NotesSessionJob is scheduled as a job, and a changelistener is added to the job.
The calling class knows when the notes stuff is finished, and calls another method in the yourclass to get some data.
final yourclass job = new yourclass("Put a job name here");
job.addJobChangeListener(new JobChangeAdapter(){
public void done(IJobChangeEvent event){
List content = job.getContent();
//Do some stuff with the content here
}
});
job.schedule();
You cannot use Notes objects out of the session scope. Like in LotusScript, document objects are invalidated when the database object they reside in is gone.
Instead of java objects, or your own classes you can also use the new Data classes in the com.ibm.notes.java.api.data package, see the NotesDocumentData class: http://publib.boulder.ibm.com/infocenter/domhelp/v8r0/topic/com.ibm.designer.domino.javadoc/javauiapi/com/ibm/notes/java/api/data/NotesDocumentData.html
The complete javadoc on the new NotesSessionJob, the new java UI classes, and some other new classes, can be found here
- 

