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 7, 2016
2 parents 747818d + 2e2afd1 commit a46f857
Show file tree
Hide file tree
Showing 55 changed files with 982 additions and 278 deletions.
2 changes: 1 addition & 1 deletion build-system/pom.xml
Expand Up @@ -73,7 +73,7 @@
<h2.version>1.3.171</h2.version>
<jdbc.postgres>9.3-1102-jdbc41</jdbc.postgres>
<jdbc.mysql>5.1.31</jdbc.mysql>
<wicket.version>7.1.0</wicket.version>
<wicket.version>7.3.0</wicket.version>
<groovy.version>2.4.0</groovy.version>
<activiti-engine.version>5.19.0.2</activiti-engine.version>
<activiti-spring.version>5.19.0.2</activiti-spring.version>
Expand Down
Expand Up @@ -21,6 +21,8 @@
<dl class="dl-horizontal">
<dt>
<label wicket:id="localPartLabel"></label>
<span wicket:id="localPartRequired" style="color: #f00; font-weight: bold;"
wicket:message="title:prismPropertyPanel.required">*</span>
<i wicket:id="localPartTooltip" />
</dt>
<dd>
Expand All @@ -31,6 +33,8 @@
<dl class="dl-horizontal">
<dt>
<label wicket:id="namespaceLabel"></label>
<span wicket:id="namespaceRequired" style="color: #f00; font-weight: bold;"
wicket:message="title:prismPropertyPanel.required">*</span>
<i wicket:id="namespaceTooltip" />
</dt>
<dd>
Expand Down
Expand Up @@ -27,6 +27,7 @@
import org.apache.commons.lang.StringUtils;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.behavior.AttributeAppender;
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.TextField;
Expand All @@ -47,21 +48,18 @@ public class QNameEditorPanel extends BasePanel<ItemPathType>{
private static final String ID_LOCAL_PART = "localPart";
private static final String ID_NAMESPACE = "namespace";
private static final String ID_LOCAL_PART_LABEL = "localPartLabel";
private static final String ID_LOCAL_PART_REQUIRED = "localPartRequired";
private static final String ID_NAMESPACE_LABEL = "namespaceLabel";
private static final String ID_NAMESPACE_REQUIRED = "namespaceRequired";
private static final String ID_T_LOCAL_PART = "localPartTooltip";
private static final String ID_T_NAMESPACE = "namespaceTooltip";

private IModel<ItemPathType> itemPathModel;
private IModel<String> localpartModel;
private IModel<String> namespaceModel;

public QNameEditorPanel(String id, IModel<ItemPathType> model) {
this(id, model, "QNameEditor.label.localPart", "QNameEditor.tooltip.localPart",
"QNameEditor.label.namespace", "QNameEditor.tooltip.namespace");
}

public QNameEditorPanel(String id, IModel<ItemPathType> model, String localPartLabelKey, String localPartTooltipKey,
String namespaceLabelKey, String namespaceTooltipKey) {
String namespaceLabelKey, String namespaceTooltipKey, boolean markLocalPartAsRequired, boolean markNamespaceAsRequired) {
super(id, model);
this.itemPathModel = model;

Expand Down Expand Up @@ -106,7 +104,7 @@ public void detach() {
}
};

initLayout(localPartLabelKey, localPartTooltipKey, namespaceLabelKey, namespaceTooltipKey);
initLayout(localPartLabelKey, localPartTooltipKey, namespaceLabelKey, namespaceTooltipKey, markLocalPartAsRequired, markNamespaceAsRequired);
}

private QName itemPathToQName() {
Expand Down Expand Up @@ -139,19 +137,27 @@ public IModel<ItemPathType> getModel() {
}

private void initLayout(String localPartLabelKey, String localPartTooltipKey,
String namespaceLabelKey, String namespaceTooltipKey){
String namespaceLabelKey, String namespaceTooltipKey, boolean markLocalPartAsRequired, boolean markNamespaceAsRequired){

Label localPartLabel = new Label(ID_LOCAL_PART_LABEL, getString(localPartLabelKey));
localPartLabel.setOutputMarkupId(true);
localPartLabel.setOutputMarkupPlaceholderTag(true);
add(localPartLabel);

WebMarkupContainer localPartRequired = new WebMarkupContainer(ID_LOCAL_PART_REQUIRED);
localPartRequired.setVisible(markLocalPartAsRequired);
add(localPartRequired);

Label namespaceLabel = new Label(ID_NAMESPACE_LABEL, getString(namespaceLabelKey));
namespaceLabel.setOutputMarkupId(true);
namespaceLabel.setOutputMarkupPlaceholderTag(true);
add(namespaceLabel);

TextField localPart = new TextField<>(ID_LOCAL_PART, localpartModel);
WebMarkupContainer namespaceRequired = new WebMarkupContainer(ID_NAMESPACE_REQUIRED);
namespaceRequired.setVisible(markNamespaceAsRequired);
add(namespaceRequired);

TextField localPart = new TextField<>(ID_LOCAL_PART, localpartModel);
localPart.setOutputMarkupId(true);
localPart.setOutputMarkupPlaceholderTag(true);
localPart.setRequired(isLocalPartRequired());
Expand Down
Expand Up @@ -199,7 +199,7 @@ private <O extends ObjectType> PrismObjectDefinition<O> getDefinition(PrismObjec
private <O extends ObjectType> List<ContainerWrapper<? extends Containerable>> createCustomContainerWrapper(
ObjectWrapper<O> oWrapper, PrismObject<O> object,
PrismObjectDefinition<O> objectDefinitionForEditing,
QName name, OperationResult result) {
QName name, OperationResult result) throws SchemaException {
PrismContainer container = object.findContainer(name);
ContainerStatus status = container == null ? ContainerStatus.ADDING : ContainerStatus.MODIFYING;
List<ContainerWrapper<? extends Containerable>> list = new ArrayList<>();
Expand All @@ -222,7 +222,7 @@ private <O extends ObjectType> List<ContainerWrapper<? extends Containerable>> c
private <O extends ObjectType, C extends Containerable> void addContainerWrappers(
List<ContainerWrapper<? extends Containerable>> containerWrappers,
ObjectWrapper<O> oWrapper, PrismContainer<C> parentContainer, ItemPath path,
OperationResult result) {
OperationResult result) throws SchemaException {

PrismContainerDefinition<C> parentContainerDefinition = parentContainer.getDefinition();

Expand Down
Expand Up @@ -31,6 +31,14 @@
<wicket:message key="org.apache.wicket.extensions.wizard.last"/>
</button>
</span>
<span class="button-group">
<button class="btn btn-default" wicket:id="validate" type="submit" value="validate">
<wicket:message key="org.apache.wicket.extensions.wizard.validate"/>
</button>
<button class="btn btn-default" wicket:id="save" type="submit" value="save">
<wicket:message key="org.apache.wicket.extensions.wizard.save"/>
</button>
</span>
<span class="button-group">
<button class="btn btn-success" wicket:id="finish" type="submit" value="finish">
<wicket:message key="org.apache.wicket.extensions.wizard.finish"/>
Expand Down
Expand Up @@ -16,7 +16,12 @@

package com.evolveum.midpoint.web.component.wizard;

import com.evolveum.midpoint.web.component.AjaxButton;
import com.evolveum.midpoint.web.component.AjaxSubmitButton;
import com.evolveum.midpoint.web.page.admin.resources.PageResourceWizard;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.wizard.*;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.IFormSubmittingComponent;
import org.apache.wicket.markup.html.panel.Panel;

Expand All @@ -25,9 +30,17 @@
*/
public class WizardButtonBar extends Panel implements IDefaultButtonProvider {

private static final String ID_PREVIOUS = "previous";
private static final String ID_NEXT = "next";
private static final String ID_LAST = "last";
private static final String ID_FINISH = "finish";
private static final String ID_CANCEL = "cancel";
private static final String ID_VALIDATE = "validate";
private static final String ID_SAVE = "save";

public WizardButtonBar(String id, final Wizard wizard) {
super(id);
add(new PreviousButton("previous", wizard) {
add(new PreviousButton(ID_PREVIOUS, wizard) {
@Override
public void onClick() {
IWizardModel wizardModel = getWizardModel();
Expand All @@ -40,7 +53,7 @@ public void onClick() {
}
}
});
add(new NextButton("next", wizard) {
add(new NextButton(ID_NEXT, wizard) {
@Override
public void onClick() {
IWizardModel wizardModel = getWizardModel();
Expand All @@ -53,21 +66,9 @@ public void onClick() {
}
}
});
add(new LastButton("last", wizard) {
@Override
public void onClick() {
IWizardModel wizardModel = getWizardModel();
IWizardStep step = wizardModel.getActiveStep();
step.applyState();
if (step.isComplete()) {
wizardModel.last();
} else {
couldntSave();
}
}
});
add(new CancelButton("cancel", wizard));
add(new FinishButton("finish", wizard){
add(new LastButton(ID_LAST, wizard)); // not used at all
add(new CancelButton(ID_CANCEL, wizard));
add(new FinishButton(ID_FINISH, wizard){

@Override
public void onClick()
Expand All @@ -91,7 +92,25 @@ public boolean isEnabled() {
return activeStep == null || activeStep.isComplete();
}
});
}

add(new AjaxSubmitButton(ID_VALIDATE) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
((PageResourceWizard) getPage()).refreshIssues(target);
}
});

add(new AjaxSubmitButton(ID_SAVE) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
IWizardStep activeStep = wizard.getModelObject().getActiveStep();
if (activeStep != null) {
activeStep.applyState();
}
}
});

}

private void couldntSave() {
// we should't come here
Expand Down
Expand Up @@ -94,7 +94,11 @@ public ConfigurationStep(NonEmptyLoadableModel<PrismObject<ResourceType>> modelN
@Override
@NotNull
protected List<ContainerWrapper> load() {
return createConfigContainerWrappers();
try {
return createConfigContainerWrappers();
} catch (SchemaException e) {
throw new SystemException(e.getMessage(), e);
}
}
};
parentPage.registerDependentModel(configurationPropertiesModel);
Expand All @@ -103,7 +107,7 @@ protected List<ContainerWrapper> load() {
}

@NotNull
private List<ContainerWrapper> createConfigContainerWrappers() {
private List<ContainerWrapper> createConfigContainerWrappers() throws SchemaException {
PrismObject<ResourceType> resource = resourceModelNoFetch.getObject();
PrismContainer<ConnectorConfigurationType> configuration = resource.findContainer(ResourceType.F_CONNECTOR_CONFIGURATION);

Expand Down
Expand Up @@ -42,6 +42,8 @@ <h4 class="panel-title">
<dl class="dl-horizontal">
<dt>
<label><wicket:message key="ResourceAssociationEditor.label.kind" /></label>
<span style="color: #f00; font-weight: bold;"
wicket:message="title:prismPropertyPanel.required">*</span>
<i wicket:id="kindTooltip" wicket:message="title:SchemaHandlingStep.association.tooltip.kind"/>
</dt>
<dd>
Expand All @@ -53,6 +55,8 @@ <h4 class="panel-title">
<dl class="dl-horizontal">
<dt>
<label><wicket:message key="ResourceAssociationEditor.label.intent" /></label>
<span style="color: #f00; font-weight: bold;"
wicket:message="title:prismPropertyPanel.required">*</span>
<i wicket:id="intentTooltip" wicket:message="title:SchemaHandlingStep.association.tooltip.intent"/>
</dt>
<div wicket:id="intent" />
Expand All @@ -61,6 +65,8 @@ <h4 class="panel-title">
<dl class="dl-horizontal">
<dt>
<label><wicket:message key="ResourceAssociationEditor.label.direction" /></label>
<span style="color: #f00; font-weight: bold;"
wicket:message="title:prismPropertyPanel.required">*</span>
<i wicket:id="directionTooltip" wicket:message="title:SchemaHandlingStep.association.tooltip.direction"/>
</dt>
<dd>
Expand All @@ -71,6 +77,8 @@ <h4 class="panel-title">
<dl class="dl-horizontal">
<dt>
<label><wicket:message key="ResourceAssociationEditor.label.associationAttribute" /></label>
<span style="color: #f00; font-weight: bold;"
wicket:message="title:prismPropertyPanel.required">*</span>
<i wicket:id="associationAttributeTooltip" wicket:message="title:SchemaHandlingStep.association.tooltip.associationAttribute"/>
</dt>
<dd>
Expand All @@ -81,6 +89,8 @@ <h4 class="panel-title">
<dl class="dl-horizontal">
<dt>
<label><wicket:message key="ResourceAssociationEditor.label.valueAttribute" /></label>
<span style="color: #f00; font-weight: bold;"
wicket:message="title:prismPropertyPanel.required">*</span>
<i wicket:id="valueAttributeTooltip" wicket:message="title:SchemaHandlingStep.association.tooltip.valueAttribute"/>
</dt>
<dd>
Expand Down
Expand Up @@ -171,7 +171,7 @@ public List<QName> getObject() {

QNameEditorPanel nonSchemaRefPanel = new QNameEditorPanel(ID_ASSOCIATION_ATTRIBUTE_PANEL, new PropertyModel<ItemPathType>(getModel(), "ref"),
"SchemaHandlingStep.association.label.associationName", "SchemaHandlingStep.association.tooltip.associationLocalPart",
"SchemaHandlingStep.association.label.associationNamespace", "SchemaHandlingStep.association.tooltip.associationNamespace") {
"SchemaHandlingStep.association.label.associationNamespace", "SchemaHandlingStep.association.tooltip.associationNamespace", true, true) {
@Override
protected void onUpdate(AjaxRequestTarget target) {
target.add(parentStep.getAssociationList());
Expand Down
Expand Up @@ -25,13 +25,16 @@ <h3><span wicket:id="label"></span></h3>
<dl wicket:id="schemaRefPanel" class="dl-horizontal">
<dt>
<label><wicket:message key="ResourceAttributeEditor.label.reference" /></label>
<span style="color: #f00; font-weight: bold;"
wicket:message="title:prismPropertyPanel.required">*</span>
<i wicket:id="referenceTooltip" wicket:message="title:SchemaHandlingStep.attribute.tooltip.reference"/>
</dt>
<dd>
<select wicket:id="referenceSelect" class="form-control input-sm"></select>
</dd>
</dl>

<!--
<div wicket:id="nonSchemaReferencePanel" />
<dl class="dl-horizontal">
Expand All @@ -43,6 +46,7 @@ <h3><span wicket:id="label"></span></h3>
<input wicket:id="allowRef" type="checkbox" value="checked"/>
</dd>
</dl>
-->

<dl class="dl-horizontal">
<dt>
Expand Down
Expand Up @@ -73,9 +73,9 @@ public class ResourceAttributeEditor extends BasePanel<ResourceAttributeDefiniti

private static final String ID_LABEL = "label";
private static final String ID_SCHEMA_REF_PANEL = "schemaRefPanel";
private static final String ID_NON_SCHEMA_REF_PANEL = "nonSchemaReferencePanel";
private static final String ID_NON_SCHEMA_REF_PANEL = "nonSchemaReferencePanel"; // temporarily not used
private static final String ID_REFERENCE_SELECT = "referenceSelect";
private static final String ID_REFERENCE_ALLOW = "allowRef";
private static final String ID_REFERENCE_ALLOW = "allowRef"; // temporarily not used
private static final String ID_DISPLAY_NAME = "displayName";
private static final String ID_DESCRIPTION = "description";
private static final String ID_EXCLUSIVE_STRONG = "exclusiveStrong";
Expand Down Expand Up @@ -124,9 +124,12 @@ protected void initLayout() {
Label label = new Label(ID_LABEL, new ResourceModel("ResourceAttributeEditor.label.edit"));
add(label);

/*
TEMPORARILY DISABLED
QNameEditorPanel nonSchemaRefPanel = new QNameEditorPanel(ID_NON_SCHEMA_REF_PANEL, new PropertyModel<ItemPathType>(getModel(), "ref"),
"SchemaHandlingStep.attribute.label.attributeName", "SchemaHandlingStep.attribute.tooltip.attributeLocalPart",
"SchemaHandlingStep.attribute.label.attributeNamespace", "SchemaHandlingStep.attribute.tooltip.attributeNamespace") {
"SchemaHandlingStep.attribute.label.attributeNamespace", "SchemaHandlingStep.attribute.tooltip.attributeNamespace", true, true) {
@Override
protected void onUpdate(AjaxRequestTarget target) {
target.add(parentStep.getAttributeList());
Expand All @@ -143,6 +146,7 @@ public boolean isVisible() {
}
});
add(nonSchemaRefPanel);
*/

WebMarkupContainer schemaRefPanel = new WebMarkupContainer(ID_SCHEMA_REF_PANEL);
schemaRefPanel.setOutputMarkupId(true);
Expand Down Expand Up @@ -211,6 +215,9 @@ protected void onUpdate(AjaxRequestTarget target) {
});
schemaRefPanel.add(refSelect);

/*
TEMPORARILY DISABLED
CheckBox allowNonSchema = new CheckBox(ID_REFERENCE_ALLOW, new PropertyModel<Boolean>(this, "nonSchemaRefValueAllowed"));
allowNonSchema.add(new AjaxFormComponentUpdatingBehavior("change") {
Expand All @@ -220,6 +227,7 @@ protected void onUpdate(AjaxRequestTarget target) {
}
});
add(allowNonSchema);
*/

TextField displayName = new TextField<>(ID_DISPLAY_NAME, new PropertyModel<String>(getModel(), "displayName"));
displayName.add(new EmptyOnChangeAjaxFormUpdatingBehavior() {
Expand Down
Expand Up @@ -500,9 +500,10 @@ private void runConfirmPerformed(AjaxRequestTarget target, IModel<ReportDto> mod

// List<ReportParameterType> reportParams = new ArrayList<ReportParameterType>();
PrismContainerDefinition<ReportParameterType> paramContainterDef = getPrismContext().getSchemaRegistry().findContainerDefinitionByElementName(ReportConstants.REPORT_PARAMS_PROPERTY_NAME);
PrismContainer<ReportParameterType> paramContainer = paramContainterDef.instantiate();
PrismContainer<ReportParameterType> paramContainer;
try {

paramContainer = paramContainterDef.instantiate();
ReportParameterType reportParam = new ReportParameterType();
PrismContainerValue<ReportParameterType> reportParamValue = reportParam.asPrismContainerValue();
reportParamValue.revive(getPrismContext());
Expand Down

0 comments on commit a46f857

Please sign in to comment.