Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/support-4.1' into s…
Browse files Browse the repository at this point in the history
…upport-4.1
  • Loading branch information
skublik committed Jun 11, 2020
2 parents bdcf71a + 3c36704 commit 52372c3
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 64 deletions.
Expand Up @@ -29,8 +29,6 @@ public class DropDownChoicePanel<T> extends InputPanel {
private static final long serialVersionUID = 1L;
private static final String ID_INPUT = "input";

private boolean sortChoices = true;

public DropDownChoicePanel(String id, IModel<T> model, IModel<? extends List<? extends T>> choices) {
this(id, model, choices, false);
}
Expand Down Expand Up @@ -66,16 +64,6 @@ protected String getNullValidDisplayValue() {
return DropDownChoicePanel.this.getNullValidDisplayValue();
}

@Override
public IModel<? extends List<? extends T>> getChoicesModel() {
IModel<? extends List<? extends T>> choices = super.getChoicesModel();
if (sortChoices) {
return Model.ofList(WebComponentUtil.sortDropDownChoices(choices, renderer));
} else {
return choices;
}
}

@Override
public String getModelValue() {
T object = this.getModelObject();
Expand Down Expand Up @@ -108,12 +96,4 @@ public IModel<T> getModel() {
protected String getNullValidDisplayValue() {
return getString("DropDownChoicePanel.notDefined");
}

public boolean isSortChoices() {
return sortChoices;
}

public void setSortChoices(boolean sortChoices) {
this.sortChoices = sortChoices;
}
}
Expand Up @@ -9,7 +9,6 @@
import com.evolveum.midpoint.gui.api.model.LoadableModel;
import com.evolveum.midpoint.gui.api.util.WebModelServiceUtils;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.schema.GetOperationOptionsBuilder;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.schema.util.WorkItemId;
import com.evolveum.midpoint.security.api.AuthorizationConstants;
Expand All @@ -32,14 +31,11 @@
import org.apache.wicket.Component;
import org.apache.wicket.RestartResponseException;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.feedback.FeedbackMessage;
import org.apache.wicket.request.mapper.parameter.PageParameters;

import java.util.ArrayList;
import java.util.List;

import static com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType.F_OBJECT_REF;

/**
* @author mederly
*/
Expand Down Expand Up @@ -100,7 +96,7 @@ public class PageCaseWorkItem extends PageAdminCaseWorkItems {
private PageParameters pageParameters;

public PageCaseWorkItem() {
this(null);
this((CaseWorkItemType)null);
}

public PageCaseWorkItem(CaseWorkItemType workItem) {
Expand All @@ -121,31 +117,35 @@ protected CaseWorkItemType load() {
}
}
};
}

public PageCaseWorkItem(PageParameters parameters) {
this.pageParameters = parameters;

String caseWorkItemId = parameters.get(OnePageParameterEncoder.PARAMETER).toString();
if (StringUtils.isEmpty(caseWorkItemId)) {
throw new IllegalStateException("Work item ID not specified.");
}
try {
workItemId = WorkItemId.create(caseWorkItemId);
} catch (IllegalStateException e) {
getSession().error(getString("PageCaseWorkItem.couldNotGetCase.runtime"));
throw redirectBackViaRestartResponseException();
}

// String caseId = parameters.get(OnePageParameterEncoder.PARAMETER).toString();
// if (StringUtils.isEmpty(caseId)) {
// throw new IllegalStateException("Case ID not specified.");
// }
// workItemId = WorkItemId.create(caseId);
// if (workItemId == null || StringUtils.isEmpty(workItemId.getCaseOid())) {
// throw new IllegalStateException("Case oid not specified.");
// }
//
// caseModel = new LoadableModel<CaseType>(false) {
// @Override
// protected CaseType load() {
// return loadCaseIfNecessary();
// }
// };
//
// caseWorkItemModel = new LoadableModel<CaseWorkItemType>(false) {
// @Override
// protected CaseWorkItemType load() {
// return loadCaseWorkItemIfNecessary();
// }
// };

// initLayout();
caseModel = new LoadableModel<CaseType>(false) {
@Override
protected CaseType load() {
return loadCaseIfNecessary();
}
};

caseWorkItemModel = new LoadableModel<CaseWorkItemType>(false) {
@Override
protected CaseWorkItemType load() {
return loadCaseWorkItemIfNecessary();
}
};
}

@Override
Expand Down Expand Up @@ -207,7 +207,8 @@ private CaseWorkItemType loadCaseWorkItemIfNecessary() {
} catch (NumberFormatException ex) {
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't parse case work item id.", ex);
}
return null;
getSession().error(getString("PageCaseWorkItem.couldNotGetCaseWorkItem"));
throw redirectBackViaRestartResponseException();
}

private void initLayout(){
Expand Down
Expand Up @@ -116,63 +116,55 @@ private void initLayout() {
GenericTraceVisualizationType.class, ID_CLOCKWORK_EXECUTION, createClockworkLevels(),
new PropertyModel<>(model, TraceViewDto.F_CLOCKWORK_EXECUTION),
this, false);
clockworkExecutionChoice.setSortChoices(false);
clockworkExecutionChoice.setOutputMarkupId(true);
mainForm.add(clockworkExecutionChoice);

DropDownChoicePanel<GenericTraceVisualizationType> clockworkClickChoice = WebComponentUtil.createEnumPanel(
GenericTraceVisualizationType.class, ID_CLOCKWORK_CLICK, createClockworkLevels(),
new PropertyModel<>(model, TraceViewDto.F_CLOCKWORK_CLICK),
this, false);
clockworkClickChoice.setSortChoices(false);
clockworkClickChoice.setOutputMarkupId(true);
mainForm.add(clockworkClickChoice);

DropDownChoicePanel<GenericTraceVisualizationType> mappingEvaluationChoice = WebComponentUtil.createEnumPanel(
GenericTraceVisualizationType.class, ID_MAPPING_EVALUATION, createMappingLevels(),
new PropertyModel<>(model, TraceViewDto.F_MAPPING_EVALUATION),
this, false);
mappingEvaluationChoice.setSortChoices(false);
mappingEvaluationChoice.setOutputMarkupId(true);
mainForm.add(mappingEvaluationChoice);

DropDownChoicePanel<GenericTraceVisualizationType> focusLoadChoice = WebComponentUtil.createEnumPanel(
GenericTraceVisualizationType.class, ID_FOCUS_LOAD, createStandardLevels(),
new PropertyModel<>(model, TraceViewDto.F_FOCUS_LOAD),
this, false);
focusLoadChoice.setSortChoices(false);
focusLoadChoice.setOutputMarkupId(true);
mainForm.add(focusLoadChoice);

DropDownChoicePanel<GenericTraceVisualizationType> projectionLoadChoice = WebComponentUtil.createEnumPanel(
GenericTraceVisualizationType.class, ID_PROJECTION_LOAD, createStandardLevels(),
new PropertyModel<>(model, TraceViewDto.F_PROJECTION_LOAD),
this, false);
projectionLoadChoice.setSortChoices(false);
projectionLoadChoice.setOutputMarkupId(true);
mainForm.add(projectionLoadChoice);

DropDownChoicePanel<GenericTraceVisualizationType> focusChangeChoice = WebComponentUtil.createEnumPanel(
GenericTraceVisualizationType.class, ID_FOCUS_CHANGE, createStandardLevels(),
new PropertyModel<>(model, TraceViewDto.F_FOCUS_CHANGE),
this, false);
focusChangeChoice.setSortChoices(false);
focusChangeChoice.setOutputMarkupId(true);
mainForm.add(focusChangeChoice);

DropDownChoicePanel<GenericTraceVisualizationType> projectionChangeChoice = WebComponentUtil.createEnumPanel(
GenericTraceVisualizationType.class, ID_PROJECTION_CHANGE, createStandardLevels(),
new PropertyModel<>(model, TraceViewDto.F_PROJECTION_CHANGE),
this, false);
projectionChangeChoice.setSortChoices(false);
projectionChangeChoice.setOutputMarkupId(true);
mainForm.add(projectionChangeChoice);

DropDownChoicePanel<GenericTraceVisualizationType> otherChoice = WebComponentUtil.createEnumPanel(
GenericTraceVisualizationType.class, ID_OTHERS, createOthersLevels(),
new PropertyModel<>(model, TraceViewDto.F_OTHERS),
this, false);
otherChoice.setSortChoices(false);
otherChoice.setOutputMarkupId(true);
mainForm.add(otherChoice);

Expand Down
Expand Up @@ -11,13 +11,11 @@
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.gui.api.util.WebModelServiceUtils;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.prism.query.NoneFilter;
import com.evolveum.midpoint.prism.query.ObjectFilter;
import com.evolveum.midpoint.prism.query.ObjectQuery;
import com.evolveum.midpoint.schema.constants.ObjectTypes;
import com.evolveum.midpoint.schema.constants.SchemaConstants;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.schema.util.ObjectQueryUtil;
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
Expand Down Expand Up @@ -444,7 +442,7 @@ protected ObjectQuery createContentQuery() {
.type(getQueryClass())
.build();
ObjectFilter assignableRolesFilter = getAssignableRolesFilter();
if (assignableRolesFilter != null && !(assignableRolesFilter instanceof NoneFilter)){
if (assignableRolesFilter != null) {
memberQuery.addFilter(assignableRolesFilter);
}
// if (getQueryType() != null && !AbstractRoleType.COMPLEX_TYPE.equals(getQueryType())){
Expand All @@ -465,9 +463,7 @@ private SearchPanel getSearchPanel(){
}

private ObjectFilter getAssignableRolesFilter() {
if (getRoleCatalogStorage().isMultiUserRequest()){
return null;
}
// When multiple users are selected, filter the roles by targeting one of them
Task task = getPageBase().createSimpleTask(OPERATION_LOAD_ASSIGNABLE_ROLES);
OperationResult result = task.getResult();
UserType targetUser = targetUserModel.getObject();
Expand Down

0 comments on commit 52372c3

Please sign in to comment.