Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/Evolveum/midpoint
- Loading branch information
Showing
20 changed files
with
972 additions
and
737 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/impl/factory/ObjectDeltaModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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()); | ||
} | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
...min-gui/src/main/java/com/evolveum/midpoint/gui/impl/factory/ObjectDeltaPanelFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/self/PageSelfProfile.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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()); | ||
} | ||
|
||
} |
Oops, something went wrong.