reflexiveRelNames[i] = (objRel != null ? objRel.getName() : null);
}
List sorted = new ArrayList(size);
Digraph objectDependencyGraph = new MapDigraph(MapDigraph.HASHMAP_FACTORY);
Object[] masters = new Object[reflexiveRelNames.length];
for (int i = 0; i < size; i++) {
DataObject current = (DataObject) objects.get(i);
objectDependencyGraph.addVertex(current);
int actualMasterCount = 0;
for (int k = 0; k < reflexiveRelNames.length; k++) {
String reflexiveRelName = reflexiveRelNames[k];
if (reflexiveRelName == null) {
continue;
}
masters[k] = (reflexiveRelName != null) ? current
.readProperty(reflexiveRelName) : null;
if (masters[k] == null) {
masters[k] = findReflexiveMaster(current, (ObjRelationship) objEntity
.getRelationship(reflexiveRelName), current
.getObjectId()
.getEntityName());
}
if (masters[k] != null) {
actualMasterCount++;
}
}
int mastersFound = 0;
for (int j = 0; j < size && mastersFound < actualMasterCount; j++) {
if (i == j) {
continue;
}
DataObject masterCandidate = (DataObject) objects.get(j);
for (int k = 0; k < masters.length; k++) {
if (masterCandidate.equals(masters[k])) {
objectDependencyGraph.putArc(
masterCandidate,
current,
Boolean.TRUE);
mastersFound++;
}