private static void simpleObject( final ObjectAdapter collectionAdapter, final DebugBuilder debugBuilder) { debugBuilder.appendln(collectionAdapter.titleString()); final ObjectSpecification objectSpec = collectionAdapter.getSpecification(); if (objectSpec.isParentedOrFreeCollection()) { final CollectionFacet facet = CollectionFacetUtils.getCollectionFacetFromSpec(collectionAdapter); int i = 1; for (final ObjectAdapter element : facet.collection(collectionAdapter)) { debugBuilder.appendln(i++ + " " + element.titleString()); } } else { // object is a regular Object try { final List<ObjectAssociation> fields = objectSpec.getAssociations(Contributed.EXCLUDED); for (int i = 0; i < fields.size(); i++) { final ObjectAssociation field = fields.get(i); final ObjectAdapter obj = field.get(collectionAdapter); final String name = field.getId(); if (obj == null) { debugBuilder.appendln(name, "null"); } else { debugBuilder.appendln(name, obj.titleString()); } } } catch (final RuntimeException e) { debugBuilder.appendException(e); } } }
private String debugCollectionGraph( final ObjectAdapter collection, final int level, final Vector<ObjectAdapter> recursiveElements) { final StringBuffer s = new StringBuffer(); if (recursiveElements.contains(collection)) { s.append("*\n"); } else { recursiveElements.addElement(collection); final CollectionFacet facet = CollectionFacetUtils.getCollectionFacetFromSpec(collection); final Iterator<ObjectAdapter> e = facet.iterator(collection); while (e.hasNext()) { indent(s, level); ObjectAdapter element; try { element = e.next(); } catch (final ClassCastException ex) { LOG.error(ex.getMessage(), ex); return s.toString(); } s.append(element); s.append(debugGraph(element, level + 1, recursiveElements)); } } return s.toString(); }
private static void collectionGraph( final ObjectAdapter collectionAdapter, final int level, final List<ObjectAdapter> ignoreAdapters, final AuthenticationSession authenticationSession, final DebugBuilder debugBuilder) { if (ignoreAdapters.contains(collectionAdapter)) { debugBuilder.append("*\n"); } else { ignoreAdapters.add(collectionAdapter); final CollectionFacet facet = CollectionFacetUtils.getCollectionFacetFromSpec(collectionAdapter); for (final ObjectAdapter element : facet.collection(collectionAdapter)) { graphIndent(level, debugBuilder); debugBuilder.append(element); if (ignoreAdapters.contains(element)) { debugBuilder.append("*\n"); } else { graph(element, level + 1, ignoreAdapters, authenticationSession, debugBuilder); } } } }