Question

I am writing a query which provides results on basis of either creation date or last modification date

SELECT * FROM cmis:document where cmis:createdBy NOT like '%System%' AND cmis:contentStreamLength > 0 AND (cmis:creationDate > '2014-03-12T18:19:48+0530' AND cmis:creationDate < '2014-03-12T18:32:48+0530') AND (cmis:lastModificationDate > '2014-03-12T18:19:48+0530' AND cmis:lastModificationDate < '2014-03-12T18:32:48+0530')

As per my need i want to check either on basis of cmis:creationDate or cmis:lastModificationDate, which seems to be logical but when i am trying to use query like

SELECT * FROM cmis:document where cmis:createdBy NOT like '%System%' AND cmis:contentStreamLength > 0 AND (cmis:creationDate > '2014-03-12T18:19:48+0530' AND cmis:creationDate < '2014-03-12T18:32:48+0530') OR (cmis:lastModificationDate > '2014-03-12T18:19:48+0530' AND cmis:lastModificationDate < '2014-03-12T18:32:48+0530')

it throws error & does not run.

I read it may not be possible to use OR predicate as such.Any idea how i can achieve this?

Thanks for help.

Was it helpful?

Solution

I was able to get time in desired format using below code.

private static final SimpleDateFormat CMIS_DATE_FORMATTER = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ") { @Override public StringBuffer format(Date date, StringBuffer toAppendTo, java.text.FieldPosition pos) { StringBuffer toFix = super.format(date, toAppendTo, pos); return toFix.insert(toFix.length()-2, ':'); }; };

Now i can get query with OR predicate.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top