Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Sep 14, 2018
2 parents 8f5031d + 48528a6 commit ecce632
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 59 deletions.
Expand Up @@ -24,6 +24,7 @@
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.behavior.AttributeAppender;
import org.apache.wicket.feedback.ComponentFeedbackMessageFilter;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.form.TextField;
Expand Down Expand Up @@ -82,14 +83,16 @@ protected void onInitialize() {

textWrapper.setOutputMarkupId(true);

TextField<String> text = new TextField<>(ID_TEXT, createTextModel());
IModel<String> textModel = createTextModel();
TextField<String> text = new TextField<>(ID_TEXT, textModel);
text.add(new AjaxFormComponentUpdatingBehavior("blur") {
private static final long serialVersionUID = 1L;

@Override
protected void onUpdate(AjaxRequestTarget ajaxRequestTarget) {
}
});
text.add(AttributeAppender.append("title", textModel));
text.setRequired(isRequired());
text.setEnabled(false);
textWrapper.add(text);
Expand Down
Expand Up @@ -928,44 +928,6 @@ private boolean isEnum(PrismProperty property) {
return (definition.getAllowedValues() != null && definition.getAllowedValues().size() > 0);
}

// TODO - try to get rid of <br> attributes when creating new lines in
// association attributes pop-up
private String createAssociationTooltipText(PrismProperty property) {
StringBuilder sb = new StringBuilder();
sb.append(getString("prismValuePanel.message.association.attributes")).append("<br>");

if (property.getParent() != null && property.getParent().getParent() != null) {
PrismObject<ShadowType> shadowPrism = (PrismObject<ShadowType>) property.getParent().getParent();

Collection<ResourceAttribute<?>> attributes = ShadowUtil.getAttributes(shadowPrism);
if (attributes == null || attributes.isEmpty()) {
return sb.toString();
}

// TODO - this is a dirty fix for situation, when attribute value is
// too long and it is a string without white chars,
// thus it will not break in tooltip. break-all is also not good,
// since it can brake in the middle of words. What we
// are doing here is replacing every, with ,&#8203;, &#8203; (the
// same with @) is a zero-width space, so the attribute value
// will break after comma. This dirty fix will be removed when
// association editor is completed.
for (ResourceAttribute<?> attr : attributes) {
for (Object realValue : attr.getRealValues()) {
sb.append(getAttributeName(attr));
sb.append(":");
if (realValue != null) {
sb.append(
realValue.toString().replace(",", ",&#8203;").replace("@", "@&#8203;").replace("_", "@&#8203;"));
}
sb.append("<br>");
}
}
}

return sb.toString();
}

private String getAttributeName(ResourceAttribute<?> attr) {
if (attr.getDisplayName() != null) {
return attr.getDisplayName();
Expand Down
Expand Up @@ -6,6 +6,7 @@
.border-radius(@input-radius);
box-shadow: none;
border-color: @gray-lte;
text-overflow: ellipsis;
&:focus {
border-color: @light-blue;
box-shadow: none;
Expand Down
10 changes: 10 additions & 0 deletions infra/prism/src/main/resources/xml/ns/public/annotation-3.xsd
Expand Up @@ -418,6 +418,16 @@
</xsd:documentation>
</xsd:annotation>
</xsd:element>

<xsd:element name="plannedChange" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
Version of data model in which the item is likely to be changed in a non-compatible way.
This annotation is used for items that will be retained in future versions, but their definition is likely to change
in a non-compatible way. It may also be used for major change in meaning or behavior of the item.
</xsd:documentation>
</xsd:annotation>
</xsd:element>

<xsd:element name="label" type="xsd:string">
<xsd:annotation>
Expand Down
Expand Up @@ -9683,7 +9683,18 @@
<xsd:annotation>
<xsd:documentation>
Object classes that will be processed by this definition.

This property should NOT be multi-value. Multiple object classes here do not
make sense any more. That might make sense in early midPoint versions. But
we cannot have several object classes that map to the same kind/intent.
This is still formally multi-valued property in the schema, so we won't break
upgrades. But multiple values in this property won't work.
</xsd:documentation>
<xsd:appinfo>
<!-- This property will be set to single-value. Therefore there will be incompatible
change in 4.0. Thereofre marking it, so it won't escape the review. -->
<a:plannedChange>4.0</a:plannedChange>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="kind" type="tns:ShadowKindType" minOccurs="0" maxOccurs="1">
Expand Down Expand Up @@ -21499,14 +21510,14 @@
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="left" type="tns:MergeStategyType" minOccurs="0" maxOccurs="1" default="ignore">
<xsd:element name="left" type="tns:MergeStrategyType" minOccurs="0" maxOccurs="1" default="ignore">
<xsd:annotation>
<xsd:documentation>
Strategy to process values from the left-hand-side object.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="right" type="tns:MergeStategyType" minOccurs="0" maxOccurs="1" default="ignore">
<xsd:element name="right" type="tns:MergeStrategyType" minOccurs="0" maxOccurs="1" default="ignore">
<xsd:annotation>
<xsd:documentation>
Strategy to process values from the right-hand-side object.
Expand Down Expand Up @@ -21562,7 +21573,7 @@
</xsd:complexContent>
</xsd:complexType>

<xsd:simpleType name="MergeStategyType">
<xsd:simpleType name="MergeStrategyType">
<xsd:annotation>
<xsd:documentation>
TODO
Expand Down
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016-2017 Evolveum
* Copyright (c) 2016-2018 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -74,7 +74,7 @@
import com.evolveum.midpoint.xml.ns._public.common.common_3.ItemMergeConfigurationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ItemRefMergeConfigurationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.MergeConfigurationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.MergeStategyType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.MergeStrategyType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ProjectionMergeConfigurationType;
Expand Down Expand Up @@ -414,7 +414,7 @@ private <O extends ObjectType> List<ShadowType> getProjections(PrismObject<O> ob
return projections;
}

private void takeProjections(MergeStategyType strategy, List<ShadowType> mergedProjections,
private void takeProjections(MergeStrategyType strategy, List<ShadowType> mergedProjections,
List<ShadowType> matchedProjections, List<ShadowType> candidateProjections,
List<ShadowType> projectionsLeft, List<ShadowType> projectionsRight,
ProjectionMergeConfigurationType projectionMergeConfig) {
Expand All @@ -431,10 +431,10 @@ private void takeProjections(MergeStategyType strategy, List<ShadowType> mergedP
LOGGER.trace("Projection matches {}", candidateProjection);
matchedProjections.add(candidateProjection);

if (strategy == MergeStategyType.TAKE) {
if (strategy == MergeStrategyType.TAKE) {
mergedProjections.add(candidateProjection);

} else if (strategy == null || strategy == MergeStategyType.IGNORE) {
} else if (strategy == null || strategy == MergeStrategyType.IGNORE) {
// Nothing to do here

} else {
Expand Down Expand Up @@ -466,17 +466,17 @@ private boolean projectionMatches(ShadowType candidateProjection,
return true;
}

private void takeUnmatchedProjections(MergeStategyType strategy, List<ShadowType> mergedProjections,
private void takeUnmatchedProjections(MergeStrategyType strategy, List<ShadowType> mergedProjections,
List<ShadowType> matchedProjections, List<ShadowType> candidateProjections) {
if (strategy == MergeStategyType.TAKE) {
if (strategy == MergeStrategyType.TAKE) {

for (ShadowType candidateProjection: candidateProjections) {
if (!hasProjection(matchedProjections, candidateProjection)) {
mergedProjections.add(candidateProjection);
}
}

} else if (strategy == null || strategy == MergeStategyType.IGNORE) {
} else if (strategy == null || strategy == MergeStrategyType.IGNORE) {
return;
} else {
throw new UnsupportedOperationException("Merge strategy "+strategy+" is not supported");
Expand Down Expand Up @@ -555,10 +555,10 @@ private <O extends ObjectType, I extends Item> ItemDelta mergeItem(PrismObject<O
}

ItemDelta itemDelta = itemDefinition.createEmptyDelta(itemPath);
MergeStategyType leftStrategy = itemMergeConfig.getLeft();
MergeStategyType rightStrategy = itemMergeConfig.getRight();
if (leftStrategy == null || leftStrategy == MergeStategyType.IGNORE) {
if (rightStrategy == null || rightStrategy == MergeStategyType.IGNORE) {
MergeStrategyType leftStrategy = itemMergeConfig.getLeft();
MergeStrategyType rightStrategy = itemMergeConfig.getRight();
if (leftStrategy == null || leftStrategy == MergeStrategyType.IGNORE) {
if (rightStrategy == null || rightStrategy == MergeStrategyType.IGNORE) {
// IGNORE both
if (itemLeft == null) {
return null;
Expand All @@ -578,8 +578,8 @@ private <O extends ObjectType, I extends Item> ItemDelta mergeItem(PrismObject<O
return itemDelta;
}
} else {
if (rightStrategy == null || rightStrategy == MergeStategyType.IGNORE) {
if (leftStrategy == MergeStategyType.TAKE) {
if (rightStrategy == null || rightStrategy == MergeStrategyType.IGNORE) {
if (leftStrategy == MergeStrategyType.TAKE) {
// TAKE left, IGNORE right
return null;
} else {
Expand Down Expand Up @@ -650,14 +650,14 @@ private Collection<PrismValue> diffValues(List<PrismValue> currentValues, Collec
}

private <O extends ObjectType, I extends Item> Collection<PrismValue> getValuesToTake(PrismObject<O> objectLeft, PrismObject<O> objectRight,
String side, I origItem, MergeStategyType strategy, Expression<PrismValue, ItemDefinition> valueExpression, Task task, OperationResult result)
String side, I origItem, MergeStrategyType strategy, Expression<PrismValue, ItemDefinition> valueExpression, Task task, OperationResult result)
throws ConfigurationException, SchemaException, ExpressionEvaluationException, ObjectNotFoundException, CommunicationException, SecurityViolationException {
if (origItem == null) {
return new ArrayList<>(0);
}
if (strategy == MergeStategyType.TAKE) {
if (strategy == MergeStrategyType.TAKE) {
return cleanContainerIds(origItem.getClonedValues());
} else if (strategy == MergeStategyType.EXPRESSION) {
} else if (strategy == MergeStrategyType.EXPRESSION) {
if (valueExpression == null) {
throw new ConfigurationException("Expression strategy specified but no expression present");
}
Expand Down

0 comments on commit ecce632

Please sign in to comment.