Search in sources :

Example 1 with ODPMapping

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

the class DesignClassTest method testDb.

protected void testDb(final Database db) {
    DatabaseDesign design = db.getDesign();
    System.out.println("Design: " + design.getClass().getName());
    DesignCollection<DesignBase> allDesign = design.getDesignElements("@ALL");
    Map<Class<?>, AtomicInteger> counter = new HashMap<Class<?>, AtomicInteger>();
    for (DesignBase des : allDesign) {
        if (!counter.containsKey(des.getClass())) {
            counter.put(des.getClass(), new AtomicInteger());
        }
        counter.get(des.getClass()).incrementAndGet();
    }
    int i = 0;
    int j = 0;
    for (ODPMapping mapping : ODPMapping.values()) {
        Class<? extends DesignBase> cls = mapping.getInstanceClass();
        if (cls == OtherDesignElement.class) {
        } else {
            DesignCollection<? extends DesignBase> ret = design.getDesignElements(cls);
            j = 0;
            for (@SuppressWarnings("unused") DesignBase b : ret) {
                i++;
                j++;
            }
            int cnt;
            if (!counter.containsKey(cls)) {
                cnt = 0;
            } else {
                cnt = counter.get(cls).get();
            }
            if (j == cnt) {
                System.out.println(j + "\t " + cnt + "\t" + cls.getName());
            } else {
                System.err.println(j + "\t " + cnt + "\t" + cls.getName());
            }
        // if (j == 0)
        // System.err.println("No design element of " + cls.getName() + " found");
        }
    }
    System.out.println("Total design elements " + i);
}
Also used : DatabaseDesign(org.openntf.domino.design.DatabaseDesign) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) HashMap(java.util.HashMap) DesignBase(org.openntf.domino.design.DesignBase) ODPMapping(org.openntf.domino.design.impl.ODPMapping)

Aggregations

HashMap (java.util.HashMap)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 DatabaseDesign (org.openntf.domino.design.DatabaseDesign)1 DesignBase (org.openntf.domino.design.DesignBase)1 ODPMapping (org.openntf.domino.design.impl.ODPMapping)1