use of com.evolveum.prism.xml.ns._public.types_3.ItemPathType in project midpoint by Evolveum.
the class AssignmentEditorPanel method findOrCreateValueConstruction.
private ResourceAttributeDefinitionType findOrCreateValueConstruction(PrismPropertyDefinition attrDef, List<ResourceAttributeDefinitionType> attrConstructions) {
for (ResourceAttributeDefinitionType construction : attrConstructions) {
if (attrDef.getName().equals(construction.getRef())) {
return construction;
}
}
ResourceAttributeDefinitionType construction = new ResourceAttributeDefinitionType();
construction.setRef(new ItemPathType(new ItemPath(attrDef.getName())));
return construction;
}
use of com.evolveum.prism.xml.ns._public.types_3.ItemPathType in project midpoint by Evolveum.
the class TestSanity method test501NotifyChangeModifyAccount.
@Test
public void test501NotifyChangeModifyAccount() throws Exception {
final String TEST_NAME = "test501NotifyChangeModifyAccount";
TestUtil.displayTestTile(TEST_NAME);
OperationResult parentResult = new OperationResult(TEST_NAME);
PrismObject<UserType> userAngelika = findUserByUsername(ANGELIKA_NAME);
assertNotNull("User with the name angelika must exist.", userAngelika);
UserType user = userAngelika.asObjectable();
assertNotNull("User with the name angelika must have one link ref.", user.getLinkRef());
assertEquals("Expected one account ref in user", 1, user.getLinkRef().size());
String oid = user.getLinkRef().get(0).getOid();
ResourceObjectShadowChangeDescriptionType changeDescription = new ResourceObjectShadowChangeDescriptionType();
ObjectDeltaType delta = new ObjectDeltaType();
delta.setChangeType(ChangeTypeType.MODIFY);
delta.setObjectType(ShadowType.COMPLEX_TYPE);
ItemDeltaType mod1 = new ItemDeltaType();
mod1.setModificationType(ModificationTypeType.REPLACE);
ItemPathType path = new ItemPathType(new ItemPath(ShadowType.F_ATTRIBUTES, new QName(resourceTypeOpenDjrepo.getNamespace(), "givenName")));
mod1.setPath(path);
RawType value = new RawType(new PrimitiveXNode<String>("newAngelika"), prismContext);
mod1.getValue().add(value);
delta.getItemDelta().add(mod1);
delta.setOid(oid);
LOGGER.info("item delta: {}", SchemaDebugUtil.prettyPrint(mod1));
LOGGER.info("delta: {}", DebugUtil.dump(mod1));
changeDescription.setObjectDelta(delta);
changeDescription.setOldShadowOid(oid);
changeDescription.setChannel(SchemaConstants.CHANNEL_WEB_SERVICE_URI);
// WHEN
TaskType task = modelWeb.notifyChange(changeDescription);
// THEN
OperationResult result = OperationResult.createOperationResult(task.getResult());
display(result);
assertSuccess(result);
PrismObject<UserType> userAngelikaAfterSync = findUserByUsername(ANGELIKA_NAME);
assertNotNull("User with the name angelika must exist.", userAngelikaAfterSync);
UserType userAfterSync = userAngelikaAfterSync.asObjectable();
PrismAsserts.assertEqualsPolyString("wrong given name in user angelika", PrismTestUtil.createPolyStringType("newAngelika"), userAfterSync.getGivenName());
}
use of com.evolveum.prism.xml.ns._public.types_3.ItemPathType in project midpoint by Evolveum.
the class ModelClientUtil method createItemPathType.
public static ItemPathType createItemPathType(String stringPath) {
String pathDeclaration = "declare default namespace '" + NS_COMMON + "'; " + stringPath;
ItemPathType itemPathType = new ItemPathType(pathDeclaration);
return itemPathType;
}
use of com.evolveum.prism.xml.ns._public.types_3.ItemPathType in project midpoint by Evolveum.
the class SecurityEnforcerImpl method isApplicableItem.
private <O extends ObjectType> boolean isApplicableItem(Authorization autz, PrismObject<O> object, ObjectDelta<O> delta) throws SchemaException {
List<ItemPathType> itemPaths = autz.getItem();
if (itemPaths == null || itemPaths.isEmpty()) {
// No item constraints. Applicable for all items.
LOGGER.trace(" items empty");
return true;
}
for (ItemPathType itemPathType : itemPaths) {
ItemPath itemPath = itemPathType.getItemPath();
if (delta == null) {
if (object != null) {
if (object.containsItem(itemPath, false)) {
LOGGER.trace(" applicable object item " + itemPath);
return true;
}
}
} else {
ItemDelta<?, ?> itemDelta = delta.findItemDelta(itemPath);
if (itemDelta != null && !itemDelta.isEmpty()) {
LOGGER.trace(" applicable delta item " + itemPath);
return true;
}
}
}
LOGGER.trace(" no applicable item");
return false;
}
use of com.evolveum.prism.xml.ns._public.types_3.ItemPathType in project midpoint by Evolveum.
the class SecurityEnforcerImpl method getItems.
private Collection<ItemPath> getItems(Authorization autz) {
List<ItemPathType> itemPaths = autz.getItem();
Collection<ItemPath> items = new ArrayList<>(itemPaths.size());
for (ItemPathType itemPathType : itemPaths) {
ItemPath itemPath = itemPathType.getItemPath();
items.add(itemPath);
}
return items;
}
Aggregations