Search in sources :

Example 1 with BeforeAfterType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.BeforeAfterType in project midpoint by Evolveum.

the class SynchronizationServiceImpl method executeActions.

private <F extends FocusType> void executeActions(SynchronizationReactionType reactionDef, LensContext<F> context, SynchronizationSituation<F> situation, BeforeAfterType order, ResourceType resource, boolean logDebug, Task task, OperationResult parentResult) throws ConfigurationException, SchemaException {
    for (SynchronizationActionType actionDef : reactionDef.getAction()) {
        if ((actionDef.getOrder() == null && order == BeforeAfterType.BEFORE) || (actionDef.getOrder() != null && actionDef.getOrder() == order)) {
            String handlerUri = actionDef.getHandlerUri();
            if (handlerUri == null) {
                handlerUri = actionDef.getRef();
            }
            if (handlerUri == null) {
                LOGGER.error("Action definition in resource {} doesn't contain handler URI", resource);
                throw new ConfigurationException("Action definition in resource " + resource + " doesn't contain handler URI");
            }
            Action action = actionManager.getActionInstance(handlerUri);
            if (action == null) {
                LOGGER.warn("Couldn't create action with uri '{}' in resource {}, skipping action.", new Object[] { handlerUri, resource });
                continue;
            }
            // TODO: legacy userTemplate
            Map<QName, Object> parameters = null;
            if (actionDef.getParameters() != null) {
            // TODO: process parameters
            // parameters = actionDef.getParameters().getAny();
            }
            if (logDebug) {
                LOGGER.debug("SYNCHRONIZATION: ACTION: Executing: {}.", new Object[] { action.getClass() });
            } else {
                LOGGER.trace("SYNCHRONIZATION: ACTION: Executing: {}.", new Object[] { action.getClass() });
            }
            action.handle(context, situation, parameters, task, parentResult);
        }
    }
}
Also used : SynchronizationActionType(com.evolveum.midpoint.xml.ns._public.common.common_3.SynchronizationActionType) ConfigurationException(com.evolveum.midpoint.util.exception.ConfigurationException) QName(javax.xml.namespace.QName) PrismObject(com.evolveum.midpoint.prism.PrismObject) PolyString(com.evolveum.midpoint.prism.polystring.PolyString)

Example 2 with BeforeAfterType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.BeforeAfterType in project midpoint by Evolveum.

the class SynchronizationActionEditorDialog method initLayout.

private void initLayout(WebMarkupContainer content) {
    Form form = new MidpointForm(ID_MAIN_FORM);
    form.setOutputMarkupId(true);
    content.add(form);
    TextFormGroup name = new TextFormGroup(ID_NAME, new PropertyModel<>(model, SynchronizationActionTypeDto.F_ACTION_OBJECT + ".name"), createStringResource("SynchronizationActionEditorDialog.label.name"), ID_LABEL_SIZE, ID_INPUT_SIZE, false);
    form.add(name);
    TextAreaFormGroup description = new TextAreaFormGroup(ID_DESCRIPTION, new PropertyModel<>(model, SynchronizationActionTypeDto.F_ACTION_OBJECT + ".description"), createStringResource("SynchronizationActionEditorDialog.label.description"), ID_LABEL_SIZE, ID_INPUT_SIZE, false);
    form.add(description);
    DropDownFormGroup<SynchronizationActionTypeDto.HandlerUriActions> handlerUri = new DropDownFormGroup<SynchronizationActionTypeDto.HandlerUriActions>(ID_HANDLER_URI, new PropertyModel<>(model, SynchronizationActionTypeDto.F_HANDLER_URI), WebComponentUtil.createReadonlyModelFromEnum(SynchronizationActionTypeDto.HandlerUriActions.class), new EnumChoiceRenderer<>(this), createStringResource("SynchronizationActionEditorDialog.label.handlerUri"), createStringResource("SynchronizationStep.action.tooltip.handlerUri", WebComponentUtil.getMidpointCustomSystemName((PageResourceWizard) getPage(), "midpoint.default.system.name")), ID_LABEL_SIZE, ID_INPUT_SIZE, false, false) {

        @Override
        protected DropDownChoice createDropDown(String id, IModel<List<SynchronizationActionTypeDto.HandlerUriActions>> choices, IChoiceRenderer<SynchronizationActionTypeDto.HandlerUriActions> renderer, boolean required) {
            DropDownChoice choice = new DropDownChoice<>(id, getModel(), choices, renderer);
            choice.setNullValid(true);
            return choice;
        }
    };
    form.add(handlerUri);
    DropDownFormGroup<BeforeAfterType> order = new DropDownFormGroup<BeforeAfterType>(ID_ORDER, new PropertyModel<>(model, SynchronizationActionTypeDto.F_ACTION_OBJECT + ".order"), WebComponentUtil.createReadonlyModelFromEnum(BeforeAfterType.class), new EnumChoiceRenderer<>(this), createStringResource("SynchronizationActionEditorDialog.label.order"), createStringResource("SynchronizationStep.action.tooltip.order", WebComponentUtil.getMidpointCustomSystemName((PageResourceWizard) getPage(), "midpoint.default.system.name")), ID_LABEL_SIZE, ID_INPUT_SIZE, false, false) {

        @Override
        protected DropDownChoice createDropDown(String id, IModel<List<BeforeAfterType>> choices, IChoiceRenderer<BeforeAfterType> renderer, boolean required) {
            DropDownChoice choice = new DropDownChoice<>(id, getModel(), choices, renderer);
            choice.setNullValid(true);
            return choice;
        }
    };
    form.add(order);
    initButtons(form);
}
Also used : IChoiceRenderer(org.apache.wicket.markup.html.form.IChoiceRenderer) SynchronizationActionTypeDto(com.evolveum.midpoint.web.component.wizard.resource.dto.SynchronizationActionTypeDto) TextFormGroup(com.evolveum.midpoint.web.component.form.TextFormGroup) IModel(org.apache.wicket.model.IModel) DropDownFormGroup(com.evolveum.midpoint.web.component.form.DropDownFormGroup) Form(org.apache.wicket.markup.html.form.Form) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) BeforeAfterType(com.evolveum.midpoint.xml.ns._public.common.common_3.BeforeAfterType) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) TextAreaFormGroup(com.evolveum.midpoint.web.component.form.TextAreaFormGroup) DropDownChoice(org.apache.wicket.markup.html.form.DropDownChoice)

Aggregations

PrismObject (com.evolveum.midpoint.prism.PrismObject)1 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)1 ConfigurationException (com.evolveum.midpoint.util.exception.ConfigurationException)1 DropDownFormGroup (com.evolveum.midpoint.web.component.form.DropDownFormGroup)1 MidpointForm (com.evolveum.midpoint.web.component.form.MidpointForm)1 TextAreaFormGroup (com.evolveum.midpoint.web.component.form.TextAreaFormGroup)1 TextFormGroup (com.evolveum.midpoint.web.component.form.TextFormGroup)1 SynchronizationActionTypeDto (com.evolveum.midpoint.web.component.wizard.resource.dto.SynchronizationActionTypeDto)1 BeforeAfterType (com.evolveum.midpoint.xml.ns._public.common.common_3.BeforeAfterType)1 SynchronizationActionType (com.evolveum.midpoint.xml.ns._public.common.common_3.SynchronizationActionType)1 QName (javax.xml.namespace.QName)1 DropDownChoice (org.apache.wicket.markup.html.form.DropDownChoice)1 Form (org.apache.wicket.markup.html.form.Form)1 IChoiceRenderer (org.apache.wicket.markup.html.form.IChoiceRenderer)1 IModel (org.apache.wicket.model.IModel)1