Skip to content

Commit

Permalink
fix for setting object classs on page debug list (MID-6848)
Browse files Browse the repository at this point in the history
  • Loading branch information
skublik committed Mar 22, 2021
1 parent ff81726 commit 024ade6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
Expand Up @@ -84,20 +84,28 @@ public Type getSearchItemType() {
@Override
public DisplayableValue<QName> getValue() {
for (PropertySearchItem property : getSearch().getPropertyItems()) {
if (ShadowType.F_RESOURCE_REF.equivalent(property.getPath())
&& property.getValue() != null && property.getValue().getValue() != null) {
Referencable ref = (Referencable) property.getValue().getValue();
if (StringUtils.isNotBlank(ref.getOid())
&& ref.getOid().equals(lastResourceOid)) {
return super.getValue();
}
break;
if (existResourceValue(property)) {
return super.getValue();
}
}
for (SearchItem item : getSearch().getSpecialItems()) {
if (item instanceof PropertySearchItem && existResourceValue((PropertySearchItem) item)) {
return super.getValue();
}

}
return new SearchValue<>();
}

private boolean existResourceValue(PropertySearchItem property) {
if (ShadowType.F_RESOURCE_REF.equivalent(property.getPath())
&& property.getValue() != null && property.getValue().getValue() != null) {
Referencable ref = (Referencable) property.getValue().getValue();
return StringUtils.isNotBlank(ref.getOid())
&& ref.getOid().equals(lastResourceOid);
}
return false;
}

@Override
protected String getTitle(PageBase pageBase) {
for (PropertySearchItem property : getSearch().getPropertyItems()) {
Expand Down
Expand Up @@ -523,9 +523,9 @@ private void configureSearch(@NotNull Search search) {
}

private PropertySearchItem createObjectClassSearchItem(Search search) {
PrismPropertyDefinition resourceRefDef = getPrismContext().getSchemaRegistry().findComplexTypeDefinitionByCompileTimeClass(ShadowType.class)
PrismPropertyDefinition objectClassDef = getPrismContext().getSchemaRegistry().findComplexTypeDefinitionByCompileTimeClass(ShadowType.class)
.findPropertyDefinition(ShadowType.F_OBJECT_CLASS);
return new ObjectClassSearchItem(search, new SearchItemDefinition(ShadowType.F_OBJECT_CLASS, resourceRefDef, null),
return new ObjectClassSearchItem(search, new SearchItemDefinition(ShadowType.F_OBJECT_CLASS, objectClassDef, null),
new PropertyModel(searchModel, Search.F_SPECIAL_ITEMS)) {

@Override
Expand Down

0 comments on commit 024ade6

Please sign in to comment.