private boolean equalsRawElements(PrismPropertyValue<T> other) { return this.rawElement.equals(other.getRawElement()); }
@NotNull private <T> XNodeImpl serializePropertyRawValue(PrismPropertyValue<T> value) throws SchemaException { XNodeImpl rawElement = (XNodeImpl) value.getRawElement(); if (rawElement != null) { return rawElement; } T realValue = value.getValue(); if (realValue != null) { return createPrimitiveXNode(realValue, null); } else { throw new IllegalStateException("Neither real nor raw value present in " + value); } }
private T parseRawElementToNewRealValue(PrismPropertyValue<T> prismPropertyValue, Class<T> clazz, PrismContext prismContext) throws SchemaException { return prismContext.parserFor(prismPropertyValue.getRawElement().toRootXNode()).parseRealValue(clazz); }
if (this.rawElement != null && other.getRawElement() != null) { return equalsRawElements((PrismPropertyValue<T>)other); if (this.rawElement != null || other.getRawElement() != null) { try { if (this.rawElement == null) { otherProcessed = parseRawElementToNewValue((PrismPropertyValue<T>) other, this); } else if (other.getRawElement() == null) { thisProcessed = parseRawElementToNewValue(this, (PrismPropertyValue<T>) other);
private T parseRawElementToNewRealValue(PrismPropertyValue<T> prismPropertyValue, PrismPropertyDefinition<T> definition) throws SchemaException { PrismContext prismCtx = definition.getPrismContext() != null ? definition.getPrismContext() : prismContext; //noinspection UnnecessaryLocalVariable if (prismCtx == null) { throw new SchemaException("Unexpected null prism context."); } T value = prismCtx.parserFor(prismPropertyValue.getRawElement().toRootXNode()).definition(definition).parseRealValue(); return value; }
sb.append("\n"); if (value.isRaw()) { sb.append(formatRawValueForDump(value.getRawElement())); sb.append(" (raw)"); } else if (value.getExpression() != null) { PrismPropertyValue<T> value = iterator.next(); if (value.isRaw()) { sb.append(formatRawValueForDump(value.getRawElement())); sb.append(" (raw)"); } else if (value.getExpression() != null) {
xnode = ((XNodeImpl) value.getRawElement()).clone(); } else { throw new SchemaException("Cannot marshall property value "+value+": marshaller returned null");
protected void assertResolvableRawValues(Visitable value) { value.accept(v -> { // TODO in RawTypes in beans? if (v instanceof PrismPropertyValue) { PrismPropertyValue ppv = (PrismPropertyValue) v; XNode raw = ppv.getRawElement(); if (raw != null && raw.getTypeQName() != null) { String label = ppv.getPath() + ": " + v; fail("Resolvable raw value of " + raw + " in " + label + " (type: " + raw.getTypeQName() + ")"); } } }); }
PrismPropertyValue<Object> pval = (PrismPropertyValue)value; if (pval.isRaw() && parent.getDefinition() == null) { XNodeImpl rawElement = (XNodeImpl) pval.getRawElement(); if (rawElement instanceof MapXNodeImpl) { return domParser.serializeXMapToElement((MapXNodeImpl)rawElement, elementName);
private void assertDummyResource(PrismObject<ResourceType> resource, boolean fromRepo) { PrismContainer<Containerable> configurationPropertiesContainer = assertResource(resource, "Dummy Resource", RESOURCE_DUMMY_NAMESPACE, dummyConnector.getOid(), fromRepo); PrismProperty<ProtectedStringType> guardedProperty = configurationPropertiesContainer.findProperty( new ItemName(CONNECTOR_DUMMY_NAMESPACE, "uselessGuardedString")); // The resource was pulled from the repository. Therefore it does not have the right schema here. We should proceed with caution // and inspect the DOM elements there assertNotNull("No uselessGuardedString property in configuration properties", guardedProperty); PrismPropertyValue<ProtectedStringType> guardedPVal = guardedProperty.getValue(); if (fromRepo) { Object passwordRawElement = guardedPVal.getRawElement(); if (!(passwordRawElement instanceof MapXNode)) { AssertJUnit.fail("Expected password value of type "+ MapXNode.class+" but got "+passwordRawElement.getClass()); } MapXNode passwordXNode = (MapXNode) passwordRawElement; assertTrue("uselessGuardedString was not encrypted (clearValue)", passwordXNode.get(new QName("clearValue")) == null); assertTrue("uselessGuardedString was not encrypted (no encryptedData)", passwordXNode.get(new QName("encryptedData")) != null); } else { ProtectedStringType psType = guardedPVal.getValue(); assertNull("uselessGuardedString was not encrypted (clearValue)", psType.getClearValue()); assertNotNull("uselessGuardedString was not encrypted (no EncryptedData)", psType.getEncryptedDataType()); } }
assertNotNull("No "+credentialsPropertyName+" property value in "+resource+" from "+source, credentialsPropertyValue); if (credentialsPropertyValue.isRaw()) { Object rawElement = credentialsPropertyValue.getRawElement(); assertTrue("Wrong element class "+rawElement.getClass()+" in "+resource+" from "+source, rawElement instanceof MapXNode);