private boolean isContainerSingleValued(PrismContainerDefinition<?> def, PrismContainer<?> pc) { if (def == null) { return pc.getValues().size() <= 1; } else { return def.isSingleValue(); } }
private List<PrismContainer<?>> listAllPrismContainers(Visitable object) { List<PrismContainer<?>> values = new ArrayList<>(); object.accept(visitable -> { if (!(visitable instanceof PrismContainer)) { return; } if (visitable instanceof PrismObject) { return; } PrismContainer container = (PrismContainer) visitable; PrismContainerDefinition def = container.getDefinition(); if (def.isSingleValue()) { return; } values.add((PrismContainer) visitable); }); return values; }
private boolean canAssumeSingleValue() { if (getDefinition() != null) { return getDefinition().isSingleValue(); } else { if (getValues().size() <= 1) { return true; } else { return false; } } }
@SuppressWarnings("Duplicates") private boolean representsSameValue(PrismContainerValue<C> other, boolean lax) { if (lax && getParent() != null) { PrismContainerDefinition definition = getDefinition(); if (definition != null) { if (definition.isSingleValue()) { // There is only one value, therefore it always represents the same thing return true; } } } if (lax && other.getParent() != null) { PrismContainerDefinition definition = other.getDefinition(); if (definition != null) { if (definition.isSingleValue()) { // There is only one value, therefore it always represents the same thing return true; } } } return this.getId() != null && other.getId() != null && this.getId().equals(other.getId()); }
public void setValue(@NotNull PrismContainerValue<C> value) throws SchemaException { checkMutability(); if (getDefinition() != null) { if (getDefinition().isSingleValue()) { clear(); add(value); } else { throw new IllegalStateException("Attempt to set single value to a multivalued container "+ getElementName()); } } else { clear(); add(value); } }
if (getDefinition().isSingleValue()) {
PrismContainerDefinition<?> def = container.getDefinition(); if (def != null) { if (def.isSingleValue()) { return container.getRealValue(); } else {