@Override public void run() { Session session = this.getSession(); session.setConvertMIME(false); session.setFixEnable(Fixes.APPEND_ITEM_VALUE, true); session.setFixEnable(Fixes.FORCE_JAVA_DATES, true); session.setFixEnable(Fixes.CREATE_DB, true); Database db = session.getDatabase("", "log.nsf"); Document doc = db.createDocument(); doc.replaceItemValue("form", "Events"); doc.replaceItemValue("Server", "Test"); Map<String, String> map = new HashMap<String, String>(); map.put("me", "us"); map.put("myself", "ourselves"); map.put("I", "we"); doc.replaceItemValue("map", map); doc.save(); String unid = doc.getUniversalID(); doc = null; Document docJunk = db.createDocument(); doc = db.getDocumentByUNID(unid); System.out.println(doc.getNoteID()); Object o = doc.getItemValue("map", Map.class); System.out.println(o.getClass().getName()); Map<String, String> remap = (Map<String, String>) o; for (String key : remap.keySet()) { System.out.println(key + ":" + remap.get(key)); } session.setConvertMIME(true); doc = null; docJunk = db.createDocument(); doc = db.getDocumentByUNID(unid); Vector<Item> items = doc.getItems(); for (Item item : items) { if (item.getName().equalsIgnoreCase("map")) { System.out.println("map: " + item.getType()); System.out.println("map value: " + item.getText()); } } doc.replaceItemValue("foo", "bar"); doc.save(); session.setConvertMIME(false); o = null; doc = null; docJunk = db.createDocument(); doc = db.getDocumentByUNID(unid); o = doc.getItemValue("map", Map.class); System.out.println(o.getClass().getName()); remap = (Map<String, String>) o; for (String key : remap.keySet()) { System.out.println(key + ":" + remap.get(key)); } System.out.println("Complete"); }
private void iterateAllDocuments(Database db, Set<Document> secondReference) { System.out.println( "Thread " + Thread.currentThread().getName() + " BEGINNING ITERATION of Documents"); Session s = db.getParent(); DocumentCollection dc = db.getAllDocuments(); for (Document doc : dc) { docCount++; Vector v = doc.getItemValue("$UpdatedBy"); for (Object o : v) { if (o instanceof String) { Name n = s.createName((String) o); String cn = n.getCommon(); nameCount++; } } if (docCount % 1000 == 0) { secondReference.add(db.getDocumentByID(doc.getNoteID())); } if (docCount % 2000 == 0) { thirdReference.add(doc); } DateTime toxic = doc.getLastModified(); String busyWork = toxic.getGMTTime(); DateTime toxic2 = doc.getLastModified(); String busyWork2 = toxic2.getDateOnly(); // System.out.println("LastMod: " + toxic.getGMTTime()); dateCount++; } System.out.println("ENDING ITERATION of Documents"); }
private void iterateForms(Database db) { System.out.println( "Thread " + Thread.currentThread().getName() + " BEGINNING ITERATION of Forms"); Vector<Form> forms = db.getForms(); for (Form form : forms) { // System.out.println("Form : " + form.getName() + " (" + // DominoUtils.getUnidFromNotesUrl(form.getNotesURL()) + ")"); Document d = form.getDocument(); Vector v = d.getItemValue("$UpdatedBy"); Name n = db.getParent().createName((String) v.get(0)); String cn = n.getCommon(); nameCount++; docCount++; // System.out.println("Last Editor: " + n); } System.out.println("ENDING ITERATION of Forms"); }