Il faudrait que tu lance l'agent directement.
Que dans cette agent tu ouvre le document creer (et sauvegarder).
J'ai pas trop le temps, mais ton tuteur t'as envoyé dans un cul de sac
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Vector;
import lotus.domino.*;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
String serveur = "*******";
String base = "*******";
Document adoc;
// (Your code goes here)
adoc = agentContext.getDocumentContext();
adoc.replaceItemValue("nom", "titi");
Item agenda;
agenda = adoc.getFirstItem("body");
agenda.appendToTextList("tutu");
agenda.appendToTextList("<style>");
agenda.appendToTextList("table { border : medium solid #000000; width : 80%;}");
agenda.appendToTextList("td,th { border : thin solid #6495ed; width: 10%; }");
agenda.appendToTextList("</style><table>");
agenda.appendToTextList("<th>Horaires</th><th>Lundi</th><th>Mardi</th><th>Mercredi</th>");
agenda.appendToTextList("<th>Jeudi</th><th>Vendredi</th><th>Samedi</th>");
agenda.appendToTextList("<tr><td> 9 H <br> 10 H <br> 11 H <br> 12 H <br> </td>");
agenda.appendToTextList("<td> </td><td> </td><td> </td>");
agenda.appendToTextList("<td> </td><td> </td><td> </td></tr><tr>");
agenda.appendToTextList("<td> 14 H <br> 15 H <br> 16 H <br> 17 H <br> 18 H <br> </td>");
agenda.appendToTextList("<td> </td><td> </td>");
agenda.appendToTextList("<td> </td> <td> </td>");
agenda.appendToTextList("<td> </td> <td> </td> </tr></table>");
Database db = session.getDatabase(serveur,base);
View premvue = db.getView("People");
Document recherche = premvue.getFirstDocument();
String tabutil [] = new String [1000];
int i = 0;
String add;
String service;
System.out.println("bonjour !");
while (recherche != null) {
add = recherche.getItemValueString("MailFile");
service = recherche.getItemValueString("MailSystem");
if ((add.indexOf("mail") > -1) && service.equals("1")) {
tabutil[i] = add;
}
i = i + 1;
recherche = premvue.getNextDocument(recherche);
}
for (i = 0; i <tabutil> -1 ) {
dbp = session.getDatabase(serveur,tabutil[i]);
}
else {
dbp = session.getDatabase(serveur,tabutil[i]+".nsf");
}
vueacces = dbp.getView("calendar");
System.out.println("On a réussit à ouvrir le calendrier "+ tabutil[i]);
}
catch(Exception e){
continue;
}
Document docc = vueacces.getFirstDocument();
while (docc != null) {
try{
Vector datefin = docc.getItemValueDateTimeArray("EndDate");
DateTime dateagenda = (DateTime)datefin.get(0);
Date date = new Date();
SimpleDateFormat recupannee = new SimpleDateFormat("yyyy");
String anneeactuelle = recupannee.format(date);
String anneeagenda = dateagenda.toString();
anneeagenda = anneeagenda.substring(6,10);
int anactu = Integer.parseInt(anneeactuelle);
int anagenda = Integer.parseInt(anneeagenda);
if (anactu < anagenda) {
System.out.println(docc.getItemValueDateTimeArray("StartDate"));
System.out.println(docc.getItemValueDateTimeArray("EndDate"));
System.out.println(docc.getItemValueDateTimeArray("StartTime"));
System.out.println(docc.getItemValueDateTimeArray("EndTime"));
System.out.println(docc.getItemValueString("Subject"));
}
}
catch(Exception e){
}
docc = vueacces.getNextDocument(docc);
}
}
} catch(Exception e) {
e.printStackTrace();
}
}
}Voilà maintenant, à partir de ça je dois réussir à afficher les informations récupérées dans mon calendrier par le moyens de div.
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Vector;
import lotus.domino.*;
public class JavaAgent extends AgentBase {
public int verifheurematin (int hf){
int nb = 0;
if (hf == 10) {
nb = 1;
}
else if (hf == 11) {
nb = 2;
}
else if ( hf == 12) {
nb = 3;
}
return nb;
}
public int verifheureaprem (int hf){
int nb = 0;
if (hf == 15) {
nb = 2;
}
else if ( hf == 16) {
nb = 3;
}
else if (hf == 17) {
nb = 4;
}
else if (hf == 18) {
nb = 5;
}
return nb;
}
public void NotesMain() {
try {
boolean commenceneuf = false;
boolean commencedix = false;
boolean commenceonze = false;
boolean commencequatorze = false;
boolean commencequinze = false;
boolean commenceseize = false;
boolean commencedixsept = false;
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
int nbplacematin = 0;
int nbplaceaprem = 0;
try {
String serveur = "*********";
String base = "*************";
Database db = session.getDatabase(serveur,base);
View premvue = db.getView("People");
Document recherche = premvue.getFirstDocument();
String tabutil [] = new String [1000];
int i = 0;
String add;
String service;
System.out.println("bonjour !");
while (recherche != null) {
add = recherche.getItemValueString("MailFile");
service = recherche.getItemValueString("MailSystem");
if ((add.indexOf("mail") > -1) && service.equals("1")) {
tabutil[i] = add;
}
i = i + 1;
recherche = premvue.getNextDocument(recherche);
}
for (i = 0; i <tabutil> -1 ) {
dbp = session.getDatabase(serveur,tabutil[i]);
}
else {
dbp = session.getDatabase(serveur,tabutil[i]+".nsf");
}
vueacces = dbp.getView("calendar");
System.out.println("On a réussit à ouvrir le calendrier "+ tabutil[i]);
}
catch(Exception e){
continue;
}
Document docc = vueacces.getFirstDocument();
while (docc != null) {
try{
Vector datefin = docc.getItemValueDateTimeArray("EndDate");
DateTime dateagenda = (DateTime)datefin.get(0);
Date date = new Date();
SimpleDateFormat recupannee = new SimpleDateFormat("yyyy");
String anneeactuelle = recupannee.format(date);
String dateagendachaine = dateagenda.toString();
String anneeagenda = dateagendachaine.substring(6,10);
String dateactuellechaine = date.toString();
String jouragenda = dateagendachaine.substring(0,2);
String jouractuelle = dateactuellechaine.substring(0,2);
String moisagenda = dateagendachaine.substring(3,5);
String moisactuelle = dateactuellechaine.substring(3,5);
int anactu = Integer.parseInt(anneeactuelle);
int anagenda = Integer.parseInt(anneeagenda);
int jagenda = Integer.parseInt(jouragenda);
int jactuelle = Integer.parseInt(jouractuelle);
int magenda = Integer.parseInt(moisagenda);
int mactuelle = Integer.parseInt(moisactuelle);
if (anactu == anagenda) {
if ( magenda == mactuelle ) {
if (jagenda == jactuelle) {
// Récup de l'heure de départ
Vector heuredebut = docc.getItemValueDateTimeArray("StartTime");
DateTime heuredeb = (DateTime)heuredebut.get(0);
String heuredebutchaine = heuredeb.toString();
heuredebutchaine = heuredebutchaine.substring(0,2);
int hdeb = Integer.parseInt(heuredebutchaine);
// Récup de l'heure de fin
Vector heurefini = docc.getItemValueDateTimeArray("EndTime");
DateTime heurefin = (DateTime)heurefini.get(0);
String heurefinchaine = heurefin.toString();
heurefinchaine = heurefinchaine.substring(0,2);
int hfin = Integer.parseInt(heurefinchaine);
if (hdeb == 9) {
commenceneuf = true;
nbplacematin = verifheurematin(hfin);
}
else if (hdeb == 10) {
commencedix = true;
nbplacematin = verifheurematin (hfin);
}
else if (hdeb == 11) {
commenceonze = true;
nbplacematin = verifheurematin (hfin);
}
if ( hdeb == 14) {
commencequatorze = true;
nbplaceaprem = verifheureaprem(hfin);
}
if ( hdeb == 15) {
commencequinze = true;
nbplaceaprem = verifheureaprem(hfin);
}
if ( hdeb == 16) {
commenceseize = true;
nbplaceaprem = verifheureaprem(hfin);
}
if ( hdeb == 17) {
commencedixsept = true;
nbplaceaprem = verifheureaprem(hfin);
}
}
}
}
//System.out.println(docc.getItemValueDateTimeArray("StartDate"));
// System.out.println(docc.getItemValueDateTimeArray("EndDate"));
//System.out.println(docc.getItemValueDateTimeArray("StartTime"));
// System.out.println(docc.getItemValueDateTimeArray("EndTime"));
// System.out.println(docc.getItemValueString("Subject"));
}
catch(Exception e){
continue;
}
docc = vueacces.getNextDocument(docc);
}
}}
catch(Exception e){
}
Document adoc;
// (Your code goes here)
adoc = agentContext.getDocumentContext();
adoc.replaceItemValue("nom", "titi");
Item agenda;
agenda = adoc.getFirstItem("body");
agenda.appendToTextList("tutu");
agenda.appendToTextList("<style>");
agenda.appendToTextList("table { border : medium solid #000000; width : 80%;}");
agenda.appendToTextList("td,th { border : thin solid #6495ed; width: 10%; }");
agenda.appendToTextList("div { width : 15%; border : solid #000000; }");
agenda.appendToTextList("</style><table>");
agenda.appendToTextList("<th>Horaires</th><th>Lundi</th><th>Mardi</th><th>Mercredi</th>");
agenda.appendToTextList("<th>Jeudi</th><th>Vendredi</th><th>Samedi</th>");
agenda.appendToTextList("<tr><td> 9 H <br> 10 H <br> 11 H <br> 12 H <br> </td>");
agenda.appendToTextList("<td>");
agenda.appendToTextList("<div><br>");
if ( commenceneuf == true )
{
agenda.appendToTextList("<style> .1 { background-color : red ; } " );
}
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
if ( nbplacematin == 1 || commencedix == true)
{
agenda.appendToTextList("<style> .2 { background-color : red ; } " );
}
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
if ( nbplacematin == 2 || commenceonze == true)
{
agenda.appendToTextList("<style> .3 { background-color : red ; } " );
}
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
if ( nbplacematin == 3)
{
agenda.appendToTextList("<style> .4 { background-color : red ; } " );
}
agenda.appendToTextList("</div>");
agenda.appendToTextList("</td>");
agenda.appendToTextList("<td>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("</td>");
agenda.appendToTextList("<td>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("</td>");
agenda.appendToTextList("<td>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("</td>");
agenda.appendToTextList("<td>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("</td>");
agenda.appendToTextList("<td>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("</td>");
agenda.appendToTextList("</tr><tr>");
agenda.appendToTextList("<td> 14 H <br> 15 H <br> 16 H <br> 17 H <br> 18 H <br> </td>");
agenda.appendToTextList("<td>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("</td>");
agenda.appendToTextList("<td>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("</td>");
agenda.appendToTextList("<td>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("</td>");
agenda.appendToTextList("<td>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("</td>");
agenda.appendToTextList("<td>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("</td>");
agenda.appendToTextList("<td>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("<div><br>");
agenda.appendToTextList("</div>");
agenda.appendToTextList("</td>");
agenda.appendToTextList("</tr></table>");
} catch(Exception e) {
e.printStackTrace();
}
}
}