本文整理汇总了Java中com.evolveum.midpoint.util.DOMUtil.getQNameValue方法的典型用法代码示例。如果您正苦于以下问题:Java DOMUtil.getQNameValue方法的具体用法?Java DOMUtil.getQNameValue怎么用?Java DOMUtil.getQNameValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.evolveum.midpoint.util.DOMUtil
的用法示例。
在下文中一共展示了DOMUtil.getQNameValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toJavaValue
import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
public static <T> T toJavaValue(Element xmlElement, Class<T> type) throws SchemaException {
if (type.equals(Element.class)) {
return (T) xmlElement;
} else if (type.equals(QName.class)) {
return (T) DOMUtil.getQNameValue(xmlElement);
} else if (PolyString.class.isAssignableFrom(type)) {
return (T) polyStringToJava(xmlElement);
} else {
String stringContent = xmlElement.getTextContent();
if (stringContent == null) {
return null;
}
T javaValue = toJavaValue(stringContent, type);
if (javaValue == null) {
throw new IllegalArgumentException("Unknown type for conversion: " + type + "(element " + DOMUtil.getQName(xmlElement) + ")");
}
return javaValue;
}
}
示例2: parsePrimitiveElementValue
import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
private static <T> T parsePrimitiveElementValue(Element element, QName typeName, XNodeProcessorEvaluationMode mode) throws SchemaException {
try {
if (ItemPathType.COMPLEX_TYPE.equals(typeName)) {
return (T) parsePath(element);
} else if (DOMUtil.XSD_QNAME.equals(typeName)) {
return (T) DOMUtil.getQNameValue(element);
} else if (XmlTypeConverter.canConvert(typeName)) {
return (T) XmlTypeConverter.toJavaValue(element, typeName);
} else if (DOMUtil.XSD_ANYTYPE.equals(typeName)) {
return (T) element.getTextContent(); // if parsing primitive as xsd:anyType, we can safely parse it as string
} else {
throw new SchemaException("Cannot convert element '" + element + "' to " + typeName);
}
} catch (IllegalArgumentException e) {
return processIllegalArgumentException(element.getTextContent(), typeName, e, mode); // primitive way of ensuring compatibility mode
}
}
示例3: assertDomSchema
import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
private void assertDomSchema(Element xsdElement) {
assertPrefix("xsd", xsdElement);
Element displayNameAnnotationElement = DOMUtil.findElementRecursive(xsdElement, PrismConstants.A_DISPLAY_NAME);
assertPrefix(PrismConstants.PREFIX_NS_ANNOTATION, displayNameAnnotationElement);
Element kindAnnotationElement = DOMUtil.findElementRecursive(xsdElement, MidPointConstants.RA_KIND);
assertPrefix("ra", kindAnnotationElement);
assertEquals(ShadowKindType.ACCOUNT.value(), kindAnnotationElement.getTextContent());
Element identifierAnnotationElement = DOMUtil.findElementRecursive(xsdElement, MidPointConstants.RA_IDENTIFIER);
assertPrefix("ra", identifierAnnotationElement);
QName identifier = DOMUtil.getQNameValue(identifierAnnotationElement);
assertEquals("Wrong <a:identifier> value namespace", SchemaTestConstants.ICFS_UID.getNamespaceURI(), identifier.getNamespaceURI());
assertEquals("Wrong <a:identifier> value localname", SchemaTestConstants.ICFS_UID.getLocalPart(), identifier.getLocalPart());
assertEquals("Wrong <a:identifier> value prefix", "icfs", identifier.getPrefix());
Element dnaAnnotationElement = DOMUtil.findElementRecursive(xsdElement, MidPointConstants.RA_DISPLAY_NAME_ATTRIBUTE);
assertPrefix("ra", dnaAnnotationElement);
QName dna = DOMUtil.getQNameValue(dnaAnnotationElement);
assertEquals("Wrong <a:identifier> value prefix", "tns", dna.getPrefix());
assertEquals("Wrong 'tns' prefix declaration", SCHEMA_NAMESPACE, xsdElement.lookupNamespaceURI("tns"));
}
示例4: getAnnotationQName
import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
public static QName getAnnotationQName(XSAnnotation annotation, QName qname) {
Element element = getAnnotationElement(annotation, qname);
if (element == null) {
return null;
}
return DOMUtil.getQNameValue(element);
}
示例5: processObjectReferenceDefinition
import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
private PrismReferenceDefinitionImpl processObjectReferenceDefinition(XSType xsType, QName elementName,
XSAnnotation annotation, ComplexTypeDefinition containingCtd, XSParticle elementParticle,
boolean inherited) throws SchemaException {
QName typeName = new QName(xsType.getTargetNamespace(), xsType.getName());
QName primaryElementName = elementName;
Element objRefAnnotationElement = SchemaProcessorUtil.getAnnotationElement(annotation,
A_OBJECT_REFERENCE);
boolean hasExplicitPrimaryElementName = (objRefAnnotationElement != null
&& !StringUtils.isEmpty(objRefAnnotationElement.getTextContent()));
if (hasExplicitPrimaryElementName) {
primaryElementName = DOMUtil.getQNameValue(objRefAnnotationElement);
}
PrismReferenceDefinitionImpl definition = null;
if (containingCtd != null) {
definition = (PrismReferenceDefinitionImpl) containingCtd.findItemDefinition(primaryElementName, PrismReferenceDefinition.class);
}
if (definition == null) {
SchemaDefinitionFactory definitionFactory = getDefinitionFactory();
definition = (PrismReferenceDefinitionImpl) definitionFactory.createReferenceDefinition(primaryElementName, typeName,
containingCtd, prismContext, annotation, elementParticle);
definition.setInherited(inherited);
if (containingCtd != null) {
((ComplexTypeDefinitionImpl) containingCtd).add(definition);
}
}
if (hasExplicitPrimaryElementName) {
// The elements that have explicit type name determine the target
// type name (if not yet set)
if (definition.getTargetTypeName() == null) {
definition.setTargetTypeName(typeName);
}
if (definition.getCompositeObjectElementName() == null) {
definition.setCompositeObjectElementName(elementName);
}
} else {
// The elements that use default element names override type
// definition
// as there can be only one such definition, therefore the behavior
// is deterministic
definition.setTypeName(typeName);
}
Element targetTypeAnnotationElement = SchemaProcessorUtil.getAnnotationElement(annotation,
A_OBJECT_REFERENCE_TARGET_TYPE);
if (targetTypeAnnotationElement != null
&& !StringUtils.isEmpty(targetTypeAnnotationElement.getTextContent())) {
// Explicit definition of target type overrides previous logic
QName targetType = DOMUtil.getQNameValue(targetTypeAnnotationElement);
definition.setTargetTypeName(targetType);
}
setMultiplicity(definition, elementParticle, annotation, false);
Boolean composite = SchemaProcessorUtil.getAnnotationBooleanMarker(annotation, A_COMPOSITE);
if (composite != null) {
definition.setComposite(composite);
}
parseItemDefinitionAnnotations(definition, annotation);
// extractDocumentation(definition, annotation);
return definition;
}