Skip to content

Commit

Permalink
object class search item fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Kateryna Honchar committed Sep 8, 2022
1 parent 36beb87 commit dff17cf
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@

import com.evolveum.midpoint.prism.Containerable;
import com.evolveum.midpoint.web.component.search.ReferenceValueSearchPanel;
import com.evolveum.midpoint.web.component.search.SearchValue;
import com.evolveum.midpoint.web.component.search.SwitchablePropertyValuePanel;
import com.evolveum.midpoint.xml.ns._public.common.audit_3.AuditEventRecordType;

import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType;

import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.PropertyModel;

Expand Down Expand Up @@ -51,10 +56,19 @@ protected List<QName> getAllowedRelations() {
return super.getAllowedRelations();
}

@Override
protected void referenceValueUpdated(ObjectReferenceType ort, AjaxRequestTarget target) {
((SearchValue<ObjectReferenceType>)ReferenceSearchItemPanel.this.getModelObject().getValue()).setValue(ort);
ReferenceSearchItemPanel.this.updateSearchPanel(ort, target);
}

private Class<? extends Containerable> getSearchType() {
return ReferenceSearchItemPanel.this.getModelObject().getSearchType();
}
};
}

private void updateSearchPanel(ObjectReferenceType ort, AjaxRequestTarget target) {
target.add(findParent(SearchPanel.class));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,12 @@ public void onClick(AjaxRequestTarget target) {
@Override
protected void onSelectPerformed(AjaxRequestTarget target, O object) {
getPageBase().hideMainPopup(target);
ReferenceValueSearchPanel.this.getModel().setObject(new ObjectReferenceType());
ReferenceValueSearchPanel.this.getModelObject().setOid(object.getOid());
ReferenceValueSearchPanel.this.getModelObject().setTargetName(object.getName());
ReferenceValueSearchPanel.this.getModelObject().setType(
object.asPrismObject().getComplexTypeDefinition().getTypeName());
ObjectReferenceType ort = new ObjectReferenceType();
ort.setOid(object.getOid());
ort.setTargetName(object.getName());
ort.setType(object.asPrismObject().getComplexTypeDefinition().getTypeName());
ReferenceValueSearchPanel.this.getModel().setObject(ort);
referenceValueUpdated(ort, target);
target.add(ReferenceValueSearchPanel.this);
}
};
Expand Down

0 comments on commit dff17cf

Please sign in to comment.