Search in sources :

Example 1 with OrgType

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

the class RoleMemberPanel method createMemberAssignmentToModify.

private AssignmentType createMemberAssignmentToModify(QName relation) throws SchemaException {
    AssignmentType assignmentToModify = createAssignmentToModify(relation);
    DropDownChoice<OrgType> tenantChoice = (DropDownChoice<OrgType>) get(ID_TENANT);
    OrgType tenant = tenantChoice.getModelObject();
    if (tenant != null) {
        assignmentToModify.setTenantRef(ObjectTypeUtil.createObjectRef(tenant.getOid(), ObjectTypes.ORG));
    }
    DropDownChoice<OrgType> projectChoice = (DropDownChoice<OrgType>) get(ID_PROJECT);
    OrgType project = projectChoice.getModelObject();
    if (project != null) {
        assignmentToModify.setOrgRef(ObjectTypeUtil.createObjectRef(project.getOid(), ObjectTypes.ORG));
    }
    return assignmentToModify;
}
Also used : DropDownChoice(org.apache.wicket.markup.html.form.DropDownChoice) OrgType(com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType) AssignmentType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType)

Example 2 with OrgType

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

the class RoleMemberPanel method createTenantList.

private List<OrgType> createTenantList() {
    ObjectQuery query = QueryBuilder.queryFor(OrgType.class, getPrismContext()).item(OrgType.F_TENANT).eq(true).build();
    List<PrismObject<OrgType>> orgs = WebModelServiceUtils.searchObjects(OrgType.class, query, new OperationResult("Tenant search"), getPageBase());
    List<OrgType> orgTypes = new ArrayList<>();
    for (PrismObject<OrgType> org : orgs) {
        orgTypes.add(org.asObjectable());
    }
    return orgTypes;
}
Also used : PrismObject(com.evolveum.midpoint.prism.PrismObject) OrgType(com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType) ArrayList(java.util.ArrayList) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery)

Example 3 with OrgType

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

the class RoleMemberPanel method initSearch.

@Override
protected void initSearch(Form form) {
    List<QName> allowedTypes = WebComponentUtil.createFocusTypeList();
    allowedTypes.add(FocusType.COMPLEX_TYPE);
    DropDownChoice<QName> typeSelect = createDropDown(ID_OBJECT_TYPE, Model.of(FocusType.COMPLEX_TYPE), allowedTypes, new QNameChoiceRenderer());
    add(typeSelect);
    DropDownChoice<OrgType> tenant = createDropDown(ID_TENANT, new Model(), createTenantList(), new ObjectTypeChoiceRenderer<OrgType>());
    add(tenant);
    tenant.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return isRole();
        }
    });
    DropDownChoice<OrgType> project = createDropDown(ID_PROJECT, new Model(), createProjectList(), new ObjectTypeChoiceRenderer<OrgType>());
    add(project);
    project.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return isRole();
        }
    });
    CheckBoxPanel includeIndirectMembers = new CheckBoxPanel(ID_INDIRECT_MEMBERS, new Model<Boolean>(false)) {

        private static final long serialVersionUID = 1L;

        public void onUpdate(AjaxRequestTarget target) {
            refreshTable(target);
        }
    };
    add(includeIndirectMembers);
    // TODO shouldn't we hide also the label?
    includeIndirectMembers.add(new VisibleBehaviour(this::isRole));
}
Also used : QNameChoiceRenderer(com.evolveum.midpoint.web.component.input.QNameChoiceRenderer) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) QName(javax.xml.namespace.QName) CheckBoxPanel(com.evolveum.midpoint.web.component.data.column.CheckBoxPanel) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) OrgType(com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType) IModel(org.apache.wicket.model.IModel) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Model(org.apache.wicket.model.Model) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Example 4 with OrgType

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

the class AbstractOrgTabPanel method changeTabPerformed.

protected void changeTabPerformed(int index) {
    if (roots != null && index >= 0 && index <= roots.size()) {
        SessionStorage storage = getPageBase().getSessionStorage();
        SelectableBean<OrgType> selected = new SelectableBean<OrgType>();
        selected.setValue(roots.get(index).asObjectable());
        storage.getUsers().setSelectedItem(selected);
        storage.getUsers().setSelectedTabId(index);
    }
}
Also used : OrgType(com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) SessionStorage(com.evolveum.midpoint.web.session.SessionStorage)

Example 5 with OrgType

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

the class AbstractOrgTabPanel method loadOrgRoots.

private List<PrismObject<OrgType>> loadOrgRoots() {
    Task task = getPageBase().createSimpleTask(OPERATION_LOAD_ORG_UNIT);
    OperationResult result = new OperationResult(OPERATION_LOAD_ORG_UNIT);
    List<PrismObject<OrgType>> list = new ArrayList<>();
    try {
        ObjectQuery query = ObjectQueryUtil.createRootOrgQuery(getPageBase().getPrismContext());
        list = getPageBase().getModelService().searchObjects(OrgType.class, query, null, task, result);
        if (list.isEmpty()) {
            warn(getString("PageOrgTree.message.noOrgStructDefined"));
        }
    } catch (Exception ex) {
        LoggingUtils.logUnexpectedException(LOGGER, "Unable to load org. unit", ex);
        result.recordFatalError("Unable to load org unit", ex);
    } finally {
        result.computeStatus();
    }
    if (WebComponentUtil.showResultInPage(result)) {
        getPageBase().showResult(result);
    }
    return list;
}
Also used : PrismObject(com.evolveum.midpoint.prism.PrismObject) Task(com.evolveum.midpoint.task.api.Task) OrgType(com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType) ArrayList(java.util.ArrayList) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery)

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