private void appendAnnotations(final XMLStreamWriter writer, final EdmAnnotatable annotatable) throws XMLStreamException { List<EdmAnnotation> annotations = annotatable.getAnnotations(); if (annotations != null && !annotations.isEmpty()) { for (EdmAnnotation annotation : annotations) { writer.writeStartElement(XML_ANNOTATION); if (annotation.getTerm() != null) { writer.writeAttribute(XML_TERM_ATT, getAliasedFullQualifiedName(annotation.getTerm().getFullQualifiedName(), false)); } if (annotation.getQualifier() != null) { writer.writeAttribute(XML_QUALIFIER_ATT, annotation.getQualifier()); } appendExpression(writer, annotation.getExpression()); appendAnnotations(writer, annotation); writer.writeEndElement(); } } }
private void appendAnnotations(final XMLStreamWriter writer, final EdmAnnotatable annotatable) throws XMLStreamException { List<EdmAnnotation> annotations = annotatable.getAnnotations(); if (annotations != null && !annotations.isEmpty()) { for (EdmAnnotation annotation : annotations) { writer.writeStartElement(XML_ANNOTATION); if (annotation.getTerm() != null) { writer.writeAttribute(XML_TERM_ATT, getAliasedFullQualifiedName(annotation.getTerm().getFullQualifiedName(), false)); } if (annotation.getQualifier() != null) { writer.writeAttribute(XML_QUALIFIER_ATT, annotation.getQualifier()); } appendExpression(writer, annotation.getExpression()); appendAnnotations(writer, annotation); writer.writeEndElement(); } } }
private void appendAnnotations(JsonGenerator json, final EdmAnnotatable annotatable, String memberName) throws SerializerException, IOException { List<EdmAnnotation> annotations = annotatable.getAnnotations(); if (annotations != null && !annotations.isEmpty()) { for (EdmAnnotation annotation : annotations) { String termName = memberName != null ? memberName : ""; if (annotation.getTerm() != null) { termName += "@" + getAliasedFullQualifiedName(annotation.getTerm().getFullQualifiedName()); } if (annotation.getQualifier() != null) { termName += "#" + annotation.getQualifier(); } if (annotation.getExpression() == null && termName.length() > 0) { json.writeBooleanField(termName, true); } else { appendExpression(json, annotation.getExpression(), termName); } appendAnnotations(json, annotation, termName); } } }
private void appendAnnotations(JsonGenerator json, final EdmAnnotatable annotatable, String memberName) throws SerializerException, IOException { List<EdmAnnotation> annotations = annotatable.getAnnotations(); if (annotations != null && !annotations.isEmpty()) { for (EdmAnnotation annotation : annotations) { String termName = memberName != null ? memberName : ""; if (annotation.getTerm() != null) { termName += "@" + getAliasedFullQualifiedName(annotation.getTerm().getFullQualifiedName()); } if (annotation.getQualifier() != null) { termName += "#" + annotation.getQualifier(); } if (annotation.getExpression() == null && termName.length() > 0) { json.writeBooleanField(termName, true); } else { appendExpression(json, annotation.getExpression(), termName); } appendAnnotations(json, annotation, termName); } } }
/** * Replacement character for the XML10 characters that are not supported. * @return */ protected String xml10IncompatibleCharReplacement() { for (EdmSchema schema : getServiceMetaData().getEdm().getSchemas()) { if (schema.getEntityContainer() != null) { for (EdmAnnotation annotation:schema.getAnnotations()) { if (annotation.getTerm() != null && annotation.getTerm().getFullQualifiedName().equals(XML10_CHAR_REPLACE_FQN)) { EdmConstantExpression expr = annotation.getExpression().asConstant(); return expr.getValueAsString(); } } } } return null; }
/** * Replacement character for the XML10 characters that are not supported. * @return */ protected String xml10IncompatibleCharReplacement() { for (EdmSchema schema : getServiceMetaData().getEdm().getSchemas()) { if (schema.getEntityContainer() != null) { for (EdmAnnotation annotation:schema.getAnnotations()) { if (annotation.getTerm() != null && annotation.getTerm().getFullQualifiedName().equals(XML10_CHAR_REPLACE_FQN)) { EdmConstantExpression expr = annotation.getExpression().asConstant(); return expr.getValueAsString(); } } } } return null; }
@Override public EdmAnnotation getAnnotation(final EdmTerm term, String qualifier) { EdmAnnotation result = null; for (EdmAnnotation annotation : getAnnotations()) { if (term.getFullQualifiedName().equals(annotation.getTerm().getFullQualifiedName()) && qualifierEqual(qualifier, annotation.getQualifier())) { result = annotation; break; } } return result; }
@Override public EdmAnnotation getAnnotation(final EdmTerm term, String qualifier) { EdmAnnotation result = null; for (EdmAnnotation annotation : getAnnotations()) { if (term.getFullQualifiedName().equals(annotation.getTerm().getFullQualifiedName()) && qualifierEqual(qualifier, annotation.getQualifier())) { result = annotation; break; } } return result; }