Search in sources :

Example 66 with OrgType

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

the class AbstractOrgTabPanel method initLayout.

private void initLayout() {
    final IModel<List<ITab>> tabModel = new LoadableModel<List<ITab>>(false) {

        private static final long serialVersionUID = 1L;

        @Override
        protected List<ITab> load() {
            LOGGER.debug("Loading org. roots for tabs for tabbed panel.");
            roots = loadOrgRoots();
            final List<ITab> tabs = new ArrayList<>();
            for (PrismObject<OrgType> root : roots) {
                final String oid = root.getOid();
                tabs.add(new AbstractTab(createTabTitle(root)) {

                    private static final long serialVersionUID = 1L;

                    private int tabId = tabs.size();

                    @Override
                    public WebMarkupContainer getPanel(String panelId) {
                        add(new AjaxEventBehavior("load") {

                            private static final long serialVersionUID = 1L;

                            protected void onEvent(final AjaxRequestTarget target) {
                                SessionStorage storage = getPageBase().getSessionStorage();
                                storage.getUsers().setSelectedTabId(tabId);
                            }
                        });
                        Panel panel = createTreePanel(panelId, new Model(oid), getPageBase());
                        panel.setOutputMarkupId(true);
                        return panel;
                    }
                });
            }
            LOGGER.debug("Tab count is {}", new Object[] { tabs.size() });
            return tabs;
        }
    };
    final SessionStorage storage = getPageBase().getSessionStorage();
    int selectedTab = storage.getUsers().getSelectedTabId() == -1 ? 0 : storage.getUsers().getSelectedTabId();
    List<ITab> tabsList = tabModel.getObject();
    if (tabsList == null || (selectedTab > tabsList.size() - 1)) {
        storage.getUsers().setSelectedTabId(0);
        selectedTab = 0;
    }
    AjaxTabbedPanel<ITab> tabbedPanel = new AjaxTabbedPanel<ITab>(ID_TABS, tabModel.getObject(), new Model<>(selectedTab), null) {

        private static final long serialVersionUID = 1L;

        @Override
        public TabbedPanel<ITab> setSelectedTab(int index) {
            changeTabPerformed(index);
            return super.setSelectedTab(index);
        }
    };
    tabbedPanel.setOutputMarkupId(true);
    if (tabsList == null || tabsList.size() == 0) {
        tabbedPanel.setVisible(false);
    }
    add(tabbedPanel);
}
Also used : AjaxEventBehavior(org.apache.wicket.ajax.AjaxEventBehavior) ArrayList(java.util.ArrayList) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) ITab(org.apache.wicket.extensions.markup.html.tabs.ITab) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxTabbedPanel(com.evolveum.midpoint.web.component.AjaxTabbedPanel) Panel(org.apache.wicket.markup.html.panel.Panel) BasePanel(com.evolveum.midpoint.gui.api.component.BasePanel) TabbedPanel(com.evolveum.midpoint.web.component.TabbedPanel) AjaxTabbedPanel(com.evolveum.midpoint.web.component.AjaxTabbedPanel) OrgType(com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) IModel(org.apache.wicket.model.IModel) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Model(org.apache.wicket.model.Model) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) AbstractTab(org.apache.wicket.extensions.markup.html.tabs.AbstractTab) ArrayList(java.util.ArrayList) List(java.util.List) SessionStorage(com.evolveum.midpoint.web.session.SessionStorage)

Example 67 with OrgType

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

the class OrgTreeAssignablePanel method initLayout.

private void initLayout() {
    AbstractOrgTabPanel tabbedPanel = new AbstractOrgTabPanel(ID_ORG_TABS, getPageBase()) {

        private static final long serialVersionUID = 1L;

        @Override
        protected Panel createTreePanel(String id, Model<String> model, PageBase pageBase) {
            OrgTreePanel panel = new OrgTreePanel(id, model, selectable) {

                private static final long serialVersionUID = 1L;

                @Override
                protected void selectTreeItemPerformed(SelectableBean<OrgType> selected, AjaxRequestTarget target) {
                    onItemSelect(selected, target);
                }
            };
            panel.setOutputMarkupId(true);
            return panel;
        }
    };
    tabbedPanel.setOutputMarkupId(true);
    add(tabbedPanel);
    AjaxButton assignButton = new AjaxButton(ID_ASSIGN, getPageBase().createStringResource("Button.assign")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            AbstractOrgTabPanel orgPanel = (AbstractOrgTabPanel) getParent().get(ID_ORG_TABS);
            OrgTreePanel treePanel = (OrgTreePanel) orgPanel.getPanel();
            List<OrgType> selectedOrgs = treePanel.getSelectedOrgs();
            assignSelectedOrgPerformed(selectedOrgs, target);
        }
    };
    assignButton.setOutputMarkupId(true);
    assignButton.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return selectable;
        }
    });
    add(assignButton);
}
Also used : PageBase(com.evolveum.midpoint.gui.api.page.PageBase) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) OrgType(com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType) StringResourceModel(org.apache.wicket.model.StringResourceModel) Model(org.apache.wicket.model.Model) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Example 68 with OrgType

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

the class AbstractTreeTablePanel method createOrgChildQuery.

protected ObjectQuery createOrgChildQuery() {
    SelectableBean<OrgType> dto = selected.getObject();
    String oid = dto != null && dto.getValue() != null ? dto.getValue().getOid() : getModel().getObject();
    BasicSearchPanel<String> basicSearch = (BasicSearchPanel) get(createComponentPath(ID_SEARCH_FORM, ID_BASIC_SEARCH));
    String object = basicSearch.getModelObject();
    DropDownChoice<String> searchScopeChoice = (DropDownChoice) get(createComponentPath(ID_SEARCH_FORM, ID_SEARCH_SCOPE));
    String scope = searchScopeChoice.getModelObject();
    if (StringUtils.isBlank(object)) {
        object = null;
    }
    PageBase page = getPageBase();
    PrismContext context = page.getPrismContext();
    S_AtomicFilterExit q;
    if (object == null || SEARCH_SCOPE_ONE.equals(scope)) {
        q = QueryBuilder.queryFor(OrgType.class, context).isDirectChildOf(oid);
    } else {
        q = QueryBuilder.queryFor(OrgType.class, context).isChildOf(oid);
    }
    if (object == null) {
        return q.build();
    }
    PolyStringNormalizer normalizer = context.getDefaultPolyStringNormalizer();
    String normalizedString = normalizer.normalize(object);
    if (StringUtils.isEmpty(normalizedString)) {
        return q.build();
    }
    ObjectQuery query = q.and().block().item(OrgType.F_NAME).containsPoly(normalizedString).matchingNorm().or().item(OrgType.F_DISPLAY_NAME).containsPoly(normalizedString).matchingNorm().build();
    if (LOGGER.isTraceEnabled()) {
        LOGGER.trace("Searching child orgs of org {} with query:\n{}", oid, query.debugDump());
    }
    return query;
}
Also used : DropDownChoice(org.apache.wicket.markup.html.form.DropDownChoice) BasicSearchPanel(com.evolveum.midpoint.web.component.BasicSearchPanel) OrgType(com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType) PrismContext(com.evolveum.midpoint.prism.PrismContext) S_AtomicFilterExit(com.evolveum.midpoint.prism.query.builder.S_AtomicFilterExit) PageBase(com.evolveum.midpoint.gui.api.page.PageBase) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) PolyStringNormalizer(com.evolveum.midpoint.prism.polystring.PolyStringNormalizer)

Example 69 with OrgType

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

the class OrgUnitAddDeletePopup method initColumns.

private List<IColumn<SelectableBean<ObjectType>, String>> initColumns() {
    List<IColumn<SelectableBean<ObjectType>, String>> columns = new ArrayList<IColumn<SelectableBean<ObjectType>, String>>();
    IColumn column = new CheckBoxHeaderColumn<OrgType>();
    columns.add(column);
    column = new LinkColumn<SelectableBean<OrgType>>(createStringResource("orgUnitAddDeletePopup.column.name"), getSortableProperty(), "value.name") {

        @Override
        public void onClick(AjaxRequestTarget target, IModel<SelectableBean<OrgType>> rowModel) {
            OrgType org = rowModel.getObject().getValue();
            chooseOperationPerformed(target, org);
        }
    };
    columns.add(column);
    return columns;
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) OrgType(com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType) CheckBoxHeaderColumn(com.evolveum.midpoint.web.component.data.column.CheckBoxHeaderColumn) ArrayList(java.util.ArrayList) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean)

Example 70 with OrgType

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

the class OrgTreeProvider method createObjectWrapper.

private SelectableBean<OrgType> createObjectWrapper(SelectableBean<OrgType> parent, PrismObject<OrgType> unit) {
    if (unit == null) {
        return null;
    }
    //todo relation [lazyman]
    //        OrgTreeDto orgDto = new OrgTreeDto(parent, unit);
    OrgType org = unit.asObjectable();
    if (parent != null) {
        org.getParentOrg().clear();
        org.getParentOrg().add(parent.getValue());
    }
    SelectableBean<OrgType> orgDto = new SelectableBean<OrgType>(org);
    orgDto.getMenuItems().addAll(createInlineMenuItems(orgDto.getValue()));
    return orgDto;
}
Also used : OrgType(com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean)

Aggregations

OrgType (com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType)123 Test (org.testng.annotations.Test)70 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)69 Task (com.evolveum.midpoint.task.api.Task)69 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)31 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)26 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)23 ObjectReferenceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType)22 DummyAccount (com.evolveum.icf.dummy.resource.DummyAccount)15 PrismObject (com.evolveum.midpoint.prism.PrismObject)13 ArrayList (java.util.ArrayList)13 AbstractInitializedModelIntegrationTest (com.evolveum.midpoint.model.intest.AbstractInitializedModelIntegrationTest)11 AssignmentType (com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType)11 Entry (org.opends.server.types.Entry)10 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)9 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)8 PolyStringType (com.evolveum.prism.xml.ns._public.types_3.PolyStringType)8 QName (javax.xml.namespace.QName)8 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)7 SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)7