[ 
http://opensource.atlassian.com/projects/roller/browse/ROL-1155?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Denis Balazuc updated ROL-1155:
-------------------------------

    Attachment: ROLL1155-patch1.txt

(patch ROLL155-patch1.txt submitted against Roller 3.1 trunk)

The issue comes from the implementation of 
org.apache.roller.business.hibernate.HibernateWeblogManagerImpl.getWeblogEntries
which accepts all sort of parameters. When dates are specified, and regardless 
of the status of the entries being queries ('PUBLISHED', 'DRAFT', 'PENDING'), 
the method adds a condition against the 'pubTime' field in the SQL query it 
creates if a start date or end date is specified.
This method works when the status is 'PUBLISHED' but unfortunately, entries in 
the 'weblogentry' table that are not yet published have a 'pubTime' set to 
NULL. This causes all such queries with a status different than 'PUBLISHED', 
which contains a start date and/or and end date to return no result. The issue 
also happens on entries that are in 'PENDING' status and can also be verified 
this way.

The 'ROLL155-patch1.txt' file fixes this issue by considering that if a start 
date and/or and end date are specified in the query for an entry that is 
'PENDING' or 'DRAFT' will be considered as queries against the 'updateTime' 
field instead of the 'pubTime' field which is always null for those statuses. 
There is no impact on the current code of the 3.1 branch since most of the 
callers of this method specify a 'PUBLISHED' status and never a start/end date. 
There is no guarantee however on the impact on customer code that uses this 
method since this fix slightly modifies its behaviour.

However, there is a deeper problem with this approach, since some logic is 
introduced inside the data access layer about how to query entries. This should 
be delegated to a higher level in the application layers . A better alternative 
would be to deprecate the offending method in favor of a a query by 
criteria/template pattern ( a getWeblogEntries with a WeblogEntryData parameter 
used as query parameters for instance), allowing more flexibility in what 
clients of this method can do. 
The proposed patch doesn't implement this solution since it requires an 
interface change, but is a straightforward fix that may introduce confusion on 
the contract of this method later.




> Filtering draft entries using dates produces no results
> -------------------------------------------------------
>
>                 Key: ROL-1155
>                 URL: 
> http://opensource.atlassian.com/projects/roller/browse/ROL-1155
>             Project: Roller
>          Issue Type: Bug
>          Components: Weblog Editor
>            Reporter: Rob Wilson
>            Assignee: Roller Unassigned
>            Priority: Minor
>         Attachments: ROLL1155-patch1.txt
>
>
> After writing a draft entry, go to entries and on the filter, select today on 
> both dates, select Draft Only and filter. No results appear. Entries do 
> appear if no dates are selected. 
> http://blogs-tst.sun.com/roller/editor/weblogEntryManagement.do

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://opensource.atlassian.com/projects/roller/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to