private Boolean isRawSet(Collection<V> set) { if (set == null) { return null; } for (V val: set) { if (!val.isRaw()) { return false; } } return true; }
public boolean isRaw() { if (values != null) { for (V value: values) { if (value.isRaw()) { return true; } } } return false; }
private boolean isRaw(Collection<V> set) { if (set == null) { return false; } for (V item: set) { if (item.isRaw()) { return true; } } return false; }
/** * Returns true is at least one of the values is raw. */ public boolean hasRaw() { for (V val: getValues()) { if (val.isRaw()) { return true; } } return false; }
/** * Returns true is all the values are raw. */ public boolean isRaw() { for (V val: getValues()) { if (!val.isRaw()) { return false; } } return true; }
public void checkConsistenceInternal(Itemable rootItem, boolean requireDefinitions, boolean prohibitRaw, ConsistencyCheckScope scope) { ItemPath path = getPath(); if (elementName == null) { throw new IllegalStateException("Item "+this+" has no name ("+path+" in "+rootItem+")"); } if (definition != null) { checkDefinition(definition); } else if (requireDefinitions && !isRaw()) { throw new IllegalStateException("No definition in item "+this+" ("+path+" in "+rootItem+")"); } for (V val: values) { if (prohibitRaw && val.isRaw()) { throw new IllegalStateException("Raw value "+val+" in item "+this+" ("+path+" in "+rootItem+")"); } if (val == null) { throw new IllegalStateException("Null value in item "+this+" ("+path+" in "+rootItem+")"); } if (val.getParent() == null) { throw new IllegalStateException("Null parent for value "+val+" in item "+this+" ("+path+" in "+rootItem+")"); } if (val.getParent() != this) { throw new IllegalStateException("Wrong parent for value "+val+" in item "+this+" ("+path+" in "+rootItem+"), "+ "bad parent: " + val.getParent()); } val.checkConsistenceInternal(rootItem, requireDefinitions, prohibitRaw, scope); } }
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);
public PipelineData evaluateConstantExpression(@NotNull RawType constant, @Nullable Class<?> expectedClass, ExecutionContext context, String desc, OperationResult result) throws ScriptExecutionException { try { // TODO fix this brutal hacking PrismValue value; if (expectedClass == null) { value = constant.getParsedValue(null, null); } else { Object object = constant.getParsedRealValue(expectedClass); if (object instanceof Referencable) { value = ((Referencable) object).asReferenceValue(); } else if (object instanceof Containerable) { value = ((Containerable) object).asPrismContainerValue(); } else { value = prismContext.itemFactory().createPropertyValue(object); } } if (value.isRaw()) { throw new IllegalStateException("Raw value while " + desc + ": " + value + ". Please specify type of the value."); } return PipelineData.createItem(value, context.getInitialVariables()); } catch (SchemaException e) { throw new ScriptExecutionException(e.getMessage(), e); } }
if (value != null && !value.isRaw()) { raw = new RawType(value, xsubnode.getTypeQName(), prismContext);
assertFalse(intAttributeReparsed.getAnyValue().isRaw()); Item<?, ?> stringAttributeReparsed = shadowReparsed.findItem(ItemPath.create(ShadowType.F_ATTRIBUTES, STRING_ATTRIBUTE_NAME)); assertNotNull(stringAttributeReparsed); assertFalse(stringAttributeReparsed.getAnyValue().isRaw()); Item<?, ?> longExtensionReparsed = shadowReparsed.findItem(ItemPath.create(ShadowType.F_EXTENSION, SchemaTestConstants.EXTENSION_LONG_TYPE_ELEMENT)); assertNotNull(longExtensionReparsed); assertFalse(longExtensionReparsed.getAnyValue().isRaw()); Item<?, ?> doubleExtensionReparsed = shadowReparsed.findItem(ItemPath.create(ShadowType.F_EXTENSION, SchemaTestConstants.EXTENSION_DOUBLE_TYPE_ELEMENT)); assertNotNull(doubleExtensionReparsed); assertFalse(doubleExtensionReparsed.getAnyValue().isRaw());
Item<PrismValue, ItemDefinition> attr1Reparsed = shadowReparsed.findItem(ItemPath.create(ShadowType.F_ATTRIBUTES, ATTR1_QNAME)); assertNotNull(attr1Reparsed); assertFalse("Reparsed attribute is raw", attr1Reparsed.getAnyValue().isRaw());