use of com.evolveum.midpoint.web.page.admin.dto.ObjectViewDto in project midpoint by Evolveum.
the class MultipleAssignmentSelectorPanel method createTenantOrgDto.
private AssignmentEditorDto createTenantOrgDto() {
//doesn't matter the type
AssignmentEditorDtoType aType = AssignmentEditorDtoType.ROLE;
ObjectReferenceType targetRef = new ObjectReferenceType();
targetRef.setOid("");
targetRef.setType(aType.getQname());
targetRef.setTargetName(new PolyStringType(""));
AssignmentType assignment = new AssignmentType();
assignment.setTargetRef(targetRef);
AssignmentEditorDto tenantOrgDto = new AssignmentEditorDto(UserDtoStatus.ADD, assignment, getPageBase());
if (tenantEditorObject != null && tenantEditorObject.size() > 0) {
OrgType org = tenantEditorObject.get(0);
ObjectViewDto<OrgType> dto = new ObjectViewDto(org.getOid(), tenantEditorObject.get(0).getName() == null ? "" : tenantEditorObject.get(0).getName().toString());
dto.setType(OrgType.class);
tenantOrgDto.setTenantRef(dto);
}
if (orgEditorObject != null && orgEditorObject.size() > 0) {
OrgType org = orgEditorObject.get(0);
ObjectViewDto<OrgType> dto = new ObjectViewDto(org.getOid(), orgEditorObject.get(0).getName() == null ? "" : orgEditorObject.get(0).getName().toString());
dto.setType(OrgType.class);
tenantOrgDto.setOrgRef(dto);
}
return tenantOrgDto;
}
use of com.evolveum.midpoint.web.page.admin.dto.ObjectViewDto in project midpoint by Evolveum.
the class CertDefinitionDto method loadOwnerReference.
private ObjectViewDto loadOwnerReference(ObjectReferenceType ref) {
ObjectViewDto dto;
if (ref != null) {
if (ref.getTargetName() != null) {
dto = new ObjectViewDto(ref.getOid(), WebComponentUtil.getOrigStringFromPoly(ref.getTargetName()));
dto.setType(UserType.class);
return dto;
} else {
dto = new ObjectViewDto(ObjectViewDto.BAD_OID);
dto.setType(UserType.class);
return dto;
}
} else {
dto = new ObjectViewDto();
dto.setType(UserType.class);
return dto;
}
}
use of com.evolveum.midpoint.web.page.admin.dto.ObjectViewDto in project midpoint by Evolveum.
the class PageDebugView method loadObject.
private ObjectViewDto loadObject() {
StringValue objectOid = getPageParameters().get(PARAM_OBJECT_ID);
if (objectOid == null || StringUtils.isEmpty(objectOid.toString())) {
getSession().error(getString("pageDebugView.message.oidNotDefined"));
throw new RestartResponseException(PageDebugList.class);
}
Task task = createSimpleTask(OPERATION_LOAD_OBJECT);
//todo is this result != null ?
OperationResult result = task.getResult();
ObjectViewDto dto = null;
try {
MidPointApplication application = PageDebugView.this.getMidpointApplication();
GetOperationOptions rootOptions = GetOperationOptions.createRaw();
rootOptions.setResolveNames(true);
rootOptions.setTolerateRawData(true);
Collection<SelectorOptions<GetOperationOptions>> options = SelectorOptions.createCollection(rootOptions);
// FIXME: ObjectType.class will not work well here. We need more specific type.
//todo on page debug list create page params, put there oid and class for object type and send that to this page....read it here
Class type = ObjectType.class;
StringValue objectType = getPageParameters().get(PARAM_OBJECT_TYPE);
if (objectType != null && StringUtils.isNotBlank(objectType.toString())) {
type = getPrismContext().getSchemaRegistry().determineCompileTimeClass(new QName(SchemaConstantsGenerated.NS_COMMON, objectType.toString()));
}
// TODO make this configurable (or at least do not show campaign cases in production)
if (UserType.class.isAssignableFrom(type)) {
options.add(SelectorOptions.create(UserType.F_JPEG_PHOTO, GetOperationOptions.createRetrieve(RetrieveOption.INCLUDE)));
}
if (LookupTableType.class.isAssignableFrom(type)) {
options.add(SelectorOptions.create(LookupTableType.F_ROW, GetOperationOptions.createRetrieve(new RelationalValueSearchQuery(ObjectPaging.createPaging(PrismConstants.T_ID, OrderDirection.ASCENDING)))));
}
if (AccessCertificationCampaignType.class.isAssignableFrom(type)) {
options.add(SelectorOptions.create(AccessCertificationCampaignType.F_CASE, GetOperationOptions.createRetrieve(RetrieveOption.INCLUDE)));
}
PrismObject<ObjectType> object = getModelService().getObject(type, objectOid.toString(), options, task, result);
PrismContext context = application.getPrismContext();
String lex = context.serializerFor(dataLanguage).serialize(object);
dto = new ObjectViewDto(object.getOid(), WebComponentUtil.getName(object), object, lex);
result.recomputeStatus();
} catch (Exception ex) {
result.recordFatalError("Couldn't load object.", ex);
}
if (dto == null) {
showResult(result);
throw new RestartResponseException(PageDebugList.class);
}
showResult(result, false);
if (!WebComponentUtil.isSuccessOrHandledErrorOrWarning(result)) {
showResult(result, false);
throw new RestartResponseException(PageDebugList.class);
}
return dto;
}
use of com.evolveum.midpoint.web.page.admin.dto.ObjectViewDto in project midpoint by Evolveum.
the class PageDebugList method loadResources.
private List<ObjectViewDto> loadResources() {
List<ObjectViewDto> objects = new ArrayList<>();
try {
OperationResult result = new OperationResult(OPERATION_LOAD_RESOURCES);
List<PrismObject<ResourceType>> list = WebModelServiceUtils.searchObjects(ResourceType.class, null, SelectorOptions.createCollection(GetOperationOptions.createRaw()), result, this, null);
for (PrismObject obj : list) {
ObjectViewDto dto = new ObjectViewDto(obj.getOid(), WebComponentUtil.getName(obj));
objects.add(dto);
}
} catch (Exception ex) {
// todo implement error handling
}
Collections.sort(objects, (o1, o2) -> String.CASE_INSENSITIVE_ORDER.compare(o1.getName(), o2.getName()));
return objects;
}
use of com.evolveum.midpoint.web.page.admin.dto.ObjectViewDto in project midpoint by Evolveum.
the class SystemConfigPanel method initLayout.
protected void initLayout() {
ChooseTypePanel<ValuePolicyType> passPolicyChoosePanel = new ChooseTypePanel<ValuePolicyType>(ID_GLOBAL_PASSWORD_POLICY_CHOOSER, new PropertyModel<ObjectViewDto<ValuePolicyType>>(getModel(), SystemConfigurationDto.F_PASSWORD_POLICY));
ChooseTypePanel<SecurityPolicyType> securityPolicyChoosePanel = new ChooseTypePanel<SecurityPolicyType>(ID_GLOBAL_SECURITY_POLICY_CHOOSER, new PropertyModel<ObjectViewDto<SecurityPolicyType>>(getModel(), SystemConfigurationDto.F_SECURITY_POLICY));
add(passPolicyChoosePanel);
add(securityPolicyChoosePanel);
ObjectPolicyConfigurationEditor objectPolicyEditor = new ObjectPolicyConfigurationEditor(ID_OBJECT_POLICY_EDITOR, new PropertyModel<List<ObjectPolicyConfigurationTypeDto>>(getModel(), SystemConfigurationDto.F_OBJECT_POLICY_LIST));
add(objectPolicyEditor);
DropDownChoice<AEPlevel> aepLevel = new DropDownChoice<>(ID_GLOBAL_AEP, new PropertyModel<AEPlevel>(getModel(), SystemConfigurationDto.F_AEP_LEVEL), WebComponentUtil.createReadonlyModelFromEnum(AEPlevel.class), new EnumChoiceRenderer<AEPlevel>(SystemConfigPanel.this));
aepLevel.setOutputMarkupId(true);
if (aepLevel.getModel().getObject() == null) {
aepLevel.getModel().setObject(null);
}
aepLevel.add(new EmptyOnChangeAjaxFormUpdatingBehavior());
add(aepLevel);
TextField<String> auditRecordsField = WebComponentUtil.createAjaxTextField(ID_CLEANUP_AUDIT_RECORDS, new PropertyModel<String>(getModel(), SystemConfigurationDto.F_AUDIT_CLEANUP));
TextField<String> closedTasksField = WebComponentUtil.createAjaxTextField(ID_CLEANUP_CLOSED_TASKS, new PropertyModel<String>(getModel(), SystemConfigurationDto.F_TASK_CLEANUP));
add(auditRecordsField);
add(closedTasksField);
createTooltip(ID_CLEANUP_AUDIT_RECORDS_TOOLTIP);
createTooltip(ID_CLEANUP_CLOSED_TASKS_TOOLTIP);
CheckBox experimentalCodeCheck = WebComponentUtil.createAjaxCheckBox(ID_EXPERIMENTAL_CODE_CHECKBOX, new PropertyModel<Boolean>(getModel(), SystemConfigurationDto.F_ENABLE_EXPERIMENTAL_CODE));
add(experimentalCodeCheck);
}
Aggregations