Skip to content

Commit

Permalink
fixing creation of property&reference wrappers - path
Browse files Browse the repository at this point in the history
(cherry picked from commit 83f856c)
  • Loading branch information
katkav authored and mederly committed Oct 4, 2018
1 parent d9c95f2 commit 8eb1e1e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Expand Up @@ -411,7 +411,6 @@ public PrismContainerValue<C> createContainerValueAddDelta() throws SchemaExcept
} else {

PropertyOrReferenceWrapper propOrRef = (PropertyOrReferenceWrapper) item;
ItemPath path = propOrRef.getPath();
ItemDelta itemDelta = collectAddModifications(propOrRef);

ItemPath itemPath = itemDelta.getParentPath().remainder(getContainer().getPath());
Expand Down
Expand Up @@ -250,7 +250,14 @@ private <C extends Containerable> List<ContainerValueWrapper<C>> createContainer
}

container.getValues().forEach(pcv -> {
ContainerValueWrapper<C> containerValueWrapper = createContainerValueWrapper(cWrapper, pcv, cWrapper.getObjectStatus(), cWrapper.getStatus() == ContainerStatus.ADDING ? ValueStatus.ADDED : ValueStatus.NOT_CHANGED, pcv.getPath(), task);
ValueStatus status = ValueStatus.NOT_CHANGED;
ItemPath pcvPath = pcv.getPath();
if (cWrapper.getStatus() == ContainerStatus.ADDING) {
status = ValueStatus.ADDED;
pcvPath = cWrapper.getPath();
}

ContainerValueWrapper<C> containerValueWrapper = createContainerValueWrapper(cWrapper, pcv, cWrapper.getObjectStatus(), status, pcvPath, task);
containerValueWrappers.add(containerValueWrapper);
});

Expand Down Expand Up @@ -388,7 +395,7 @@ private <T, C extends Containerable> PropertyWrapper<T> createPropertyWrapper(
PrismProperty<T> newProperty = def.instantiate();
// We cannot just get path from newProperty.getPath(). The property is not added to the container, so it does not know its path.
// Definitions are reusable, they do not have paths either.
ItemPath propPath = containerValue.getPath().subPath(newProperty.getElementName());
ItemPath propPath = cWrapper.getPath().subPath(newProperty.getElementName());
return new PropertyWrapper(cWrapper, newProperty, propertyIsReadOnly, ValueStatus.ADDED, propPath);
}
return new PropertyWrapper(cWrapper, property, propertyIsReadOnly, cWrapper.getStatus() == ValueStatus.ADDED ? ValueStatus.ADDED: ValueStatus.NOT_CHANGED, property.getPath());
Expand Down Expand Up @@ -420,9 +427,9 @@ private <C extends Containerable> ReferenceWrapper createReferenceWrapper(PrismR
if (QNameUtil.match(AbstractRoleType.F_APPROVER_REF, def.getName()) || QNameUtil.match(AbstractRoleType.F_APPROVER_REF, def.getName())) {
refWrapper.setTargetTypes(Arrays.asList(FocusType.COMPLEX_TYPE, OrgType.COMPLEX_TYPE));
} else {

QName targetType = def.getTargetTypeName();

if (targetType == null || ObjectType.COMPLEX_TYPE.equals(targetType)) {
refWrapper.setTargetTypes(WebComponentUtil.createObjectTypeList());
} else if (AbstractRoleType.COMPLEX_TYPE.equals(targetType)) {
Expand Down

0 comments on commit 8eb1e1e

Please sign in to comment.