本文整理汇总了Java中com.evolveum.midpoint.util.DOMUtil.getQNameAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java DOMUtil.getQNameAttribute方法的具体用法?Java DOMUtil.getQNameAttribute怎么用?Java DOMUtil.getQNameAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.evolveum.midpoint.util.DOMUtil
的用法示例。
在下文中一共展示了DOMUtil.getQNameAttribute方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPropertyDefinition
import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
/**
* Creates appropriate instance of PropertyDefinition. It creates either
* PropertyDefinition itself or one of its subclasses
* (ResourceObjectAttributeDefinition). The behavior depends of the "mode"
* of the schema. This method is also processing annotations and other fancy
* property-relates stuff.
*/
private <T> PrismPropertyDefinitionImpl<T> createPropertyDefinition(XSType xsType, QName elementName,
QName typeName, ComplexTypeDefinition ctd, XSAnnotation annotation, XSParticle elementParticle)
throws SchemaException {
PrismPropertyDefinitionImpl<T> propDef;
SchemaDefinitionFactory definitionFactory = getDefinitionFactory();
Collection<? extends DisplayableValue<T>> allowedValues = parseEnumAllowedValues(typeName, ctd,
xsType);
Object defaultValue = parseDefaultValue(elementParticle, typeName);
propDef = (PrismPropertyDefinitionImpl) definitionFactory.createPropertyDefinition(elementName, typeName, ctd, prismContext,
annotation, elementParticle, allowedValues, null);
setMultiplicity(propDef, elementParticle, annotation, ctd == null);
// Process generic annotations
parseItemDefinitionAnnotations(propDef, annotation);
List<Element> accessElements = SchemaProcessorUtil.getAnnotationElements(annotation, A_ACCESS);
if (accessElements.isEmpty()) {
// Default access is read-write-create
propDef.setCanAdd(true);
propDef.setCanModify(true);
propDef.setCanRead(true);
} else {
propDef.setCanAdd(false);
propDef.setCanModify(false);
propDef.setCanRead(false);
for (Element e : accessElements) {
String access = e.getTextContent();
if (access.equals(A_ACCESS_CREATE)) {
propDef.setCanAdd(true);
}
if (access.equals(A_ACCESS_UPDATE)) {
propDef.setCanModify(true);
}
if (access.equals(A_ACCESS_READ)) {
propDef.setCanRead(true);
}
}
}
markRuntime(propDef);
Element indexableElement = SchemaProcessorUtil.getAnnotationElement(annotation, A_INDEXED);
if (indexableElement != null) {
Boolean indexable = XmlTypeConverter.toJavaValue(indexableElement, Boolean.class);
propDef.setIndexed(indexable);
}
Element matchingRuleElement = SchemaProcessorUtil.getAnnotationElement(annotation, A_MATCHING_RULE);
if (matchingRuleElement != null) {
QName matchingRule = XmlTypeConverter.toJavaValue(matchingRuleElement, QName.class);
propDef.setMatchingRuleQName(matchingRule);
}
Element valueEnumerationRefElement = SchemaProcessorUtil.getAnnotationElement(annotation, A_VALUE_ENUMERATION_REF);
if (valueEnumerationRefElement != null) {
String oid = valueEnumerationRefElement.getAttribute(PrismConstants.ATTRIBUTE_OID_LOCAL_NAME);
if (oid != null) {
QName targetType = DOMUtil.getQNameAttribute(valueEnumerationRefElement, PrismConstants.ATTRIBUTE_REF_TYPE_LOCAL_NAME);
PrismReferenceValue valueEnumerationRef = new PrismReferenceValue(oid, targetType);
propDef.setValueEnumerationRef(valueEnumerationRef);
}
}
return propDef;
}