Skip to content

Commit

Permalink
Merge branch 'master' into closure
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Oct 6, 2014
2 parents 42b59d3 + 53a13c1 commit bd5f645
Show file tree
Hide file tree
Showing 76 changed files with 1,555 additions and 565 deletions.
2 changes: 1 addition & 1 deletion build-system/pom.xml
Expand Up @@ -45,7 +45,7 @@
<commons.io.version>2.0.1</commons.io.version>
<commons.lang.version>2.6</commons.lang.version>
<commons.cli>1.2</commons.cli>
<cxf.version>3.0.1.e1</cxf.version>
<cxf.version>3.0.1.e2</cxf.version>
<cxf-xjc.version>3.0.1</cxf-xjc.version>
<dbunit.version>2.4.7</dbunit.version>
<jaxb-api.version>2.2.9</jaxb-api.version>
Expand Down
Expand Up @@ -233,6 +233,7 @@ public PrismContainerValue getNewValue() throws SchemaException {
} else {
ObjectReferenceType ref = new ObjectReferenceType();
ref.setOid(this.tenantRef.getOid());
ref.setType(OrgType.COMPLEX_TYPE);
newAssignment.setTenantRef(ref);
}
}
Expand Down
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 @@ -35,11 +35,10 @@
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.markup.html.form.EnumChoiceRenderer;
import org.apache.wicket.markup.html.form.IChoiceRenderer;
import org.apache.wicket.markup.html.form.TextArea;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.*;
import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.PropertyModel;
Expand All @@ -66,6 +65,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 +95,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 All @@ -108,6 +112,7 @@ protected void onUpdate(AjaxRequestTarget target) {
});
type.setOutputMarkupId(true);
type.setOutputMarkupPlaceholderTag(true);
type.setNullValid(true);
add(type);

WebMarkupContainer languageContainer = new WebMarkupContainer(ID_LANGUAGE_CONTAINER);
Expand Down Expand Up @@ -180,14 +185,17 @@ 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);

AjaxLink update = new AjaxLink(ID_BUTTON_UPDATE) {
AjaxSubmitLink update = new AjaxSubmitLink(ID_BUTTON_UPDATE) {

@Override
public void onClick(AjaxRequestTarget target) {
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
updateExpressionPerformed(target);
}
};
Expand Down Expand Up @@ -246,8 +254,19 @@ protected void updateExpressionPerformed(AjaxRequestTarget target){
/**
* Override this in component with ExpressionEditorPanel to provide additional functionality when expression is updated
* */
public void performExpressionHook(AjaxRequestTarget target){
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 All @@ -24,6 +24,7 @@ ExpressionEditorPanel.message.cantSerialize=Could not create JAXBElement<?> from
ExpressionEditorPanel.message.expressionSuccess=Expression has been update successfully.

policyRef.nullValid=Choose One
type.nullValid=Choose One
ExpressionEvaluatorType.LITERAL=Literal
ExpressionEvaluatorType.AS_IS=As is
ExpressionEvaluatorType.PATH=Path
Expand Down
Expand Up @@ -42,7 +42,7 @@
</dt>
<dd>
<!--TODO - enable this button when problem with SearchFilterType and RootXNode serialization is fixed-->
<a wicket:id="update" class="btn btn-success disabled">
<a wicket:id="update" class="btn btn-success">
<span><wicket:message key="SearchFilterPanel.button.update" /></span>
</a>
</dd>
Expand Down
Expand Up @@ -16,7 +16,6 @@

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

import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.util.logging.LoggingUtils;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
Expand All @@ -25,7 +24,8 @@
import com.evolveum.midpoint.web.component.util.SimplePanel;
import com.evolveum.prism.xml.ns._public.query_3.SearchFilterType;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.TextArea;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.PropertyModel;
Expand All @@ -41,7 +41,7 @@ public class SearchFilterPanel<T extends SearchFilterType> extends SimplePanel<T
private static final String ID_FILTER_CLAUSE = "filterClause";
private static final String ID_BUTTON_UPDATE = "update";

private IModel<SearchFilterTypeDto> model;
protected IModel<SearchFilterTypeDto> model;

public SearchFilterPanel(String id, IModel<T> model){
super(id, model);
Expand Down Expand Up @@ -71,10 +71,10 @@ protected void initLayout(){
new PropertyModel<String>(model, SearchFilterTypeDto.F_FILTER_CLAUSE));
add(filterClause);

AjaxLink update = new AjaxLink(ID_BUTTON_UPDATE) {
AjaxSubmitLink update = new AjaxSubmitLink(ID_BUTTON_UPDATE) {

@Override
public void onClick(AjaxRequestTarget target) {
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
updateClausePerformed(target);
}
};
Expand All @@ -86,7 +86,7 @@ private void updateClausePerformed(AjaxRequestTarget target){
model.getObject().updateFilterClause(getPageBase().getPrismContext());

success(getString("SearchFilterPanel.message.expressionSuccess"));
} catch (SchemaException e){
} catch (Exception e){
LoggingUtils.logException(LOGGER, "Could not create MapXNode from provided XML filterClause.", e);
error(getString("SearchFilterPanel.message.cantSerialize"));
}
Expand All @@ -98,7 +98,5 @@ private void updateClausePerformed(AjaxRequestTarget target){
/**
* Override this in component with SearchFilterPanel to provide additional functionality when filterClause is updated
* */
public void performFilterClauseHook(AjaxRequestTarget target){
target.add();
}
public void performFilterClauseHook(AjaxRequestTarget target){}
}
Expand Up @@ -17,17 +17,14 @@
package com.evolveum.midpoint.web.component.input.dto;

import com.evolveum.midpoint.prism.PrismContext;
import com.evolveum.midpoint.prism.xnode.MapXNode;
import com.evolveum.midpoint.prism.xnode.RootXNode;
import com.evolveum.midpoint.prism.xnode.XNode;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.util.logging.LoggingUtils;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.prism.xml.ns._public.query_3.SearchFilterType;
import org.apache.commons.lang.StringUtils;

import javax.xml.namespace.QName;
import java.io.Serializable;

/**
Expand Down Expand Up @@ -56,13 +53,12 @@ public SearchFilterTypeDto(SearchFilterType filter, PrismContext prismContext){
}

private String loadFilterClause(PrismContext prismContext){
MapXNode clause = filterObject.getFilterClauseXNode();
String fClause;

try {
//TODO - fix the problem with RootElement
RootXNode rootClause = new RootXNode(new QName("fixMe"), clause);
fClause = prismContext.serializeXNodeToString(rootClause, PrismContext.LANG_XML);
RootXNode clause = filterObject.getFilterClauseAsRootXNode();

fClause = prismContext.serializeXNodeToString(clause, PrismContext.LANG_XML);
} catch (SchemaException e){
LoggingUtils.logException(LOGGER, "Could not load filterClause from SearchFilterType object.", e);

Expand All @@ -84,11 +80,14 @@ public void updateFilterClause(PrismContext context) throws SchemaException{
LOGGER.trace("Filter Clause to serialize: " + filterClause);
}

XNode filterClauseNode = context.parseToXNode(filterClause, PrismContext.LANG_XML);
RootXNode filterClauseNode = (RootXNode) context.parseToXNode(filterClause, PrismContext.LANG_XML);

filterObject.setFilterClauseXNode(filterClauseNode);
} else {
String oldDescription = filterObject.getDescription();

MapXNode newClause = new MapXNode();
newClause.setParent(filterClauseNode);
filterObject.setFilterClauseXNode(newClause);
filterObject = new SearchFilterType();
filterObject.setDescription(oldDescription);
}
}

Expand Down
Expand Up @@ -95,10 +95,15 @@ public boolean correspondsTo(ProgressInformation newStatus) {
if (activityType != newStatus.getActivityType()) {
return false;
}
if (activityType == RESOURCE_OBJECT_OPERATION
&& (resourceShadowDiscriminator == null ||
!resourceShadowDiscriminator.equals(newStatus.getResourceShadowDiscriminator()))) {
return false;
if (activityType == RESOURCE_OBJECT_OPERATION) {
if (resourceShadowDiscriminator != null &&
!resourceShadowDiscriminator.equals(newStatus.getResourceShadowDiscriminator())) {
return false;
}
if (resourceShadowDiscriminator == null && newStatus.getResourceShadowDiscriminator() != null) {
// actually, we consider all resource-related records with null RSD to be equal (even if they deal with different resources)
return false;
}
}
return true;
}
Expand Down
Expand Up @@ -26,6 +26,7 @@
import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType;
import org.apache.commons.lang.StringUtils;
import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.wizard.IWizard;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.model.AbstractReadOnlyModel;
Expand All @@ -49,15 +50,13 @@ public WizardStep() {

@Override
public Component getHeader(String id, Component parent, IWizard wizard) {
Label header = new Label(id, new AbstractReadOnlyModel<String>() {
return new Label(id, new AbstractReadOnlyModel<String>() {

@Override
public String getObject() {
return getTitle();
}
});

return header;
}

public PageBase getPageBase() {
Expand Down Expand Up @@ -127,8 +126,8 @@ protected IValidator<String> createObjectClassValidator(final IModel<List<QName>
return new IValidator<String>() {

@Override
public void validate(IValidatable<String> validatable) {
String value = validatable.getValue();
public void validate(IValidatable<String> validated) {
String value = validated.getValue();
List<QName> list = model.getObject();
List<String> stringList = new ArrayList<>();

Expand All @@ -138,6 +137,8 @@ public void validate(IValidatable<String> validatable) {

if(!stringList.contains(value)){
error(createStringResource("SchemaHandlingStep.message.validationError", value).getString());
AjaxRequestTarget target = getRequestCycle().find(AjaxRequestTarget.class);
target.add(getPageBase().getFeedbackPanel());
}
}
};
Expand Down
Expand Up @@ -14,4 +14,5 @@
# limitations under the License.
#

WizardStep.title=
WizardStep.title=
SchemaHandlingStep.message.validationError=Inserted objectClass value: '{0}' is not valid. Please provide valid objectClass value.

0 comments on commit bd5f645

Please sign in to comment.