Search in sources :

Example 1 with OnDiskProject

use of org.openntf.domino.design.impl.OnDiskProject in project org.openntf.domino by OpenNTF.

the class DesignClassTest method testDesignClass.

// @Test
public void testDesignClass() throws IOException {
    Session sess = Factory.getSession(SessionType.CURRENT);
    // Database db = sess.getDatabase("D:/Daten/notesdaten_9/localdb/empty.ns9");
    // Database db = sess.getDatabase("D:/Daten/notesdaten_9/empty2.nsf");
    // Database db = sess.getDatabase("D:/Daten/notesdaten_9/localdb/proglib4work2.nsf");
    Database db = sess.getDatabase("srv-01-ndev2!!entwicklung/alex/proglib4work22.nsf");
    testDb(db);
    DatabaseDesign design = db.getDesign();
    // -X = no AgentData
    DesignCollection<DesignBase> elems = design.getDesignElements(// 
    "!@Contains($Flags;{X}) & !($TITLE={WEB-INF/classes/plugin/Activator.class}:{$BEProfileR7}) " + "");
    // + "& @IsAvailable($ACLDigest) ");
    // + "& @contains($TITLE;{gadproxy}) ");
    System.out.println("Count: " + elems.getCount());
    Path root = Paths.get("D:/daten/temp/ods3");
    OnDiskProject odp = new OnDiskProject(root);
    // PrintWriter pw = new PrintWriter(oFile);
    for (DesignBase elem : elems) {
        // + elem.getDocument().getItemValueString("$FLAGS"));
        try {
            odp.export(elem);
        // //elem.getDxlString(null)
        // String odp = elem.getOnDiskPath();
        // if (StringUtil.isEmpty(odp)) {
        // odp = elem.getNoteID() + ".note";
        // }
        // File odsFile = new File(root, odp);
        // System.out.println(elem.getClass().getName() + "\t\t\t" + odsFile);
        // odsFile.getParentFile().mkdirs(); // ensure the path exists
        // elem.writeOnDiskFile(odsFile);
        // if (elem instanceof HasMetadata) {
        // File meta = new File(odsFile.getAbsolutePath() + ".metadata");
        // ((HasMetadata) elem).writeOnDiskMeta(meta);
        // }
        } catch (Exception ne) {
            ne.printStackTrace();
        }
    // String path = "./" + elem.getOnDiskPath();
    // String ext = elem.getOnDiskExtension();
    // if (path != null && ext != null && !path.endsWith(ext))
    // path = path + ext;
    // pw.println(path + "\t'" + elem.getClass().getSimpleName() + "\t" + elem.getNoteID() + "\t" + elem.getName() + "\t"
    // + elem.getDocument().getItemValueString("$FLAGS"));
    // if (elem instanceof HasMetadata) {
    // pw.println(path + ".metadata");
    // }
    // if (elem instanceof CustomControl) {
    // pw.println(path + "-config");
    // }
    }
}
Also used : Path(java.nio.file.Path) DatabaseDesign(org.openntf.domino.design.DatabaseDesign) DesignBase(org.openntf.domino.design.DesignBase) Database(org.openntf.domino.Database) OnDiskProject(org.openntf.domino.design.impl.OnDiskProject) IOException(java.io.IOException) OpenNTFNotesException(org.openntf.domino.exceptions.OpenNTFNotesException) NotesException(lotus.domino.NotesException) Session(org.openntf.domino.Session)

Aggregations

IOException (java.io.IOException)1 Path (java.nio.file.Path)1 NotesException (lotus.domino.NotesException)1 Database (org.openntf.domino.Database)1 Session (org.openntf.domino.Session)1 DatabaseDesign (org.openntf.domino.design.DatabaseDesign)1 DesignBase (org.openntf.domino.design.DesignBase)1 OnDiskProject (org.openntf.domino.design.impl.OnDiskProject)1 OpenNTFNotesException (org.openntf.domino.exceptions.OpenNTFNotesException)1