OpenNTF / org.openntf.xsp.jakartaee

XPages Jakarta EE support libraries
Apache License 2.0
21 stars 7 forks source link

Custom object isn't readable when using @ViewEntries #472

Closed jesse-gallagher closed 11 months ago

jesse-gallagher commented 1 year ago

It seems that using a custom object property with @ItemStorage(type = ItemStorage.Type.JSON) fails when reading view entries, but not with a normal method or @ViewDocuments.

Custom class:

public class JsonConfig {
  public String id, unid, title;
  public String[] arr;
}

Repo:

public interface Repository extends DominoRepository<Employee, String> {
  @ViewEntries("Employee")
  Stream<Employee> findAllPerView();
}

Property:

private @Column @ItemStorage(type = ItemStorage.Type.JSON) JsonConfig jsonConfig;

Stack trace:

java.lang.UnsupportedOperationException: The type class model.JsonConfig is not supported yet
  at jakarta.nosql.ValueReaderDecorator.read(ValueReaderDecorator.java)
  at org.eclipse.jnosql.communication.DefaultValue.get(DefaultValue.java:51)
  at org.eclipse.jnosql.mapping.reflection.AbstractFieldMapping.getValue(AbstractFieldMapping.java:107)
  at org.eclipse.jnosql.mapping.reflection.DefaultFieldMapping.getValue(DefaultFieldMapping.java:26)
  at org.eclipse.jnosql.mapping.document.DocumentFieldConverters$DefaultConverter.convert(DocumentFieldConverters.java:133)
  at org.eclipse.jnosql.mapping.document.AbstractDocumentEntityConverter.lambda$feedObject$6(AbstractDocumentEntityConverter.java:124)
  at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
  at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
  at java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1580)
  at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:497)
  at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:487)
  at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
  at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
  at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:241)
  at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:485)
  at org.eclipse.jnosql.mapping.document.AbstractDocumentEntityConverter.convertEntity(AbstractDocumentEntityConverter.java:110)
  at org.eclipse.jnosql.mapping.document.AbstractDocumentEntityConverter.toEntity(AbstractDocumentEntityConverter.java:96)
  at org.eclipse.jnosql.mapping.document.DefaultDocumentEntityConverter$Proxy$_$$_WeldClientProxy.toEntity(Unknown Source)
  at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
  at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
  at java.util.Iterator.forEachRemaining(Iterator.java:116)
  at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
  at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:497)
  at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:487)
  at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
  at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:241)
  at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
  at rest.EmployeeResource.getPerView(EmployeeResource.java:77)
  ...
jesse-gallagher commented 11 months ago

In doing this, I also expanded the JSON enum's Javadoc to mention that it will cause the item to be non-summary by default.