Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Evolveum/midpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Sep 23, 2020
2 parents d35141a + 673c70a commit 472d2a6
Show file tree
Hide file tree
Showing 25 changed files with 182 additions and 432 deletions.
Expand Up @@ -58,9 +58,7 @@ protected void onInitialize() {
}

private void initLayout() {
WebMarkupContainer typeImage = new WebMarkupContainer(ID_TYPE_IMAGE);
typeImage.setOutputMarkupId(true);
typeImage.add(AttributeModifier.append("class", createImageModel()));
WebMarkupContainer typeImage = createTypeImagePanel(ID_TYPE_IMAGE);
add(typeImage);

Label name = new Label(ID_DISPLAY_NAME, createHeaderModel());
Expand Down Expand Up @@ -117,6 +115,13 @@ protected void populateItem(ListItem<String> item) {
// add(new Label(ID_PENDING_OPERATION, getPendingOperationLabelModel()));
}

protected WebMarkupContainer createTypeImagePanel(String idTypeImage) {
WebMarkupContainer typeImage = new WebMarkupContainer(idTypeImage);
typeImage.setOutputMarkupId(true);
typeImage.add(AttributeModifier.append("class", createImageModel()));
return typeImage;
}

private boolean isObjectPolicyConfigurationType() {
return QNameUtil.match(
ObjectPolicyConfigurationType.COMPLEX_TYPE,
Expand Down
Expand Up @@ -3495,7 +3495,7 @@ public static <O extends ObjectType> DisplayType getDisplayTypeForObject(O obj,
//TODO unify createAccountIcon with createCompositeIconForObject
public static <O extends ObjectType> CompositedIcon createCompositeIconForObject(O obj, OperationResult result, PageBase pageBase) {
if (obj instanceof ShadowType) {
return createAccountIcon((ShadowType) obj, pageBase);
return createAccountIcon((ShadowType) obj, pageBase, true);
}

DisplayType basicIconDisplayType = getDisplayTypeForObject(obj, result, pageBase);
Expand Down Expand Up @@ -3525,22 +3525,31 @@ public static <O extends ObjectType> CompositedIcon createCompositeIconForObject
return builder.build();
}

public static CompositedIcon createAccountIcon(ShadowType shadow, PageBase pageBase) {
public static CompositedIcon createAccountIcon(ShadowType shadow, PageBase pageBase, boolean isColumn) {
List<TriggerType> triggerType = shadow.getTrigger();
String iconCssClass = WebComponentUtil.createShadowIcon(shadow.asPrismObject());
CompositedIconBuilder builder = new CompositedIconBuilder();
String title = createTriggerTooltip(triggerType, pageBase);
if (StringUtils.isNotBlank(title)) {
IconType icon = new IconType();
icon.setCssClass("fa fa-clock-o " + GuiStyleConstants.BLUE_COLOR);
builder.appendLayerIcon(icon, IconCssStyle.TOP_RIGHT_FOR_COLUMN_STYLE);
if (isColumn) {
builder.appendLayerIcon(icon, IconCssStyle.TOP_RIGHT_FOR_COLUMN_STYLE);
} else {
builder.appendLayerIcon(icon, IconCssStyle.TOP_RIGHT_STYLE);
}

}
builder.setBasicIcon(iconCssClass, IconCssStyle.BOTTOM_RIGHT_FOR_COLUMN_STYLE);

if (BooleanUtils.isTrue(shadow.isDead())) {
IconType icon = new IconType();
icon.setCssClass("fa fa-times-circle " + GuiStyleConstants.RED_COLOR);
builder.appendLayerIcon(icon, IconCssStyle.BOTTOM_RIGHT_FOR_COLUMN_STYLE);
if (isColumn) {
builder.setBasicIcon(icon, IconCssStyle.BOTTOM_RIGHT_FOR_COLUMN_STYLE);
} else {
builder.setBasicIcon(icon, IconCssStyle.BOTTOM_RIGHT_STYLE);
}
builder.setTitle(pageBase.createStringResource("FocusProjectionsTabPanel.deadShadow").getString()
+ (StringUtils.isNotBlank(title) ? ("\n" + title) : ""));
return builder.build();
Expand All @@ -3559,7 +3568,11 @@ public static CompositedIcon createAccountIcon(ShadowType shadow, PageBase pageB
|| (lockoutExpirationTimestamp != null && pageBase.getClock().isPast((lockoutExpirationTimestamp)))) {
IconType icon = new IconType();
icon.setCssClass("fa fa-lock " + GuiStyleConstants.RED_COLOR);
builder.appendLayerIcon(icon, IconCssStyle.BOTTOM_RIGHT_FOR_COLUMN_STYLE);
if (isColumn) {
builder.setBasicIcon(icon, IconCssStyle.BOTTOM_RIGHT_FOR_COLUMN_STYLE);
} else {
builder.setBasicIcon(icon, IconCssStyle.BOTTOM_RIGHT_STYLE);
}
builder.setTitle(pageBase.createStringResource("LockoutStatusType.LOCKED").getString()
+ (StringUtils.isNotBlank(title) ? ("\n" + title) : ""));
return builder.build();
Expand All @@ -3575,10 +3588,18 @@ public static CompositedIcon createAccountIcon(ShadowType shadow, PageBase pageB

switch (value) {
case DISABLED:
appendIcon(builder, "fe fe-slash " + GuiStyleConstants.RED_COLOR, IconCssStyle.CENTER_FOR_COLUMN_STYLE);
if (isColumn) {
appendIcon(builder, "fe fe-slash " + GuiStyleConstants.RED_COLOR, IconCssStyle.CENTER_FOR_COLUMN_STYLE);
} else {
appendIcon(builder, "fe fe-slash " + GuiStyleConstants.RED_COLOR, IconCssStyle.CENTER_STYLE);
}
return builder.build();
case ARCHIVED:
appendIcon(builder, "fa fa-archive " + GuiStyleConstants.RED_COLOR, IconCssStyle.BOTTOM_RIGHT_FOR_COLUMN_STYLE);
if (isColumn) {
appendIcon(builder, "fa fa-archive " + GuiStyleConstants.RED_COLOR, IconCssStyle.BOTTOM_RIGHT_FOR_COLUMN_STYLE);
} else {
appendIcon(builder, "fa fa-archive " + GuiStyleConstants.RED_COLOR, IconCssStyle.BOTTOM_RIGHT_STYLE);
}
return builder.build();
}

Expand Down
Expand Up @@ -47,13 +47,13 @@ protected void onInitialize() {

private void initLayout() {

addBasicContainerValuePanel(ID_BASIC_PANEL);
add(getSpecificContainers(ID_SPECIFIC_CONTAINERS_PANEL));

DisplayNamePanel<C> displayNamePanel = createDisplayNamePanel(ID_DISPLAY_NAME);

displayNamePanel.setOutputMarkupId(true);
add(displayNamePanel);

addBasicContainerValuePanel(ID_BASIC_PANEL);
add(getSpecificContainers(ID_SPECIFIC_CONTAINERS_PANEL));
}

protected WebMarkupContainer getSpecificContainers(String contentAreaId) {
Expand Down
Expand Up @@ -12,7 +12,7 @@
<div class="container-fluid prism-container">
<div class="info-box info-box-ethereal">
<div class="info-box-icon info-box-icon-ethereal">
<i class="info-box-icon-ethereal-image" wicket:id="typeImage"></i>
<i wicket:id="typeImage"></i>
</div>
<div class="info-box-content">
<span class="info-box-number">
Expand Down
Expand Up @@ -9,6 +9,8 @@
import java.util.ArrayList;
import java.util.List;

import com.evolveum.midpoint.gui.impl.component.data.column.CompositedIconPanel;

import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.model.IModel;

Expand Down Expand Up @@ -72,10 +74,10 @@ protected IModel<List<String>> getDescriptionLabelsModel() {
}

@Override
protected String createImageModel() {
protected WebMarkupContainer createTypeImagePanel(String idTypeImage) {
if (getModelObject() == null) {
return "";
return super.createTypeImagePanel(idTypeImage);
}
return WebComponentUtil.createShadowIcon(getModelObject().asPrismObject());
return new CompositedIconPanel(idTypeImage, WebComponentUtil.createAccountIcon(getModelObject(), getPageBase(), false));
}
}
Expand Up @@ -83,8 +83,6 @@ public class FocusProjectionsTabPanel<F extends FocusType> extends AbstractObjec
private static final long serialVersionUID = 1L;

private static final String ID_SHADOW_TABLE = "shadowTable";
private static final String ID_SHADOW_PANEL = "shadowPanel";
protected static final String ID_SPECIFIC_CONTAINERS_FRAGMENT = "specificContainersFragment";

private static final String DOT_CLASS = FocusProjectionsTabPanel.class.getName() + ".";
private static final String OPERATION_ADD_ACCOUNT = DOT_CLASS + "addShadow";
Expand Down Expand Up @@ -244,9 +242,13 @@ private MultivalueContainerDetailsPanel<ShadowType> getMultivalueContainerDetail

@Override
protected DisplayNamePanel<ShadowType> createDisplayNamePanel(String displayNamePanelId) {
ItemRealValueModel<ShadowType> displayNameModel =
new ItemRealValueModel<>(item.getModel());
return new ProjectionDisplayNamePanel(displayNamePanelId, displayNameModel);
IModel<ShadowType> shadowModel = new IModel<ShadowType>() {
@Override
public ShadowType getObject() {
return createShadowType(item.getModel());
}
};
return new ProjectionDisplayNamePanel(displayNamePanelId, shadowModel);
}

@Override
Expand Down Expand Up @@ -287,34 +289,8 @@ protected CompositedIcon getCompositedIcon(IModel<PrismContainerValueWrapper<Sha
if (rowModel == null || rowModel.getObject() == null || rowModel.getObject().getRealValue() == null) {
return new CompositedIconBuilder().build();
}
ShadowType shadow = rowModel.getObject().getRealValue();
try {
PrismPropertyWrapper<Boolean> dead = rowModel.getObject().findProperty(ShadowType.F_DEAD);
if (dead != null && !dead.isEmpty()) {
shadow.setDead(dead.getValue().getRealValue());
}
} catch (SchemaException e) {
LOGGER.error("Couldn't find property " + ShadowType.F_DEAD);
}
try {
PrismContainerWrapper<ActivationType> activation = rowModel.getObject().findContainer(ShadowType.F_ACTIVATION);
if (activation != null && !activation.isEmpty()) {
shadow.setActivation(activation.getValue().getRealValue());
}
} catch (SchemaException e) {
LOGGER.error("Couldn't find container " + ShadowType.F_ACTIVATION);
}
try {
PrismContainerWrapper<TriggerType> triggers = rowModel.getObject().findContainer(ShadowType.F_TRIGGER);
if (triggers != null && !triggers.isEmpty()) {
for (PrismContainerValueWrapper<TriggerType> trigger : triggers.getValues()) {
shadow.getTrigger().add(trigger.getRealValue());
}
}
} catch (SchemaException e) {
LOGGER.error("Couldn't find container " + ShadowType.F_TRIGGER);
}
return WebComponentUtil.createAccountIcon(shadow, getPageBase());
ShadowType shadow = createShadowType(rowModel);
return WebComponentUtil.createAccountIcon(shadow, getPageBase(), true);
}

});
Expand Down Expand Up @@ -372,6 +348,37 @@ public String getCssClass() {
return columns;
}

private ShadowType createShadowType(IModel<PrismContainerValueWrapper<ShadowType>> rowModel) {
ShadowType shadow = rowModel.getObject().getRealValue();
try {
PrismPropertyWrapper<Boolean> dead = rowModel.getObject().findProperty(ShadowType.F_DEAD);
if (dead != null && !dead.isEmpty()) {
shadow.setDead(dead.getValue().getRealValue());
}
} catch (SchemaException e) {
LOGGER.error("Couldn't find property " + ShadowType.F_DEAD);
}
try {
PrismContainerWrapper<ActivationType> activation = rowModel.getObject().findContainer(ShadowType.F_ACTIVATION);
if (activation != null && !activation.isEmpty()) {
shadow.setActivation(activation.getValue().getRealValue());
}
} catch (SchemaException e) {
LOGGER.error("Couldn't find container " + ShadowType.F_ACTIVATION);
}
try {
PrismContainerWrapper<TriggerType> triggers = rowModel.getObject().findContainer(ShadowType.F_TRIGGER);
if (triggers != null && !triggers.isEmpty()) {
for (PrismContainerValueWrapper<TriggerType> trigger : triggers.getValues()) {
shadow.getTrigger().add(trigger.getRealValue());
}
}
} catch (SchemaException e) {
LOGGER.error("Couldn't find container " + ShadowType.F_TRIGGER);
}
return shadow;
}

private MultivalueContainerListPanelWithDetailsPanel<ShadowType, F> getMultivalueContainerListPanel() {
return ((MultivalueContainerListPanelWithDetailsPanel<ShadowType, F>) get(ID_SHADOW_TABLE));
}
Expand Down
Expand Up @@ -209,9 +209,9 @@
}

i.center-layer {
font-size: 70% !important;
font-size: 90% !important;
position: absolute;
top: 45%;
top: 40%;
right: 0;
left: 0;
}
Expand Down
Expand Up @@ -1002,6 +1002,17 @@ public static Collection<SelectorOptions<GetOperationOptions>> fromRestOptions(L
return rv;
}

public static List<String> toRestIncludeOption(Collection<SelectorOptions<GetOperationOptions>> options) {
List<SelectorOptions<GetOperationOptions>> includeOptions = SelectorOptions.filterRetrieveOptions(options);

List<String> includePaths = new ArrayList<>();
for (SelectorOptions<GetOperationOptions> includeOption : includeOptions) {
UniformItemPath path = includeOption.getSelector().getPath();
includePaths.add(path.namedSegmentsOnly().toString());
}
return includePaths;
}

public static GetOperationOptions fromRestOptions(List<String> options, DefinitionProcessingOption definitionProcessing) {
if (options == null || options.isEmpty()) {
if (definitionProcessing != null) {
Expand Down
Expand Up @@ -163,7 +163,7 @@ public class DOMUtil {
documentBuilderFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
documentBuilderFactory.setXIncludeAware(false);
documentBuilderFactory.setExpandEntityReferences(false);
LOGGER.info("Document builder factory for thread {} initialized in {} ms",
LOGGER.debug("Document builder factory for thread {} initialized in {} ms",
Thread.currentThread().getName(), System.currentTimeMillis() - ms);
return documentBuilderFactory.newDocumentBuilder();
} catch (ParserConfigurationException e) {
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

83 changes: 0 additions & 83 deletions model/report-impl/src/test/resources/reports/report-sample.xml

This file was deleted.

0 comments on commit 472d2a6

Please sign in to comment.