Why my class property initialized programmatically appears deprecated?

Hello

I encounter a little issue I don’t know if it’s a bug or if I missed something.

I have an XWiki class in an AWM called OIDCClass to manage some OIDC Client.

This OIDC Class contain a property ;

  • owner : String
  • maintainers : Static List (of String)

In my java code I have a API to create client and I initialized this maintainers property like this

DocumentReference oidcClass = new DocumentReference(entityResolver.resolve("xwiki:MySite.Apps.OIDC.Code.OIDCClass", EntityType.DOCUMENT))
clientDoc.setStringListValue(oidcClass, "maintainers", oidcClientForm.getMaintainers());

oidcClientForm.getMaintainers() is a List<String> containing some usernames from our oidc system.

This is how the static list property in the AWM looks

Screenshot 2022-11-03 at 10.59.40

This is the result after creating the document programmatically

Screenshot 2022-11-03 at 11.02.21

If from the UI I just edit the maintainers field, for exemple if I remove username2 and put it again and save, the property doesn’t appears deprecated anymore.

Screenshot 2022-11-03 at 11.04.25

I even export the XML of the object and they are the very same with or without deprecated I can’t found any difference.

      <maintainers>
        <cache>0</cache>
        <customDisplay/>
        <defaultValue/>
        <disabled>0</disabled>
        <displayType>input</displayType>
        <freeText/>
        <hint/>
        <multiSelect>1</multiSelect>
        <name>maintainers</name>
        <number>3</number>
        <picker>1</picker>
        <prettyName>Maintainers</prettyName>
        <relationalStorage>1</relationalStorage>
        <separator> </separator>
        <separators> ,|</separators>
        <size>1</size>
        <sort>none</sort>
        <unmodifiable>0</unmodifiable>
        <validationMessage/>
        <validationRegExp/>
        <values/>
        <classType>com.xpn.xwiki.objects.classes.StaticListClass</classType>
      </maintainers>
...
    <property>
      <maintainers>
        <value>username1</value>
        <value>username2</value>
      </maintainers>
    </property>

And an other issue related to the deprecated property is that if a do a XWQL request on OIDCClass and maintainers property, result doesn’t show up if property is deprecated, when edited and deprecated remove the request works. I don’t know if it’s a feature ? Is it a way to return deprecated results ?

        String statement =
                "FROM doc.object(MySite.Apps.OIDC.Code.OIDCClass) as client "
                + "WHERE client.owner = :username OR (:username member of client.maintainers)";
        
            List<String> clients = null;
            DocumentReference oidcClass = getOidcClass();
            
            try {        	
                clients =
                    this.queryManager.createQuery(statement, Query.XWQL)
                    .bindValue("username", username)
                    .execute();

I triple checked and my property is calles maintainers and when I set it programatically it’s also maintainers there is no spelling issue because I know property not in the class would appear deprecated.

Many thanks in advance :slight_smile: Sorry the post is a bit long but I hope it’s comprehensive.

Regards

The deprecated bug in my case appears only when Relational storage is checked in the properties of the static list.

Removing this Relational storage (what does this property) solve the deprecated issue, but broke my WXQL request :username member of client.maintainers

Should I report this on the Jira as a bug or it’s me missing something ?

I found the cause of the deprecated issue. When I uncheck the checkbox Relational Storage it works.

But if I uncheck it my request xwql :username member of client.maintainers doesn’t works anymore.

What is doing the relational storage option, and how looks the value in the database when relational storage is not checked ?