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;
}
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;
}
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));
}
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);
}
}
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;
}
Aggregations