if (contribution.isPlaceholder()) {
// Iterate over the children and add only if there is not already one ...
Iterator<Location> childIterator = contribution.getChildren();
while (childIterator.hasNext()) {
Location child = childIterator.next();
Name childName = child.getPath().getLastSegment().getName();
if (!childNames.containsKey(childName)) {
childNames.put(childName, 1);
Path pathToChild = pathFactory.create(location.getPath(), childName);
federatedNode.addChild(new Location(pathToChild));
}
}
} else {
// Get the identification properties for each contribution ...
Location contributionLocation = contribution.getLocationInSource();
for (Property idProperty : contributionLocation) {
// Record the property ...
Property existing = properties.put(idProperty.getName(), idProperty);
if (existing != null) {
// There's already an existing property, so we need to merge them ...
Property merged = merge(existing, idProperty, context.getPropertyFactory(), removeDuplicateProperties);
properties.put(merged.getName(), merged);
}
}
// Accumulate the children ...
Iterator<Location> childIterator = contribution.getChildren();
while (childIterator.hasNext()) {
Location child = childIterator.next();
Name childName = child.getPath().getLastSegment().getName();
int index = Path.NO_INDEX;
Integer previous = childNames.put(childName, 1);
if (previous != null) {
int previousValue = previous.intValue();
// Correct the index in the child name map ...