Search in sources :

Example 26 with AssignmentObjectRelation

use of com.evolveum.midpoint.model.api.AssignmentObjectRelation in project midpoint by Evolveum.

the class AssignmentPanel method getAssignmentObjectRelationList.

private List<AssignmentObjectRelation> getAssignmentObjectRelationList() {
    if (AssignmentPanel.this.getModelObject() == null) {
        return null;
    }
    if (isInducement()) {
        return null;
    } else {
        List<AssignmentObjectRelation> assignmentRelationsList = WebComponentUtil.divideAssignmentRelationsByAllValues(loadAssignmentTargetRelationsList());
        if (assignmentRelationsList == null || assignmentRelationsList.isEmpty()) {
            return assignmentRelationsList;
        }
        QName assignmentType = getAssignmentType();
        if (assignmentType == null) {
            return assignmentRelationsList;
        }
        List<AssignmentObjectRelation> assignmentRelationsListFilteredByType = new ArrayList<>();
        assignmentRelationsList.forEach(assignmentRelation -> {
            QName objectType = assignmentRelation.getObjectTypes() != null && !assignmentRelation.getObjectTypes().isEmpty() ? assignmentRelation.getObjectTypes().get(0) : null;
            if (QNameUtil.match(assignmentType, objectType)) {
                assignmentRelationsListFilteredByType.add(assignmentRelation);
            }
        });
        return assignmentRelationsListFilteredByType;
    }
}
Also used : QName(javax.xml.namespace.QName) ArrayList(java.util.ArrayList) AssignmentObjectRelation(com.evolveum.midpoint.model.api.AssignmentObjectRelation)

Example 27 with AssignmentObjectRelation

use of com.evolveum.midpoint.model.api.AssignmentObjectRelation in project midpoint by Evolveum.

the class AssignmentPanel method loadAssignmentTargetRelationsList.

@NotNull
private <AH extends AssignmentHolderType> List<AssignmentObjectRelation> loadAssignmentTargetRelationsList() {
    OperationResult result = new OperationResult(OPERATION_LOAD_ASSIGNMENT_TARGET_RELATIONS);
    List<AssignmentObjectRelation> assignmentTargetRelations = new ArrayList<>();
    PrismObject<AH> obj = getMultivalueContainerListPanel().getFocusObject();
    try {
        AssignmentCandidatesSpecification spec = getPageBase().getModelInteractionService().determineAssignmentTargetSpecification(obj, result);
        assignmentTargetRelations = spec != null ? spec.getAssignmentObjectRelations() : new ArrayList<>();
    } catch (SchemaException | ConfigurationException ex) {
        result.recordPartialError(ex.getLocalizedMessage());
        LOGGER.error("Couldn't load assignment target specification for the object {} , {}", obj.getName(), ex.getLocalizedMessage());
    }
    return assignmentTargetRelations;
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) ConfigurationException(com.evolveum.midpoint.util.exception.ConfigurationException) ArrayList(java.util.ArrayList) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) AssignmentCandidatesSpecification(com.evolveum.midpoint.model.api.AssignmentCandidatesSpecification) AssignmentObjectRelation(com.evolveum.midpoint.model.api.AssignmentObjectRelation) NotNull(org.jetbrains.annotations.NotNull)

Example 28 with AssignmentObjectRelation

use of com.evolveum.midpoint.model.api.AssignmentObjectRelation in project midpoint by Evolveum.

the class MultifunctionalButton method initLayout.

private void initLayout() {
    AjaxCompositedIconButton mainButton = new AjaxCompositedIconButton(ID_MAIN_BUTTON, new PropertyModel<>(getModel(), MultiFunctinalButtonDto.F_MAIN_BUTTON)) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            if (!additionalButtonsExist()) {
                buttonClickPerformed(target, null, null);
            }
        }
    };
    mainButton.add(AttributeAppender.append(" data-toggle", additionalButtonsExist() ? "dropdown" : ""));
    // if (!additionalButtonsExist()) {
    mainButton.add(new VisibleBehaviour(this::isMainButtonVisible));
    // }
    add(mainButton);
    MultiCompositedButtonPanel buttonsPanel = new MultiCompositedButtonPanel(ID_BUTTON, new PropertyModel<>(getModel(), MultiFunctinalButtonDto.F_ADDITIONAL_BUTTONS)) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void buttonClickPerformed(AjaxRequestTarget target, AssignmentObjectRelation relationSpec, CompiledObjectCollectionView collectionViews, Class<? extends WebPage> page) {
            MultifunctionalButton.this.buttonClickPerformed(target, relationSpec, collectionViews);
        }
    };
    buttonsPanel.setOutputMarkupId(true);
    buttonsPanel.add(new VisibleBehaviour(this::additionalButtonsExist));
    add(buttonsPanel);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxCompositedIconButton(com.evolveum.midpoint.gui.impl.component.AjaxCompositedIconButton) WebPage(org.apache.wicket.markup.html.WebPage) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) CompiledObjectCollectionView(com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView) AssignmentObjectRelation(com.evolveum.midpoint.model.api.AssignmentObjectRelation)

Example 29 with AssignmentObjectRelation

use of com.evolveum.midpoint.model.api.AssignmentObjectRelation in project midpoint by Evolveum.

the class AssignmentTargetRelationFinder method assertCount.

public AssignmentObjectRelationsAsserter<RA> assertCount(int expectedCount) throws ObjectNotFoundException, SchemaException {
    int foundCount = 0;
    for (AssignmentObjectRelation item : collectionAsserter.getAssignmentTargetRelations()) {
        if (matches(item)) {
            foundCount++;
        }
    }
    assertEquals("Wrong number of assignment target relations for specified criteria in " + collectionAsserter.desc(), expectedCount, foundCount);
    return collectionAsserter;
}
Also used : AssignmentObjectRelation(com.evolveum.midpoint.model.api.AssignmentObjectRelation)

Aggregations

AssignmentObjectRelation (com.evolveum.midpoint.model.api.AssignmentObjectRelation)29 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)18 CompiledObjectCollectionView (com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView)13 ArrayList (java.util.ArrayList)12 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)8 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)8 WebPage (org.apache.wicket.markup.html.WebPage)8 QName (javax.xml.namespace.QName)7 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)7 IModel (org.apache.wicket.model.IModel)7 UserProfileStorage (com.evolveum.midpoint.web.session.UserProfileStorage)6 List (java.util.List)6 MainObjectListPanel (com.evolveum.midpoint.gui.api.component.MainObjectListPanel)5 CompositedIconBuilder (com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder)5 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)5 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)5 SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)5 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)5 MultiCompositedButtonPanel (com.evolveum.midpoint.web.component.MultiCompositedButtonPanel)4 MultiFunctinalButtonDto (com.evolveum.midpoint.web.component.MultiFunctinalButtonDto)4