From: <mb...@re...> - 2005-02-24 19:22:19
|
Author: mbooth Date: 2005-02-24 20:20:47 +0100 (Thu, 24 Feb 2005) New Revision: 298 Modified: ccm-ldn-aplaws/trunk/src/com/arsdigita/aplaws/ui/TermWidget.java ccm-ldn-aplaws/trunk/web/__ccm__/themes/aplaws/content-section-admin.xsl Log: Fix to show all child terms of a domain, even if they're in a domain. This is specifically relevant to the LGDL which has child terms in the LGSL. Modified: ccm-ldn-aplaws/trunk/src/com/arsdigita/aplaws/ui/TermWidget.java =================================================================== --- ccm-ldn-aplaws/trunk/src/com/arsdigita/aplaws/ui/TermWidget.java 2005-02-24 13:38:23 UTC (rev 297) +++ ccm-ldn-aplaws/trunk/src/com/arsdigita/aplaws/ui/TermWidget.java 2005-02-24 19:20:47 UTC (rev 298) @@ -29,10 +29,11 @@ import com.arsdigita.bebop.parameters.BigDecimalParameter; import com.arsdigita.categorization.Category; import com.arsdigita.categorization.CategoryCollection; -import com.arsdigita.domain.DomainCollection; import com.arsdigita.domain.DomainObjectFactory; +import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.OID; +import com.arsdigita.persistence.SessionManager; import com.arsdigita.xml.Element; import com.arsdigita.xml.XML; @@ -82,7 +83,6 @@ widget.addAttribute("mode", (String)state.getValue(m_mode)); widget.addAttribute("name", getName()); - widget.addAttribute("domain", domain.getKey()); Set ids = new HashSet(); @@ -93,15 +93,32 @@ } } - DomainCollection terms = domain.getTerms(); - + DataCollection terms = SessionManager.getSession().retrieve + (Term.BASE_DATA_OBJECT_TYPE); + terms.addEqualsFilter("model.roTransParents.id", + domain.getModel().getID()); terms.addEqualsFilter("model.parents.link.relationType", "child"); terms.addPath("model.parents.link.sortKey"); terms.addPath("model.parents.id"); + terms.addPath("domain.key"); + + // Pull out everything related to the category, otherwise + // another query per row is executed when doing term.getModel(); + terms.addPath("model.objectType"); + terms.addPath("model.displayName"); + terms.addPath("model.defaultDomainClass"); + terms.addPath("model.name"); + terms.addPath("model.description"); + terms.addPath("model.url"); + terms.addPath("model.isEnabled"); + terms.addPath("model.isAbstract"); + terms.addPath("model.defaultAncestors"); + Map children = new HashMap(); while (terms.next()) { - Term term = (Term) terms.getDomainObject(); + Term term = (Term) + DomainObjectFactory.newInstance(terms.getDataObject()); BigDecimal parentID = (BigDecimal) terms.get("model.parents.id"); List childList = (List)children.get(parentID); @@ -125,7 +142,7 @@ Term term = pair.getTerm(); BigDecimal sortKey = pair.getSortKey(); - generateTerm(el, domain.getKey(), term, ids, sortKey, children); + generateTerm(el, term, ids, sortKey, children); } } } @@ -155,7 +172,6 @@ } public void generateTerm(Element parent, - String domainKey, Term term, Set selected, BigDecimal sortKey, @@ -164,7 +180,7 @@ Element el = generateCategory(parent, cat, selected, sortKey); el.addAttribute("pid", term.getUniqueID().toString()); - el.addAttribute("domain", domainKey); + el.addAttribute("domain", term.getDomain().getKey()); List c = (List)children.get(cat.getID()); if (c != null) { @@ -173,8 +189,7 @@ TermSortKeyPair pair = (TermSortKeyPair) i.next(); Term child = pair.getTerm(); BigDecimal childSortKey = pair.getSortKey(); - generateTerm(el, domainKey, child, - selected, childSortKey, children); + generateTerm(el, child, selected, childSortKey, children); } } } Modified: ccm-ldn-aplaws/trunk/web/__ccm__/themes/aplaws/content-section-admin.xsl =================================================================== --- ccm-ldn-aplaws/trunk/web/__ccm__/themes/aplaws/content-section-admin.xsl 2005-02-24 13:38:23 UTC (rev 297) +++ ccm-ldn-aplaws/trunk/web/__ccm__/themes/aplaws/content-section-admin.xsl 2005-02-24 19:20:47 UTC (rev 298) @@ -16,7 +16,7 @@ <xsl:template name="cat-widget-cat-name"> <xsl:value-of select="@name"/> - <xsl:if test="@pid and @domain='LGDL'"> + <xsl:if test="@pid and @domain='LGSL'"> (<xsl:value-of select="@pid"/>) </xsl:if> </xsl:template> |