Marko Zadravec
Marko Zadravec

Reputation: 8730

Eclipse Scout Neon : code type not working

I have one List box and I would like to set code type of it.

I create new AbstractCodeType :

public class MyCodeType extends AbstractCodeType<String, String> {

  private static final long serialVersionUID = 6808664924551155395L;

  public static final String ID = null;

  @Override
  public String getId() {

    return ID;
  }

  @Order(10.0)
  public static class UnknownCode extends AbstractCode<String> {

    private static final long serialVersionUID = -1307260056726644943L;

    public static final String ID = "Unknown";

    @Override
    protected String getConfiguredText() {

      return TEXTS.get("Unknown");
    }

    @Override
    public String getId() {

      return ID;
    }
  }
}

and I set this code type in list box :

 @Override
  protected Class<? extends ICodeType<?, String>> getConfiguredCodeType() {

    return MyCodeType.class;
  }

But doesn't work. It return empty box.

While I was debugging I noticed that in AbstractListBox.class in initConfig method it call this code type and set code type in m_lookupCall inside setCodeTypeClass. Then inside execLoadTableData, it get call but this call return empty array when called call.getDataByAll().

I suspect that converting between code type and Lookup call does not work properly.

EDIT


I try to debug where is the problem and if follow the path :

initConfig() -> CodeLookupCall.newInstanceByService(m_codeTypeClass); (line 581)

and if you look inside CodeLookupCall ;

getDataByAll() in line 221 `resolveCodes(v)` -> BEANS.opt(m_codeTypeClass) -> bean.getInstance() -> m_producer.produce(this) -> return (T) getCache().get(createCacheKey(type));

This is in class CodeService.class in line 97 :

Class<T> type is right class and createCacheKey(type) return not null object but then getCache().get(...) return null. From this point on everything is null (what is reasonable regarding that getCodeType return null.)

This is what I found out while debugging, if it helps someone to figure out what is wrong.

Upvotes: 0

Views: 120

Answers (2)

Ken
Ken

Reputation: 36

I tested your code snippet with Eclipse Scout Neon M4 and I could reproduce your described error.

However, it seems that this bug has been fixed with Scout Neon M5. So I suggest that you upgrade to the latest milestone version, which is recommended anyway.

Upvotes: 1

Judith Gull
Judith Gull

Reputation: 41

It looks like your codetype class is not found by the bean manager. CodeService only finds CodeTypes in its classpath (accessible in the server).

-> You might need to move your class to the shared project.

You can find examples for code types in the contacts demo application: https://github.com/BSI-Business-Systems-Integration-AG/org.eclipse.scout.docs/tree/releases/5.2.x/code/contacts

Upvotes: 2

Related Questions