Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feature/simulations
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed Nov 2, 2022
2 parents 98afd15 + cba3074 commit eb859fe
Show file tree
Hide file tree
Showing 17 changed files with 157 additions and 262 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
Expand Up @@ -45,23 +45,23 @@
public class AssignmentsDetailsPanel extends MultivalueContainerDetailsPanel<AssignmentType> {

private static final Trace LOGGER = TraceManager.getTrace(AssignmentsDetailsPanel.class);
private boolean isEntitledAssignemnt;
private boolean isEntitledAssignment;

public AssignmentsDetailsPanel(String id, IModel<PrismContainerValueWrapper<AssignmentType>> model, boolean isEntitledAssignment) {
super(id, model, !isEntitledAssignment);
this.isEntitledAssignemnt = isEntitledAssignment;
this.isEntitledAssignment = isEntitledAssignment;
}

public AssignmentsDetailsPanel(String id, IModel<PrismContainerValueWrapper<AssignmentType>> model, boolean isEntitledAssignment, ContainerPanelConfigurationType config) {
super(id, model, !isEntitledAssignment, config);
this.isEntitledAssignemnt = isEntitledAssignment;
this.isEntitledAssignment = isEntitledAssignment;
}

@NotNull
@Override
protected List<ITab> createTabs() {
List<ITab> tabs = super.createTabs();
if (isEntitledAssignemnt) {
if (isEntitledAssignment) {
tabs.add(getConstructionAssociationPanel());
return tabs;
}
Expand Down Expand Up @@ -330,6 +330,4 @@ protected ItemVisibility getVisibility(ItemWrapper itemWrapper) {
}
};
}


}

0 comments on commit eb859fe

Please sign in to comment.