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 annotations(final ClientAnnotatable odataAnnotatable, final Annotatable annotatable) { for (ClientAnnotation odataAnnotation : odataAnnotatable.getAnnotations()) { final Annotation annotation = new Annotation(); annotation.setTerm(odataAnnotation.getTerm()); annotation.setType(odataAnnotation.getValue().getTypeName()); updateValuable(annotation, odataAnnotation); annotatable.getAnnotations().add(annotation); } }
private void annotations(final ClientAnnotatable odataAnnotatable, final Annotatable annotatable) { for (ClientAnnotation odataAnnotation : odataAnnotatable.getAnnotations()) { final Annotation annotation = new Annotation(); annotation.setTerm(odataAnnotation.getTerm()); annotation.setType(odataAnnotation.getValue().getTypeName()); updateValuable(annotation, odataAnnotation); annotatable.getAnnotations().add(annotation); } }
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); } }