Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Evolveum/midpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Sep 8, 2015
2 parents 5ed4203 + 08fb581 commit 674c541
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
Expand Up @@ -630,7 +630,7 @@ private ReferenceDelta computeReferenceDeltas(ReferenceWrapper referenceWrapper,
private void addItemDelta(ItemWrapper itemWrapper, ItemDelta pDelta, ItemDefinition propertyDef,
ItemPath path) {
for (ValueWrapper valueWrapper : itemWrapper.getValues()) {
valueWrapper.normalize();
valueWrapper.normalize(propertyDef.getPrismContext());
ValueStatus valueStatus = valueWrapper.getStatus();
if (!valueWrapper.hasValueChanged()
&& (ValueStatus.NOT_CHANGED.equals(valueStatus) || ValueStatus.ADDED.equals(valueStatus))) {
Expand Down Expand Up @@ -785,7 +785,7 @@ private ObjectDelta createAddingObjectDelta() throws SchemaException {
continue;
}
for (ValueWrapper valueWrapper : propertyWrapper.getValues()) {
valueWrapper.normalize();
valueWrapper.normalize(object.getPrismContext());
if (!valueWrapper.hasValueChanged()
|| ValueStatus.DELETED.equals(valueWrapper.getStatus())) {
continue;
Expand Down Expand Up @@ -824,7 +824,6 @@ private ObjectDelta createAddingObjectDelta() throws SchemaException {

private void cleanupEmptyContainers(PrismContainer container) {
List<PrismContainerValue> values = container.getValues();

List<PrismContainerValue> valuesToBeRemoved = new ArrayList<PrismContainerValue>();
for (PrismContainerValue value : values) {
List<? extends Item> items = value.getItems();
Expand Down
Expand Up @@ -207,7 +207,7 @@ public boolean isEnabled() {
private int countUsableValues(ItemWrapper property) {
int count = 0;
for (ValueWrapper value : property.getValues()) {
value.normalize();
value.normalize(property.getItemDefinition().getPrismContext());

if (ValueStatus.DELETED.equals(value.getStatus())) {
continue;
Expand All @@ -225,7 +225,7 @@ private int countUsableValues(ItemWrapper property) {
private List<ValueWrapper> getUsableValues(ItemWrapper property) {
List<ValueWrapper> values = new ArrayList<>();
for (ValueWrapper value : property.getValues()) {
value.normalize();
value.normalize(property.getItemDefinition().getPrismContext());
if (ValueStatus.DELETED.equals(value.getStatus())) {
continue;
}
Expand All @@ -238,7 +238,7 @@ private List<ValueWrapper> getUsableValues(ItemWrapper property) {
private int countNonDeletedValues(ItemWrapper property) {
int count = 0;
for (ValueWrapper value : property.getValues()) {
value.normalize();
value.normalize(property.getItemDefinition().getPrismContext());
if (ValueStatus.DELETED.equals(value.getStatus())) {
continue;
}
Expand All @@ -249,7 +249,7 @@ private int countNonDeletedValues(ItemWrapper property) {

private boolean hasEmptyPlaceholder(ItemWrapper property) {
for (ValueWrapper value : property.getValues()) {
value.normalize();
value.normalize(property.getItemDefinition().getPrismContext());
if (ValueStatus.ADDED.equals(value.getStatus()) && !value.hasValueChanged()) {
return true;
}
Expand Down
Expand Up @@ -16,15 +16,18 @@

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

import com.evolveum.midpoint.prism.PrismContext;
import com.evolveum.midpoint.prism.PrismPropertyValue;
import com.evolveum.midpoint.prism.PrismReferenceValue;
import com.evolveum.midpoint.prism.PrismValue;
import com.evolveum.midpoint.prism.polystring.PolyString;
import com.evolveum.midpoint.prism.util.CloneUtil;
import com.evolveum.midpoint.prism.util.PrismUtil;
import com.evolveum.midpoint.util.DisplayableValue;
import com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType;

import org.apache.commons.lang.Validate;
import org.apache.cxf.common.util.PrimitiveUtils;

import java.io.Serializable;

Expand Down Expand Up @@ -111,14 +114,18 @@ public void setStatus(ValueStatus status) {
this.status = status;
}

public void normalize() {
public void normalize(PrismContext prismContext) {
if (value instanceof PrismPropertyValue) {
PrismPropertyValue ppVal = (PrismPropertyValue) value;
if (ppVal.getValue() instanceof PolyString) {
PolyString poly = (PolyString) ppVal.getValue();
if (poly.getOrig() == null) {
ppVal.setValue((T) new PolyString(""));
}
if (prismContext != null){
PrismUtil.recomputePrismPropertyValue(ppVal, prismContext);
}

} else if (ppVal.getValue() instanceof DisplayableValue) {
DisplayableValue displayableValue = (DisplayableValue) ppVal.getValue();
ppVal.setValue((T) displayableValue.getValue());
Expand Down
8 changes: 4 additions & 4 deletions testing/selenidetest/testng.xml
Expand Up @@ -18,10 +18,10 @@
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="selenidetests" parallel="false">
<parameter name="site.url" value="http://localhost:8080/midpoint"/>
<!--<suite-files>-->
<!--<suite-file path="./basic-tests-suite.xml"/>-->
<!--</suite-files>-->
<suite-files>
<suite-file path="./complex-test-suite.xml"/>
<suite-file path="./basic-tests-suite.xml"/>
</suite-files>
<!--<suite-files>-->
<!--<suite-file path="./complex-test-suite.xml"/>-->
<!--</suite-files>-->
</suite>

0 comments on commit 674c541

Please sign in to comment.