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