use of com.evolveum.midpoint.prism.query.ObjectQuery in project midpoint by Evolveum.
the class ObjectBrowserPanel method createObjectListPanel.
private ObjectListPanel<O> createObjectListPanel(Class<? extends O> type, final boolean multiselect) {
PopupObjectListPanel<O> listPanel = new PopupObjectListPanel<O>(ID_TABLE, type, multiselect, parentPage, selectedObjectsList) {
private static final long serialVersionUID = 1L;
@Override
protected void onSelectPerformed(AjaxRequestTarget target, O object) {
ObjectBrowserPanel.this.onSelectPerformed(target, object);
}
@Override
protected ObjectQuery addFilterToContentQuery(ObjectQuery query) {
if (queryFilter != null) {
if (query == null) {
query = new ObjectQuery();
}
query.addFilter(queryFilter);
}
return query;
}
};
listPanel.setOutputMarkupId(true);
return listPanel;
}
use of com.evolveum.midpoint.prism.query.ObjectQuery in project midpoint by Evolveum.
the class TypedAssignablePanel method createObjectListPanel.
private PopupObjectListPanel<T> createObjectListPanel(String id, final String countId, final QName type) {
PopupObjectListPanel<T> listPanel = new PopupObjectListPanel<T>(id, qnameToCompileTimeClass(type), true, getPageBase()) {
@Override
protected void onUpdateCheckbox(AjaxRequestTarget target) {
refreshCounts(target);
}
@Override
protected ObjectQuery addFilterToContentQuery(ObjectQuery query) {
if (type.equals(RoleType.COMPLEX_TYPE)) {
LOGGER.debug("Loading roles which the current user has right to assign");
OperationResult result = new OperationResult(OPERATION_LOAD_ASSIGNABLE_ROLES);
ObjectFilter filter = null;
try {
ModelInteractionService mis = parentPage.getModelInteractionService();
RoleSelectionSpecification roleSpec = mis.getAssignableRoleSpecification(SecurityUtils.getPrincipalUser().getUser().asPrismObject(), result);
filter = roleSpec.getFilter();
} catch (Exception ex) {
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't load available roles", ex);
result.recordFatalError("Couldn't load available roles", ex);
} finally {
result.recomputeStatus();
}
if (!result.isSuccess() && !result.isHandledError()) {
parentPage.showResult(result);
}
if (query == null) {
query = new ObjectQuery();
}
query.addFilter(filter);
}
return query;
}
};
listPanel.setOutputMarkupId(true);
listPanel.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return type.equals(typeModel.getObject());
}
});
return listPanel;
}
use of com.evolveum.midpoint.prism.query.ObjectQuery in project midpoint by Evolveum.
the class MappingEditorDialog method createPasswordPolicyList.
private List<ObjectReferenceType> createPasswordPolicyList() {
policyMap.clear();
OperationResult result = new OperationResult(OPERATION_LOAD_PASSWORD_POLICIES);
Task task = getPageBase().createSimpleTask(OPERATION_LOAD_PASSWORD_POLICIES);
List<PrismObject<ValuePolicyType>> policies = null;
List<ObjectReferenceType> references = new ArrayList<>();
try {
policies = getPageBase().getModelService().searchObjects(ValuePolicyType.class, new ObjectQuery(), null, task, result);
result.recomputeStatus();
} catch (CommonException | RuntimeException e) {
result.recordFatalError("Couldn't load password policies.", e);
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't load password policies", e);
}
if (policies != null) {
ObjectReferenceType ref;
for (PrismObject<ValuePolicyType> policy : policies) {
policyMap.put(policy.getOid(), WebComponentUtil.getName(policy));
ref = new ObjectReferenceType();
ref.setType(ValuePolicyType.COMPLEX_TYPE);
ref.setOid(policy.getOid());
references.add(ref);
}
}
return references;
}
use of com.evolveum.midpoint.prism.query.ObjectQuery in project midpoint by Evolveum.
the class SynchronizationReactionEditor method createObjectTemplateList.
private List<ObjectReferenceType> createObjectTemplateList() {
objectTemplateMap.clear();
OperationResult result = new OperationResult(OPERATION_LOAD_OBJECT_TEMPLATES);
Task task = getPageBase().createSimpleTask(OPERATION_LOAD_OBJECT_TEMPLATES);
List<PrismObject<ObjectTemplateType>> templates = null;
List<ObjectReferenceType> references = new ArrayList<>();
try {
templates = getPageBase().getModelService().searchObjects(ObjectTemplateType.class, new ObjectQuery(), null, task, result);
result.recomputeStatus();
} catch (CommonException | RuntimeException e) {
result.recordFatalError("Couldn't load object templates from repository. ", e);
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't load object templates from repository", e);
}
if (templates != null) {
ObjectReferenceType ref;
for (PrismObject<ObjectTemplateType> template : templates) {
objectTemplateMap.put(template.getOid(), WebComponentUtil.getName(template));
ref = new ObjectReferenceType();
ref.setType(ObjectTemplateType.COMPLEX_TYPE);
ref.setOid(template.getOid());
references.add(ref);
}
}
return references;
}
use of com.evolveum.midpoint.prism.query.ObjectQuery in project midpoint by Evolveum.
the class ResourceCredentialsEditor method createPasswordPolicyList.
private List<ObjectReferenceType> createPasswordPolicyList() {
passPolicyMap.clear();
OperationResult result = new OperationResult(OPERATION_LOAD_PASSWORD_POLICIES);
Task task = getPageBase().createSimpleTask(OPERATION_LOAD_PASSWORD_POLICIES);
List<PrismObject<ValuePolicyType>> policies = null;
List<ObjectReferenceType> references = new ArrayList<>();
try {
policies = getPageBase().getModelService().searchObjects(ValuePolicyType.class, new ObjectQuery(), null, task, result);
result.recomputeStatus();
} catch (CommonException | RuntimeException e) {
result.recordFatalError("Couldn't load password policies.", e);
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't load password policies", e);
}
if (policies != null) {
ObjectReferenceType ref;
for (PrismObject<ValuePolicyType> policy : policies) {
passPolicyMap.put(policy.getOid(), WebComponentUtil.getName(policy));
ref = new ObjectReferenceType();
ref.setType(ValuePolicyType.COMPLEX_TYPE);
ref.setOid(policy.getOid());
references.add(ref);
}
}
return references;
}
Aggregations