Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Oct 31, 2022
2 parents 1a69b72 + 1f0a43a commit d3fa034
Show file tree
Hide file tree
Showing 11 changed files with 103 additions and 141 deletions.
4 changes: 4 additions & 0 deletions gui/admin-gui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,10 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2020 Evolveum and contributors
* Copyright (C) 2010-2022 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
Expand All @@ -15,14 +15,12 @@
import java.util.List;
import java.util.Map;

import com.evolveum.midpoint.gui.api.page.PageAdminLTE;

import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.lang3.Validate;
import org.apache.commons.text.StringEscapeUtils;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;

import com.evolveum.midpoint.gui.api.model.ReadOnlyModel;
import com.evolveum.midpoint.gui.api.page.PageAdminLTE;
import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.prism.Visitable;
Expand Down Expand Up @@ -160,18 +158,16 @@ public static OpResult getOpResult(PageBase page, OperationResult result) {
private static IModel<String> createXmlModel(OperationResult result, PageBase page) {
try {
OperationResultType resultType = result.createOperationResultType();
return new ReadOnlyModel<String>(() -> {
return () -> {
try {
return page.getPrismContext().xmlSerializer().serializeAnyData(resultType, SchemaConstants.C_RESULT);
} catch (SchemaException e) {
throw new TunnelException(e);
}
});
};
} catch (RuntimeException ex) {
String m = "Can't create xml: " + ex;
// error(m);
return Model.of("<?xml version='1.0'?><message>" + StringEscapeUtils.escapeXml(m) + "</message>");
// throw ex;
return Model.of("<?xml version='1.0'?><message>" + StringEscapeUtils.escapeXml10(m) + "</message>");
}
}

Expand All @@ -191,7 +187,8 @@ private void determineBackgroundTaskVisibility(PageAdminLTE pageBase) {
backgroundTaskVisible = true;
return;
}
} catch (SchemaException | ExpressionEvaluationException | ObjectNotFoundException | CommunicationException | ConfigurationException | SecurityViolationException e) {
} catch (SchemaException | ExpressionEvaluationException | ObjectNotFoundException | CommunicationException |
ConfigurationException | SecurityViolationException e) {
backgroundTaskVisible = false;
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't determine background task visibility", e);
return;
Expand All @@ -201,7 +198,8 @@ private void determineBackgroundTaskVisibility(PageAdminLTE pageBase) {
try {
pageBase.getModelService().getObject(TaskType.class, backgroundTaskOid, null, task, task.getResult());
backgroundTaskVisible = true;
} catch (ObjectNotFoundException | SchemaException | SecurityViolationException | CommunicationException | ConfigurationException | ExpressionEvaluationException e) {
} catch (ObjectNotFoundException | SchemaException | SecurityViolationException | CommunicationException |
ConfigurationException | ExpressionEvaluationException e) {
LOGGER.debug("Task {} is not visible by the current user: {}: {}", backgroundTaskOid, e.getClass(), e.getMessage());
backgroundTaskVisible = false;
}
Expand All @@ -221,7 +219,8 @@ private void determineCaseVisibility(PageAdminLTE pageBase) {
caseVisible = true;
return;
}
} catch (SchemaException | ExpressionEvaluationException | ObjectNotFoundException | CommunicationException | ConfigurationException | SecurityViolationException e) {
} catch (SchemaException | ExpressionEvaluationException | ObjectNotFoundException | CommunicationException |
ConfigurationException | SecurityViolationException e) {
caseVisible = false;
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't determine case visibility", e);
return;
Expand All @@ -231,7 +230,8 @@ private void determineCaseVisibility(PageAdminLTE pageBase) {
try {
pageBase.getModelService().getObject(CaseType.class, caseOid, null, task, task.getResult());
caseVisible = true;
} catch (ObjectNotFoundException | SchemaException | SecurityViolationException | CommunicationException | ConfigurationException | ExpressionEvaluationException e) {
} catch (ObjectNotFoundException | SchemaException | SecurityViolationException | CommunicationException |
ConfigurationException | ExpressionEvaluationException e) {
LOGGER.debug("Case {} is not visible by the current user: {}: {}", caseOid, e.getClass(), e.getMessage());
caseVisible = false;
}
Expand Down Expand Up @@ -336,28 +336,22 @@ public boolean isCaseVisible() {

@Override
public void accept(Visitor visitor) {

visitor.visit(this);

for (OpResult result : this.getSubresults()) {
result.accept(visitor);
}

}

public void setShowMoreAll(final boolean show) {
Visitor visitor = new Visitor() {

@Override
public void visit(Visitable visitable) {
if (!(visitable instanceof OpResult)) {
return;
}
Visitor visitor = visitable -> {
if (!(visitable instanceof OpResult)) {
return;
}

OpResult result = (OpResult) visitable;
result.setShowMore(show);
OpResult result = (OpResult) visitable;
result.setShowMore(show);

}
};

accept(visitor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,12 @@
import javax.xml.datatype.XMLGregorianCalendar;
import javax.xml.namespace.QName;

import com.evolveum.midpoint.web.application.PageMounter;

import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.reflect.ConstructorUtils;
import org.apache.commons.lang3.time.DurationFormatUtils;
import org.apache.commons.text.StringEscapeUtils;
import org.apache.commons.validator.routines.UrlValidator;
import org.apache.wicket.*;
import org.apache.wicket.ajax.AjaxRequestTarget;
Expand Down Expand Up @@ -170,6 +168,7 @@
import com.evolveum.midpoint.util.logging.LoggingUtils;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.web.application.PageMounter;
import com.evolveum.midpoint.web.component.DateLabelComponent;
import com.evolveum.midpoint.web.component.TabbedPanel;
import com.evolveum.midpoint.web.component.breadcrumbs.Breadcrumb;
Expand Down Expand Up @@ -199,11 +198,8 @@
import com.evolveum.midpoint.web.page.admin.services.PageServices;
import com.evolveum.midpoint.web.page.admin.users.PageUsers;
import com.evolveum.midpoint.web.page.admin.workflow.dto.EvaluatedTriggerGroupDto;
import com.evolveum.midpoint.web.page.self.PageSelfProfile;
import com.evolveum.midpoint.web.security.MidPointApplication;
import com.evolveum.midpoint.web.session.ObjectDetailsStorage;
import com.evolveum.midpoint.web.session.SessionStorage;
import com.evolveum.midpoint.web.session.UserProfileStorage.TableId;
import com.evolveum.midpoint.web.util.DateValidator;
import com.evolveum.midpoint.web.util.InfoTooltipBehavior;
import com.evolveum.midpoint.web.util.ObjectTypeGuiDescriptor;
Expand Down Expand Up @@ -239,8 +235,6 @@ public final class WebComponentUtil {
*/
private static RelationRegistry staticallyProvidedRelationRegistry;

// private static final Map<Class<? extends ObjectType>, Class<? extends PageBase>> CREATE_NEW_OBJECT_PAGE_MAP;

private static final Map<Class<? extends ObjectType>, Class<? extends PageBase>> OBJECT_DETAILS_PAGE_MAP;

static {
Expand All @@ -261,11 +255,6 @@ public final class WebComponentUtil {
OBJECT_DETAILS_PAGE_MAP.put(MessageTemplateType.class, PageMessageTemplate.class);
}

// static {
// CREATE_NEW_OBJECT_PAGE_MAP = new HashMap<>();
// CREATE_NEW_OBJECT_PAGE_MAP.put(ResourceType.class, PageResourceWizard.class);
// }

// only pages that support 'advanced search' are currently listed here (TODO: generalize)
private static final Map<Class<?>, Class<? extends PageBase>> OBJECT_LIST_PAGE_MAP;

Expand All @@ -279,41 +268,6 @@ public final class WebComponentUtil {
OBJECT_LIST_PAGE_MAP.put(PageMessageTemplate.class, PageMessageTemplates.class);
}

private static final Map<TableId, String> STORAGE_TABLE_ID_MAP;

static {
STORAGE_TABLE_ID_MAP = new HashMap<>();
STORAGE_TABLE_ID_MAP.put(TableId.PAGE_RESOURCE_ACCOUNTS_PANEL_REPOSITORY_MODE, SessionStorage.KEY_RESOURCE_ACCOUNT_CONTENT + SessionStorage.KEY_RESOURCE_PAGE_REPOSITORY_CONTENT);
STORAGE_TABLE_ID_MAP.put(TableId.PAGE_RESOURCE_ACCOUNTS_PANEL_RESOURCE_MODE, SessionStorage.KEY_RESOURCE_ACCOUNT_CONTENT + SessionStorage.KEY_RESOURCE_PAGE_RESOURCE_CONTENT);
STORAGE_TABLE_ID_MAP.put(TableId.PAGE_RESOURCE_ENTITLEMENT_PANEL_REPOSITORY_MODE, SessionStorage.KEY_RESOURCE_ENTITLEMENT_CONTENT + SessionStorage.KEY_RESOURCE_PAGE_REPOSITORY_CONTENT);
STORAGE_TABLE_ID_MAP.put(TableId.PAGE_RESOURCE_ENTITLEMENT_PANEL_RESOURCE_MODE, SessionStorage.KEY_RESOURCE_ENTITLEMENT_CONTENT + SessionStorage.KEY_RESOURCE_PAGE_RESOURCE_CONTENT);
STORAGE_TABLE_ID_MAP.put(TableId.PAGE_RESOURCE_GENERIC_PANEL_REPOSITORY_MODE, SessionStorage.KEY_RESOURCE_GENERIC_CONTENT + SessionStorage.KEY_RESOURCE_PAGE_REPOSITORY_CONTENT);
STORAGE_TABLE_ID_MAP.put(TableId.PAGE_RESOURCE_GENERIC_PANEL_RESOURCE_MODE, SessionStorage.KEY_RESOURCE_GENERIC_CONTENT + SessionStorage.KEY_RESOURCE_PAGE_RESOURCE_CONTENT);
STORAGE_TABLE_ID_MAP.put(TableId.PAGE_RESOURCE_OBJECT_CLASS_PANEL, SessionStorage.KEY_RESOURCE_OBJECT_CLASS_CONTENT);
STORAGE_TABLE_ID_MAP.put(TableId.ROLE_MEMBER_PANEL, SessionStorage.KEY_ROLE_MEMBER_PANEL);
STORAGE_TABLE_ID_MAP.put(TableId.ORG_MEMBER_PANEL, SessionStorage.KEY_ORG_MEMBER_PANEL);
STORAGE_TABLE_ID_MAP.put(TableId.SERVICE_MEMBER_PANEL, SessionStorage.KEY_SERVICE_MEMBER_PANEL);

}

private static final Map<String, LoggingComponentType> COMPONENT_MAP = new HashMap<>();

static {
COMPONENT_MAP.put("com.evolveum.midpoint", LoggingComponentType.ALL);
COMPONENT_MAP.put("com.evolveum.midpoint.model", LoggingComponentType.MODEL);
COMPONENT_MAP.put("com.evolveum.midpoint.provisioning", LoggingComponentType.PROVISIONING);
COMPONENT_MAP.put("com.evolveum.midpoint.repo", LoggingComponentType.REPOSITORY);
COMPONENT_MAP.put("com.evolveum.midpoint.web", LoggingComponentType.WEB);
COMPONENT_MAP.put("com.evolveum.midpoint.gui", LoggingComponentType.GUI);
COMPONENT_MAP.put("com.evolveum.midpoint.task", LoggingComponentType.TASKMANAGER);
COMPONENT_MAP.put("com.evolveum.midpoint.model.sync",
LoggingComponentType.RESOURCEOBJECTCHANGELISTENER);
COMPONENT_MAP.put("com.evolveum.midpoint.wf", LoggingComponentType.WORKFLOWS);
COMPONENT_MAP.put("com.evolveum.midpoint.notifications", LoggingComponentType.NOTIFICATIONS);
COMPONENT_MAP.put("com.evolveum.midpoint.certification", LoggingComponentType.ACCESS_CERTIFICATION);
COMPONENT_MAP.put("com.evolveum.midpoint.security", LoggingComponentType.SECURITY);
}

public enum AssignmentOrder {

ASSIGNMENT(0),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018 Evolveum and contributors
* Copyright (C) 2018-2022 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
Expand All @@ -13,8 +13,8 @@
import com.evolveum.midpoint.xml.ns._public.common.common_3.LoggingComponentType;

/**
* @author skublik
* */
* @author skublik
*/
public final class ComponentLoggerType {

public static final Map<String, LoggingComponentType> COMPONENT_MAP = new HashMap<>();
Expand All @@ -31,6 +31,7 @@ public final class ComponentLoggerType {
LoggingComponentType.RESOURCEOBJECTCHANGELISTENER);
COMPONENT_MAP.put("com.evolveum.midpoint.wf", LoggingComponentType.WORKFLOWS);
COMPONENT_MAP.put("com.evolveum.midpoint.notifications", LoggingComponentType.NOTIFICATIONS);
COMPONENT_MAP.put("com.evolveum.midpoint.transport", LoggingComponentType.TRANSPORT);
COMPONENT_MAP.put("com.evolveum.midpoint.certification", LoggingComponentType.ACCESS_CERTIFICATION);
COMPONENT_MAP.put("com.evolveum.midpoint.security", LoggingComponentType.SECURITY);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Evolveum and contributors
* Copyright (C) 2021-2022 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
Expand All @@ -12,21 +12,19 @@
import java.util.List;
import javax.xml.namespace.QName;

import com.evolveum.midpoint.gui.api.page.PageBase;

import com.evolveum.prism.xml.ns._public.types_3.ItemPathType;

import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.text.StringEscapeUtils;

import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.prism.Containerable;
import com.evolveum.midpoint.prism.PrismContainerValue;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.web.component.assignment.AssignmentsUtil;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import com.evolveum.prism.xml.ns._public.types_3.ItemPathType;

public class GuiDisplayNameUtil {

Expand Down Expand Up @@ -59,6 +57,7 @@ private static <C extends Containerable> String getDefaultDisplayName(Class<C> c
}
return "ContainerPanel.containerProperties";
}

private static <C extends Containerable> Method findDisplayNameMethod(PrismContainerValue<C> pcv) {
for (Method method : GuiDisplayNameUtil.class.getMethods()) {
if (method.getName().equals("getDisplayName")) {
Expand Down Expand Up @@ -232,10 +231,10 @@ public static String getDisplayName(RelationDefinitionType relationDefinition) {
}

public static String getDisplayName(ResourceItemDefinitionType resourceItemDefinition) {
if (resourceItemDefinition.getDisplayName() != null && !resourceItemDefinition.getDisplayName().isEmpty()) {
return resourceItemDefinition.getDisplayName();
}
return resourceItemDefinition.asPrismContainerValue().getParent().getPath().last().toString();
if (resourceItemDefinition.getDisplayName() != null && !resourceItemDefinition.getDisplayName().isEmpty()) {
return resourceItemDefinition.getDisplayName();
}
return resourceItemDefinition.asPrismContainerValue().getParent().getPath().last().toString();
}

public static String getDisplayName(MappingType mapping) {
Expand All @@ -245,7 +244,7 @@ public static String getDisplayName(MappingType mapping) {
return mappingName + (StringUtils.isNotEmpty(description) ? (" - " + description) : "");
}
List<VariableBindingDefinitionType> sources = mapping.getSource();
String sourceDescription = "";
StringBuilder sourceDescriptionBuilder = new StringBuilder();
if (CollectionUtils.isNotEmpty(sources)) {
Iterator<VariableBindingDefinitionType> iterator = sources.iterator();
while (iterator.hasNext()) {
Expand All @@ -254,14 +253,15 @@ public static String getDisplayName(MappingType mapping) {
continue;
}
String sourcePath = source.getPath().toString();
sourceDescription += sourcePath;
sourceDescriptionBuilder.append(sourcePath);
if (iterator.hasNext()) {
sourceDescription += ",";
sourceDescriptionBuilder.append(",");
}
}
}
VariableBindingDefinitionType target = mapping.getTarget();
String targetDescription = target.getPath() != null ? target.getPath().toString() : null;
String sourceDescription = sourceDescriptionBuilder.toString();
if (StringUtils.isBlank(sourceDescription)) {
sourceDescription = "(no sources)";
}
Expand All @@ -272,11 +272,14 @@ public static String getDisplayName(MappingType mapping) {
}

public static String getDisplayName(ProvenanceAcquisitionType acquisition) {
return "ProvenanceAcquisitionType.details";
return "ProvenanceAcquisitionType.details";
}

public static String getDisplayName(ActivityErrorHandlingStrategyEntryType taskErrorHandlingStrategy) {
return "Strategy (order " + (taskErrorHandlingStrategy.getOrder() == null ? " not defined)" : Integer.toString(taskErrorHandlingStrategy.getOrder()) + ")");
return "Strategy (order " +
(taskErrorHandlingStrategy.getOrder() == null
? " not defined)"
: taskErrorHandlingStrategy.getOrder() + ")");
}

//TODO improve
Expand All @@ -300,7 +303,7 @@ public static String getDisplayName(ActivityDefinitionType partitionDefinition)
return "";
}

public static String getDisplayName(AbstractCorrelatorType correlator){
public static String getDisplayName(AbstractCorrelatorType correlator) {
if (correlator == null) {
return "";
}
Expand Down

0 comments on commit d3fa034

Please sign in to comment.