Skip to content

Commit

Permalink
Fixed MID-2073 by retrieving associations in GUI with noFetch option.
Browse files Browse the repository at this point in the history
Fixed ClassCastException in PrismValuePanel.
  • Loading branch information
mederly committed Jan 15, 2015
1 parent f9b5a0c commit d84f0f0
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 15 deletions.
Expand Up @@ -448,7 +448,9 @@ private String createAssociationTooltipText(PrismProperty property){
for (Object realValue : attr.getRealValues()){
sb.append(getAttributeName(attr));
sb.append(":");
sb.append(((String)realValue).replace(",", ",​").replace("@", "@​"));
if (realValue != null) {
sb.append(realValue.toString().replace(",", ",​").replace("@", "@​"));
}
sb.append("<br>");
}
}
Expand Down
Expand Up @@ -700,9 +700,10 @@ private List<UserAccountDto> loadAccountWrappers() {
List<PrismProperty> associations = new ArrayList<>(associationContainer.getValues().size());
for (PrismContainerValue associationVal : associationContainer.getValues()){
ShadowAssociationType associationType = (ShadowAssociationType) associationVal.asContainerable();
PrismObject<ShadowType> association = getModelService().getObject(ShadowType.class, associationType.getShadowRef().getOid(), null, task, subResult);
// we can safely eliminate fetching from resource, because we need only the name
PrismObject<ShadowType> association = getModelService().getObject(ShadowType.class, associationType.getShadowRef().getOid(),
SelectorOptions.createCollection(GetOperationOptions.createNoFetch()), task, subResult);
associations.add(association.findProperty(ShadowType.F_NAME));

}

wrapper.setAssociations(associations);
Expand Down
Expand Up @@ -536,15 +536,16 @@ private <T, F extends FocusType> void evaluateActivationMapping(final LensContex
LOGGER.trace("No outbound definition in '{}' definition in activation in projection {}, skipping", desc, accCtxDesc);
return;
}

ObjectDelta<ShadowType> projectionDelta = projCtx.getDelta();
PropertyDelta<T> shadowPropertyDelta = LensUtil.findAPrioriDelta(context, projCtx, projectionPropertyPath);

// commented out unused code
// ObjectDelta<ShadowType> projectionDelta = projCtx.getDelta();
// PropertyDelta<T> shadowPropertyDelta = LensUtil.findAPrioriDelta(context, projCtx, projectionPropertyPath);

PrismObject<ShadowType> shadowNew = projCtx.getObjectNew();
PrismProperty<T> shadowPropertyNew = null;
if (shadowNew != null) {
shadowPropertyNew = shadowNew.findProperty(projectionPropertyPath);
}
// PrismProperty<T> shadowPropertyNew = null;
// if (shadowNew != null) {
// shadowPropertyNew = shadowNew.findProperty(projectionPropertyPath);
// }

MappingInitializer<PrismPropertyValue<T>> initializer = new MappingInitializer<PrismPropertyValue<T>>() {
@Override
Expand Down
Expand Up @@ -925,14 +925,17 @@ private PrismObject<ShadowType> lookupOrCreateShadowInRepository(ConnectorInstan
parentResult);

if (repoShadow == null) {
LOGGER.trace(
"Shadow object (in repo) corresponding to the resource object (on the resource) was not found. The repo shadow will be created. The resource object:\n{}",
SchemaDebugUtil.prettyPrint(resourceShadow));
if (LOGGER.isTraceEnabled()) {
LOGGER.trace(
"Shadow object (in repo) corresponding to the resource object (on the resource) was not found. The repo shadow will be created. The resource object:\n{}",
SchemaDebugUtil.prettyPrint(resourceShadow));
}

repoShadow = createShadowInRepository(connector, resourceShadow, objectClassDef, resourceType, parentResult);
} else {
LOGGER.trace("Found shadow object in the repository {}",
SchemaDebugUtil.prettyPrint(repoShadow));
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Found shadow object in the repository {}", SchemaDebugUtil.prettyPrint(repoShadow));
}
}

return repoShadow;
Expand Down

0 comments on commit d84f0f0

Please sign in to comment.