Skip to main content
This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal

Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum


  

PreviousPrevious NextNext


~Joseph Brenitexjip 30.Sep.03 09: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 ... (~Joseph Brenite... 30.Sep.03)
. . RE: Database access from another cl... (~Delores Dwonic... 30.Sep.03)
. . . . RE: Database access from another cl... (~Joseph Brenite... 30.Sep.03)
. . . . . . Why can't you ... (WAS: Database ac... (~Delores Dwonic... 30.Sep.03)
. . . . . . . . RE: Why can't you ... (WAS: Databas... (~Dan Zekpone 1.Oct.03)
. . . . . . . . . . RE: Why can't you ... (WAS: Databas... (~Joseph Brenite... 2.Oct.03)
. . . . . . . . . . . . RE: Why can't you ... (WAS: Databas... (~Dan Zekpone 2.Oct.03)
. . . . . . . . . . . . . . Additional comment re loop (~Delores Dwonic... 2.Oct.03)
. . . . . . . . . . . . . . It works ;) (~Joseph Brenite... 2.Oct.03)
. . . . . . . . . . . . . . RE: Why can't you ... (WAS: Databas... (~Naomi Nimkitex... 2.Oct.03)
. . . . . . . . . . . . . . . . Thanks Joe, that's useful to know! ... (~Delores Dwonic... 2.Oct.03)





  Document options
Print this pagePrint this page

 Search this forum

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

 RSS feedsRSS
All forum posts RSS
All main topics RSS