@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; }
public static void addAnnotations( final EdmEnabledODataClient client, final Map<Class<? extends AbstractTerm>, Object> annotations, final ClientAnnotatable annotatable) { for (Map.Entry<Class<? extends AbstractTerm>, Object> entry : annotations.entrySet()) { final Namespace nsAnn = entry.getKey().getAnnotation(Namespace.class); final Term termAnn = entry.getKey().getAnnotation(Term.class); final FullQualifiedName termName = new FullQualifiedName(nsAnn.value(), termAnn.name()); final EdmTerm term = client.getCachedEdm().getTerm(termName); if (term == null) { LOG.error("Could not find term for class {}", entry.getKey().getName()); } else { annotatable.getAnnotations().add(getODataAnnotation( client, term.getFullQualifiedName().toString(), term.getType(), entry.getValue())); } } }
public static void addAnnotations( final EdmEnabledODataClient client, final Map<Class<? extends AbstractTerm>, Object> annotations, final ClientAnnotatable annotatable) { for (Map.Entry<Class<? extends AbstractTerm>, Object> entry : annotations.entrySet()) { final Namespace nsAnn = entry.getKey().getAnnotation(Namespace.class); final Term termAnn = entry.getKey().getAnnotation(Term.class); final FullQualifiedName termName = new FullQualifiedName(nsAnn.value(), termAnn.name()); final EdmTerm term = client.getCachedEdm().getTerm(termName); if (term == null) { LOG.error("Could not find term for class {}", entry.getKey().getName()); } else { annotatable.getAnnotations().add(getODataAnnotation( client, term.getFullQualifiedName().toString(), term.getType(), entry.getValue())); } } }
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(); } } }
writer.writeAttribute(XML_BASE_TERM, getAliasedFullQualifiedName(term.getBaseTerm().getFullQualifiedName(), false));
writer.writeAttribute(XML_BASE_TERM, getAliasedFullQualifiedName(term.getBaseTerm().getFullQualifiedName(), false));
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); } } }
json.writeStringField(BASE_TERM, getAliasedFullQualifiedName(term.getBaseTerm().getFullQualifiedName()));
json.writeStringField(BASE_TERM, getAliasedFullQualifiedName(term.getBaseTerm().getFullQualifiedName()));
/** * 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; }