<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16981" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=943501910-08022010><FONT face=Arial
color=#0000ff size=2>Hi </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=943501910-08022010><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=943501910-08022010><FONT face=Arial
color=#0000ff size=2>Self-replying, the problem has been identified and
solved. </FONT></SPAN><SPAN class=943501910-08022010><FONT face=Arial
color=#0000ff size=2>It was merely a simple typo, the invalid
key "collectorTime" was used instead of the valid key "propertyTime" in the
parameter string.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=943501910-08022010><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=943501910-08022010><FONT face=Arial
color=#0000ff size=2>Sorry for any inconvenience. I should
have realized this sooner, but that's just typical for typos I guess.
>.<</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=943501910-08022010><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=943501910-08022010><FONT face=Arial
color=#0000ff size=2>Best regards,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=943501910-08022010><FONT face=Arial
color=#0000ff size=2>Paul</FONT></SPAN></DIV><BR>
<BLOCKQUOTE dir=ltr
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> opencms-dev-bounces@opencms.org
[mailto:opencms-dev-bounces@opencms.org] <B>On Behalf Of </B>Paul-Inge
Flakstad<BR><B>Sent:</B> 5. februar 2010 15:25<BR><B>To:</B> The OpenCms
mailing list<BR><B>Subject:</B> [opencms-dev] CmsTimeFrameCategoryCollector
not filtering properly<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV><FONT face=Arial size=2><SPAN class=706325713-05022010>Hi
</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=706325713-05022010></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=706325713-05022010>I'm using
org.opencms.file.collectors.CmsTimeFrameCategoryCollector for the first time,
and I </SPAN></FONT><FONT face=Arial size=2><SPAN
class=706325713-05022010>don't know if there's a bug in this
file, or if I'm just doing something terribly wrong. No matter
what time range I define, all resources in the given folder is returned by the
collector. Basically, I can just as well leave out the
timeStart and timeEnd parts of the collector parameter, as they do not
influence the result in any way(!).</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=706325713-05022010></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=706325713-05022010>Any ideas why this
is happening?</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=706325713-05022010></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=706325713-05022010>My development
system is the 7.5.1 release version. To avoid misunderstandings, and so
you'll be able to test for yourselves, I'm attaching my JSP test code (in
order for this particular JSP to work, place it in the same folder as
your timestamped resources):</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=706325713-05022010></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=706325713-05022010><%@ page
import="org.opencms.jsp.*,<BR>java.util.*,<BR>java.text.SimpleDateFormat,<BR>org.opencms.file.*,<BR>org.opencms.file.collectors.*,<BR>org.opencms.relations.*"
session="false" </SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=706325713-05022010>%><%<BR></SPAN></FONT><FONT size=+0><SPAN
class=706325713-05022010><FONT face=Arial size=2>CmsJspXmlContentBean cms =
new CmsJspActionElement(pageContext, request,
response);</FONT></SPAN></FONT></DIV>
<DIV><FONT size=+0><SPAN class=706325713-05022010><FONT face=Arial
size=2></FONT> </DIV>
<DIV><SPAN class=706325713-05022010></SPAN><FONT face=Arial size=2>/<SPAN
class=706325713-05022010>/ Make the appropriate adjustments to the variables
below</SPAN><BR>String start = "2010-02-07 12:00:00";<BR>String end =
"2010-02-09 12:00:00";<BR>String timeProp = "collector.date";<BR>String
resType = "my_event";</FONT></DIV>
<DIV><SPAN class=706325713-05022010><FONT face=Arial size=2>String listFolder
= cms.getRequestContext().getFolderUri(); // default setting: look inside this
JSP's parent folder</FONT></SPAN></DIV>
<DIV><SPAN class=706325713-05022010><FONT face=Arial size=2>// No need to
change anything below this line</FONT></SPAN></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=706325713-05022010>SimpleDateFormat
df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");<BR>Date startDate =
df.parse(start);<BR>Date endDate = df.parse(end);</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=706325713-05022010>out.println("<h2>Time range
parameters:</h2>");<BR>out.println("<p>Start set to: " +
df.format(startDate) + "<br/>");<BR>out.println("End set to: " +
df.format(endDate) + "<br/>");<BR>out.println("Time property set to: " +
timeProp + "<br/>");</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=706325713-05022010>out.println("List
folder set to: " + listFolder + "<br/>");<BR>out.println("Resource type
set to: " + resType + "</p>");</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=706325713-05022010>String
collectorParam = "resource=" + listFolder;<BR>collectorParam +=
"|resourceType=np_event";<BR>collectorParam += "|timeStart=" +
start;<BR>collectorParam += "|timeEnd=" + end;<BR>collectorParam +=
"|collectorTime=" + timeProp;<BR>collectorParam +=
"|sortDescending=true";<BR>collectorParam +=
"|resultLimit=100";</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=706325713-05022010>I_CmsXmlContentContainer xmlEvents =
cms.contentload("timeFrameAndCategories", collectorParam,
false);<BR>out.println("<h2>Resources collected for this time
range:</h2>");<BR>out.println("<ul>");<BR>while
(xmlEvents.hasMoreContent()) {<BR> String filename =
cms.contentshow(xmlEvents, "%(opencms.filename)");<BR>
String timePropValue = cms.getCmsObject().readPropertyObject(filename,
timeProp, false).getValue();<BR> Date timestamp = new
Date(Long.valueOf(timePropValue).longValue());<BR>
out.print("<li><code>" + filename + "</code>: timestamp is
<strong>" + df.format(timestamp) + "</strong> –
");<BR> out.print("this is <em>" +
(timestamp.after(startDate) ? "after" : "before") + "</em> the time
range start");<BR> //out.print(" [" + timestamp.getTime() +
(timestamp.getTime() > startDate.getTime() ? " > " : " < ") +
startDate.getTime() + "]"); // Remove comment to
print timestamp long comparisons<BR> out.print(" and
<em>" + (timestamp.after(endDate) ? "after" : "before") + "</em>
the time range end");<BR> //out.print(" [" +
timestamp.getTime() + (timestamp.getTime() > endDate.getTime() ? " > " :
" < ") + endDate.getTime() + "]"); // Remove comment to
print timestamp long comparisons<BR>
out.print("</li>");<BR>}<BR>out.println("</ul>");</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=706325713-05022010>%></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=706325713-05022010></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=706325713-05022010>Best
regards,</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=706325713-05022010>Paul</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=706325713-05022010></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=706325713-05022010></SPAN></FONT> </DIV></BLOCKQUOTE></BODY></HTML>