|
From: <ap...@vh...> - 2006-06-16 17:03:06
|
Author: apevec
Date: 2006-06-16 18:58:26 +0200 (Fri, 16 Jun 2006)
New Revision: 1220
Modified:
trunk/ccm-ldn-aplaws/src/com/arsdigita/aplaws/AutoCategorisation.java
Log:
findItem must not return Folder or ContentBundle
Modified: trunk/ccm-ldn-aplaws/src/com/arsdigita/aplaws/AutoCategorisation.java
===================================================================
--- trunk/ccm-ldn-aplaws/src/com/arsdigita/aplaws/AutoCategorisation.java 2006-06-14 22:57:25 UTC (rev 1219)
+++ trunk/ccm-ldn-aplaws/src/com/arsdigita/aplaws/AutoCategorisation.java 2006-06-16 16:58:26 UTC (rev 1220)
@@ -25,6 +25,7 @@
import com.arsdigita.cms.ContentBundle;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentSection;
+import com.arsdigita.cms.Folder;
import com.arsdigita.cms.dispatcher.ItemResolver;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.domain.DomainCollection;
@@ -273,6 +274,19 @@
ContentItem.LIVE);
if (item != null) {
item = item.getDraftVersion();
+ if (item != null) {
+ // make sure we return real content item,
+ // and not structure (folder or bundle)
+ if (item instanceof Folder) {
+ item = ((Folder) item).getIndexItem();
+ }
+ if (item instanceof ContentBundle) {
+ item = ((ContentBundle) item).getPrimaryInstance();
+ }
+ } else {
+ out("draft item not found for " + url);
+ }
+
} else {
out("live item not found for " + url);
}
@@ -311,7 +325,7 @@
}
// category index item
if (cat != null) {
- item = (ContentItem) cat.getIndexObject();
+ item = ((ContentBundle) cat.getIndexObject()).getPrimaryInstance();
}
} else {
if (isVerbose) {
|