public GenericAnnotation(String namespaceUri, String namespacePrefix, String localName, Class<T> valueType, T value) { this.namespace = new PrefixedNamespace(namespaceUri, namespacePrefix); this.localName = localName; this.valueType = valueType; this.value = value; }
public String getFullyQualifiedName() { return namespace.getPrefix() + ":" + localName; }
/** * Extensions to CSDL like Annotations appear in an application specific set * of namespaces. */ private static void writeExtensionNamespaces(EdmDataServices services, XMLWriter2 writer) { if (services.getNamespaces() != null) { for (PrefixedNamespace ns : services.getNamespaces()) { writer.writeNamespace(ns.getPrefix(), ns.getUri()); } } }
public NamespacedAnnotation<?> findAnnotation(String namespaceUri, String localName) { if (annotations != null) { for (NamespacedAnnotation<?> annotation : annotations) { if (annotation.getNamespace().getUri().equals(namespaceUri) && annotation.getName().equals(localName)) return annotation; } } return null; }
/** * Extensions to CSDL like Annotations appear in an application specific set * of namespaces. */ private static void writeExtensionNamespaces(EdmDataServices services, XMLWriter2 writer) { if (services.getNamespaces() != null) { for (PrefixedNamespace ns : services.getNamespaces()) { writer.writeNamespace(ns.getPrefix(), ns.getUri()); } } }
public NamespacedAnnotation<?> findAnnotationElement(String namespaceUri, String name) { if (annotationElements != null) { for (NamespacedAnnotation<?> element : annotationElements) { if (element.getNamespace().getUri().equals(namespaceUri) && element.getName().equals(name)) return element; } } return null; }
private static void writeAnnotation(Iterable<? extends NamespacedAnnotation<?>> annotList, XMLWriter2 writer, String prefix) { String prefix1 = prefix; for (NamespacedAnnotation<?> a : annotList) { if (a instanceof EdmAnnotationAttribute) { String prefix2 = a.getNamespace().getPrefix(); writer.writeAttribute( new QName2(a.getNamespace().getUri(), a.getName(), a.getNamespace().getPrefix()), a.getValue() == null ? "" : a.getValue().toString()); if (!prefix2.equals(prefix1)) { writer.writeNamespace(a.getNamespace().getPrefix(), a.getNamespace().getUri()); } prefix1 = prefix2; } } }
public EdmAnnotation<?> findAnnotationElement(String namespaceUri, String name) { if (annotationElements != null) { for (EdmAnnotation<?> element : annotationElements) { if (element.getNamespace().getUri().equals(namespaceUri) && element.getName().equals(name)) return element; } } return null; }
public GenericAnnotation(String namespaceUri, String namespacePrefix, String localName, Class<T> valueType, T value) { this.namespace = new PrefixedNamespace(namespaceUri, namespacePrefix); this.localName = localName; this.valueType = valueType; this.value = value; }
public String getFullyQualifiedName() { return namespace.getPrefix() + ":" + localName; }
private static void writeAnnotation(Iterable<? extends NamespacedAnnotation<?>> annotList, XMLWriter2 writer, String prefix) { String prefix1 = prefix; for (NamespacedAnnotation<?> a : annotList) { if (a instanceof EdmAnnotationAttribute) { String prefix2 = a.getNamespace().getPrefix(); writer.writeAttribute( new QName2(a.getNamespace().getUri(), a.getName(), a.getNamespace().getPrefix()), a.getValue() == null ? "" : a.getValue().toString()); if (!prefix2.equals(prefix1)) { writer.writeNamespace(a.getNamespace().getPrefix(), a.getNamespace().getUri()); } prefix1 = prefix2; } } }
public NamespacedAnnotation<?> findAnnotation(String namespaceUri, String localName) { if (annotations != null) { for (NamespacedAnnotation<?> annotation : annotations) { if (annotation.getNamespace().getUri().equals(namespaceUri) && annotation.getName().equals(localName)) return annotation; } } return null; }
public GenericAnnotation(String namespaceUri, String namespacePrefix, String localName, Class<T> valueType, T value) { this.namespace = new PrefixedNamespace(namespaceUri, namespacePrefix); this.localName = localName; this.valueType = valueType; this.value = value; }
public String getFullyQualifiedName() { return namespace.getPrefix() + ":" + localName; }
private static void writeElementInAnnotation(Iterable<? extends NamespacedAnnotation<?>> annotList, XMLWriter2 writer) { for (NamespacedAnnotation<?> a : annotList) { if (a instanceof EdmAnnotationElement) { EdmAnnotationElement<?> elem = (EdmAnnotationElement<?>) a; writer.startElement(new QName2(elem.getNamespace().getUri(), elem.getName(), elem.getNamespace().getPrefix())); if (elem.getNamespace().getPrefix() != null && elem.getNamespace().getUri() != null) { writer.writeNamespace(elem.getNamespace().getPrefix(), elem.getNamespace().getUri()); } writeAnnotationAttributes(elem, writer, elem.getNamespace().getPrefix()); writer.writeText(elem.getValue().toString().trim()); writeAnnotationElements(elem, writer); writer.endElement(a.getName()); // TODO: please don't throw an exception here. // this totally breaks ODataConsumer even thought it doesn't rely // on annotations. A no-op is a interim approach that allows work // to proceed by those using queryable metadata to access annotations. // throw new UnsupportedOperationException("Implement element annotations"); } } }
public EdmAnnotation<?> findAnnotationElement(String namespaceUri, String name) { if (annotationElements != null) { for (EdmAnnotation<?> element : annotationElements) { if (element.getNamespace().getUri().equals(namespaceUri) && element.getName().equals(name)) return element; } } return null; }
public MyEdmDecorator() { namespaces.add(new PrefixedNamespace(namespace, prefix)); this.schemaInfoType = createSchemaInfoType().build(); }
String propName = a.getNamespace().getPrefix() + "_" + a.getName(); if (c.pathHelper.isSelected(propName)) { Object override = this.decorator != null ? this.decorator.getAnnotationValueOverride(item, a, c.flatten, c.locale,
private static void writeElementInAnnotation(Iterable<? extends NamespacedAnnotation<?>> annotList, XMLWriter2 writer) { for (NamespacedAnnotation<?> a : annotList) { if (a instanceof EdmAnnotationElement) { EdmAnnotationElement<?> elem = (EdmAnnotationElement<?>) a; writer.startElement(new QName2(elem.getNamespace().getUri(), elem.getName(), elem.getNamespace().getPrefix())); if (elem.getNamespace().getPrefix() != null && elem.getNamespace().getUri() != null) { writer.writeNamespace(elem.getNamespace().getPrefix(), elem.getNamespace().getUri()); } writeAnnotationAttributes(elem, writer, elem.getNamespace().getPrefix()); writer.writeText(elem.getValue().toString().trim()); writeAnnotationElements(elem, writer); writer.endElement(a.getName()); // TODO: please don't throw an exception here. // this totally breaks ODataConsumer even thought it doesn't rely // on annotations. A no-op is a interim approach that allows work // to proceed by those using queryable metadata to access annotations. // throw new UnsupportedOperationException("Implement element annotations"); } } }
public NamespacedAnnotation<?> findAnnotationElement(String namespaceUri, String name) { if (annotationElements != null) { for (NamespacedAnnotation<?> element : annotationElements) { if (element.getNamespace().getUri().equals(namespaceUri) && element.getName().equals(name)) return element; } } return null; }