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 Jun 21, 2016
2 parents 264c337 + 08bf2c7 commit f22ecb8
Show file tree
Hide file tree
Showing 30 changed files with 522 additions and 179 deletions.
Expand Up @@ -42,6 +42,7 @@
import com.evolveum.midpoint.prism.match.*;
import com.evolveum.midpoint.web.component.AjaxTabbedPanel;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;
import com.evolveum.midpoint.web.page.admin.services.PageService;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.Validate;
Expand Down Expand Up @@ -1444,6 +1445,8 @@ public static void dispatchToObjectDetailsPage(ObjectReferenceType objectRef, Pa
page.setResponsePage(PageRole.class, parameters);
} else if (OrgType.COMPLEX_TYPE.equals(type)) {
page.setResponsePage(PageOrgUnit.class, parameters);
} else if (ServiceType.COMPLEX_TYPE.equals(type)) {
page.setResponsePage(PageService.class, parameters);
} else if (UserType.COMPLEX_TYPE.equals(type)) {
page.setResponsePage(PageUser.class, parameters);
} else if (ResourceType.COMPLEX_TYPE.equals(type)) {
Expand Down
Expand Up @@ -52,11 +52,11 @@ public class MultiValueTextPanel<T extends Serializable> extends BasePanel<List<

private static final String CSS_DISABLED = " disabled";

public MultiValueTextPanel(String id, IModel<List<T>> value, NonEmptyModel<Boolean> readOnlyModel){
public MultiValueTextPanel(String id, IModel<List<T>> value, NonEmptyModel<Boolean> readOnlyModel, boolean emptyStringToNull) {
super(id, value);
setOutputMarkupId(true);

initLayout(readOnlyModel);
initLayout(readOnlyModel, emptyStringToNull);
}

@Override
Expand All @@ -68,7 +68,7 @@ public IModel<List<T>> getModel(){
return super.getModel();
}

private void initLayout(final NonEmptyModel<Boolean> readOnlyModel) {
private void initLayout(final NonEmptyModel<Boolean> readOnlyModel, final boolean emptyStringToNull) {
WebMarkupContainer placeholderContainer = new WebMarkupContainer(ID_PLACEHOLDER_CONTAINER);
placeholderContainer.setOutputMarkupPlaceholderTag(true);
placeholderContainer.setOutputMarkupPlaceholderTag(true);
Expand Down Expand Up @@ -115,6 +115,7 @@ protected void onUpdate(AjaxRequestTarget target) {}
});
text.add(AttributeAppender.replace("placeholder", createEmptyItemPlaceholder()));
text.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
text.setConvertEmptyInputStringToNull(emptyStringToNull);
item.add(text);

WebMarkupContainer buttonGroup = new WebMarkupContainer(ID_BUTTON_GROUP);
Expand Down
Expand Up @@ -21,6 +21,8 @@

import javax.xml.namespace.QName;

import com.evolveum.midpoint.web.component.prism.*;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import org.apache.commons.lang.Validate;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.Component;
Expand Down Expand Up @@ -60,28 +62,12 @@
import com.evolveum.midpoint.web.component.menu.cog.InlineMenu;
import com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem;
import com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction;
import com.evolveum.midpoint.web.component.prism.CheckTableHeader;
import com.evolveum.midpoint.web.component.prism.ContainerStatus;
import com.evolveum.midpoint.web.component.prism.ContainerWrapper;
import com.evolveum.midpoint.web.component.prism.ObjectWrapper;
import com.evolveum.midpoint.web.component.prism.PrismObjectPanel;
import com.evolveum.midpoint.web.component.prism.PropertyWrapper;
import com.evolveum.midpoint.web.component.prism.SimpleErrorPanel;
import com.evolveum.midpoint.web.component.prism.ValueWrapper;
import com.evolveum.midpoint.web.component.util.ObjectWrapperUtil;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;
import com.evolveum.midpoint.web.page.admin.PageAdminFocus;
import com.evolveum.midpoint.web.page.admin.users.dto.FocusSubwrapperDto;
import com.evolveum.midpoint.web.page.admin.users.dto.UserDtoStatus;
import com.evolveum.midpoint.web.resource.img.ImgResources;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationStatusType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.LayerType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowKindType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType;

/**
* @author semancik
Expand Down Expand Up @@ -464,8 +450,28 @@ private void unlockShadowPerformed(AjaxRequestTarget target,
}

for (FocusSubwrapperDto<ShadowType> account : selected) {
// TODO: implement unlock
if (!account.isLoadedOK()) {
continue;
}
ObjectWrapper<ShadowType> wrapper = account.getObject();
wrapper.setSelected(false);

ContainerWrapper<ActivationType> activation = wrapper.findContainerWrapper(new ItemPath(ShadowType.F_ACTIVATION));
if (activation == null) {
warn(getString("pageAdminFocus.message.noActivationFound", wrapper.getDisplayName()));
continue;
}

PropertyWrapper lockedProperty = activation.findPropertyWrapper(ActivationType.F_LOCKOUT_STATUS);
if (lockedProperty == null || lockedProperty.getValues().size() != 1) {
warn(getString("pageAdminFocus.message.noLockoutStatusPropertyFound", wrapper.getDisplayName()));
continue;
}
ValueWrapper value = (ValueWrapper) lockedProperty.getValues().get(0);
((PrismPropertyValue) value.getValue()).setValue(LockoutStatusType.NORMAL);
info(getString("pageAdminFocus.message.unlocked", wrapper.getDisplayName())); // TODO only for really unlocked accounts
}
target.add(getFeedbackPanel(), get(createComponentPath(ID_SHADOWS)));
}

private void unlinkProjectionPerformed(AjaxRequestTarget target,
Expand Down
Expand Up @@ -1154,7 +1154,7 @@ private void prepareActivation(ResourceActivationDefinitionType activation){
continue;
}

if(inbound.getSource().size() == 0 && compareItemPath(inbound.getSource().get(0).getPath(), ResourceActivationEditor.EXISTENCE_DEFAULT_SOURCE)){
if(inbound.getSource().size() == 1 && compareItemPath(inbound.getSource().get(0).getPath(), ResourceActivationEditor.EXISTENCE_DEFAULT_SOURCE)){
newInbounds.add(new MappingType());
continue;
}
Expand Down
Expand Up @@ -70,6 +70,56 @@ <h4><wicket:message key="capabilityActivationPanel.label.status" /></h4>
<div wicket:id="statusDisableList" />
</dl>

<h4><wicket:message key="capabilityActivationPanel.label.lockout" /></h4>
<div class="row">
<div class="col-xs-6">
<dl class="dl-horizontal">
<dt>
<label><wicket:message key="capabilityActivationPanel.label.enabled" /></label>
<i wicket:id="lockoutEnabledTooltip" wicket:message="title:CapabilityStep.activation.tooltip.enabled"/>
</dt>
<dd><input wicket:id="lockoutEnabled" type="checkbox" value="checked"/></dd>
</dl>
</div>
<div class="col-xs-6">
<dl class="dl-horizontal">
<dt>
<label><wicket:message key="capabilityActivationPanel.label.returnedByDefault" /></label>
<i wicket:id="lockoutReturnedByDefaultTooltip" wicket:message="title:CapabilityStep.activation.tooltip.returnedByDefault"/>
</dt>
<dd><input wicket:id="lockoutReturnedByDefault" type="checkbox" value="checked"/></dd>
</dl>
<dl class="dl-horizontal">
<dt>
<label><wicket:message key="capabilityActivationPanel.label.ignoreAttribute"/></label>
<i wicket:id="lockoutIgnoreAttributeTooltip" wicket:message="title:CapabilityStep.activation.tooltip.ignoreAttribute"/>
</dt>
<dd><input wicket:id="lockoutIgnoreAttribute" type="checkbox" value="checked"/></dd>
</dl>
</div>
</div>
<dl class="dl-horizontal">
<dt>
<label><wicket:message key="capabilityActivationPanel.label.attributeName" /></label>
<i wicket:id="lockoutAttributeNameTooltip" wicket:message="title:CapabilityStep.activation.tooltip.lockoutAttributeName"/>
</dt>
<dd><select wicket:id="lockoutSelect" class="form-control input-sm"></select></dd>
</dl>
<dl class="dl-horizontal">
<dt>
<label><wicket:message key="capabilityActivationPanel.label.normalList" /></label>
<i wicket:id="lockoutNormalListTooltip" wicket:message="title:CapabilityStep.activation.tooltip.lockoutNormalList"/>
</dt>
<div wicket:id="lockoutNormalList" />
</dl>
<dl class="dl-horizontal">
<dt>
<label><wicket:message key="capabilityActivationPanel.label.lockedList" /></label>
<i wicket:id="lockoutLockedListTooltip" wicket:message="title:CapabilityStep.activation.tooltip.lockoutLockedList"/>
</dt>
<div wicket:id="lockoutLockedList" />
</dl>

<div class="row">
<div class="col-xs-6">
<h4><wicket:message key="capabilityActivationPanel.label.validFrom" /></h4>
Expand Down
Expand Up @@ -16,6 +16,7 @@
package com.evolveum.midpoint.web.component.wizard.resource.component.capability;

import com.evolveum.midpoint.gui.api.component.BasePanel;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.web.component.form.multivalue.MultiValueTextPanel;
import com.evolveum.midpoint.web.component.input.QNameChoiceRenderer;
import com.evolveum.midpoint.web.component.wizard.resource.dto.CapabilityDto;
Expand Down Expand Up @@ -48,12 +49,24 @@ public class CapabilityActivationPanel extends BasePanel {
private static final String ID_STATUS_ENABLE_LIST = "statusEnableList";
private static final String ID_STATUS_DISABLE_LIST = "statusDisableList";
private static final String ID_SELECT_STATUS = "statusSelect";
private static final String ID_CHECK_LOCKOUT_ENABLED = "lockoutEnabled";
private static final String ID_CHECK_LOCKOUT_RETURNED = "lockoutReturnedByDefault";
private static final String ID_CHECK_LOCKOUT_IGNORE = "lockoutIgnoreAttribute";
private static final String ID_LOCKOUT_NORMAL_LIST = "lockoutNormalList";
private static final String ID_LOCKOUT_LOCKED_LIST = "lockoutLockedList";
private static final String ID_SELECT_LOCKOUT = "lockoutSelect";
private static final String ID_T_ENABLED = "enabledTooltip";
private static final String ID_T_RETURNED_BY_DEFAULT = "returnedByDefaultTooltip";
private static final String ID_T_IGNORE_ATTR = "ignoreAttributeTooltip";
private static final String ID_T_ATTR_NAME = "attributeNameTooltip";
private static final String ID_T_ENABLE_LIST = "enableListTooltip";
private static final String ID_T_DISABLE_LIST = "disableListTooltip";
private static final String ID_T_L_ENABLED = "lockoutEnabledTooltip";
private static final String ID_T_L_RETURNED_BY_DEFAULT = "lockoutReturnedByDefaultTooltip";
private static final String ID_T_L_IGNORE_ATTR = "lockoutIgnoreAttributeTooltip";
private static final String ID_T_L_ATTR_NAME = "lockoutAttributeNameTooltip";
private static final String ID_T_L_NORMAL_LIST = "lockoutNormalListTooltip";
private static final String ID_T_L_LOCKED_LIST = "lockoutLockedListTooltip";
private static final String ID_T_V_FROM_ENABLED = "validFromEnabledTooltip";
private static final String ID_T_V_FROM_RETURN = "validFromReturnedTooltip";
private static final String ID_T_V_TO_ENABLED = "validToEnabledTooltip";
Expand Down Expand Up @@ -83,20 +96,12 @@ protected void initLayout(PageResourceWizard parentPage) {
new PropertyModel<Boolean>(getModel(), "capability.validTo.returnedByDefault"));
add(validToReturned);

CheckBox statusEnabled = new CheckBox(ID_CHECK_STATUS_ENABLED,
new PropertyModel<Boolean>(getModel(), "capability.status.enabled"));
add(statusEnabled);

CheckBox statusReturned = new CheckBox(ID_CHECK_STATUS_RETURNED,
new PropertyModel<Boolean>(getModel(), "capability.status.returnedByDefault"));
add(statusReturned);

CheckBox statusIgnore = new CheckBox(ID_CHECK_STATUS_IGNORE,
new PropertyModel<Boolean>(getModel(), "capability.status.ignoreAttribute"));
add(statusIgnore);
add(new CheckBox(ID_CHECK_STATUS_ENABLED, new PropertyModel<Boolean>(getModel(), "capability.status.enabled")));
add(new CheckBox(ID_CHECK_STATUS_RETURNED, new PropertyModel<Boolean>(getModel(), "capability.status.returnedByDefault")));
add(new CheckBox(ID_CHECK_STATUS_IGNORE, new PropertyModel<Boolean>(getModel(), "capability.status.ignoreAttribute")));

MultiValueTextPanel statusEnableList = new MultiValueTextPanel<String>(ID_STATUS_ENABLE_LIST,
new PropertyModel<List<String>>(getModel(), "capability.status.enableValue"), parentPage.getReadOnlyModel()) {
new PropertyModel<List<String>>(getModel(), "capability.status.enableValue"), parentPage.getReadOnlyModel(), false) {

@Override
protected StringResourceModel createEmptyItemPlaceholder(){
Expand All @@ -106,7 +111,7 @@ protected StringResourceModel createEmptyItemPlaceholder(){
add(statusEnableList);

MultiValueTextPanel statusDisableList = new MultiValueTextPanel<String>(ID_STATUS_DISABLE_LIST,
new PropertyModel<List<String>>(getModel(), "capability.status.disableValue"), parentPage.getReadOnlyModel()) {
new PropertyModel<List<String>>(getModel(), "capability.status.disableValue"), parentPage.getReadOnlyModel(), false) {

@Override
protected StringResourceModel createEmptyItemPlaceholder(){
Expand All @@ -122,6 +127,44 @@ protected StringResourceModel createEmptyItemPlaceholder(){
createAttributeChoiceModel(renderer), renderer);
add(statusChoice);

add(new CheckBox(ID_CHECK_LOCKOUT_ENABLED, new PropertyModel<Boolean>(getModel(), "capability.lockoutStatus.enabled")));
add(new CheckBox(ID_CHECK_LOCKOUT_RETURNED, new PropertyModel<Boolean>(getModel(), "capability.lockoutStatus.returnedByDefault")));
add(new CheckBox(ID_CHECK_LOCKOUT_IGNORE, new PropertyModel<Boolean>(getModel(), "capability.lockoutStatus.ignoreAttribute")));

MultiValueTextPanel lockoutNormalList = new MultiValueTextPanel<String>(ID_LOCKOUT_NORMAL_LIST,
new PropertyModel<List<String>>(getModel(), "capability.lockoutStatus.normalValue"), parentPage.getReadOnlyModel(), false) {

@Override
protected StringResourceModel createEmptyItemPlaceholder() {
return createStringResource("capabilityActivationPanel.list.placeholder");
}
};
add(lockoutNormalList);

MultiValueTextPanel lockoutLockedList = new MultiValueTextPanel<String>(ID_LOCKOUT_LOCKED_LIST,
new PropertyModel<List<String>>(getModel(), "capability.lockoutStatus.lockedValue"), parentPage.getReadOnlyModel(), false) {

@Override
protected StringResourceModel createEmptyItemPlaceholder(){
return createStringResource("capabilityActivationPanel.list.placeholder");
}
};
add(lockoutLockedList);

IChoiceRenderer<QName> lockoutRenderer = new QNameChoiceRenderer(true);

DropDownChoice lockoutChoice = new DropDownChoice<>(ID_SELECT_LOCKOUT,
new PropertyModel<QName>(getModel(), "capability.lockoutStatus.attribute"),
createAttributeChoiceModel(lockoutRenderer), lockoutRenderer);
add(lockoutChoice);

add(WebComponentUtil.createHelp(ID_T_L_ENABLED));
add(WebComponentUtil.createHelp(ID_T_L_RETURNED_BY_DEFAULT));
add(WebComponentUtil.createHelp(ID_T_L_IGNORE_ATTR));
add(WebComponentUtil.createHelp(ID_T_L_ATTR_NAME));
add(WebComponentUtil.createHelp(ID_T_L_NORMAL_LIST));
add(WebComponentUtil.createHelp(ID_T_L_LOCKED_LIST));

Label enabledTooltip = new Label(ID_T_ENABLED);
enabledTooltip.add(new InfoTooltipBehavior());
add(enabledTooltip);
Expand Down
Expand Up @@ -65,10 +65,11 @@ protected void onUpdate(AjaxRequestTarget target) {
});
add(enabled);

MultiValueTextPanel onConnector = new MultiValueTextPanel(ID_ON_CONNECTOR, prepareOnConnectorModel(), parentPage.getReadOnlyModel());
MultiValueTextPanel onConnector = new MultiValueTextPanel(ID_ON_CONNECTOR, prepareOnConnectorModel(), parentPage.getReadOnlyModel(), true);
add(onConnector);

MultiValueTextPanel onResource = new MultiValueTextPanel(ID_ON_RESOURCE, Model.of(prepareOnResourceModel()), parentPage.getReadOnlyModel());
MultiValueTextPanel onResource = new MultiValueTextPanel(ID_ON_RESOURCE, Model.of(prepareOnResourceModel()), parentPage.getReadOnlyModel(),
true);
add(onResource);

Label enabledTooltip = new Label(ID_T_ENABLED);
Expand Down
Expand Up @@ -137,7 +137,7 @@ protected void initLayout(NonEmptyModel<Boolean> readOnlyModel) {
add(kind);

MultiValueTextPanel intent = new MultiValueTextPanel<>(ID_INTENT,
new PropertyModel<List<String>>(getModel(), "intent"), readOnlyModel);
new PropertyModel<List<String>>(getModel(), "intent"), readOnlyModel, true);
intent.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
add(intent);

Expand Down Expand Up @@ -226,12 +226,12 @@ public void onClick(AjaxRequestTarget target) {
add(tolerant);

MultiValueTextPanel tolerantVP = new MultiValueTextPanel<>(ID_TOLERANT_VP,
new PropertyModel<List<String>>(getModel(), "tolerantValuePattern"), readOnlyModel);
new PropertyModel<List<String>>(getModel(), "tolerantValuePattern"), readOnlyModel, true);
tolerantVP.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
add(tolerantVP);

MultiValueTextPanel intolerantVP = new MultiValueTextPanel<>(ID_INTOLERANT_VP,
new PropertyModel<List<String>>(getModel(), "intolerantValuePattern"), readOnlyModel);
new PropertyModel<List<String>>(getModel(), "intolerantValuePattern"), readOnlyModel, true);
intolerantVP.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
add(intolerantVP);

Expand Down
Expand Up @@ -267,12 +267,12 @@ public void onClick(AjaxRequestTarget target) {
add(tolerant);

MultiValueTextPanel tolerantVP = new MultiValueTextPanel<>(ID_TOLERANT_VP,
new PropertyModel<List<String>>(getModel(), "tolerantValuePattern"), readOnlyModel);
new PropertyModel<List<String>>(getModel(), "tolerantValuePattern"), readOnlyModel, true);
tolerantVP.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
add(tolerantVP);

MultiValueTextPanel intolerantVP = new MultiValueTextPanel<>(ID_INTOLERANT_VP,
new PropertyModel<List<String>>(getModel(), "intolerantValuePattern"), readOnlyModel);
new PropertyModel<List<String>>(getModel(), "intolerantValuePattern"), readOnlyModel, true);
intolerantVP.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
add(intolerantVP);

Expand Down
Expand Up @@ -35,7 +35,6 @@
import org.apache.wicket.markup.html.form.EnumChoiceRenderer;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.IChoiceRenderer;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
Expand Down Expand Up @@ -290,7 +289,7 @@ protected IChoiceRenderer<String> createRenderer() {

// TODO - create some nice ItemPathType editor in near future
MultiValueTextPanel source = new MultiValueTextPanel<>(ID_SOURCE,
new PropertyModel<List<String>>(model, MappingTypeDto.F_SOURCE), readOnlyModel);
new PropertyModel<List<String>>(model, MappingTypeDto.F_SOURCE), readOnlyModel, true);
form.add(source);

// TODO - create some nice ItemPathType editor in near future
Expand Down

0 comments on commit f22ecb8

Please sign in to comment.