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 Apr 6, 2020
2 parents 08f177f + fcde18a commit ff4d80a
Show file tree
Hide file tree
Showing 20 changed files with 972 additions and 737 deletions.
Expand Up @@ -39,6 +39,6 @@ public Integer getOrder() {

@Override
protected Panel getPanel(PrismPropertyPanelContext<ExecuteScriptType> panelCtx) {
return new TextAreaPanel<>(panelCtx.getComponentId(), new ExecuteScriptModel(panelCtx.getRealValueModel(), panelCtx.getPageBase()), 100);
return new TextAreaPanel<>(panelCtx.getComponentId(), new ExecuteScriptModel(panelCtx.getRealValueModel(), panelCtx.getPageBase()), 20);
}
}
@@ -0,0 +1,67 @@
/*
* Copyright (c) 2020 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/

package com.evolveum.midpoint.gui.impl.factory;

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

import org.apache.commons.lang3.StringUtils;
import org.apache.wicket.ThreadContext;
import org.apache.wicket.model.IModel;

import com.evolveum.midpoint.gui.api.util.ModelServiceLocator;
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.xml.ns._public.model.scripting_3.ExecuteScriptType;

public class ObjectDeltaModel implements IModel<String> {

private static final transient Trace LOGGER = TraceManager.getTrace(ObjectDeltaModel.class);

private IModel<ObjectDeltaType> baseModel;
private ModelServiceLocator locator;

public ObjectDeltaModel(IModel<ObjectDeltaType> model, ModelServiceLocator locator) {
this.baseModel = model;
this.locator = locator;
}


@Override
public String getObject() {
try {
ObjectDeltaType value = baseModel.getObject();
if (value == null) {
return null;
}

return locator.getPrismContext().xmlSerializer().serializeRealValue(value);
} catch (Exception e) {
// TODO handle!!!!
LoggingUtils.logUnexpectedException(LOGGER, "Cannot serialize delta", e);
ThreadContext.getSession().error("Cannot serialize delta: " + e.getMessage());
}
return null;
}

@Override
public void setObject(String object) {
if (StringUtils.isBlank(object)) {
return;
}

try {
ObjectDeltaType script = locator.getPrismContext().parserFor(object).parseRealValue(ObjectDeltaType.class);
baseModel.setObject(script);
} catch (Exception e) {
// TODO handle!!!!
LoggingUtils.logUnexpectedException(LOGGER, "Cannot parse delta", e);
ThreadContext.getSession().error("Cannot parse delta: " + e.getMessage());
}
}
}
@@ -0,0 +1,44 @@
/*
* Copyright (c) 2020 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/

package com.evolveum.midpoint.gui.impl.factory;

import javax.annotation.PostConstruct;

import com.evolveum.midpoint.web.component.input.TextAreaPanel;

import org.apache.wicket.markup.html.panel.Panel;
import org.springframework.stereotype.Component;

import com.evolveum.midpoint.gui.api.factory.AbstractGuiComponentFactory;
import com.evolveum.midpoint.gui.api.prism.ItemWrapper;
import com.evolveum.midpoint.util.QNameUtil;
import com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType;

@Component
public class ObjectDeltaPanelFactory extends AbstractGuiComponentFactory<ObjectDeltaType> {

@PostConstruct
public void register() {
getRegistry().addToRegistry(this);
}

@Override
public Integer getOrder() {
return super.getOrder() - 100;
}

@Override
protected Panel getPanel(PrismPropertyPanelContext<ObjectDeltaType> panelCtx) {
return new TextAreaPanel<>(panelCtx.getComponentId(), new ObjectDeltaModel(panelCtx.getRealValueModel(), panelCtx.getPageBase()), 20);
}

@Override
public <IW extends ItemWrapper> boolean match(IW wrapper) {
return QNameUtil.match(ObjectDeltaType.COMPLEX_TYPE, wrapper.getTypeName());
}
}
Expand Up @@ -186,7 +186,6 @@ protected void populateItem(final ListItem<IW> item) {
populateNonContainer(item);
}
};
properties.setReuseItems(true);
properties.setOutputMarkupId(true);
add(propertiesLabel);
propertiesLabel.add(properties);
Expand Down Expand Up @@ -355,13 +354,8 @@ public boolean isVisible() {
private void populateContainer(ListItem<PrismContainerWrapper<?>> container) {
PrismContainerWrapper<?> itemWrapper = container.getModelObject();
try {
// ItemPanelSettingsBuilder builder = new ItemPanelSettingsBuilder().visibilityHandler(getVisibilityHandler());
Panel panel = getPageBase().initItemPanel("container", itemWrapper.getTypeName(), container.getModel(), settings);
panel.setOutputMarkupId(true);
// panel.add(new VisibleBehaviour(() -> {
// CVW parent = PrismContainerValuePanel.this.getModelObject();
// return container.getModelObject().isVisible(parent, visibilityHandler);
// }));
container.add(panel);
} catch (SchemaException e) {
throw new SystemException("Cannot instantiate panel for: " + itemWrapper.getDisplayName());
Expand Down
Expand Up @@ -173,6 +173,29 @@ private ItemVisibility getBasicTabVisibility(ItemPath path) {
return ItemVisibility.HIDDEN;
}

// region no panel for type
if (ItemPath.create(TaskType.F_EXTENSION, SchemaConstants.MODEL_EXTENSION_SEARCH_OPTIONS).equivalent(path)) {
return ItemVisibility.HIDDEN;
}

if (ItemPath.create(TaskType.F_EXTENSION, SchemaConstants.MODEL_EXTENSION_EXECUTE_OPTIONS).equivalent(path)) {
return ItemVisibility.HIDDEN;
}

if (ItemPath.create(TaskType.F_EXTENSION, SchemaConstants.MODEL_EXTENSION_MODEL_EXECUTE_OPTIONS).equivalent(path)) {
return ItemVisibility.HIDDEN;
}

if (TaskType.F_RESULT.equivalent(path)) {
return ItemVisibility.HIDDEN;
}

if (TaskType.F_OTHER_HANDLERS_URI_STACK.equivalent(path)) {
return ItemVisibility.HIDDEN;
}

//end region unsupported panel for type

String taskHandler = getTask().getHandlerUri();

if (taskHandler == null) {
Expand Down
@@ -0,0 +1,45 @@
/*
* Copyright (c) 2010-2015 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/
package com.evolveum.midpoint.web.page.self;

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

import com.evolveum.midpoint.gui.api.util.WebComponentUtil;

import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.request.mapper.parameter.PageParameters;

import com.evolveum.midpoint.gui.api.GuiStyleConstants;
import com.evolveum.midpoint.gui.api.util.WebModelServiceUtils;
import com.evolveum.midpoint.security.api.AuthorizationConstants;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.web.application.AuthorizationAction;
import com.evolveum.midpoint.web.application.PageDescriptor;
import com.evolveum.midpoint.web.component.breadcrumbs.Breadcrumb;
import com.evolveum.midpoint.web.page.admin.roles.PageRole;

@PageDescriptor(url = {"/self/profile"}, action = {
@AuthorizationAction(actionUri = PageSelf.AUTH_SELF_ALL_URI,
label = PageSelf.AUTH_SELF_ALL_LABEL,
description = PageSelf.AUTH_SELF_ALL_DESCRIPTION),
@AuthorizationAction(actionUri = AuthorizationConstants.AUTZ_UI_SELF_PROFILE_URL,
label = "PageRoleSelfProfile.auth.profile.label",
description = "PageRoleSelfProfile.auth.profile.description")})
public class PageSelfProfile extends PageBase {

public PageSelfProfile() {
getRequestCycle().setResponsePage(WebComponentUtil.resolveSelfPage());
}

public PageSelfProfile(PageParameters parameters) {
super(parameters);
getRequestCycle().setResponsePage(WebComponentUtil.resolveSelfPage());
}

}

0 comments on commit ff4d80a

Please sign in to comment.