You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by Ankit Jain <ja...@gmail.com> on 2020/05/05 09:12:06 UTC

annotation.getTerm() always returns null

Hi,

Hope all the group members are doing well.

We are using Olingo V4 library in our project to parse the
odata-metadata.xml. We have a requirement where in we need to compare the
term with a specific value. This is piece of code we have written to get
the term for a particular property but it always returns null. We even
tried with the sample Odata service example but even with that we getting
term as null.

for (String propertyName : entityType.getPropertyNames()) {
        EdmProperty property = entityType.getStructuralProperty(propertyName);
        List<EdmAnnotation> propAnnotations = property.getAnnotations();

        boolean isReadOnlyProperty = false;
        for (EdmAnnotation annotation : propAnnotations) {
            if (ALLOW_EDIT_ANNOTATION_TERM.equalsIgnoreCase(annotation.getTerm().getName()))
{
                isReadOnlyProperty = true;
                System.out.println("Uneditatble Property: " + propertyName);
                break;
            }
        }}

Thanks and regards,

Ankit Jain