Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feature/merge
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed Apr 16, 2024
2 parents 4eeafaa + 6541d37 commit 67f3104
Show file tree
Hide file tree
Showing 13 changed files with 535 additions and 103 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ protected List<CompositedIconButtonDto> load() {
}

private List<CompositedIconButtonDto> getAssignButtonDescription() {

List<CompositedIconButtonDto> buttons = new ArrayList<>();
List<AssignmentObjectRelation> loadedRelations = loadMemberRelationsList();
boolean addDefaultObjectRelation = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@

import com.evolveum.midpoint.gui.impl.component.search.Search;
import com.evolveum.midpoint.model.api.AssignmentObjectRelation;
import com.evolveum.midpoint.web.component.MultiFunctinalButtonDto;
import com.evolveum.midpoint.web.component.util.SelectableBean;
import com.evolveum.midpoint.web.component.util.VisibleBehaviour;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.RelationSearchItemConfigurationType;

import org.apache.commons.collections4.CollectionUtils;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable;
import org.apache.wicket.extensions.markup.html.tabs.ITab;
Expand All @@ -31,15 +33,15 @@
public abstract class ChooseOrgMemberPopup<O extends ObjectType> extends ChooseMemberPopup<O, OrgType> {
private static final long serialVersionUID = 1L;

public ChooseOrgMemberPopup(String id, Search search){
super(id, search, null); //todo
public ChooseOrgMemberPopup(String id, Search search, IModel<MultiFunctinalButtonDto> compositedButtonsModel){
super(id, search, compositedButtonsModel);
}

@Override
protected List<ITab> createAssignmentTabs(AssignmentObjectRelation relationSpec) {
List<ITab> tabs = super.createAssignmentTabs(relationSpec);
tabs.add(new CountablePanelTab(getPageBase().createStringResource("chooseMemberForOrgPopup.otherTypesLabel"),
new VisibleBehaviour(() -> getAvailableObjectTypes() == null)) {
new VisibleBehaviour(() -> isOthersTabVisible(relationSpec))) {

private static final long serialVersionUID = 1L;

Expand Down Expand Up @@ -69,6 +71,11 @@ public String getCount() {
return tabs;
}

private boolean isOthersTabVisible(AssignmentObjectRelation assignmentObjectRelation) {
return assignmentObjectRelation == null
|| assignmentObjectRelation.getObjectTypes() != null && assignmentObjectRelation.getObjectTypes().size() > 1;
}

@Override
protected QName getDefaultTargetType() {
return OrgType.COMPLEX_TYPE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2846,6 +2846,11 @@ public static List<AssignmentObjectRelation> divideAssignmentRelationsByRelation
return combinedRelationList;
}

public static List<AssignmentObjectRelation> divideAssignmentRelationsByAllValues(
List<AssignmentObjectRelation> initialAssignmentRelationsList) {
return divideAssignmentRelationsByAllValues(initialAssignmentRelationsList, false);
}

/**
* The idea is to divide the list of AssignmentObjectRelation objects in such way that each AssignmentObjectRelation
* in the list will contain not more than 1 relation, not more than 1 object type and not more than one archetype reference.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import com.evolveum.midpoint.gui.impl.page.login.module.PageLogin;
import com.evolveum.midpoint.model.api.ModelExecuteOptions;
import com.evolveum.midpoint.model.api.ModelInteractionService;
import com.evolveum.midpoint.model.api.ModelService;
import com.evolveum.midpoint.model.api.authentication.CompiledGuiProfile;
import com.evolveum.midpoint.model.api.authentication.GuiProfiledPrincipal;
import com.evolveum.midpoint.prism.*;
Expand Down Expand Up @@ -140,36 +139,38 @@ public static <T extends ObjectType> PrismObject<T> resolveReferenceNoFetch(Refe
return loadObject(definition.getCompileTimeClass(), reference.getOid(), createNoFetchCollection(), page, task, result);
}

public static <O extends ObjectType> List<ObjectReferenceType> createObjectReferenceList(Class<O> type, PageBase page, Map<String, String> referenceMap) {
referenceMap.clear();

public static <O extends ObjectType> List<ObjectReferenceType> createObjectReferenceListForType(Class<O> type, PageBase page,
Map<String, String> referenceMap) {
OperationResult result = new OperationResult(OPERATION_LOAD_OBJECT_REFS);
// Task task = page.createSimpleTask(OPERATION_LOAD_PASSWORD_POLICIES);

List<PrismObject<O>> objects = new ArrayList<>();
try {
List<PrismObject<O>> objects = searchObjects(type, null, result, page);
objects = searchObjects(type, null, result, page);
result.recomputeStatus();
List<ObjectReferenceType> references = new ArrayList<>();

for (PrismObject<O> object : objects) {
referenceMap.put(object.getOid(), WebComponentUtil.getName(object));
ObjectReferenceType ref = ObjectTypeUtil.createObjectRef(object, page.getPrismContext());
ref.setTargetName(null); // this fixes MID-5878. the problem is, that ORT(type, targetName, oid) is not equal to ORT(type, oid)
references.add(ref);

}
return references;
return createObjectReferenceListForObjects(page, objects, referenceMap);
} catch (Exception e) {
result.recordFatalError(page.createStringResource("WebModelUtils.couldntLoadPasswordPolicies").getString(), e);
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't load password policies", e);
}

return null;
// TODO - show error somehow
// if(!result.isSuccess()){
// getPageBase().showResult(result);
// }
}

return null;
public static <O extends ObjectType> List<ObjectReferenceType> createObjectReferenceListForObjects(PageBase page,
List<PrismObject<O>> objects, Map<String, String> referenceMap) {
referenceMap.clear();

List<ObjectReferenceType> references = new ArrayList<>();

for (PrismObject<O> object : objects) {
referenceMap.put(object.getOid(), WebComponentUtil.getName(object));
ObjectReferenceType ref = ObjectTypeUtil.createObjectRef(object, page.getPrismContext());
ref.setTargetName(null); // this fixes MID-5878. the problem is, that ORT(type, targetName, oid) is not equal to ORT(type, oid)
references.add(ref);
}
return references;
}

public static <O extends ObjectType> PrismObject<O> loadObject(PrismReferenceValue objectRef, QName expectedTargetType, PageBase pageBase, Task task, OperationResult result) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,20 @@ private void initLayout() {
add(form);

initSearchPanel(form);
IModel<SearchBoxModeType> searchButtonModel = new IModel<>(){

@Override
public SearchBoxModeType getObject() {
return getModelObject().getSearchMode();
}

@Override
public void setObject(SearchBoxModeType searchBoxMode) {
getModelObject().setSearchMode(searchBoxMode);
}
};
SearchButtonWithDropdownMenu<SearchBoxModeType> searchButtonPanel = new SearchButtonWithDropdownMenu<>(ID_SEARCH_BUTTON_PANEL,
new PropertyModel<>(getModel(), Search.F_ALLOWED_MODES), new PropertyModel<>(getModelObject(), Search.F_MODE)) {
new PropertyModel<>(getModel(), Search.F_ALLOWED_MODES), searchButtonModel) {
private static final long serialVersionUID = 1L;

@Override
Expand Down

0 comments on commit 67f3104

Please sign in to comment.