Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/support-4.4' into s…
Browse files Browse the repository at this point in the history
…upport-4.4
  • Loading branch information
skublik committed Mar 29, 2022
2 parents 8212b09 + 54a5ec1 commit 57790b9
Show file tree
Hide file tree
Showing 10 changed files with 186 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -627,11 +627,11 @@ private boolean pathNotEmpty(ItemPath columnPath) {
return columnPath != null && !columnPath.isEmpty();
}

private IModel<?> getExportableColumnDataModel(IModel<PO> rowModel, GuiObjectColumnType customColumn, ItemPath columnPath, ExpressionType expression) {
protected IModel<?> getExportableColumnDataModel(IModel<PO> rowModel, GuiObjectColumnType customColumn, ItemPath columnPath, ExpressionType expression) {
return new ReadOnlyModel<>(() -> loadExportableColumnDataModel(rowModel, customColumn, columnPath, expression));
}

protected Collection<String> loadExportableColumnDataModel(IModel<PO> rowModel, GuiObjectColumnType customColumn, ItemPath columnPath, ExpressionType expression) {
public Collection<String> loadExportableColumnDataModel(IModel<PO> rowModel, GuiObjectColumnType customColumn, ItemPath columnPath, ExpressionType expression) {
C value = getRowRealValue(rowModel.getObject());
if (value == null) {
return Collections.singletonList("");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
*/
package com.evolveum.midpoint.gui.impl.page.admin.assignmentholder.component.assignmentType;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.*;
import javax.xml.namespace.QName;

import org.apache.commons.collections4.CollectionUtils;
Expand Down Expand Up @@ -68,6 +65,7 @@
import com.evolveum.midpoint.web.component.search.SearchItemDefinition;
import com.evolveum.midpoint.web.component.util.AssignmentListProvider;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;
import com.evolveum.midpoint.web.session.GenericPageStorage;
import com.evolveum.midpoint.web.session.PageStorage;
import com.evolveum.midpoint.web.session.UserProfileStorage;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
Expand Down Expand Up @@ -162,6 +160,20 @@ public void onClick(AjaxRequestTarget target, IModel<PrismContainerValueWrapper<
};
}

@Override
protected PageStorage getPageStorage(String storageKey) {
Map<String, PageStorage> storage = getSession().getSessionStorage().getPageStorageMap();
PageStorage pageStorage = storage.get(storageKey);
if (pageStorage != null) {
return pageStorage;
}

pageStorage = new GenericPageStorage();
storage.put(storageKey, pageStorage);

return pageStorage;
}

private String loadValuesForNameColumn(IModel<PrismContainerValueWrapper<AssignmentType>> rowModel, GuiObjectColumnType customColumn, ItemPath itemPath, ExpressionType expression) {
if (expression != null || itemPath != null) {
Collection<String> evaluatedValues = loadExportableColumnDataModel(rowModel, customColumn, itemPath, expression);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.util.stream.Collectors;
import javax.xml.namespace.QName;

import org.apache.commons.collections4.CollectionUtils;
import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
Expand All @@ -36,6 +37,7 @@
import com.evolveum.midpoint.gui.api.component.tabs.PanelTab;
import com.evolveum.midpoint.gui.api.factory.wrapper.PrismObjectWrapperFactory;
import com.evolveum.midpoint.gui.api.factory.wrapper.WrapperContext;
import com.evolveum.midpoint.gui.api.model.LoadableModel;
import com.evolveum.midpoint.gui.api.model.ReadOnlyModel;
import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.gui.api.prism.ItemStatus;
Expand Down Expand Up @@ -71,6 +73,7 @@
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.web.application.*;
import com.evolveum.midpoint.web.component.data.ISelectableDataProvider;
import com.evolveum.midpoint.web.component.data.column.AjaxLinkColumn;
import com.evolveum.midpoint.web.component.data.column.CheckBoxHeaderColumn;
import com.evolveum.midpoint.web.component.data.column.ColumnMenuAction;
import com.evolveum.midpoint.web.component.dialog.ConfirmationPanel;
Expand Down Expand Up @@ -192,16 +195,7 @@ protected List<IColumn<PrismContainerValueWrapper<ShadowType>, String>> createDe

@Override
protected IColumn<PrismContainerValueWrapper<ShadowType>, String> createNameColumn(IModel<String> displayModel, GuiObjectColumnType customColumn, ItemPath itemPath, ExpressionType expression) {
IModel<PrismContainerDefinition<ShadowType>> shadowDef = Model.of(getShadowDefinition());
return new PrismPropertyWrapperColumn<ShadowType, String>(shadowDef, ShadowType.F_NAME, ColumnType.LINK, getPageBase()) {
private static final long serialVersionUID = 1L;

@Override
protected void onClick(AjaxRequestTarget target, IModel<PrismContainerValueWrapper<ShadowType>> rowModel) {
getMultivalueContainerListPanel().itemDetailsPerformed(target, rowModel);
target.add(getPageBase().getFeedbackPanel());
}
};
return createProjectionNameColumn(displayModel, customColumn, itemPath, expression);
}

@Override
Expand Down Expand Up @@ -281,6 +275,50 @@ protected MultivalueContainerDetailsPanel<ShadowType> getMultivalueContainerDeta
setOutputMarkupId(true);
}

private IColumn<PrismContainerValueWrapper<ShadowType>, String> createProjectionNameColumn(IModel<String> displayModel, GuiObjectColumnType customColumn, ItemPath itemPath, ExpressionType expression) {
if (expression != null) {
return new AjaxLinkColumn<>(displayModel) {
private static final long serialVersionUID = 1L;

@Override
public IModel<String> createLinkModel(IModel<PrismContainerValueWrapper<ShadowType>> rowModel) {
return new LoadableModel<>() {
@Override
protected String load() {
Collection<String> evaluatedValues = getMultivalueContainerListPanel().loadExportableColumnDataModel(rowModel, customColumn, itemPath, expression);
if (CollectionUtils.isEmpty(evaluatedValues)) {
return "";
}
if (evaluatedValues.size() == 1) {
return evaluatedValues.iterator().next();
}
return String.join(", ", evaluatedValues);
}
};
}


@Override
public void onClick(AjaxRequestTarget target, IModel<PrismContainerValueWrapper<ShadowType>> rowModel) {
getMultivalueContainerListPanel().itemDetailsPerformed(target, rowModel);
target.add(getPageBase().getFeedbackPanel());
}
};
}

IModel<PrismContainerDefinition<ShadowType>> shadowDef = Model.of(getShadowDefinition());
return new PrismPropertyWrapperColumn<ShadowType, String>(shadowDef, ShadowType.F_NAME, ColumnType.LINK, getPageBase()) {
private static final long serialVersionUID = 1L;

@Override
protected void onClick(AjaxRequestTarget target, IModel<PrismContainerValueWrapper<ShadowType>> rowModel) {
getMultivalueContainerListPanel().itemDetailsPerformed(target, rowModel);
target.add(getPageBase().getFeedbackPanel());
}

};
}

private IModel<List<PrismContainerValueWrapper<ShadowType>>> loadShadowModel() {
return () -> {
List<PrismContainerValueWrapper<ShadowType>> items = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,6 @@ public PageStorage initPageStorage(String key) {
} else if (KEY_AUDIT_LOG.equals(key)
|| key.startsWith(KEY_OBJECT_HISTORY_AUDIT_LOG)) {
pageStorage = new AuditLogStorage();
} else {
pageStorage = new GenericPageStorage();
}
if (pageStorage != null) {
pageStorageMap.put(key, pageStorage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ public Jsonb processExtensions(

extMap.put(extItemInfo.getId(), value);

// we may need to add add also single value index, if definition is dynamic
// see additionalSingleValueIndexNeeded javadoc for more information
// We may need to add also single value index, if definition is dynamic;
// see additionalSingleValueIndexNeeded() javadoc for more information.
if (additionalSingleValueIndexNeeded(item, extItemInfo)) {
addSingleValueIndex(extMap, item, holderType);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ public class SqaleRepositoryService extends SqaleServiceBase implements Reposito
private static final Collection<SelectorOptions<GetOperationOptions>> GET_FOR_UPDATE_OPTIONS =
SchemaService.get().getOperationOptionsBuilder().build();

private static final Collection<SelectorOptions<GetOperationOptions>> GET_FOR_REINDEX_OPTIONS =
SchemaService.get().getOperationOptionsBuilder()
.retrieve()
.raw()
.build();

private final SqlQueryExecutor sqlQueryExecutor;

@Autowired private SystemConfigurationChangeDispatcher systemConfigurationChangeDispatcher;
Expand Down Expand Up @@ -655,13 +661,16 @@ RootUpdateContext<S, Q, R> prepareUpdateContext(
@NotNull JdbcSession jdbcSession,
@NotNull Class<S> schemaType,
@NotNull Collection<? extends ItemDelta<?, ?>> modifications,
@NotNull UUID oid, RepoModifyOptions options)
@NotNull UUID oid,
@Nullable RepoModifyOptions options)
throws SchemaException, ObjectNotFoundException {

QueryTableMapping<S, FlexibleRelationalPathBase<Object>, Object> rootMapping =
sqlRepoContext.getMappingBySchemaType(schemaType);
Collection<SelectorOptions<GetOperationOptions>> getOptions =
rootMapping.updateGetOptions(GET_FOR_UPDATE_OPTIONS, modifications);
rootMapping.updateGetOptions(
RepoModifyOptions.isForceReindex(options) ? GET_FOR_REINDEX_OPTIONS : GET_FOR_UPDATE_OPTIONS,
modifications);

return prepareUpdateContext(jdbcSession, schemaType, oid, getOptions, options);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ protected QObjectMapping(
@Override
public @NotNull Path<?>[] selectExpressions(
Q entity, Collection<SelectorOptions<GetOperationOptions>> options) {
// TODO: there is currently no support for index-only extensions (from entity.ext).
// See how QShadowMapping.loadIndexOnly() is used, and probably compose the result of this call
// using super... call in the subclasses. (joining arrays? providing mutable list?)
return new Path[] { entity.oid, entity.fullObject };
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,10 @@ public class ShadowAttributesHelper {
private final ShadowAttributesType attributesContainer;
private final MutablePrismContainerDefinition<Containerable> attrsDefinition;

/**
* Creates the attribute helper for the shadow, adding attributes container to the shadow.
* The container can be later obtained by {@link #attributesContainer()} if/when needed.
*/
public ShadowAttributesHelper(ShadowType object) throws SchemaException {
attributesContainer = new ShadowAttributesType(prismContext);
// let's create the container+PCV inside the shadow object
Expand Down

0 comments on commit 57790b9

Please sign in to comment.