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);
}
Aggregations