0

I have a nested object like

public class SQSMessage implements Serializable {
    private String type;
    private boolean isEntity;
    private String eventType;
    private SystemInfo systemInfo;
    private DomainAttributes domainAttributes;

    @Data
    public static class SystemInfo implements Serializable {
        private String identifier;
        private String ownedBy;
        private Payload payload;
        private EntityTags entityTags;
        private long createdOn;
        private String createdBy;
        private long version;
        private long lastUpdatedOn;
        private String lastUpdatedBy;
        private String attrEncKeyName;

        @Data
        public static class Payload implements Serializable {
            private String bucketName;
            private String objName;
            private String encKeyName;
            private byte[] payloadBytes;
            private byte[] decryptedBytes;
            private byte[] sanitizedBytes;
        }
        @Data
        public static class EntityTags implements Serializable {
            private List<Tag> tags;
            @Data
            public static class Tag implements Serializable {
                private String tagName;
                private String tagValue;
            }
        }
    }
    @Data
    public static class DomainAttributes implements Serializable {
        private String updatedByAuthId;
        private String saveType;
        private String docName;
        private String ceDataType;
        private String year;
        private String appId;
        private String formSetId;
        private String appSku;
        private String deviceId;
        private String deviceName;
    }
}

I would like to query the collection of SQSObjects by applying a filter like

ResultSet<SQSMessage> results = parser.retrieve(indexedSQSMessage, "SELECT * FROM indexedSQSMessage WHERE type='income' and DomainAttributes.saveType in ('endSession', 'cancelled')or (DomainAttributes.countryCode is null or DomainAttributes.countryCode='US'");

Is that possible using CQEngine? if yes.. please send me the examples.

The reason why I want o make that as sql... where clause is dynamic for various use cases.

SSK
  • 3,444
  • 6
  • 32
  • 59

1 Answers1

0

Your example is more complicated than it needs to be for the question, so I am just skimming it. (Read about SSCCE)

However generally this kind of thing should be possible. See this related question/answer for how to construct nested queries: Can CQEngine query an object inside another object

If you set up attributes like that, you should be able to use them in SQL queries as well as programmatically.

npgall
  • 2,979
  • 1
  • 24
  • 24