use of com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView in project midpoint by Evolveum.
the class PageSystemConfiguration method initLayout.
private void initLayout() {
IModel<List<CompositedIconButtonDto>> model = Model.ofList(Arrays.asList(createCompositedButton("fa fa-wrench", PageSystemBasic.class), createCompositedButton("fa fa-camera", PageSystemPolicies.class), createCompositedButton("fa fa-envelope", PageSystemNotification.class), createCompositedButton("fa fa-file-text", PageSystemLogging.class), createCompositedButton("fa fa-camera", PageProfiling.class), createCompositedButton("fa fa-camera", PageSystemAdminGui.class), createCompositedButton("fa fa-camera", PageSystemWorkflow.class), createCompositedButton("fa fa-camera", PageRoleManagement.class), createCompositedButton("fa fa-camera", PageSystemInternals.class), createCompositedButton("fa fa-camera", PageAccessCertification.class)));
MultiCompositedButtonPanel panel = new MultiCompositedButtonPanel(ID_CONTAINER, model) {
@Override
protected void buttonClickPerformed(AjaxRequestTarget target, AssignmentObjectRelation relationSpec, CompiledObjectCollectionView collectionViews, Class<? extends WebPage> page) {
navigateToNext(page);
}
};
panel.add(AttributeModifier.append("class", " row"));
add(panel);
}
use of com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView in project midpoint by Evolveum.
the class CollectionProcessor method evaluateCollectionPolicyRules.
Collection<EvaluatedPolicyRule> evaluateCollectionPolicyRules(PrismObject<ObjectCollectionType> collection, CompiledObjectCollectionView collectionView, Class<? extends ObjectType> targetTypeClass, Task task, OperationResult result) throws ObjectNotFoundException, SchemaException, SecurityViolationException, CommunicationException, ConfigurationException, ExpressionEvaluationException {
if (collectionView == null) {
collectionView = new CompiledObjectCollectionView();
compileObjectCollectionView(collectionView, null, collection.asObjectable(), targetTypeClass, task, result);
}
Collection<EvaluatedPolicyRule> evaluatedPolicyRules = new ArrayList<>();
for (AssignmentType assignmentType : collection.asObjectable().getAssignment()) {
PolicyRuleType policyRuleType = assignmentType.getPolicyRule();
if (policyRuleType == null) {
continue;
}
evaluatedPolicyRules.add(evaluatePolicyRule(collection, collectionView, assignmentType, policyRuleType, task, result));
}
return evaluatedPolicyRules;
}
use of com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView in project midpoint by Evolveum.
the class CollectionProcessor method compileObjectCollectionView.
private void compileObjectCollectionView(CompiledObjectCollectionView existingView, CollectionRefSpecificationType baseCollectionSpec, @NotNull ObjectCollectionType objectCollectionType, Class<? extends Containerable> targetTypeClass, Task task, OperationResult result) throws SchemaException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException, ObjectNotFoundException {
if (targetTypeClass == null) {
if (existingView.getContainerType() == null) {
QName targetTypeQName = objectCollectionType.getType();
if (targetTypeQName == null) {
throw new SchemaException("Target container type not specified in " + objectCollectionType);
}
targetTypeClass = ObjectTypes.getObjectTypeClassIfKnown(targetTypeQName);
if (targetTypeClass == null) {
PrismContainerDefinition<Containerable> def = prismContext.getSchemaRegistry().findContainerDefinitionByType(targetTypeQName);
if (def == null) {
throw new IllegalArgumentException("Unsupported container type " + targetTypeQName);
}
targetTypeClass = def.getTypeClass();
}
existingView.setContainerType(targetTypeQName);
} else {
QName targetTypeQName = existingView.getContainerType();
targetTypeClass = ObjectTypes.getObjectTypeClass(targetTypeQName);
}
}
// Used for help text in search panel
if (objectCollectionType.getDescription() != null) {
existingView.setObjectCollectionDescription(objectCollectionType.getDescription());
}
// hierarchy. It makes no sense to compile all domain specs from the entire hierarchy just to throw that out.
if (!existingView.hasDomain()) {
CollectionRefSpecificationType domainSpec = objectCollectionType.getDomain();
if (domainSpec != null) {
CompiledObjectCollectionView domainView = new CompiledObjectCollectionView();
compileObjectCollectionView(domainView, domainSpec, targetTypeClass, task, result);
if (domainView.getFilter() == null) {
// We have domain specification, but compilation produced no filter. Which means that the domain is "all"
// Explicitly set "all" filter here. We want to avoid confusion between no domain spec and "all" domain spec.
existingView.setDomainFilter(prismContext.queryFactory().createAll());
} else {
existingView.setDomainFilter(domainView.getFilter());
}
existingView.setDomainOptions(domainView.getOptions());
}
}
SearchFilterType collectionFilterType = objectCollectionType.getFilter();
ObjectFilter collectionFilter;
if (collectionFilterType != null) {
collectionFilter = prismContext.getQueryConverter().parseFilter(collectionFilterType, targetTypeClass);
} else {
collectionFilter = null;
}
List<SelectorOptions<GetOperationOptions>> collectionOptions = GetOperationOptionsUtil.optionsBeanToOptions(objectCollectionType.getGetOptions());
CollectionRefSpecificationType baseCollectionSpecFromCollection = objectCollectionType.getBaseCollection();
if (baseCollectionSpecFromCollection == null && baseCollectionSpec == null) {
existingView.setFilter(collectionFilter);
existingView.setOptions(collectionOptions);
} else {
if (baseCollectionSpecFromCollection == null || baseCollectionSpec == null) {
compileBaseCollectionSpec(collectionFilter, existingView, collectionOptions, baseCollectionSpec == null ? baseCollectionSpecFromCollection : baseCollectionSpec, targetTypeClass, task, result);
} else {
compileObjectCollectionView(existingView, baseCollectionSpecFromCollection, targetTypeClass, task, result);
ObjectFilter baseFilterFromCollection = existingView.getFilter();
Collection<SelectorOptions<GetOperationOptions>> baseOptionFromCollection = existingView.getOptions();
compileObjectCollectionView(existingView, baseCollectionSpec, targetTypeClass, task, result);
ObjectFilter baseFilter = existingView.getFilter();
ObjectFilter combinedFilter = ObjectQueryUtil.filterAnd(baseFilterFromCollection, baseFilter, prismContext);
combinedFilter = ObjectQueryUtil.filterAnd(combinedFilter, collectionFilter, prismContext);
existingView.setFilter(combinedFilter);
GetOperationOptionsBuilder optionsBuilder = schemaService.getOperationOptionsBuilder().setFrom(baseOptionFromCollection);
optionsBuilder.mergeFrom(existingView.getOptions());
optionsBuilder.mergeFrom(collectionOptions);
existingView.setOptions(optionsBuilder.build());
}
}
compileView(existingView, objectCollectionType.getDefaultView(), false);
}
use of com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView in project midpoint by Evolveum.
the class WebComponentUtil method getCollectionViewByObject.
public static CompiledObjectCollectionView getCollectionViewByObject(AssignmentHolderType assignmentHolder, PageBase pageBase) {
String archetypeOid = getArchetypeOid(assignmentHolder);
if (!StringUtils.isEmpty(archetypeOid)) {
List<CompiledObjectCollectionView> collectionViews = pageBase.getCompiledGuiProfile().getObjectCollectionViews();
for (CompiledObjectCollectionView view : collectionViews) {
if (view.getCollection() != null && view.getCollection().getCollectionRef() != null && archetypeOid.equals(view.getCollection().getCollectionRef().getOid())) {
return view;
}
}
}
QName type = classToQName(pageBase.getPrismContext(), assignmentHolder.getClass());
return pageBase.getCompiledGuiProfile().findObjectCollectionView(type, null);
}
use of com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView in project midpoint by Evolveum.
the class ChooseMemberPopup method onInitialize.
@Override
protected void onInitialize() {
super.onInitialize();
Form form = new Form(ID_FORM);
form.setOutputMarkupId(true);
add(form);
IModel<List<CompositedIconButtonDto>> assignButtonDescriptionModel = createAssignButtonDescriptionModel();
MultiCompositedButtonPanel assignDescriptionButtonsPanel = new MultiCompositedButtonPanel(ID_COMPOSITED_BUTTONS, assignButtonDescriptionModel) {
private static final long serialVersionUID = 1L;
@Override
protected void buttonClickPerformed(AjaxRequestTarget target, AssignmentObjectRelation relationSpec, CompiledObjectCollectionView collectionViews, Class<? extends WebPage> page) {
Form form = (Form) ChooseMemberPopup.this.get(ID_FORM);
isCompositedButtonsPanelVisible = false;
addOrReplaceTabPanels(form, relationSpec);
target.add(form);
}
};
form.add(assignDescriptionButtonsPanel);
assignDescriptionButtonsPanel.add(new VisibleBehaviour(() -> isCompositedButtonsPanelVisible));
addOrReplaceTabPanels(form, null);
AjaxButton cancelButton = new AjaxButton(ID_CANCEL_BUTTON, createStringResource("userBrowserDialog.button.cancelButton")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
ChooseMemberPopup.this.getPageBase().hideMainPopup(target);
}
};
cancelButton.setOutputMarkupId(true);
form.add(cancelButton);
AjaxButton addButton = new AjaxButton(ID_ADD_BUTTON, createStringResource("userBrowserDialog.button.addButton")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
boolean orgPanelProcessed = false;
for (ITab panelTab : tabs) {
WebMarkupContainer tabPanel = ((CountablePanelTab) panelTab).getPanel();
if (tabPanel == null) {
continue;
}
MemberPopupTabPanel memberPanel = (MemberPopupTabPanel) tabPanel;
if (memberPanel.getObjectType().equals(ObjectTypes.ORG) && orgPanelProcessed) {
continue;
}
List<ObjectType> selectedObjects = memberPanel.getObjectType().equals(ObjectTypes.ORG) ? memberPanel.getPreselectedObjects() : memberPanel.getSelectedObjectsList();
if (selectedObjects == null || selectedObjects.size() == 0) {
continue;
}
executeMemberOperation(memberPanel.getAbstractRoleTypeObject(), createInOidQuery(selectedObjects), memberPanel.getRelationValue(), memberPanel.getObjectType().getTypeQName(), target, getPageBase());
if (memberPanel.getObjectType().equals(ObjectTypes.ORG)) {
orgPanelProcessed = true;
}
}
ChooseMemberPopup.this.getPageBase().hideMainPopup(target);
}
};
addButton.add(AttributeAppender.append("title", getAddButtonTitleModel()));
addButton.add(new EnableBehaviour(() -> isAddButtonEnabled()));
addButton.setOutputMarkupId(true);
form.add(addButton);
}
Aggregations