use of com.evolveum.midpoint.schema.constants.ObjectTypes in project midpoint by Evolveum.
the class MultiTypesMemberPopupTabPanel method onInitialize.
@Override
protected void onInitialize() {
super.onInitialize();
WebMarkupContainer typePanel = new WebMarkupContainer(ID_TYPE_SELECT_PANEL);
typePanel.setOutputMarkupId(true);
add(typePanel);
DropDownChoicePanel<ObjectTypes> typeSelect = new DropDownChoicePanel<ObjectTypes>(ID_TYPE, new LoadableModel<ObjectTypes>() {
@Override
protected ObjectTypes load() {
return defaultObjectType;
}
}, Model.ofList(getSupportedTypesList()), new EnumChoiceRenderer<>(this));
typeSelect.getBaseFormComponent().add(new OnChangeAjaxBehavior() {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget target) {
defaultObjectType = typeSelect.getModel().getObject();
MultiTypesMemberPopupTabPanel.this.addOrReplace(initObjectListPanel());
target.add(MultiTypesMemberPopupTabPanel.this);
}
});
typePanel.add(typeSelect);
add(typePanel);
}
use of com.evolveum.midpoint.schema.constants.ObjectTypes in project midpoint by Evolveum.
the class ObjectBrowserPanel method initLayout.
private void initLayout() {
MessagePanel warningMessage = new MessagePanel(ID_WARNING_MESSAGE, MessagePanel.MessagePanelType.WARN, getWarningMessageModel());
warningMessage.setOutputMarkupId(true);
warningMessage.add(new VisibleBehaviour(() -> getWarningMessageModel() != null));
add(warningMessage);
List<ObjectTypes> supported = new ArrayList<>();
for (QName qname : supportedTypes) {
supported.add(ObjectTypes.getObjectTypeFromTypeQName(qname));
}
WebMarkupContainer typePanel = new WebMarkupContainer(ID_TYPE_PANEL);
typePanel.setOutputMarkupId(true);
typePanel.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return supportedTypes.size() != 1;
}
});
add(typePanel);
DropDownChoice<ObjectTypes> typeSelect = new DropDownChoice<>(ID_TYPE, typeModel, new ListModel<>(supported), new EnumChoiceRenderer<>(this));
typeSelect.add(new OnChangeAjaxBehavior() {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget target) {
ObjectListPanel<O> listPanel = (ObjectListPanel<O>) get(ID_TABLE);
listPanel = createObjectListPanel(typeModel.getObject(), multiselect);
addOrReplace(listPanel);
target.add(listPanel);
}
});
typePanel.add(typeSelect);
ObjectTypes objType = defaultType != null ? ObjectTypes.getObjectType(defaultType) : null;
ObjectListPanel<O> listPanel = createObjectListPanel(objType, multiselect);
add(listPanel);
AjaxButton addButton = new AjaxButton(ID_BUTTON_ADD, createStringResource("userBrowserDialog.button.addButton")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
List<O> selected = ((PopupObjectListPanel) getParent().get(ID_TABLE)).getSelectedRealObjects();
ObjectTypes type = ObjectBrowserPanel.this.typeModel.getObject();
QName qname = type != null ? type.getTypeQName() : null;
ObjectBrowserPanel.this.addPerformed(target, qname, selected);
}
};
addButton.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return multiselect;
}
});
add(addButton);
AjaxButton cancelButton = new AjaxButton(ID_BUTTON_CANCEL, createStringResource("Button.cancel")) {
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
getPageBase().hideMainPopup(ajaxRequestTarget);
}
};
add(cancelButton);
}
use of com.evolveum.midpoint.schema.constants.ObjectTypes in project midpoint by Evolveum.
the class TypedAssignablePanel method initAssignmentParametersPanel.
protected void initAssignmentParametersPanel() {
DropDownChoicePanel<ObjectTypes> typeSelect = new DropDownChoicePanel<>(ID_TYPE, typeModel, Model.ofList(getObjectTypesList()), new EnumChoiceRenderer<>());
typeSelect.getBaseFormComponent().add(new OnChangeAjaxBehavior() {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget target) {
target.add(get(ID_TABLES_CONTAINER));
target.add(addOrReplace(createCountContainer()));
}
});
typeSelect.setOutputMarkupId(true);
add(typeSelect);
WebMarkupContainer relationContainer = new WebMarkupContainer(ID_RELATION_CONTAINER);
relationContainer.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return TypedAssignablePanel.this.isRelationPanelVisible() && !ResourceType.COMPLEX_TYPE.equals(typeModel.getObject().getTypeQName());
}
});
relationContainer.setOutputMarkupId(true);
add(relationContainer);
DropDownChoicePanel<RelationTypes> relationSelector = WebComponentUtil.createEnumPanel(RelationTypes.class, ID_RELATION, WebComponentUtil.createReadonlyModelFromEnum(RelationTypes.class), Model.of(RelationTypes.MEMBER), TypedAssignablePanel.this, false);
relationSelector.getBaseFormComponent().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
relationSelector.setOutputMarkupId(true);
relationSelector.setOutputMarkupPlaceholderTag(true);
relationContainer.add(relationSelector);
WebMarkupContainer kindContainer = new WebMarkupContainer(ID_KIND_CONTAINER);
kindContainer.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return ResourceType.COMPLEX_TYPE.equals(typeModel.getObject().getTypeQName());
}
});
kindContainer.setOutputMarkupId(true);
add(kindContainer);
DropDownChoicePanel kindSelector = WebComponentUtil.createEnumPanel(ShadowKindType.class, ID_KIND, WebComponentUtil.createReadonlyModelFromEnum(ShadowKindType.class), Model.of(ShadowKindType.ACCOUNT), TypedAssignablePanel.this, false);
kindSelector.setOutputMarkupId(true);
kindSelector.getBaseFormComponent().add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isEnabled() {
return ResourceType.COMPLEX_TYPE.equals(typeModel.getObject().getTypeQName()) && getSelectedResourceCount() > 0;
}
});
kindSelector.getBaseFormComponent().add(new AjaxFormComponentUpdatingBehavior("change") {
@Override
protected void onUpdate(AjaxRequestTarget target) {
target.add(TypedAssignablePanel.this);
}
});
kindSelector.getBaseFormComponent().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
kindSelector.setOutputMarkupPlaceholderTag(true);
kindContainer.add(kindSelector);
WebMarkupContainer intentContainer = new WebMarkupContainer(ID_INTENT_CONTAINER);
intentContainer.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return ResourceType.COMPLEX_TYPE.equals(typeModel.getObject().getTypeQName());
}
});
intentContainer.setOutputMarkupId(true);
add(intentContainer);
DropDownChoicePanel<?> intentSelector = new DropDownChoicePanel<>(ID_INTENT, intentValueModel, intentValues);
intentSelector.getBaseFormComponent().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
intentSelector.getBaseFormComponent().add(new AjaxFormComponentUpdatingBehavior("change") {
@Override
protected void onUpdate(AjaxRequestTarget target) {
target.add(TypedAssignablePanel.this);
}
});
intentSelector.getBaseFormComponent().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
intentSelector.setOutputMarkupId(true);
intentSelector.setOutputMarkupPlaceholderTag(true);
intentSelector.getBaseFormComponent().add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isEnabled() {
return ResourceType.COMPLEX_TYPE.equals(typeModel.getObject().getTypeQName()) && getSelectedResourceCount() > 0;
}
});
intentContainer.add(intentSelector);
WebMarkupContainer orgTreeViewContainer = new WebMarkupContainer(ID_ORG_TREE_VIEW_CONTAINER);
orgTreeViewContainer.setOutputMarkupId(true);
orgTreeViewContainer.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
boolean res = OrgType.COMPLEX_TYPE.equals(typeModel.getObject().getTypeQName());
return res;
}
});
add(orgTreeViewContainer);
CheckBox orgTreeViewCheckbox = new CheckBox(ID_ORG_TREE_VIEW, orgTreeViewModel);
orgTreeViewCheckbox.add(new AjaxEventBehavior("change") {
@Override
protected void onEvent(AjaxRequestTarget ajaxRequestTarget) {
orgTreeViewModel.setObject(!orgTreeViewModel.getObject());
ajaxRequestTarget.add(TypedAssignablePanel.this);
}
});
orgTreeViewCheckbox.setOutputMarkupId(true);
orgTreeViewContainer.add(orgTreeViewCheckbox);
}
use of com.evolveum.midpoint.schema.constants.ObjectTypes in project midpoint by Evolveum.
the class PageAdminObjectDetails method changeArchetypeButtonClicked.
private void changeArchetypeButtonClicked(AjaxRequestTarget target) {
AssignmentPopup changeArchetypePopup = new AssignmentPopup(getMainPopupBodyId(), null) {
private static final long serialVersionUID = 1L;
@Override
protected void addPerformed(AjaxRequestTarget target, List<AssignmentType> newAssignmentsList) {
OperationResult result = new OperationResult(OPERATION_EXECUTE_ARCHETYPE_CHANGES);
if (newAssignmentsList.size() > 1) {
result.recordWarning(getString("PageAdminObjectDetails.change.archetype.more.than.one.selected"));
showResult(result);
target.add(PageAdminObjectDetails.this.getFeedbackPanel());
return;
}
AssignmentType oldArchetypAssignment = getOldArchetypeAssignment(result);
if (oldArchetypAssignment == null) {
showResult(result);
target.add(PageAdminObjectDetails.this.getFeedbackPanel());
return;
}
try {
ObjectDelta<O> delta = getPrismContext().deltaFor(getCompileTimeClass()).item(AssignmentHolderType.F_ASSIGNMENT).delete(oldArchetypAssignment.clone()).asObjectDelta(getObjectWrapper().getOid());
delta.addModificationAddContainer(AssignmentHolderType.F_ASSIGNMENT, newAssignmentsList.iterator().next());
Task task = createSimpleTask(OPERATION_EXECUTE_ARCHETYPE_CHANGES);
getModelService().executeChanges(MiscUtil.createCollection(delta), null, task, result);
} catch (Exception e) {
LOGGER.error("Cannot find assignment wrapper: {}", e.getMessage(), e);
result.recordFatalError(getString("PageAdminObjectDetails.change.archetype.failed", e.getMessage()), e);
}
result.computeStatusIfUnknown();
showResult(result);
target.add(PageAdminObjectDetails.this.getFeedbackPanel());
refresh(target);
}
@Override
protected List<ITab> createAssignmentTabs(AssignmentObjectRelation assignmentObjectRelation) {
List<ITab> tabs = new ArrayList<>();
tabs.add(new PanelTab(getPageBase().createStringResource("ObjectTypes.ARCHETYPE"), new VisibleBehaviour(() -> true)) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer createPanel(String panelId) {
return new FocusTypeAssignmentPopupTabPanel<ArchetypeType>(panelId, ObjectTypes.ARCHETYPE, null) {
private static final long serialVersionUID = 1L;
@Override
protected PrismContainerWrapper<AssignmentType> getAssignmentWrapperModel() {
PrismContainerWrapper<AssignmentType> assignmentsWrapper = null;
try {
assignmentsWrapper = getObjectWrapper().findContainer(FocusType.F_ASSIGNMENT);
} catch (SchemaException e) {
LOGGER.error("Cannot find assignment wrapper: {}", e.getMessage());
}
return assignmentsWrapper;
}
@Override
protected List<QName> getSupportedRelations() {
return Collections.singletonList(SchemaConstants.ORG_DEFAULT);
}
@Override
protected void onSelectionPerformed(AjaxRequestTarget target, IModel<SelectableBean<ArchetypeType>> rowModel) {
target.add(getObjectListPanel());
tabLabelPanelUpdate(target);
}
@Override
protected IModel<Boolean> getObjectSelectCheckBoxEnableModel(IModel<SelectableBean<ArchetypeType>> rowModel) {
if (rowModel == null) {
return Model.of(false);
}
List selectedObjects = getSelectedObjectsList();
return Model.of(selectedObjects == null || selectedObjects.size() == 0 || (rowModel.getObject() != null && rowModel.getObject().isSelected()));
}
@Override
protected ObjectTypes getObjectType() {
return ObjectTypes.ARCHETYPE;
}
@Override
protected ObjectQuery addFilterToContentQuery() {
ObjectQuery query = super.addFilterToContentQuery();
if (query == null) {
query = getPrismContext().queryFactory().createQuery();
}
List<String> archetypeOidsList = getArchetypeOidsListToAssign();
ObjectFilter filter = getPrismContext().queryFor(ArchetypeType.class).id(archetypeOidsList.toArray(new String[0])).buildFilter();
query.addFilter(filter);
return query;
}
};
}
});
return tabs;
}
@Override
protected IModel<String> getWarningMessageModel() {
return createStringResource("PageAdminObjectDetails.button.changeArchetype.warningMessage");
}
};
changeArchetypePopup.setOutputMarkupPlaceholderTag(true);
showMainPopup(changeArchetypePopup, target);
}
use of com.evolveum.midpoint.schema.constants.ObjectTypes in project midpoint by Evolveum.
the class DefaultGuiConfigurationCompiler method compileDefaultCollectionViews.
private List<CompiledObjectCollectionView> compileDefaultCollectionViews(Collection<Class<?>> classes) {
List<CompiledObjectCollectionView> compiledObjectCollectionViews = new ArrayList<>();
for (Class<?> clazz : classes) {
CollectionInstance collectionInstance = clazz.getAnnotation(CollectionInstance.class);
if (collectionInstance == null) {
continue;
}
ObjectTypes objectType = ObjectTypes.getObjectType(collectionInstance.applicableForType());
CompiledObjectCollectionView defaultCollectionView = new CompiledObjectCollectionView(objectType.getTypeQName(), collectionInstance.identifier());
defaultCollectionView.setDisplay(createDisplayType(collectionInstance.display()));
compiledObjectCollectionViews.add(defaultCollectionView);
defaultCollectionView.setDefaultView(true);
if (collectionInstance.applicableForOperation().length == 1) {
defaultCollectionView.setApplicableForOperation(collectionInstance.applicableForOperation()[0]);
}
}
return compiledObjectCollectionViews;
}
Aggregations