Skip to content

Commit

Permalink
Resource Wizard update:
Browse files Browse the repository at this point in the history
  - Fixed bug with incorrect <inbound/> and <outbound/> mapping handling
  - improving getting information label for mappings in wizard
  - small fix for condition labels in correlation editor
  • Loading branch information
Erik Suta committed Oct 3, 2014
1 parent 2c1c020 commit 1daa596
Show file tree
Hide file tree
Showing 12 changed files with 112 additions and 19 deletions.
Expand Up @@ -101,7 +101,7 @@ public List<AssignmentType> getAssignmentTypeList(){
}

public List<AssignmentEditorDto> loadFromAssignmentTypeList(List<AssignmentType> asgList, OperationResult result){
List<AssignmentEditorDto> list = new ArrayList<AssignmentEditorDto>();
List<AssignmentEditorDto> list = new ArrayList<>();

for (AssignmentType assignment : asgList) {
ObjectType targetObject = null;
Expand Down Expand Up @@ -221,7 +221,7 @@ public ObjectQuery getProviderQuery(){
return null;
} else {
ObjectQuery query = new ObjectQuery();
List<String> oids = new ArrayList<String>();
List<String> oids = new ArrayList<>();
oids.add(getExcludeOid());

ObjectFilter oidFilter = InOidFilter.createInOid(oids);
Expand Down Expand Up @@ -253,7 +253,7 @@ public void yesPerformed(AjaxRequestTarget target){
}

private List<InlineMenuItem> createAssignmentMenu(){
List<InlineMenuItem> items = new ArrayList<InlineMenuItem>();
List<InlineMenuItem> items = new ArrayList<>();

InlineMenuItem item = new InlineMenuItem(createStringResource("AssignmentTablePanel.menu.assign"),
new InlineMenuItemAction(){
Expand Down Expand Up @@ -300,7 +300,7 @@ public void onClick(AjaxRequestTarget target) {
}

private List<AssignmentEditorDto> getSelectedAssignments(){
List<AssignmentEditorDto> selected = new ArrayList<AssignmentEditorDto>();
List<AssignmentEditorDto> selected = new ArrayList<>();

List<AssignmentEditorDto> all = assignmentModel.getObject();

Expand Down
Expand Up @@ -20,7 +20,7 @@

<dl class="dl-horizontal">
<dt>
<label><wicket:message key="ExpressionEditorPanel.label.type" /></label>
<label wicket:id="typeLabel"></label>
</dt>
<dd>
<select wicket:id="type" class="form-control input-sm"></select>
Expand All @@ -47,7 +47,7 @@

<dl class="dl-horizontal">
<dt>
<label><wicket:message key="ExpressionEditorPanel.label.expression" /></label>
<label wicket:id="expressionLabel"></label>
</dt>
<dd>
<textarea wicket:id="expression" class="form-control input-sm" rows="5"></textarea>
Expand Down
Expand Up @@ -36,6 +36,7 @@
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.markup.html.form.EnumChoiceRenderer;
import org.apache.wicket.markup.html.form.IChoiceRenderer;
Expand Down Expand Up @@ -66,6 +67,8 @@ public class ExpressionEditorPanel extends SimplePanel<ExpressionType>{
private static final String ID_LANGUAGE_CONTAINER = "languageContainer";
private static final String ID_POLICY_CONTAINER = "policyRefContainer";
private static final String ID_BUTTON_UPDATE = "update";
private static final String ID_LABEL_TYPE = "typeLabel";
private static final String ID_LABEL_EXPRESSION = "expressionLabel";

private IModel<ExpressionTypeDto> model;
private Map<String, String> policyMap = new HashMap<>();
Expand Down Expand Up @@ -94,6 +97,9 @@ protected ExpressionTypeDto load() {
protected void initLayout(){
loadModel();

Label typeLabel = new Label(ID_LABEL_TYPE, createStringResource(getTypeLabelKey()));
add(typeLabel);

DropDownChoice type = new DropDownChoice<>(ID_TYPE,
new PropertyModel<ExpressionUtil.ExpressionEvaluatorType>(model, ExpressionTypeDto.F_TYPE),
WebMiscUtil.createReadonlyModelFromEnum(ExpressionUtil.ExpressionEvaluatorType.class),
Expand Down Expand Up @@ -180,6 +186,9 @@ protected void onUpdate(AjaxRequestTarget target) {
policyRef.setNullValid(true);
policyContainer.add(policyRef);

Label expressionLabel = new Label(ID_LABEL_EXPRESSION, createStringResource(getExpressionLabelKey()));
add(expressionLabel);

TextArea expression = new TextArea<>(ID_EXPRESSION, new PropertyModel<String>(model, ExpressionTypeDto.F_EXPRESSION));
expression.setOutputMarkupId(true);
add(expression);
Expand Down Expand Up @@ -250,4 +259,17 @@ public void performExpressionHook(AjaxRequestTarget target){

}

/**
* Provide key for expression type label
* */
public String getTypeLabelKey(){
return "ExpressionEditorPanel.label.type";
}

/**
* Provide key for expression label
* */
public String getExpressionLabelKey(){
return "ExpressionEditorPanel.label.expression";
}
}
Expand Up @@ -15,7 +15,7 @@
#

ExpressionEditorPanel.label.type=Expression Type
ExpressionEditorPanel.label.language=Expression Language
ExpressionEditorPanel.label.language=Language
ExpressionEditorPanel.label.valuePolicyRef=Policy Ref.
ExpressionEditorPanel.label.expression=Expression
ExpressionEditorPanel.button.expressionSave=Update Expression
Expand Down
Expand Up @@ -24,6 +24,7 @@
import com.evolveum.midpoint.xml.ns._public.common.common_3.MappingType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceActivationDefinitionType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceBidirectionalMappingType;
import org.apache.commons.lang.StringUtils;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
import org.apache.wicket.markup.html.form.DropDownChoice;
Expand Down Expand Up @@ -119,7 +120,17 @@ protected IModel<String> createTextModel(final IModel<MappingType> model) {

@Override
public String getObject() {
return model.getObject().getName();
MappingType mapping = model.getObject();

if(mapping == null){
return null;
}

if(mapping.getName() != null && StringUtils.isNotEmpty(mapping.getName())){
return mapping.getName();
} else {
return getString("MultiValueField.nameNotSpecified");
}
}
};
}
Expand Down Expand Up @@ -147,10 +158,14 @@ protected IModel<String> createTextModel(final IModel<MappingType> model) {
public String getObject() {
MappingType mapping = model.getObject();

if(mapping != null){
if(mapping == null){
return null;
}

if(mapping.getName() != null && StringUtils.isNotEmpty(mapping.getName())){
return mapping.getName();
} else {
return null;
return getString("MultiValueField.nameNotSpecified");
}
}
};
Expand Down
Expand Up @@ -35,6 +35,7 @@
import com.evolveum.midpoint.web.page.admin.resources.PageResources;
import com.evolveum.midpoint.web.util.WebMiscUtil;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import org.apache.commons.lang.StringUtils;
import org.apache.wicket.RestartResponseException;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
Expand Down Expand Up @@ -323,10 +324,14 @@ protected IModel<String> createTextModel(final IModel<MappingType> model) {
public String getObject() {
MappingType mapping = model.getObject();

if(mapping != null){
if(mapping == null){
return null;
}

if(mapping.getName() != null && StringUtils.isNotEmpty(mapping.getName())){
return mapping.getName();
} else {
return null;
return getString("MultiValueField.nameNotSpecified");
}
}
};
Expand Down
Expand Up @@ -33,6 +33,7 @@
import com.evolveum.midpoint.web.page.admin.resources.PageResources;
import com.evolveum.midpoint.web.util.WebMiscUtil;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import org.apache.commons.lang.StringUtils;
import org.apache.wicket.RestartResponseException;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
Expand Down Expand Up @@ -221,7 +222,29 @@ public String getIdValue(QName object, int index) {
add(matchingRule);

TextField outboundLabel = new TextField<>(ID_OUTBOUND_LABEL,
new PropertyModel<String>(getModel(), "outbound.name"));
new AbstractReadOnlyModel<String>() {

@Override
public String getObject() {
ResourceAttributeDefinitionType attributeDefinition = getModel().getObject();

if(attributeDefinition == null){
return null;
}

MappingType outbound = attributeDefinition.getOutbound();

if(outbound == null){
return null;
}

if(outbound.getName() != null && StringUtils.isNotEmpty(outbound.getName())){
return outbound.getName();
} else {
return getString("MultiValueField.nameNotSpecified");
}
}
});
outboundLabel.setEnabled(false);
outboundLabel.setOutputMarkupId(true);
add(outboundLabel);
Expand All @@ -247,10 +270,14 @@ protected IModel<String> createTextModel(final IModel<MappingType> model) {
public String getObject() {
MappingType mapping = model.getObject();

if(mapping != null){
if(mapping == null){
return null;
}

if(mapping.getName() != null && StringUtils.isNotEmpty(mapping.getName())){
return mapping.getName();
} else {
return null;
return getString("MultiValueField.nameNotSpecified");
}
}
};
Expand Down
Expand Up @@ -28,6 +28,7 @@
import com.evolveum.midpoint.web.component.wizard.resource.component.schemahandling.modal.MappingEditorDialog;
import com.evolveum.midpoint.web.util.WebMiscUtil;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import org.apache.commons.lang.StringUtils;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;
import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
Expand Down Expand Up @@ -115,10 +116,14 @@ protected IModel<String> createTextModel(final IModel<MappingType> model) {
public String getObject() {
MappingType mapping = model.getObject();

if(mapping != null){
if(mapping == null){
return null;
}

if(mapping.getName() != null && StringUtils.isNotEmpty(mapping.getName())){
return mapping.getName();
} else {
return null;
return getString("MultiValueField.nameNotSpecified");
}
}
};
Expand Down
Expand Up @@ -90,6 +90,16 @@ public void performExpressionHook(AjaxRequestTarget target){
ConditionalSearchFilterEditor.this.getModel().getObject().setCondition(expression);
}
}

@Override
public String getTypeLabelKey() {
return "ConditionalSearchFilterEditor.condition.type.label";
}

@Override
public String getExpressionLabelKey() {
return "ConditionalSearchFilterEditor.condition.label";
}
};
add(expressionEditor);

Expand Down
Expand Up @@ -15,4 +15,6 @@
#

ConditionalSearchFilterEditor.label=Edit Synchronization Correlation
ConditionalSearchFilterEditor.description=Description
ConditionalSearchFilterEditor.description=Description
ConditionalSearchFilterEditor.condition.type.label=Condition Type
ConditionalSearchFilterEditor.condition.label=Condition
Expand Up @@ -65,6 +65,12 @@ public class MappingTypeDto implements Serializable {

public MappingTypeDto(MappingType mapping, PrismContext prismContext){

if(mapping != null && mapping.equals(new MappingType())){
mappingObject = mapping;
expression = ExpressionUtil.EXPRESSION_AS_IS;
expressionType = ExpressionUtil.ExpressionEvaluatorType.AS_IS;
}

if(mapping == null){
mappingObject = new MappingType();
} else {
Expand Down
Expand Up @@ -538,4 +538,5 @@ operation.com.evolveum.midpoint.model.controller.ModelController.searchObjects=S
operation.com.evolveum.midpoint.model.impl.controller.ModelDiagController.repositorySelfTest.user=Repository self test, user (Model)
operation.com.evolveum.midpoint.common.crypto.CryptoUtil.securitySelfTest=Security self test

TextField.universal.placeholder=Insert value
TextField.universal.placeholder=Insert value
MultiValueField.nameNotSpecified=(Name not specified)

0 comments on commit 1daa596

Please sign in to comment.