use of org.jvnet.jaxb2_commons.lang.Equals in project midpoint by Evolveum.
the class PrismPropertyValue method equalsComplex.
public boolean equalsComplex(PrismPropertyValue<?> other, boolean ignoreMetadata, boolean isLiteral, MatchingRule<T> matchingRule) {
if (!super.equalsComplex(other, ignoreMetadata, isLiteral)) {
return false;
}
if (this.rawElement != null && other.rawElement != null) {
return equalsRawElements((PrismPropertyValue<T>) other);
}
PrismPropertyValue<T> otherProcessed = (PrismPropertyValue<T>) other;
PrismPropertyValue<T> thisProcessed = this;
if (this.rawElement != null || other.rawElement != null) {
try {
if (this.rawElement == null) {
otherProcessed = parseRawElementToNewValue((PrismPropertyValue<T>) other, this);
} else if (other.rawElement == null) {
thisProcessed = parseRawElementToNewValue(this, (PrismPropertyValue<T>) other);
}
} catch (SchemaException e) {
// TODO: Maybe just return false?
throw new IllegalArgumentException("Error parsing the value of property " + getParent() + " using the 'other' definition " + "during a compare: " + e.getMessage(), e);
}
}
T otherRealValue = otherProcessed.getValue();
T thisRealValue = thisProcessed.getValue();
if (otherRealValue == null && thisRealValue == null) {
return true;
}
if (otherRealValue == null || thisRealValue == null) {
return false;
}
if (matchingRule != null) {
try {
return matchingRule.match(thisRealValue, otherRealValue);
} catch (SchemaException e) {
// ordinary equality mechanism instead.
return thisRealValue.equals(otherRealValue);
}
} else {
if (thisRealValue instanceof Element && otherRealValue instanceof Element) {
return DOMUtil.compareElement((Element) thisRealValue, (Element) otherRealValue, isLiteral);
}
if (thisRealValue instanceof SchemaDefinitionType && otherRealValue instanceof SchemaDefinitionType) {
SchemaDefinitionType thisSchema = (SchemaDefinitionType) thisRealValue;
return thisSchema.equals(otherRealValue, isLiteral);
// return DOMUtil.compareElement((Element)thisRealValue, (Element)otherRealValue, isLiteral);
}
if (thisRealValue instanceof byte[] && otherRealValue instanceof byte[]) {
return Arrays.equals((byte[]) thisRealValue, (byte[]) otherRealValue);
}
if (isLiteral) {
if (thisRealValue instanceof QName && otherRealValue instanceof QName) {
// we compare prefixes as well
if (!thisRealValue.equals(otherRealValue)) {
return false;
}
return StringUtils.equals(((QName) thisRealValue).getPrefix(), ((QName) otherRealValue).getPrefix());
} else if (thisRealValue instanceof Equals && otherRealValue instanceof Equals) {
return ((Equals) thisRealValue).equals(null, null, otherRealValue, LiteralEqualsStrategy.INSTANCE);
}
}
return thisRealValue.equals(otherRealValue);
}
}
Aggregations