private void removeEmptyValues(Collection<V> set, boolean allowEmptyRealValues) { if (set == null) { return; } Iterator<V> iterator = set.iterator(); while (iterator.hasNext()) { V val = iterator.next(); if (val.isEmpty()) { iterator.remove(); continue; } if (!allowEmptyRealValues) { if (val instanceof PrismPropertyValue<?>) { Object realValue = ((PrismPropertyValue<?>)val).getValue(); if (realValue instanceof String) { if (((String)realValue).isEmpty()) { iterator.remove(); continue; } } else if (realValue instanceof PolyString) { if (((PolyString)realValue).isEmpty()) { iterator.remove(); continue; } } } } } }
public void checkConsistence() { Visitor visitor = visitable -> { if (visitable instanceof PrismValue) { if (((PrismValue)visitable).isEmpty()) { throw new IllegalStateException("Empty value "+visitable+" in triple "+PrismValueDeltaSetTripleImpl.this); } } }; accept(visitor); Processor<V> processor = pval -> { if (pval.getParent() != null) { throw new IllegalStateException("Value "+pval+" in triple "+PrismValueDeltaSetTripleImpl.this+" has parent, looks like it was not cloned properly"); } }; foreach(processor); }
private void cleanupAllTheWayUp(Item<?,?> item) { if (item.isEmpty()) { PrismValue itemParent = item.getParent(); if (itemParent != null) { ((PrismContainerValue<?>)itemParent).remove(item); if (itemParent.isEmpty()) { Itemable itemGrandparent = itemParent.getParent(); if (itemGrandparent != null) { if (itemGrandparent instanceof Item<?,?>) { cleanupAllTheWayUp((Item<?,?>)itemGrandparent); } } } } } }
throw new IllegalArgumentException("Value "+value+" in "+this+" has a bad parent "+value.getParent()); if (value.isEmpty() && !value.isRaw()) { throw new IllegalArgumentException("Empty value in "+this);
private void handleBasicOrEmbedded(Object bean, ItemDelta delta, Attribute attribute) { Class outputType = getRealOutputType(attribute); PrismValue anyPrismValue = delta.getAnyValue(); Object value; if (delta.isDelete() || (delta.isReplace() && (anyPrismValue == null || anyPrismValue.isEmpty()))) { value = null; } else { value = anyPrismValue.getRealValue(); } value = prismEntityMapper.map(value, outputType); try { PropertyUtils.setSimpleProperty(bean, attribute.getName(), value); } catch (Exception ex) { throw new SystemException("Couldn't set simple property for '" + attribute.getName() + "'", ex); } }
filter, expressionFactory, shortDesc, task, result); if (expressionResult == null || expressionResult.isEmpty()) { LOGGER.debug("Result of search filter expression was null or empty. Expression: {}", valueExpression);