static <C extends Containerable> boolean containsRealValue(Collection<PrismContainerValue<C>> cvalCollection, PrismContainerValue<C> cval) { for (PrismContainerValue<C> colVal: cvalCollection) { if (colVal.equals(cval, EquivalenceStrategy.REAL_VALUE)) { return true; } } return false; }
public static <C extends Containerable> boolean containsRealValue(Collection<PrismContainerValue<C>> cvalCollection, PrismContainerValue<C> cval) { for (PrismContainerValue<C> colVal: cvalCollection) { if (colVal.equals(cval, EquivalenceStrategy.REAL_VALUE)) { return true; } } return false; }
private boolean equalsAssignment(PrismContainerValue<AssignmentType> other) { return assignmentCVal.equals(other, EquivalenceStrategy.IGNORE_METADATA); }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SceneImpl scene = (SceneImpl) o; if (operational != scene.operational) return false; if (name != null ? !name.equals(scene.name) : scene.name != null) return false; if (changeType != scene.changeType) return false; if (partialScenes != null ? !partialScenes.equals(scene.partialScenes) : scene.partialScenes != null) return false; if (items != null ? !items.equals(scene.items) : scene.items != null) return false; if (sourceRelPath != null ? !sourceRelPath.equals(scene.sourceRelPath) : scene.sourceRelPath != null) return false; if (sourceAbsPath != null ? !sourceAbsPath.equals(scene.sourceAbsPath) : scene.sourceAbsPath != null) return false; if (sourceValue != null ? !sourceValue.equals(scene.sourceValue) : scene.sourceValue != null) return false; if (sourceDefinition != null ? !sourceDefinition.equals(scene.sourceDefinition) : scene.sourceDefinition != null) return false; return !(sourceDelta != null ? !sourceDelta.equals(scene.sourceDelta) : scene.sourceDelta != null); }
private boolean existsEquivalentValue(PrismObject<ShadowType> shadowOld, PrismContainerValue<ShadowAssociationType> association) { ShadowType shadowType = shadowOld.asObjectable(); for (ShadowAssociationType existing : shadowType.getAssociation()) { if (existing.asPrismContainerValue().equals(association, EquivalenceStrategy.REAL_VALUE)) { // TODO better check return true; } } return false; }
private boolean existsEquivalentValue(PrismObject<?> focusOld, PrismContainerValue<AssignmentType> assignmentValue) { FocusType focusType = (FocusType) focusOld.asObjectable(); for (AssignmentType existing : focusType.getAssignment()) { if (existing.asPrismContainerValue().equals(assignmentValue, EquivalenceStrategy.REAL_VALUE)) { return true; } } return false; }
public void mergeValue(PrismContainerValue<C> otherValue) throws SchemaException { checkMutability(); Iterator<PrismContainerValue<C>> iterator = getValues().iterator(); while (iterator.hasNext()) { PrismContainerValue<C> thisValue = iterator.next(); if (thisValue.equals(otherValue)) { // Same values, nothing to merge return; } if (thisValue.getId() != null && thisValue.getId().equals(otherValue.getId())) { // Different value but same id. New value overwrites. iterator.remove(); } } PrismContainerValue<C> clonedOtherValue = otherValue.clone(); if (getDefinition() != null) { clonedOtherValue.applyDefinition(getDefinition()); } add(clonedOtherValue); }
private void swallowIntoValues(Collection<AssignmentType> assignments, AssignmentType assignmentToFind, List<ItemDelta<?, ?>> modifications) throws SchemaException { for (AssignmentType assignment : assignments) { PrismContainerValue<?> pcv = assignment.asPrismContainerValue(); PrismContainerValue<?> pcvToFind = assignmentToFind.asPrismContainerValue(); if (pcv.representsSameValue(pcvToFind, false) || pcv.equals(pcvToFind, EquivalenceStrategy.REAL_VALUE_CONSIDER_DIFFERENT_IDS)) { // TODO what if ID of the assignment being added is changed in repo? Hopefully it will be not. for (ItemDelta<?, ?> modification : modifications) { ItemPath newParentPath = modification.getParentPath().rest(2); // killing assignment + ID ItemDelta<?, ?> pathRelativeModification = modification.cloneWithChangedParentPath(newParentPath); pathRelativeModification.applyTo(pcv); } return; } } // TODO change to warning throw new IllegalStateException("We have 'plus' assignment to modify but it couldn't be found in assignment delta. Assignment=" + assignmentToFind + ", new assignments=" + assignments); }
PrismContainerValue<AssignmentType> as2ContVal = as2Type.asPrismContainerValue(); PrismContainer<AssignmentType> as2Cont = as2ContVal.getContainer(); assertTrue("Assignment not equals (ContainerValue)", as1ContVal.equals(as2ContVal)); assertTrue("Assignment not equals (ContainerValue, ignoreMetadata)", as1ContVal.equals(as2ContVal, EquivalenceStrategy.IGNORE_METADATA)); assertTrue("Assignment not equals (ContainerValue, not ignoreMetadata)", as1ContVal.equals(as2ContVal, EquivalenceStrategy.NOT_LITERAL)); assertTrue("Assignment not equivalent (ContainerValue)", as1ContVal.equivalent(as2ContVal)); assertTrue("Assignment not equals (Container)", as1Cont.equals(as2Cont));