@Override public void mergeWith(Record record, Map<Record, Object> recordsToRefresh) { super.mergeWith(record, recordsToRefresh); HierarchicalRecord hierarchicalRecord = (HierarchicalRecord) record; // parent ids for (HierarchicalRecord parentRecord : hierarchicalRecord.getParentRecords()) { if (!isParentOf(parentRecord) && !parentRecord.isRoot()) getHierarchicalIndex().addRelationship(parentRecord, this); } // child ids for (HierarchicalRecord childRecord : hierarchicalRecord.getChildRecords()) { if (!isChildOf(childRecord)) getHierarchicalIndex().addRelationship(this, childRecord); } }
public boolean isRootChild() { for (HierarchicalRecord record : getParentRecords()) { if ((record != null) && record.isRoot()) return true; } return false; }