*/
public List exportData(Set dataSourceSet, Lookup whereMap, boolean bExclusive)
{
Metadata metadata = m_context.getMetadata();
List resultList = new ArrayList();
Lookup identityMap = new IdentityHashTab();
Lookup classMap = new HashTab();
for (Iterator itr = metadata.getMetaclassIterator(); itr.hasNext();)
{
Metaclass metaclass = (Metaclass)itr.next();
PersistenceMapping mapping = metaclass.getPersistenceMapping();
Object where = resolve(metaclass, whereMap);
if (mapping == null ||
dataSourceSet != null && !dataSourceSet.contains(mapping.getDataSource()) ||
where == null && bExclusive ||
Boolean.FALSE.equals(where) ||
!isWritable(mapping))
{
continue;
}
Metaclass root = metaclass.getPersistenceRoot();
Pair attributes = null;
for (int i = 0, n = metaclass.getInstanceAttributeCount(); i < n; ++i)
{
Attribute attribute = metaclass.getInstanceAttribute(i);
Metaclass declarator = attribute.getDeclarator();
if (attribute.isPersistent() &&
attribute.getWhere() == null &&
(!attribute.isCollection() || attribute.getReverse() == null) &&
attribute != mapping.getLockingAttribute() &&
(declarator == metaclass ||
declarator.getPersistenceMapping() == null ||
declarator.getPersistenceMapping().isCompatible(metaclass.getPersistenceMapping())) &&
isWritable(metaclass.getPersistenceMapping().getAttributeMapping(attribute)))
{
attributes = new Pair(attribute.getSymbol(), attributes);
}
}
if (metaclass != root)
{
attributes = new Pair(new Pair(Symbol.ATAT, new Pair(metaclass.getSymbol(), attributes)));
}
classMap.put(root, Pair.append((Pair)classMap.get(root), attributes));
}
for (Iterator itr = classMap.iterator(); itr.hasNext();)
{
Metaclass metaclass = (Metaclass)itr.next();
if (s_logger.isDebugEnabled())
{
s_logger.debug("Reading class \"" + metaclass.getName() + "\"");
}
Pair attributes = (Pair)classMap.get(metaclass);
resultList.add(new Pair(read(metaclass, attributes, resolve(metaclass, whereMap)), attributes));
}
List list = new ArrayList();