private Object getRealContent(Item<?,?> item, ItemPath residualPath) { if (residualPath == null || residualPath.isEmpty()) { return item; } if (item == null) { return null; } return item.find(residualPath); }
private static Collection<PrismEntityPair<?>> createExistingPairs(Collection existing, Item item) { Collection<PrismEntityPair<?>> pairs = new ArrayList<>(); for (Object obj : existing) { if (obj instanceof Container) { Container container = (Container) obj; PrismValue value = (PrismValue) item.find(ItemPath.create(container.getId())); pairs.add(new PrismEntityPair(value, container)); } else { // todo improve somehow pairs.add(new PrismEntityPair(null, obj)); } } return pairs; }
@Override public Object find(ItemPath path) { if (path == null || path.isEmpty()) { return this; } Object first = path.first(); if (!ItemPath.isName(first)) { throw new IllegalArgumentException("Attempt to lookup item using a non-name path "+path+" in "+this); } ItemName subName = ItemPath.toName(first); ItemPath rest = path.rest(); Item<?,?> subItem = findItem(subName); if (subItem == null) { return null; } return subItem.find(rest); }