Skip to main content
BlueMix free trial
 
developerWorks
AIX and UNIX
Information Mgmt
Lotus
New to Lotus
Products
How to buy
Downloads
Live demos
Technical library
Training
Support
Forums & community
Events
Rational
Tivoli
WebSphere
Java™ technology
Linux
Open source
SOA and Web services
Web development
XML
My developerWorks
About dW
Submit content
Feedback



developerWorks  >  Lotus  >  Forums & community  >  Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum

developerWorks

  

Sign in to participate


Pawel Cudek 30.Sep.03 05:16 AM a Web browser
General All Releases Windows 2000


Hello!
Sorry for my English :-)
I am beginer and I don't know how to get access to local database.
I wrote two classes:
1. JavaAgent extend AgentBase with NotesMain function. From this level I have acces to my database, except this I can't read all records from my ViewEntryCollection vec = view.getAllEntries(); (only 9000 - my database have 13000).
2. MyWindow which is interface to my Agent.
From this level I have't acces to database - please help!!!!!!!!!!

This is my code:

import lotus.domino.*;
import java.util.*;
import java.util.Properties;
import javax.mail.*;
import javax.mail.internet.*;
import java.awt.*;
import java.awt.event.*;

public class JavaAgent extends AgentBase {

String myString="";
MyWindow myWindow;
public void NotesMain() {

try {
lotus.domino.Session session = getSession();
AgentContext agentContext = session.getAgentContext();
lotus.domino.Database db = agentContext.getCurrentDatabase();
Document doc = agentContext.getDocumentContext();

if(doc!=null)//sprawdzenie czy pobrano dokument
{
myString = doc.getFirstItem("e_mail").getText();

}
else System.out.println("doc is null");


} catch(Exception e) {e.printStackTrace();}

myWindow = new MyWindow(this,myString);
myWindow.setSize(500,500);
myWindow.setVisible(true);
}



}//end class JavaAgent

class MyWindow extends Frame implements WindowListener,ActionListener
{
Button sendToPerson;
Button sendToAll;
JavaAgent agent;
MyWindow(JavaAgent agent,String meil)
{

super("Mailing");
this.agent=agent;
addWindowListener(this);
setLayout(new BorderLayout());
sendToPerson = new Button("Send to person");
sendToPerson.addActionListener(this);
add(BorderLayout.WEST, sendToPerson);

sendToAll = new Button("Send to all");
sendToAll.addActionListener(this);
add(BorderLayout.EAST, sendToAll);
}

public void SendtoPerson()
{

}


public void SendToAll()
{
try {
///// here I have problem
lotus.domino.Session session = agent.getSession();
AgentContext agentContext = session.getAgentContext();
lotus.domino.Database db = agentContext.getCurrentDatabase();
View view = db.getView("MyView");
ViewEntryCollection vec = view.getAllEntries();
System.out.println("\"MyView\" view has " +vec.getCount() + " entries");

ViewEntry entry;
for (int i=1; i< vec.getCount(); i++)
{
try {
entry = vec.getNthEntry(i);
System.out.println(i+" "+entry.getDocument().getItemValueString("e_mail")+"\n");

//here I will send a message, but I have't access to database and field e_mail
//please Help ;)

} catch(Exception en) {}

}

}
catch(Exception e) {e.printStackTrace();}

}
public void actionPerformed(ActionEvent e)
{


if (e.getSource() instanceof Button)
{
if (e.getSource() == sendToPerson)
{
SendtoPerson();
}
if (e.getSource() == sendToAll)
{
SendToAll();
}
}
}

public void windowActivated(WindowEvent e){}
public void windowClosed(WindowEvent e){}
public void windowClosing(WindowEvent e) {
setVisible(false);
dispose();

}
public void windowDeactivated(WindowEvent e){}
public void windowDeiconified(WindowEvent e){}
public void windowIconified(WindowEvent e){}
public void windowOpened(WindowEvent e){}

}


I have this error:
lotus.domino.NotesException

at lotus.domino.local.NotesBase.CheckObject(NotesBase.java:979)

at lotus.domino.local.Session.getAgentContext(Session.java:1221)

at MyWindow.SendToAll(JavaAgent.java:72)

at MyWindow.actionPerformed(JavaAgent.java:108)

at java.awt.Button.processActionEvent(Button.java:256)

at java.awt.Button.processEvent(Button.java:229)

at java.awt.Component.dispatchEventImpl(Component.java:1812)

at java.awt.Component.dispatchEvent(Component.java:1744)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:79)








Database access from another class ... (Pawel Cudek 30.Sep.03)
. . RE: Database access from another cl... (benpoole 30.Sep.03)
. . . . RE: Database access from another cl... (Pawel Cudek 30.Sep.03)
. . . . . . Why can't you ... (WAS: Database ac... (benpoole 30.Sep.03)
. . . . . . . . RE: Why can't you ... (WAS: Databas... (Benedict R Pool... 1.Oct.03)
. . . . . . . . . . RE: Why can't you ... (WAS: Databas... (Pawel Cudek 2.Oct.03)
. . . . . . . . . . . . RE: Why can't you ... (WAS: Databas... (Benedict R Pool... 2.Oct.03)
. . . . . . . . . . . . . . Additional comment re loop (benpoole 2.Oct.03)
. . . . . . . . . . . . . . It works ;) (Pawel Cudek 2.Oct.03)
. . . . . . . . . . . . . . RE: Why can't you ... (WAS: Databas... (Joseph Millar 2.Oct.03)
. . . . . . . . . . . . . . . . Thanks Joe, that's useful to know! ... (benpoole 2.Oct.03)





  Document options
Print this pagePrint this page

 Search this forum

  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Author
Category
Platform
Release
Advanced search

 Sign In or Register
Sign in
Forgot your password?
Forgot your user name?
Create new registration

 RSS feedsRSS
All forum posts RSS
All main topics RSS
More Lotus RSS feeds

Resources

 Resources
Forum use and etiquette
Native Notes Access
Web site Feedback

Lotus Support

 Lotus Support
IBM Support Portal - Lotus software
Lotus Support documents
Lotus support by product
Lotus support downloads
Lotus support RSS feeds

Wikis

 Wikis
IBM Composite Applications
IBM Mashup Center
IBM Connections
IBM Connections Cloud Developers
IBM Docs
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud for Social Business
IBM Web Experience Factory
Lotus Domino
Lotus Domino Designer
Lotus Expeditor
Lotus Foundations
Lotus iNotes
Lotus Instructor Community Courseware
Lotus Notes
Lotus Notes & Domino Application Development
Lotus Notes Traveler
Lotus Protector
Lotus Quickr
Lotus Symphony
IBM Web Content Manager
WebSphere Portal

Lotus Forums


 Lotus Forums
Notes/Domino 9.0
Notes/Domino 8.5 + Traveler
Notes/Domino XPages development forum
Notes/Domino 8
Notes/Domino 6 and 7
IBM Connections
IBM Mobile Connect
IBM Sametime
IBM SmartCloud Notes
Lotus Enterprise Integration
Lotus Protector
Lotus Quickr
Lotus SmartSuite