use of com.evolveum.midpoint.schema.constants.ObjectTypes in project midpoint by Evolveum.
the class WebComponentUtil method getReferencedObjectDisplayNamesAndNames.
public static String getReferencedObjectDisplayNamesAndNames(Referencable ref, boolean showTypes, boolean translate) {
if (ref == null) {
return "";
}
String name = ref.getTargetName() == null ? "" : (translate ? ref.getTargetName().getOrig() : "");
StringBuilder sb = new StringBuilder(name);
if (showTypes) {
sb.append(" (");
ObjectTypes type = ObjectTypes.getObjectTypeFromTypeQName(ref.getType());
ObjectTypeGuiDescriptor descriptor = ObjectTypeGuiDescriptor.getDescriptor(type);
if (descriptor == null) {
return null;
}
sb.append(emptyIfNull(createStringResourceStatic(null, descriptor.getLocalizationKey()).getString())).append(")");
}
return sb.toString();
}
use of com.evolveum.midpoint.schema.constants.ObjectTypes in project midpoint by Evolveum.
the class AbstractAssignmentTypePanel method newAssignmentClickPerformed.
protected void newAssignmentClickPerformed(AjaxRequestTarget target) {
AssignmentPopup popupPanel = new AssignmentPopup(getPageBase().getMainPopupBodyId(), createAssignmentPopupModel()) {
private static final long serialVersionUID = 1L;
@Override
protected void addPerformed(AjaxRequestTarget target, List<AssignmentType> newAssignmentsList) {
super.addPerformed(target, newAssignmentsList);
addSelectedAssignmentsPerformed(target, newAssignmentsList);
}
@Override
protected List<ObjectTypes> getObjectTypesList() {
return AbstractAssignmentTypePanel.this.getObjectTypesList();
}
@Override
protected ObjectFilter getSubtypeFilter() {
return AbstractAssignmentTypePanel.this.getSubtypeFilter();
}
@Override
protected boolean isEntitlementAssignment() {
return AbstractAssignmentTypePanel.this.isEntitlementAssignment();
}
@Override
protected PrismContainerWrapper<AssignmentType> getAssignmentWrapperModel() {
return AbstractAssignmentTypePanel.this.getContainerModel().getObject();
}
@Override
protected <F extends AssignmentHolderType> PrismObject<F> getFocusObject() {
return AbstractAssignmentTypePanel.this.getFocusObject();
}
};
popupPanel.setOutputMarkupId(true);
popupPanel.setOutputMarkupPlaceholderTag(true);
getPageBase().showMainPopup(popupPanel, target);
}
use of com.evolveum.midpoint.schema.constants.ObjectTypes in project midpoint by Evolveum.
the class AssignmentHolderOperationalButtonsPanel method changeArchetypeButtonClicked.
private void changeArchetypeButtonClicked(AjaxRequestTarget target) {
AssignmentPopup changeArchetypePopup = new AssignmentPopup(getPageBase().getMainPopupBodyId(), Model.of(new AssignmentPopupDto(null))) {
private static final long serialVersionUID = 1L;
@Override
protected void addPerformed(AjaxRequestTarget target, List<AssignmentType> newAssignmentsList) {
addArchetypePerformed(target, newAssignmentsList);
}
@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 = AssignmentHolderOperationalButtonsPanel.this.getModelObject().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);
getPageBase().showMainPopup(changeArchetypePopup, target);
}
use of com.evolveum.midpoint.schema.constants.ObjectTypes in project midpoint by Evolveum.
the class AssignmentPopup method mergeNewAssignmentTargetTypeLists.
private List<ObjectTypes> mergeNewAssignmentTargetTypeLists(List<QName> allowedByAssignmentTargetSpecification, List<ObjectTypes> availableTypesList) {
if (CollectionUtils.isEmpty(allowedByAssignmentTargetSpecification)) {
return availableTypesList;
}
if (CollectionUtils.isEmpty(availableTypesList)) {
return allowedByAssignmentTargetSpecification.stream().map(spec -> ObjectTypes.getObjectTypeFromTypeQName(spec)).collect(Collectors.toList());
}
List<ObjectTypes> mergedList = new ArrayList<>();
allowedByAssignmentTargetSpecification.forEach(qnameValue -> {
ObjectTypes objectTypes = ObjectTypes.getObjectTypeFromTypeQName(qnameValue);
for (ObjectTypes availableObjectTypes : availableTypesList) {
if (availableObjectTypes.getClassDefinition().equals(objectTypes.getClassDefinition())) {
mergedList.add(objectTypes);
break;
}
}
});
return mergedList;
}
use of com.evolveum.midpoint.schema.constants.ObjectTypes in project midpoint by Evolveum.
the class ChooseMemberPopup method createAssignmentTabs.
protected List<ITab> createAssignmentTabs(AssignmentObjectRelation relationSpec) {
List<ITab> tabs = new ArrayList<>();
List<QName> objectTypes = relationSpec != null && CollectionUtils.isNotEmpty(relationSpec.getObjectTypes()) ? relationSpec.getObjectTypes() : getAvailableObjectTypes();
List<ObjectReferenceType> archetypeRefList = relationSpec != null && !CollectionUtils.isEmpty(relationSpec.getArchetypeRefs()) ? relationSpec.getArchetypeRefs() : getArchetypeRefList();
tabs.add(new CountablePanelTab(getPageBase().createStringResource("ObjectTypes.USER"), new VisibleBehaviour(() -> objectTypes == null || objectTypes.contains(UserType.COMPLEX_TYPE))) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer createPanel(String panelId) {
return new MemberPopupTabPanel<UserType>(panelId, relationsConfig, archetypeRefList) {
private static final long serialVersionUID = 1L;
@Override
protected void onSelectionPerformed(AjaxRequestTarget target, IModel<SelectableBean<UserType>> rowModel) {
tabLabelPanelUpdate(target);
}
@Override
protected ObjectTypes getObjectType() {
return ObjectTypes.USER;
}
@Override
protected T getAbstractRoleTypeObject() {
return ChooseMemberPopup.this.getAssignmentTargetRefObject();
}
};
}
@Override
public String getCount() {
return Integer.toString(getTabPanelSelectedCount(getPanel()));
}
});
tabs.add(new CountablePanelTab(getPageBase().createStringResource("ObjectTypes.ROLE"), new VisibleBehaviour(() -> objectTypes == null || objectTypes.contains(RoleType.COMPLEX_TYPE))) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer createPanel(String panelId) {
return new MemberPopupTabPanel<RoleType>(panelId, relationsConfig, archetypeRefList) {
private static final long serialVersionUID = 1L;
@Override
protected void onSelectionPerformed(AjaxRequestTarget target, IModel<SelectableBean<RoleType>> rowModel) {
tabLabelPanelUpdate(target);
}
@Override
protected ObjectTypes getObjectType() {
return ObjectTypes.ROLE;
}
@Override
protected T getAbstractRoleTypeObject() {
return ChooseMemberPopup.this.getAssignmentTargetRefObject();
}
};
}
@Override
public String getCount() {
return Integer.toString(getTabPanelSelectedCount(getPanel()));
}
});
tabs.add(new CountablePanelTab(getPageBase().createStringResource("ObjectTypes.ORG"), new VisibleBehaviour(() -> objectTypes == null || objectTypes.contains(OrgType.COMPLEX_TYPE))) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer createPanel(String panelId) {
return new MemberPopupTabPanel<OrgType>(panelId, relationsConfig, archetypeRefList) {
private static final long serialVersionUID = 1L;
@Override
protected void onSelectionPerformed(AjaxRequestTarget target, IModel<SelectableBean<OrgType>> rowModel) {
selectedOrgsListUpdate(rowModel);
tabLabelPanelUpdate(target);
}
@Override
protected ObjectTypes getObjectType() {
return ObjectTypes.ORG;
}
@Override
protected T getAbstractRoleTypeObject() {
return ChooseMemberPopup.this.getAssignmentTargetRefObject();
}
@Override
protected List<OrgType> getPreselectedObjects() {
return selectedOrgsList;
}
};
}
@Override
public String getCount() {
return Integer.toString(selectedOrgsList.size());
}
});
if (archetypeRefList == null || archetypeRefList.isEmpty()) {
tabs.add(new CountablePanelTab(createStringResource("TypedAssignablePanel.orgTreeView"), new VisibleBehaviour(() -> isOrgTreeVisible() && (objectTypes == null || objectTypes.contains(OrgType.COMPLEX_TYPE)))) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer createPanel(String panelId) {
return new OrgTreeMemberPopupTabPanel(panelId, relationsConfig, archetypeRefList) {
private static final long serialVersionUID = 1L;
@Override
protected T getAbstractRoleTypeObject() {
return ChooseMemberPopup.this.getAssignmentTargetRefObject();
}
@Override
protected void onSelectionPerformed(AjaxRequestTarget target, IModel<SelectableBean<OrgType>> rowModel) {
selectedOrgsListUpdate(rowModel);
tabLabelPanelUpdate(target);
}
@Override
protected List<OrgType> getPreselectedObjects() {
return selectedOrgsList;
}
};
}
@Override
public String getCount() {
return Integer.toString(selectedOrgsList.size());
}
});
}
tabs.add(new CountablePanelTab(getPageBase().createStringResource("ObjectTypes.SERVICE"), new VisibleBehaviour(() -> objectTypes == null || objectTypes.contains(ServiceType.COMPLEX_TYPE))) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer createPanel(String panelId) {
return new MemberPopupTabPanel<ServiceType>(panelId, relationsConfig, archetypeRefList) {
private static final long serialVersionUID = 1L;
@Override
protected T getAbstractRoleTypeObject() {
return ChooseMemberPopup.this.getAssignmentTargetRefObject();
}
@Override
protected ObjectTypes getObjectType() {
return ObjectTypes.SERVICE;
}
@Override
protected void onSelectionPerformed(AjaxRequestTarget target, IModel<SelectableBean<ServiceType>> rowModel) {
tabLabelPanelUpdate(target);
}
};
}
@Override
public String getCount() {
return Integer.toString(getTabPanelSelectedCount(getPanel()));
}
});
return tabs;
}
Aggregations