if (request != null) {
url = (String) request.get("url");
if (url == null)
return getDynamicUrl(contentid);
else {
Datasource ds = null;
String ret = null;
try {
//if there is an attribute URL the servlet was called with a beautiful URL so give back a beautiful URL
//check if valid local link
String applicationrule = (String) config.get("applicationrule");
ds = config.getDatasource();
Expression expression = null;
try {
expression = PortalConnectorFactory.createExpression("object.contentid == '" + contentid
+ "' && " + applicationrule);
} catch (ParserException exception) {
log.error("Error while building expression object for " + contentid, exception);
System.out.println("Error while building expression object for " + contentid);
ret = getDynamicUrl(contentid);
}
DatasourceFilter filter = null;
try {
filter = ds.createDatasourceFilter(expression);
} catch (ExpressionParserException e) {
log.error("Error while building filter object for " + contentid, e);
ret = getDynamicUrl(contentid);
}
int count = 0;
try {
count = ds.getCount(filter);
} catch (DatasourceException e) {
log.error("Error while querying for " + contentid, e);
ret = getDynamicUrl(contentid);
}