use of com.evolveum.midpoint.model.api.ModelInteractionService in project midpoint by Evolveum.
the class ProgressReporter method executeChanges.
/**
* Executes changes on behalf of the parent page. By default, changes are executed asynchronously (in
* a separate thread). However, when set in the midpoint configuration, changes are executed synchronously.
*
* @param deltas Deltas to be executed.
* @param options Model execution options.
* @param task Task in context of which the changes have to be executed.
* @param result Operation result.
* @param target AjaxRequestTarget into which any synchronous changes are signalized.
*/
public void executeChanges(final Collection<ObjectDelta<? extends ObjectType>> deltas, final boolean previewOnly, final ModelExecuteOptions options, final Task task, final OperationResult result, AjaxRequestTarget target) {
parentPage.startProcessing(target, result);
ModelService modelService = parentPage.getModelService();
ModelInteractionService modelInteractionService = parentPage.getModelInteractionService();
if (asynchronousExecution) {
executeChangesAsync(deltas, previewOnly, options, task, result, target, modelService, modelInteractionService);
} else {
executeChangesSync(deltas, previewOnly, options, task, result, target, modelService, modelInteractionService);
}
}
use of com.evolveum.midpoint.model.api.ModelInteractionService in project midpoint by Evolveum.
the class MultipleAssignmentSelectorPanel method getAssignableRolesFilter.
private ObjectFilter getAssignableRolesFilter() {
LOGGER.debug("Loading roles which the current user has right to assign");
OperationResult result = new OperationResult(OPERATION_LOAD_ASSIGNABLE_ROLES);
ObjectFilter filter = null;
try {
PageBase pb = getPageBase();
ModelInteractionService mis = pb.getModelInteractionService();
RoleSelectionSpecification roleSpec = mis.getAssignableRoleSpecification(focus, 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()) {
getPageBase().showResult(result);
}
return filter;
}
use of com.evolveum.midpoint.model.api.ModelInteractionService 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.model.api.ModelInteractionService in project midpoint by Evolveum.
the class AssignmentCatalogPanel method addAssignableRolesFilter.
private void addAssignableRolesFilter(ObjectQuery query) {
ObjectFilter filter = null;
LOGGER.debug("Loading roles which the current user has right to assign");
OperationResult result = new OperationResult(OPERATION_LOAD_ASSIGNABLE_ROLES);
try {
ModelInteractionService mis = pageBase.getModelInteractionService();
RoleSelectionSpecification roleSpec = mis.getAssignableRoleSpecification(getTargetUser(), 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()) {
pageBase.showResult(result);
}
if (query == null) {
query = new ObjectQuery();
}
query.addFilter(filter);
}
Aggregations