Search in sources :

Example 51 with FocusType

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

the class PageTaskAdd method initLayout.

private void initLayout() {
    Form mainForm = new Form(ID_FORM_MAIN);
    add(mainForm);
    final DropDownChoice resource = new DropDownChoice<>(ID_RESOURCE, new PropertyModel<TaskAddResourcesDto>(model, TaskAddDto.F_RESOURCE), new AbstractReadOnlyModel<List<TaskAddResourcesDto>>() {

        @Override
        public List<TaskAddResourcesDto> getObject() {
            return createResourceList();
        }
    }, new ChoiceableChoiceRenderer<TaskAddResourcesDto>());
    resource.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isEnabled() {
            TaskAddDto dto = model.getObject();
            boolean sync = TaskCategory.LIVE_SYNCHRONIZATION.equals(dto.getCategory());
            boolean recon = TaskCategory.RECONCILIATION.equals(dto.getCategory());
            boolean importAccounts = TaskCategory.IMPORTING_ACCOUNTS.equals(dto.getCategory());
            return sync || recon || importAccounts;
        }
    });
    resource.add(new AjaxFormComponentUpdatingBehavior("change") {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            PageTaskAdd.this.loadResource();
            target.add(get(ID_FORM_MAIN + ":" + ID_OBJECT_CLASS));
        }
    });
    resource.setOutputMarkupId(true);
    mainForm.add(resource);
    final DropDownChoice focusType = new DropDownChoice<>(ID_FOCUS_TYPE, new PropertyModel<QName>(model, TaskAddDto.F_FOCUS_TYPE), new AbstractReadOnlyModel<List<QName>>() {

        @Override
        public List<QName> getObject() {
            return createFocusTypeList();
        }
    }, new QNameChoiceRenderer());
    focusType.setOutputMarkupId(true);
    focusType.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isEnabled() {
            TaskAddDto dto = model.getObject();
            return TaskCategory.RECOMPUTATION.equals(dto.getCategory());
        }
    });
    mainForm.add(focusType);
    final DropDownChoice kind = new DropDownChoice<>(ID_KIND, new PropertyModel<ShadowKindType>(model, TaskAddDto.F_KIND), WebComponentUtil.createReadonlyModelFromEnum(ShadowKindType.class), new EnumChoiceRenderer<ShadowKindType>());
    kind.setOutputMarkupId(true);
    kind.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isEnabled() {
            TaskAddDto dto = model.getObject();
            boolean sync = TaskCategory.LIVE_SYNCHRONIZATION.equals(dto.getCategory());
            boolean recon = TaskCategory.RECONCILIATION.equals(dto.getCategory());
            boolean importAccounts = TaskCategory.IMPORTING_ACCOUNTS.equals(dto.getCategory());
            return sync || recon || importAccounts;
        }
    });
    mainForm.add(kind);
    final TextField<String> intent = new TextField<>(ID_INTENT, new PropertyModel<String>(model, TaskAddDto.F_INTENT));
    mainForm.add(intent);
    intent.setOutputMarkupId(true);
    intent.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isEnabled() {
            TaskAddDto dto = model.getObject();
            boolean sync = TaskCategory.LIVE_SYNCHRONIZATION.equals(dto.getCategory());
            boolean recon = TaskCategory.RECONCILIATION.equals(dto.getCategory());
            boolean importAccounts = TaskCategory.IMPORTING_ACCOUNTS.equals(dto.getCategory());
            return sync || recon || importAccounts;
        }
    });
    if (model.getObject() != null && model.getObject().getResource() != null && model.getObject().getResource().getOid() != null) {
        loadResource();
    }
    AutoCompleteSettings autoCompleteSettings = new AutoCompleteSettings();
    autoCompleteSettings.setShowListOnEmptyInput(true);
    autoCompleteSettings.setMaxHeightInPx(200);
    final AutoCompleteTextField<String> objectClass = new AutoCompleteTextField<String>(ID_OBJECT_CLASS, new PropertyModel<String>(model, TaskAddDto.F_OBJECT_CLASS), autoCompleteSettings) {

        @Override
        protected Iterator<String> getChoices(String input) {
            return prepareObjectClassChoiceList(input);
        }
    };
    objectClass.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isEnabled() {
            TaskAddDto dto = model.getObject();
            boolean sync = TaskCategory.LIVE_SYNCHRONIZATION.equals(dto.getCategory());
            boolean recon = TaskCategory.RECONCILIATION.equals(dto.getCategory());
            boolean importAccounts = TaskCategory.IMPORTING_ACCOUNTS.equals(dto.getCategory());
            return sync || recon || importAccounts;
        }
    });
    mainForm.add(objectClass);
    DropDownChoice type = new DropDownChoice<>(ID_CATEGORY, new PropertyModel<String>(model, TaskAddDto.F_CATEGORY), new AbstractReadOnlyModel<List<String>>() {

        @Override
        public List<String> getObject() {
            return WebComponentUtil.createTaskCategoryList();
        }
    }, new StringChoiceRenderer("pageTask.category."));
    type.add(new AjaxFormComponentUpdatingBehavior("change") {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            target.add(resource);
            target.add(intent);
            target.add(kind);
            target.add(objectClass);
            target.add(focusType);
        }
    });
    type.setRequired(true);
    mainForm.add(type);
    TextField<String> name = new TextField<>(ID_NAME, new PropertyModel<String>(model, TaskAddDto.F_NAME));
    name.setRequired(true);
    mainForm.add(name);
    initScheduling(mainForm);
    initAdvanced(mainForm);
    CheckBox dryRun = new CheckBox(ID_DRY_RUN, new PropertyModel<Boolean>(model, TaskAddDto.F_DRY_RUN));
    mainForm.add(dryRun);
    initButtons(mainForm);
}
Also used : TaskAddDto(com.evolveum.midpoint.web.page.admin.server.dto.TaskAddDto) Form(org.apache.wicket.markup.html.form.Form) AutoCompleteTextField(org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteTextField) TextField(org.apache.wicket.markup.html.form.TextField) AutoCompleteTextField(org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteTextField) DateTextField(org.apache.wicket.datetime.markup.html.form.DateTextField) List(java.util.List) ArrayList(java.util.ArrayList) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) AjaxFormComponentUpdatingBehavior(org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior) QNameChoiceRenderer(com.evolveum.midpoint.web.component.input.QNameChoiceRenderer) QName(javax.xml.namespace.QName) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AutoCompleteSettings(org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteSettings) DropDownChoice(org.apache.wicket.markup.html.form.DropDownChoice) StringChoiceRenderer(com.evolveum.midpoint.web.component.input.StringChoiceRenderer) CheckBox(org.apache.wicket.markup.html.form.CheckBox) AjaxCheckBox(org.apache.wicket.ajax.markup.html.form.AjaxCheckBox) TaskAddResourcesDto(com.evolveum.midpoint.web.page.admin.server.dto.TaskAddResourcesDto) ShadowKindType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowKindType)

Example 52 with FocusType

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

the class ResourceContentPanel method loadShadowOwner.

private <F extends FocusType> F loadShadowOwner(IModel<SelectableBean<ShadowType>> model) {
    ShadowType shadow = model.getObject().getValue();
    String shadowOid;
    if (shadow != null) {
        shadowOid = shadow.getOid();
    } else {
        return null;
    }
    return loadShadowOwner(shadowOid);
}
Also used : ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)

Example 53 with FocusType

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

the class AbstractRoleMemberPanel method initObjectForAdd.

// TODO: merge this with TreeTablePanel.initObjectForAdd, also see MID-3233
private void initObjectForAdd(ObjectReferenceType parentOrgRef, QName type, QName relation, AjaxRequestTarget target) throws SchemaException {
    getPageBase().hideMainPopup(target);
    PrismContext prismContext = getPageBase().getPrismContext();
    PrismObjectDefinition def = prismContext.getSchemaRegistry().findObjectDefinitionByType(type);
    PrismObject obj = def.instantiate();
    if (parentOrgRef == null) {
        parentOrgRef = createReference(relation);
    }
    ObjectType objType = (ObjectType) obj.asObjectable();
    if (FocusType.class.isAssignableFrom(obj.getCompileTimeClass())) {
        AssignmentType assignment = new AssignmentType();
        assignment.setTargetRef(parentOrgRef);
        ((FocusType) objType).getAssignment().add(assignment);
    }
    // TODO: fix MID-3234
    if (parentOrgRef.getType() != null && OrgType.COMPLEX_TYPE.equals(parentOrgRef.getType())) {
        objType.getParentOrgRef().add(parentOrgRef.clone());
    }
    WebComponentUtil.dispatchToObjectDetailsPage(obj, this);
}
Also used : PrismObject(com.evolveum.midpoint.prism.PrismObject) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) PrismContext(com.evolveum.midpoint.prism.PrismContext) PrismObjectDefinition(com.evolveum.midpoint.prism.PrismObjectDefinition) AssignmentType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType)

Example 54 with FocusType

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

the class ResourceContentPanel method createRowMenuItems.

@SuppressWarnings("serial")
private List<InlineMenuItem> createRowMenuItems() {
    List<InlineMenuItem> items = new ArrayList<InlineMenuItem>();
    items.add(new InlineMenuItem(createStringResource("pageContentAccounts.menu.enableAccount"), true, new ColumnMenuAction<SelectableBean<ShadowType>>() {

        @Override
        public void onSubmit(AjaxRequestTarget target, Form<?> form) {
            SelectableBean<ShadowType> shadow = getRowModel().getObject();
            updateResourceObjectStatusPerformed(shadow.getValue(), target, true);
        }
    }));
    items.add(new InlineMenuItem(createStringResource("pageContentAccounts.menu.disableAccount"), true, new ColumnMenuAction<SelectableBean<ShadowType>>() {

        @Override
        public void onSubmit(AjaxRequestTarget target, Form<?> form) {
            SelectableBean<ShadowType> shadow = getRowModel().getObject();
            updateResourceObjectStatusPerformed(shadow.getValue(), target, false);
        }
    }));
    items.add(new InlineMenuItem(createStringResource("pageContentAccounts.menu.deleteAccount"), true, new ColumnMenuAction<SelectableBean<ShadowType>>() {

        @Override
        public void onSubmit(AjaxRequestTarget target, Form<?> form) {
            SelectableBean<ShadowType> shadow = getRowModel().getObject();
            deleteResourceObjectPerformed(shadow.getValue(), target);
        }
    }));
    items.add(new InlineMenuItem());
    items.add(new InlineMenuItem(createStringResource("pageContentAccounts.menu.importAccount"), true, new ColumnMenuAction<SelectableBean<ShadowType>>() {

        @Override
        public void onSubmit(AjaxRequestTarget target, Form<?> form) {
            SelectableBean<ShadowType> shadow = getRowModel().getObject();
            importResourceObject(shadow.getValue(), target);
        }
    }));
    items.add(new InlineMenuItem());
    items.add(new InlineMenuItem(createStringResource("pageContentAccounts.menu.removeOwner"), true, new ColumnMenuAction<SelectableBean<ShadowType>>() {

        @Override
        public void onSubmit(AjaxRequestTarget target, Form<?> form) {
            SelectableBean<ShadowType> shadow = getRowModel().getObject();
            changeOwner(shadow.getValue(), target, null, Operation.REMOVE);
        }
    }));
    items.add(new InlineMenuItem(createStringResource("pageContentAccounts.menu.changeOwner"), true, new ColumnMenuAction<SelectableBean<ShadowType>>() {

        @Override
        public void onSubmit(AjaxRequestTarget target, Form<?> form) {
            final SelectableBean<ShadowType> shadow = getRowModel().getObject();
            ObjectBrowserPanel<FocusType> browser = new ObjectBrowserPanel<FocusType>(pageBase.getMainPopupBodyId(), UserType.class, WebComponentUtil.createFocusTypeList(), false, pageBase) {

                @Override
                protected void onSelectPerformed(AjaxRequestTarget target, FocusType focus) {
                    changeOwner(shadow.getValue(), target, focus, Operation.MODIFY);
                }
            };
            pageBase.showMainPopup(browser, target);
        }
    }));
    return items;
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) Form(org.apache.wicket.markup.html.form.Form) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) ObjectBrowserPanel(com.evolveum.midpoint.gui.api.component.ObjectBrowserPanel) FocusType(com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType) ArrayList(java.util.ArrayList) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) ColumnMenuAction(com.evolveum.midpoint.web.component.data.column.ColumnMenuAction)

Example 55 with FocusType

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

the class SearchShadowOwnerTest method searchNonExistingShadowOwner.

@Test
public void searchNonExistingShadowOwner() throws Exception {
    //searching owner for non existing shadow
    OperationResult result = new OperationResult("List owner");
    PrismObject<FocusType> shadow = repositoryService.searchShadowOwner("12345", null, result);
    AssertJUnit.assertNull(shadow);
    result.computeStatus();
    AssertJUnit.assertTrue(result.isSuccess());
}
Also used : FocusType(com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Test(org.testng.annotations.Test)

Aggregations

ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)27 ObjectReferenceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType)25 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)23 FocusType (com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType)22 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)21 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)18 PrismObject (com.evolveum.midpoint.prism.PrismObject)16 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)15 ArrayList (java.util.ArrayList)15 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)14 AssignmentType (com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType)12 ItemDelta (com.evolveum.midpoint.prism.delta.ItemDelta)10 ExpressionEvaluationException (com.evolveum.midpoint.util.exception.ExpressionEvaluationException)9 LensProjectionContext (com.evolveum.midpoint.model.impl.lens.LensProjectionContext)8 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)8 QName (javax.xml.namespace.QName)8 PropertyDelta (com.evolveum.midpoint.prism.delta.PropertyDelta)7 ConfigurationException (com.evolveum.midpoint.util.exception.ConfigurationException)7 PolicyViolationException (com.evolveum.midpoint.util.exception.PolicyViolationException)7 ActivationStatusType (com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationStatusType)7