private boolean isDeprecated(XSElementDecl xsElementDecl) throws SchemaException { XSAnnotation annotation = xsElementDecl.getAnnotation(); Boolean deprecated = SchemaProcessorUtil.getAnnotationBooleanMarker(annotation, A_DEPRECATED); return (deprecated != null && deprecated); }
private boolean isResourceObject(XSAnnotation annotation) { // annotation: resourceObject if (SchemaProcessorUtil.getAnnotationElement(annotation, MidPointConstants.RA_RESOURCE_OBJECT) != null) { return true; } // annotation: accountType DEPRECATED if (SchemaProcessorUtil.getAnnotationElement(annotation, MidPointConstants.RA_ACCOUNT) != null) { // <accountType> implies <resourceObject> ... at least for now (compatibility) return true; } return false; }
public static Boolean getAnnotationBoolean(XSAnnotation annotation, QName qname) throws SchemaException { return getAnnotationConverted(annotation, qname, Boolean.class); }
Boolean ignore = SchemaProcessorUtil.getAnnotationBooleanMarker(annotation, A_IGNORE); if (ignore != null) { itemDef.setProcessing(ItemProcessing.IGNORE); Element processing = SchemaProcessorUtil.getAnnotationElement(annotation, A_PROCESSING); if (processing != null) { itemDef.setProcessing(ItemProcessing.findByValue(processing.getTextContent())); Boolean deprecated = SchemaProcessorUtil.getAnnotationBooleanMarker(annotation, A_DEPRECATED); if (deprecated != null) { itemDef.setDeprecated(deprecated); Element deprecatedSince = SchemaProcessorUtil.getAnnotationElement(annotation, A_DEPRECATED_SINCE); if (deprecatedSince != null) { itemDef.setDeprecatedSince(deprecatedSince.getTextContent()); Boolean experimental = SchemaProcessorUtil.getAnnotationBooleanMarker(annotation, A_EXPERIMENTAL); if (experimental != null) { itemDef.setExperimental(experimental); Element plannedRemoval = SchemaProcessorUtil.getAnnotationElement(annotation, A_PLANNED_REMOVAL); if (plannedRemoval != null) { itemDef.setPlannedRemoval(plannedRemoval.getTextContent()); Boolean elaborate = SchemaProcessorUtil.getAnnotationBooleanMarker(annotation, A_ELABORATE); if (elaborate != null) { itemDef.setElaborate(elaborate); Boolean operational = SchemaProcessorUtil.getAnnotationBooleanMarker(annotation, A_OPERATIONAL);
private MutablePrismPropertyDefinition createResourceAttributeDefinition(QName elementName, QName typeName, PrismContext prismContext, XSAnnotation annotation) throws SchemaException { ResourceAttributeDefinitionImpl attrDef = new ResourceAttributeDefinitionImpl(elementName, typeName, prismContext); // nativeAttributeName Element nativeAttrElement = SchemaProcessorUtil.getAnnotationElement(annotation, MidPointConstants.RA_NATIVE_ATTRIBUTE_NAME); String nativeAttributeName = nativeAttrElement == null ? null : nativeAttrElement.getTextContent(); if (!StringUtils.isEmpty(nativeAttributeName)) { attrDef.setNativeAttributeName(nativeAttributeName); } // frameworkAttributeName Element frameworkAttrElement = SchemaProcessorUtil.getAnnotationElement(annotation, MidPointConstants.RA_FRAMEWORK_ATTRIBUTE_NAME); String frameworkAttributeName = frameworkAttrElement == null ? null : frameworkAttrElement.getTextContent(); if (!StringUtils.isEmpty(frameworkAttributeName)) { attrDef.setFrameworkAttributeName(frameworkAttributeName); } // returnedByDefault attrDef.setReturnedByDefault(SchemaProcessorUtil.getAnnotationBoolean(annotation, MidPointConstants.RA_RETURNED_BY_DEFAULT_NAME)); return attrDef; }
public static boolean hasAnnotation(XSType xsType, QName annotationElementName) { if (xsType.getName() == null) { return false; } Element annotationElement = getAnnotationElement(xsType.getAnnotation(), annotationElementName); if (annotationElement != null) { return true; } if (xsType.getBaseType() != null && !xsType.getBaseType().equals(xsType)) { return hasAnnotation(xsType.getBaseType(), annotationElementName); } return false; }
List<Element> accessElements = SchemaProcessorUtil.getAnnotationElements(annotation, A_ACCESS); if (accessElements.isEmpty()) { Element indexableElement = SchemaProcessorUtil.getAnnotationElement(annotation, A_INDEXED); if (indexableElement != null) { Boolean indexable = XmlTypeConverter.toJavaValue(indexableElement, Boolean.class); Element matchingRuleElement = SchemaProcessorUtil.getAnnotationElement(annotation, A_MATCHING_RULE); if (matchingRuleElement != null) { QName matchingRule = XmlTypeConverter.toJavaValue(matchingRuleElement, QName.class); Element valueEnumerationRefElement = SchemaProcessorUtil.getAnnotationElement(annotation, A_VALUE_ENUMERATION_REF); if (valueEnumerationRefElement != null) { String oid = valueEnumerationRefElement.getAttribute(PrismConstants.ATTRIBUTE_OID_LOCAL_NAME);
public static Element getAnnotationElement(XSAnnotation annotation, QName qname) { if (annotation == null) { return null; } List<Element> elements = getAnnotationElements(annotation, qname); if (elements.isEmpty()) { return null; } return elements.get(0); }
/** * Returns true if provides XSD type is an object definition. It looks for a * ObjectType supertype. */ private boolean isObjectDefinition(XSType xsType) { return SchemaProcessorUtil.hasAnnotation(xsType, A_OBJECT); }
private QName getTypeAnnotation(XSAnnotation annotation) { return SchemaProcessorUtil.getAnnotationQName(annotation, A_TYPE); }
private void setInstantiationOrder(MutableTypeDefinition typeDefinition, XSAnnotation annotation) throws SchemaException { Integer order = SchemaProcessorUtil.getAnnotationInteger(annotation, A_INSTANTIATION_ORDER); typeDefinition.setInstantiationOrder(order); }
Element nativeAttrElement = SchemaProcessorUtil.getAnnotationElement(annotation, MidPointConstants.RA_NATIVE_OBJECT_CLASS); String nativeObjectClass = nativeAttrElement == null ? null : nativeAttrElement.getTextContent(); ocDef.setNativeObjectClass(nativeObjectClass); Element kindElement = SchemaProcessorUtil.getAnnotationElement(annotation, MidPointConstants.RA_KIND); if (kindElement != null) { String kindString = kindElement.getTextContent(); Boolean defaultInAKind = SchemaProcessorUtil.getAnnotationBooleanMarker(annotation, MidPointConstants.RA_DEFAULT); if (defaultInAKind == null) { ocDef.setDefaultInAKind(false); Boolean auxiliary = SchemaProcessorUtil.getAnnotationBooleanMarker(annotation, MidPointConstants.RA_AUXILIARY); if (auxiliary == null) { ocDef.setAuxiliary(false); Element intentElement = SchemaProcessorUtil.getAnnotationElement(annotation, MidPointConstants.RA_INTENT); if (intentElement != null) { intent = intentElement.getTextContent(); Element account = SchemaProcessorUtil.getAnnotationElement(annotation, MidPointConstants.RA_ACCOUNT); if (account != null && !defaultInAKind) { String defaultValue = account.getAttribute("default"); Element accountTypeElement = SchemaProcessorUtil.getAnnotationElement(annotation, MidPointConstants.RA_ACCOUNT_TYPE); if (accountTypeElement != null) { String accountType = accountTypeElement.getTextContent();
@NotNull private List<String> getIgnoredNamespaces(XSType xsType) { List<String> rv = new ArrayList<>(); List<Element> annoElements = SchemaProcessorUtil.getAnnotationElements(xsType.getAnnotation(), A_IGNORED_NAMESPACE); for (Element annoElement : annoElements) { rv.add(annoElement.getTextContent()); } if (xsType.getBaseType() != null && !xsType.getBaseType().equals(xsType)) { rv.addAll(getIgnoredNamespaces(xsType.getBaseType())); } return rv; }
private boolean isObjectReference(XSType xsType) { return SchemaProcessorUtil.hasAnnotation(xsType, A_OBJECT_REFERENCE); }
private boolean isObjectReference(XSAnnotation annotation) { Element objRefAnnotationElement = SchemaProcessorUtil.getAnnotationElement(annotation, A_OBJECT_REFERENCE); return (objRefAnnotationElement != null); }
QName typeName = new QName(xsType.getTargetNamespace(), xsType.getName()); QName primaryElementName = elementName; Element objRefAnnotationElement = SchemaProcessorUtil.getAnnotationElement(annotation, A_OBJECT_REFERENCE); boolean hasExplicitPrimaryElementName = (objRefAnnotationElement != null Element targetTypeAnnotationElement = SchemaProcessorUtil.getAnnotationElement(annotation, A_OBJECT_REFERENCE_TARGET_TYPE); if (targetTypeAnnotationElement != null Boolean composite = SchemaProcessorUtil.getAnnotationBooleanMarker(annotation, A_COMPOSITE); if (composite != null) { definition.setComposite(composite);
public static Integer getAnnotationInteger(XSAnnotation annotation, QName qname) throws SchemaException { return getAnnotationConverted(annotation, qname, Integer.class); }
private boolean testAnnotationAppinfo(XSAnnotation annotation) { Element appinfo = SchemaProcessorUtil.getAnnotationElement(annotation, new QName(W3C_XML_SCHEMA_NS_URI, "appinfo")); if (appinfo != null) { return true; } return false; }
public static <T> T getAnnotationConverted(XSAnnotation annotation, QName qname, Class<T> type) throws SchemaException { Element element = getAnnotationElement(annotation, qname); if (element == null) { return null; } String textContent = element.getTextContent(); if (textContent == null || textContent.isEmpty()) { return null; } return XmlTypeConverter.toJavaValue(element, type); }
public static QName getAnnotationQName(XSAnnotation annotation, QName qname) { Element element = getAnnotationElement(annotation, qname); if (element == null) { return null; } return DOMUtil.getQNameValue(element); }