From: <ap...@vh...> - 2006-06-09 21:09:06
|
Author: apevec Date: 2006-06-09 23:04:49 +0200 (Fri, 09 Jun 2006) New Revision: 1153 Modified: trunk/ccm-ldn-aplaws/src/com/arsdigita/aplaws/AutoCategorisation.java Log: reformatting and minor fixes Modified: trunk/ccm-ldn-aplaws/src/com/arsdigita/aplaws/AutoCategorisation.java =================================================================== --- trunk/ccm-ldn-aplaws/src/com/arsdigita/aplaws/AutoCategorisation.java 2006-06-09 16:08:05 UTC (rev 1152) +++ trunk/ccm-ldn-aplaws/src/com/arsdigita/aplaws/AutoCategorisation.java 2006-06-09 21:04:49 UTC (rev 1153) @@ -275,19 +275,17 @@ cat = cats[cats.length - 1]; } else { if (isVerbose) { - System.out - .println("category path not found: " - + url); + out("category path not found: "+url); } } } // category index item - item = (ContentItem) cat.getIndexObject(); + if (cat != null) { + item = (ContentItem) cat.getIndexObject(); + } } else { if (isVerbose) { - System.out - .println("unsupported application: " + appType + " at " - + url); + out("unsupported application: " + appType + " at " + url); } } } else { @@ -333,7 +331,7 @@ dc.addFilter("domain.key IN ('IPSV','LGCL')"); while (!foundIPSVLGCL && dc.next()) { foundIPSVLGCL = true; - if (isDebug) { + if (isVerbose) { out("manual IPSV/LGCL found"); } } @@ -369,22 +367,24 @@ if (persistChanges) { category.removeChild(item); } - if (isDebug){ + if (isVerbose){ out("removing oldAuto "+category+" from "+item); } } - cursor = ((DataAssociation)DomainServiceInterfaceExposer - .get(item, "categories")).cursor(); - cursor.addEqualsFilter("id", newAutoCategories); - while (cursor.next()) { - Object categoryID = cursor.get("id"); - if (persistChanges) { - DataObject link = cursor.getLink(); - link.set("isAuto",Boolean.TRUE); + if (!newAutoCategories.isEmpty()) { + cursor = ((DataAssociation)DomainServiceInterfaceExposer + .get(item, "categories")).cursor(); + cursor.addEqualsFilter("id", newAutoCategories); + while (cursor.next()) { + Object categoryID = cursor.get("id"); + if (persistChanges) { + DataObject link = cursor.getLink(); + link.set("isAuto",Boolean.TRUE); + } + if (isVerbose) { + out("isAuto=TRUE for new categoryID="+categoryID+"/"+item); + } } - if (isDebug) { - out("isAuto=TRUE for new categoryID="+categoryID+"/"+item); - } } } else { // TODO derive other domains from assigned terms using mappings @@ -394,8 +394,7 @@ } } else { if (isVerbose) { - System.out - .println("skip terms, item not found"); + out("skip terms, item not found"); } } } else if ("term".equals(qName)) { @@ -411,10 +410,9 @@ out("low score "+score+" for "+term.getName()+" "+term.getUniqueID()); } } else if (isVerbose) { - System.out - .println("term names differ XML:" - + termNameFromXML + " DB:" - + term.getName()); + out("term names differ XML:" + + termNameFromXML + " DB:" + + term.getName()); } term = null; } else if (isVerbose) { |