1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 package de.bea.domingo.samples;
24
25 import java.util.Iterator;
26
27 import de.bea.domingo.DDatabase;
28 import de.bea.domingo.DDocument;
29 import de.bea.domingo.DNotesException;
30 import de.bea.domingo.DNotesFactory;
31 import de.bea.domingo.DSession;
32
33 /***
34 * Creating parent and child documents.
35 *
36 * @author <a href="mailto:kriede@users.sourceforge.net">Kurt Riede </a>
37 */
38 public final class ParentChildSample {
39
40 /***
41 * Main method of sample.
42 *
43 * @param args arguments
44 * @throws DNotesException if the sample fails
45 */
46 public static void main(String[] args) throws DNotesException {
47 DNotesFactory factory = DNotesFactory.getInstance();
48 DSession session = factory.getSession("plato.acme", "Administrator", "password");
49 DDatabase database = session.getDatabase("", "test.nsf");
50
51
52 DDocument parent = database.createDocument();
53
54 parent.save();
55
56
57 DDocument child = database.createDocument();
58
59 child.makeResponse(parent);
60 child.save();
61
62
63 System.out.println("parent documents:");
64 Iterator iterator = database.search("ParentUNID = \"\"");
65 while (iterator.hasNext()) {
66 DDocument document = (DDocument) iterator.next();
67 System.out.println(document.getUniversalID());
68 }
69 }
70 }