.getParameterValues("minimalRelevance")[0]);
} catch (Exception ex) {
minimalRelevance = DefaultValuesHandler
.getDefaultMinimalRelevance(model);
}
EnhancedRequest ehRequest = new EnhancedRequest(request);
String requestURL;
if (ehRequest.getRequestURI().getPath().startsWith("/remote")) {
requestURL = new EnhancedRequestURI(ehRequest.getRequestURI())
.getParameter("url");
} else {
requestURL = ehRequest.getRequestURLWithoutParams().toString();
}
log.info("looking up resource: " + requestURL);
Resource resource = model.createResource(requestURL);
if (!isPermitted(resource)) {
throw new AccessControlException(
"No suitable permission to access topic");
}
if (!model.containsResource(resource)) {
chain.doNext(request, response);
return;
}
if ((!resource.hasProperty(RDF.type, KNOBOT.CalendarTopic))) {
chain.doNext(request, response);
return;
}
checkLanguageAvailability(resource, ehRequest);
/*
* ItemsList itemsList = new ItemsListFactory(model)
*/
// ItemsList itemsList = new ItemsList(resource, minimalRelevance);
boolean onlyDirect = false;
try {
onlyDirect = "true".equals(request.getRequestURI()
.getParameterValues("onlyDirect")[0]);
} catch (Exception ex) {
}
boolean unOrdered = false;
try {
unOrdered = "true".equals(request.getRequestURI()
.getParameterValues("unOrdered")[0]);
} catch (Exception ex) {
}
RelationIterator itemIterator;
itemIterator = new DirectRelationIterator(resource);
if (!onlyDirect) {
itemIterator = new IndirectRelationIterator(
(CSRelationIterator) itemIterator, minimalRelevance);
}
if (!unOrdered) {
itemIterator = new StrengthSortedRelationIterator(
(CSRelationIterator) itemIterator);
}
/*
* RelationIterator itemIterator = new IndirectRelationIterator(new
* DirectRelationIterator( resource), minimalRelevance);
*/
Model resultModel = PersonalHistory.update(resource); // ph updated
// first to
// avoid old
// versions in
// result (such
// as if user is
// maker of
// item)
resultModel.add(JenaUtil.getExpandedResource(resource, 1, true));
try {
Resource attachmentResource = resource.getProperty(
ATTACH.attachments).getResource();
resultModel
.add(JenaUtil.getExpandedResource(attachmentResource, 2));
} catch (NullPointerException ex) {
}
try {
Resource requiresResource = resource.getProperty(
AUTHORIZATION.requires).getResource();
resultModel.add(JenaUtil.getExpandedResource(requiresResource, 2));
} catch (NullPointerException ex) {
}
int from = 1;
int till = 10000;
Date now = new Date();
Date startDate;
String[] startDateParamValues = ehRequest.getRequestURI()
.getParameterValues("startDate");
if (startDateParamValues != null) {
try {
startDate = new SimpleDateFormat("yyyy-MM-dd")
.parse(startDateParamValues[0]);
} catch (ParseException e) {
throw new HandlerException(e);
}
} else {
startDate = getStartOfMonth(now);
}
Set relevantMonths = new HashSet();
Date endDate;
String[] endDateParamValues = ehRequest.getRequestURI()
.getParameterValues("endDate");
if (endDateParamValues != null) {
try {
endDate = new SimpleDateFormat("yyyy-MM-dd")
.parse(endDateParamValues[0]);
} catch (ParseException e) {
throw new HandlerException(e);
}
endDate.setTime(endDate.getTime() + (24*60*60-1)*1000);
} else {
endDate = getEndOfMonth(now);
if ((endDate.getTime() - now.getTime()) < (15*24*60*60*1000)) {
relevantMonths.add(new Month(startDate, endDate));
endDate = getEndOfMonth(new Date(now.getTime() + 15*24*60*60*1000));
relevantMonths.add(new Month(endDate));
}
}
Set relevantAreas = new HashSet();
relevantMonths.add(new Month(startDate));
String[] regionParamValues = ehRequest.getRequestURI()
.getParameterValues("region");
Resource area;
if (regionParamValues != null) {
area = getRegion(regionParamValues[0]);
} else {