Skip to content

Commit

Permalink
fixes for assignment/inducement panels
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Mar 6, 2018
1 parent 5b7e843 commit ef2e87e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
Expand Up @@ -19,6 +19,7 @@
import java.util.List;

import com.evolveum.midpoint.prism.Containerable;
import com.evolveum.midpoint.web.component.input.QNameEditorPanel;
import com.evolveum.midpoint.web.component.prism.ContainerValueWrapper;
import com.evolveum.midpoint.web.component.prism.ContainerWrapper;
import com.evolveum.midpoint.web.model.ContainerWrapperListFromObjectWrapperModel;
Expand All @@ -29,6 +30,8 @@
import com.evolveum.midpoint.web.component.form.Form;
import org.apache.wicket.model.Model;

import javax.xml.namespace.QName;

/**
* TODO: is this class abstract or not?
*/
Expand All @@ -44,7 +47,7 @@ public AbstractRoleAssignmentDetailsPanel(String id, Form<?> form, IModel<Contai
@Override
protected IModel<ContainerWrapper> getSpecificContainerModel() {
if (ConstructionType.COMPLEX_TYPE.equals(AssignmentsUtil.getTargetType(getModelObject().getContainerValue().getValue()))) {
ContainerWrapper<ConstructionType> constructionWrapper = getModelObject().findContainerWrapper(new ItemPath(FocusType.F_ASSIGNMENT, AssignmentType.F_CONSTRUCTION));
ContainerWrapper<ConstructionType> constructionWrapper = getModelObject().findContainerWrapper(new ItemPath(getObjectContainerPath(), AssignmentType.F_CONSTRUCTION));
constructionWrapper.setAddContainerButtonVisible(true);
constructionWrapper.setShowEmpty(true, false);
if (constructionWrapper != null && constructionWrapper.getValues() != null) {
Expand All @@ -58,14 +61,17 @@ protected IModel<ContainerWrapper> getSpecificContainerModel() {
}

if (PersonaConstructionType.COMPLEX_TYPE.equals(AssignmentsUtil.getTargetType(getModelObject().getContainerValue().getValue()))) {
ContainerWrapper<PolicyRuleType> personasWrapper = getModelObject().findContainerWrapper(new ItemPath(FocusType.F_ASSIGNMENT, AssignmentType.F_PERSONA_CONSTRUCTION));
ContainerWrapper<PolicyRuleType> personasWrapper = getModelObject().findContainerWrapper(new ItemPath(getObjectContainerPath(), AssignmentType.F_PERSONA_CONSTRUCTION));
if (personasWrapper != null && personasWrapper.getValues() != null) {
personasWrapper.getValues().forEach(vw -> vw.setShowEmpty(true, false));
}

return Model.of();
return Model.of(personasWrapper);
}
return null;
return Model.of();
}

protected QName getObjectContainerPath(){
return FocusType.F_ASSIGNMENT;
}
}
Expand Up @@ -20,6 +20,9 @@
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import org.apache.wicket.model.IModel;

import javax.xml.namespace.QName;
import java.util.List;

/**
* Created by honchar.
*/
Expand All @@ -29,4 +32,8 @@ public class InducementDetailsPanel<R extends AbstractRoleType> extends Abstract
public InducementDetailsPanel(String id, Form<?> form, IModel<ContainerValueWrapper<AssignmentType>> assignmentModel) {
super(id, form, assignmentModel);
}

protected QName getObjectContainerPath(){
return AbstractRoleType.F_INDUCEMENT;
}
}
Expand Up @@ -60,7 +60,7 @@ private void setAddContainerButtonVisibility(ContainerWrapper<PolicyRuleType> po

@Override
protected IModel<ContainerWrapper> getSpecificContainerModel() {
ContainerWrapper<PolicyRuleType> policyRuleWrapper = getModelObject().findContainerWrapper(new ItemPath(FocusType.F_ASSIGNMENT, AssignmentType.F_POLICY_RULE));
ContainerWrapper<PolicyRuleType> policyRuleWrapper = getModelObject().findContainerWrapper(new ItemPath(getModelObject().getPath(), AssignmentType.F_POLICY_RULE));
if (policyRuleWrapper != null && policyRuleWrapper.getValues() != null) {
policyRuleWrapper.getValues().forEach(vw -> vw.setShowEmpty(true, false));
}
Expand Down
Expand Up @@ -14179,7 +14179,6 @@
</xsd:documentation>
<xsd:appinfo>
<a:since>3.5</a:since>
<a:experimental>true</a:experimental>
<a:container>true</a:container>
</xsd:appinfo>
</xsd:annotation>
Expand Down

0 comments on commit ef2e87e

Please sign in to comment.