String getProperty(EdmEntitySet entitySet, String key) { Iterable<? extends NamespacedAnnotation> annotations = entitySet.getAnnotations(); for (NamespacedAnnotation annotation:annotations) { PrefixedNamespace namespace = annotation.getNamespace(); if (namespace.getUri().equals(SAPURI)) { if (annotation.getName().equalsIgnoreCase(key)) { return (String)annotation.getValue(); } } } return null; }
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 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; }
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"); } } }
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; }
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; }
PrefixedNamespace namespace = annotation.getNamespace(); if (namespace.getUri().equals(SAPURI)) { String name = annotation.getName(); if (name.equalsIgnoreCase("label")) { //$NON-NLS-1$ t.setAnnotation((String)annotation.getValue()); creatable = Boolean.parseBoolean((String)annotation.getValue()); updatable = Boolean.parseBoolean((String)annotation.getValue()); pageable = Boolean.parseBoolean((String)annotation.getValue()); topable = Boolean.parseBoolean((String)annotation.getValue()); deletable = Boolean.parseBoolean((String)annotation.getValue());
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; }
PrefixedNamespace namespace = annotation.getNamespace(); if (namespace.getUri().equals(SAPURI)) { String name = annotation.getName(); if (name.equalsIgnoreCase("label")) { //$NON-NLS-1$ c.setAnnotation((String)annotation.getValue()); creatable = Boolean.parseBoolean((String)annotation.getValue()); c.setSelectable(Boolean.parseBoolean((String)annotation.getValue())); updatable = Boolean.parseBoolean((String)annotation.getValue()); if (!Boolean.parseBoolean((String)annotation.getValue())){ c.setSearchType(SearchType.Unsearchable); filterable = Boolean.parseBoolean((String)annotation.getValue()); required_in_filter = Boolean.parseBoolean((String)annotation.getValue());
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; }
private void addAnnotationProperties(Context c, EdmItem item, List<OProperty<?>> props) { if (item.getAnnotations() != null) { for (NamespacedAnnotation<?> a : item.getAnnotations()) { if (a.getValue() != null) { 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, Object ov = override == null ? a.getValue() : override; if (a instanceof EdmAnnotationAttribute) { props.add(OProperties.string(propName, ov.toString()));
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 void addAnnotationProperties(Context c, EdmItem item, List<OProperty<?>> props) { if (item.getAnnotations() != null) { for (NamespacedAnnotation<?> a : item.getAnnotations()) { if (a.getValue() != null) { 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, Object ov = override == null ? a.getValue() : override; if (a instanceof EdmAnnotationAttribute) { props.add(OProperties.string(propName, ov.toString()));
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 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; }