private Long getLastId(ItemPath deltaParentPath) { return ItemPath.toIdOrNull(deltaParentPath.last()); }
throw new IllegalArgumentException("Empty path in "+this); Object last = fullPath.last(); if (!ItemPath.isName(last) && !ItemPath.isIdentifier(last)) { throw new IllegalArgumentException("Last segment of item path is not a name or identifier segment: " + fullPath + " (it is " + last + ")");
private ItemPath getDeltaParentItemPath(ItemPath deltaParentPath) { if (ItemPath.isId(deltaParentPath.last())) { return deltaParentPath.allExceptLast(); } else { return deltaParentPath; } }
@NotNull public ItemName getElementName() { if (definition != null) { return definition.getName(); // this is more precise, as the name in path can be unqualified } if (fullPath.isEmpty()) { throw new IllegalStateException("Empty full path in filter "+this); } Object last = fullPath.last(); if (ItemPath.isName(last)) { return ItemPath.toName(last); } else { throw new IllegalStateException("Got "+last+" as a last path segment in value filter "+this); } }
public static void assertPropertyReplace(Collection<? extends ItemDelta> modifications, ItemPath propertyPath, Object... expectedValues) { PropertyDelta propertyDelta = ItemDeltaCollectionsUtil.findPropertyDelta(modifications, propertyPath); assertNotNull("Property delta for "+propertyPath+" not found",propertyDelta); assertSet("delta "+propertyDelta+" for "+propertyPath.last(), "replace", propertyDelta.getValuesToReplace(), expectedValues); }
public static void assertPropertyDelete(Collection<? extends ItemDelta> modifications, ItemPath propertyPath, Object... expectedValues) { PropertyDelta propertyDelta = ItemDeltaCollectionsUtil.findPropertyDelta(modifications, propertyPath); assertNotNull("Property delta for "+propertyPath+" not found",propertyDelta); assertSet("delta "+propertyDelta+" for "+propertyPath.last(), "delete", propertyDelta.getValuesToDelete(), expectedValues); }
protected ItemDeltaImpl(ItemPath path, D itemDefinition, PrismContext prismContext) { //checkPrismContext(prismContext, itemDefinition); checkNoSpecialSymbols(path); this.prismContext = prismContext; if (path == null) { throw new IllegalArgumentException("Null path specified while creating item delta"); } if (path.isEmpty()) { this.elementName = null; } else { Object last = path.last(); if (!ItemPath.isName(last)) { throw new IllegalArgumentException("Invalid delta path "+path+". Delta path must always point to item, not to value"); } this.elementName = ItemPath.toName(last); this.parentPath = path.allExceptLast(); } this.definition = itemDefinition; }
public static <T> void assertPropertyReplace(ObjectDelta<?> userDelta, ItemPath path, T... expectedValues) { PropertyDelta<T> propertyDelta = userDelta.findPropertyDelta(path); assertNotNull("Property delta for "+path+" not found",propertyDelta); assertSet("delta " + propertyDelta + " for " + path.last(), "replace", propertyDelta.getValuesToReplace(), expectedValues); }
protected ObjectDelta<ShadowType> createModifyAccountShadowReplaceDelta(String accountOid, PrismObject<ResourceType> resource, ItemPath itemPath, Object... newRealValue) throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException { if (itemPath.startsWithName(ShadowType.F_ATTRIBUTES)) { PropertyDelta<?> attributeDelta = createAttributeReplaceDelta(resource, ItemPath.toName(itemPath.last()), newRealValue); ObjectDelta<ShadowType> accountDelta = prismContext.deltaFactory().object() .createModifyDelta(accountOid, attributeDelta, ShadowType.class); return accountDelta; } else { ObjectDelta<ShadowType> accountDelta = prismContext.deltaFactory().object().createModificationReplaceProperty( ShadowType.class, accountOid, itemPath, newRealValue); return accountDelta; } }
private void assertXmlPolyMod(ObjectModificationType objectModificationType, QName propertyName, ModificationTypeType modType, PolyStringType... expectedValues) throws SchemaException { //FIXME: for (ItemDeltaType mod : objectModificationType.getItemDelta()) { if (!propertyName.equals(mod.getPath().getItemPath().last())) { continue; } assertEquals(modType, mod.getModificationType()); for (RawType val : mod.getValue()){ assertModificationPolyStringValue(val, expectedValues); } } }
throw new SchemaException("Could not convert query, because query does not contain item path."); QName itemName = ItemPath.toName(itemPath.last()); QName matchingRule = getMatchingRule(clauseXMap);
throw new SchemaException("Cannot convert query, because query does not contain property path."); QName itemName = ItemPath.toName(itemPath.last());
throw new SchemaException("Could not convert query, because query does not contain item path."); QName itemName = ItemPath.toName(itemPath.last());
name = ItemPath.toName(path.last());
diffDelta.setElementName(ItemPath.toName(outputPath.last())); diffDelta.setParentPath(outputPath.allExceptLast()); outputFocusItemDelta.merge(diffDelta);