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())); } } }
@Override public EdmTerm getBaseTerm() { if (baseTerm == null && term.getBaseTerm() != null) { baseTerm = edm.getTerm(new FullQualifiedName(term.getBaseTerm())); } return baseTerm; }
@Override public EdmTerm getBaseTerm() { if (baseTerm == null && term.getBaseTerm() != null) { baseTerm = edm.getTerm(new FullQualifiedName(term.getBaseTerm())); } return baseTerm; }
@Override public EdmTerm getTerm() { if (term == null) { if (annotation.getTerm() == null) { throw new EdmException("Term must not be null for an annotation."); } term = edm.getTerm(new FullQualifiedName(annotation.getTerm())); } return term; }
@Override public EdmTerm getTerm() { if (term == null) { if (annotation.getTerm() == null) { throw new EdmException("Term must not be null for an annotation."); } term = edm.getTerm(new FullQualifiedName(annotation.getTerm())); } return term; }
private void odataAnnotations(final Annotatable annotatable, final ClientAnnotatable odataAnnotatable) { for (Annotation annotation : annotatable.getAnnotations()) { FullQualifiedName fqn = null; if (client instanceof EdmEnabledODataClient) { final EdmTerm term = ((EdmEnabledODataClient) client).getCachedEdm(). getTerm(new FullQualifiedName(annotation.getTerm())); if (term != null) { fqn = term.getType().getFullQualifiedName(); } } if (fqn == null && annotation.getType() != null) { final EdmTypeInfo typeInfo = new EdmTypeInfo.Builder().setTypeExpression(annotation.getType()).build(); if (typeInfo.isPrimitiveType()) { fqn = typeInfo.getPrimitiveTypeKind().getFullQualifiedName(); } } final ClientAnnotation odataAnnotation = new ClientAnnotationImpl(annotation.getTerm(), getODataValue(fqn, annotation, null, null)); odataAnnotatable.getAnnotations().add(odataAnnotation); } }
private void odataAnnotations(final Annotatable annotatable, final ClientAnnotatable odataAnnotatable) { for (Annotation annotation : annotatable.getAnnotations()) { FullQualifiedName fqn = null; if (client instanceof EdmEnabledODataClient) { final EdmTerm term = ((EdmEnabledODataClient) client).getCachedEdm(). getTerm(new FullQualifiedName(annotation.getTerm())); if (term != null) { fqn = term.getType().getFullQualifiedName(); } } if (fqn == null && annotation.getType() != null) { final EdmTypeInfo typeInfo = new EdmTypeInfo.Builder().setTypeExpression(annotation.getType()).build(); if (typeInfo.isPrimitiveType()) { fqn = typeInfo.getPrimitiveTypeKind().getFullQualifiedName(); } } final ClientAnnotation odataAnnotation = new ClientAnnotationImpl(annotation.getTerm(), getODataValue(fqn, annotation, null, null)); odataAnnotatable.getAnnotations().add(odataAnnotation); } }