private static String determinePropName(PrismPropertyValue<?> value) { Itemable item = value.getParent(); return item != null && item.getElementName() != null ? item.getElementName().getLocalPart() : ""; }
/** * Returns JAXBElement corresponding to the this value. * Name of the element is the name of parent property; its value is the real value of the property. * * @return Created JAXBElement. */ public JAXBElement<T> toJaxbElement() { Itemable parent = getParent(); if (parent == null) { throw new IllegalStateException("Couldn't represent parent-less property value as a JAXBElement"); } Object realValue = getValue(); return new JAXBElement<T>(parent.getElementName(), (Class) realValue.getClass(), (T) realValue); }
/** * @param targetType * @param allowEmptyNamespace This is an ugly hack. See comment in DOMUtil.validateNonEmptyQName. */ public void setTargetType(QName targetType, boolean allowEmptyNamespace) { checkMutability(); // Null value is OK if (targetType != null) { // But non-empty is not .. Itemable item = getParent(); DOMUtil.validateNonEmptyQName(targetType, " in target type in reference "+ (item == null ? "(unknown)" : item.getElementName()), allowEmptyNamespace); } this.targetType = targetType; }
@NotNull @Override public T serialize(@NotNull PrismValue value) throws SchemaException { QName nameToUse; if (itemName != null) { nameToUse = itemName; } else if (itemDefinition != null) { nameToUse = itemDefinition.getName(); } else if (value.getParent() != null) { nameToUse = value.getParent().getElementName(); } else { nameToUse = null; } // else { // // TODO derive from the value type itself? Not worth the effort. // throw new IllegalArgumentException("Item name nor definition is not known for " + value); // } RootXNodeImpl xroot = getMarshaller().marshalPrismValueAsRoot(value, nameToUse, itemDefinition, context); checkPostconditions(xroot); // TODO find better way return target.write(xroot, context); }
return ConnIdUtil.toGuardedString(ps, pval.getParent().getElementName().getLocalPart(), protector); } else { throw new ConfigurationException( "Expected protected string as value of configuration property " + pval.getParent().getElementName().getLocalPart() + " but got " + midPointRealValue.getClass());
info.itemDefinition = itemDefinition = value.getParent().getDefinition(); if (info.itemDefinition == null) { info.itemDefinition = schemaRegistry.findItemDefinitionByElementName(value.getParent().getElementName()); info.itemName = value.getParent().getElementName();
QName propName = item.getElementName(); @SuppressWarnings("unchecked") PrismPropertyValue<ProtectedStringType> psPval = (PrismPropertyValue<ProtectedStringType>)pval;
QName propName = item.getElementName(); @SuppressWarnings("unchecked") PrismPropertyValue<ProtectedStringType> psPval = (PrismPropertyValue<ProtectedStringType>) pval;
public RAnyValue convertToRValue(PrismValue value, boolean assignment, RObjectExtensionType ownerType) throws SchemaException { RAnyValue rValue; ItemDefinition definition = value.getParent().getDefinition(); if (!isIndexed(definition, value.getParent().getElementName(), areDynamicsOfThisKindIndexed(ownerType), prismContext)) { return null; } if (value instanceof PrismPropertyValue) { PrismPropertyValue propertyValue = (PrismPropertyValue) value; rValue = extractAndCreateValue(definition, propertyValue, assignment); } else if (value instanceof PrismReferenceValue) { if (assignment) { PrismReferenceValue referenceValue = (PrismReferenceValue) value; rValue = RAExtReference.createReference(referenceValue); } else { PrismReferenceValue referenceValue = (PrismReferenceValue) value; rValue = ROExtReference.createReference(referenceValue); } } else { // shouldn't get here because if isIndexed test above throw new AssertionError("Wrong value type: " + value); } rValue.setItemId(extItemDictionary.createOrFindItemDefinition(definition).getId()); return rValue; }
throw new IllegalStateException("Couldn't convert parent-less prism value to xsd:any: " + value); QName elementName = parent.getElementName(); if (value instanceof PrismPropertyValue) { PrismPropertyValue<Object> pval = (PrismPropertyValue)value;
PrismContext prismContext, String contextDesc, boolean throwExceptionOnFailure, OperationResult parentResult) { String refName = refVal.getParent() != null ? refVal.getParent().getElementName().toString() : "(unnamed)";