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