* trunk/ccm-cms/src/com/arsdigita/cms/installer/xml/ContentTypeHelperImpl.java

trunk/ccm-cms/src/com/arsdigita/cms/ContentType.java
 
  Vererbungshierarchien werden jetzt korrekt in die content_types Tabelle eingetragen

* releases/1.1.2/ccm-zes-aplaws/bundles/devel/cfg/applications.cfg
  
  ccm-sci-types-organizationwithpublications hinzugefügt

* trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchFolderBrowser.java
  trunk/ccm-cms/src/com/arsdigita/cms/Folder.java

  Sortierung im ItemSearchWidget korrigiert. Könnte aber eventuell Seiteneffekte an anderen Stellen haben (bisher keine gefunden).



git-svn-id: https://svn.libreccm.org/ccm/trunk@960 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2011-06-10 19:56:58 +00:00
parent b51c08c90b
commit a62873c8e9
4 changed files with 86 additions and 39 deletions

View File

@ -408,6 +408,10 @@ public class ContentType extends ACSObject {
*/ */
public void addDescendants(BigDecimal newDescendant) { public void addDescendants(BigDecimal newDescendant) {
if (getID().equals(newDescendant)) {
return;
}
// Get the list of descendants from db // Get the list of descendants from db
String descendants = (String) get(DESCENDANTS); String descendants = (String) get(DESCENDANTS);

View File

@ -630,7 +630,7 @@ public class Folder extends ContentItem {
public ItemCollection(DataQuery query) { public ItemCollection(DataQuery query) {
super(new DataQueryDataCollectionAdapter(doAlias(query), ITEM)); super(new DataQueryDataCollectionAdapter(doAlias(query), ITEM));
init(query, true); init(query, false);
} }
private void init(DataQuery query, boolean bSort) { private void init(DataQuery query, boolean bSort) {

View File

@ -31,12 +31,15 @@ import com.arsdigita.persistence.metadata.ObjectType;
import com.arsdigita.search.MetadataProviderRegistry; import com.arsdigita.search.MetadataProviderRegistry;
import com.arsdigita.util.Assert; import com.arsdigita.util.Assert;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
public class ContentTypeHelperImpl implements ContentTypeHelper { public class ContentTypeHelperImpl implements ContentTypeHelper {
private static final Logger s_log = Logger.getLogger(ContentTypeHelperImpl.class); private static final Logger s_log = Logger.getLogger(
ContentTypeHelperImpl.class);
private ContentType m_type; private ContentType m_type;
private ContentType m_parent; private ContentType m_parent;
// Basic Content type properties // Basic Content type properties
@ -223,7 +226,8 @@ public class ContentTypeHelperImpl implements ContentTypeHelper {
} }
// Turn on search indexing for this type // Turn on search indexing for this type
ObjectType type = SessionManager.getMetadataRoot().getObjectType(m_objectType); ObjectType type = SessionManager.getMetadataRoot().getObjectType(
m_objectType);
if (type.isSubtypeOf(ContentPage.BASE_DATA_OBJECT_TYPE) if (type.isSubtypeOf(ContentPage.BASE_DATA_OBJECT_TYPE)
&& !isInternal()) { && !isInternal()) {
s_log.debug("Registering search adapter for " s_log.debug("Registering search adapter for "
@ -318,8 +322,13 @@ public class ContentTypeHelperImpl implements ContentTypeHelper {
*/ */
private void createPedigree(ContentType type) { private void createPedigree(ContentType type) {
//System.out.printf(String.format(
// "\n\nCreating pedigrees for content type '%s'...\n",
// type.getClassName()));
// The parent content type // The parent content type
ContentType parent = null; ContentType parent = null;
List<ContentType> parents = new ArrayList<ContentType> ();
// Get all content types // Get all content types
ContentTypeCollection cts = ContentType.getAllContentTypes(); ContentTypeCollection cts = ContentType.getAllContentTypes();
@ -329,31 +338,51 @@ public class ContentTypeHelperImpl implements ContentTypeHelper {
while (cts.next()) { while (cts.next()) {
ContentType ct = cts.getContentType(); ContentType ct = cts.getContentType();
//System.out.printf(
// "Checking if content type '%s' is a sub type of content type '%s'\n",
//type.getClassName(),
//ct.getClassName());
try { try {
Class.forName(type.getClassName()).asSubclass(Class.forName(ct.getClassName())); Class.forName(type.getClassName()).asSubclass(Class.forName(ct.
getClassName()));
//System.out.printf(
// "content type '%s' is a sub type of content type '%s'\n",
// type.getClassName(),
// ct.getClassName());
} catch (Exception ex) { } catch (Exception ex) {
// This cast is not valid so type is not a sublacss of ct // This cast is not valid so type is not a sublacss of ct
//System.out.printf(
//"content type '%s' is *NOT* a sub type of content type '%s'\n",
//type.getClassName(),
//ct.getClassName());
continue; continue;
} }
// Save the current ct as possible parent if we haven't found any parent yet // Save the current ct as possible parent if we haven't found any parent yet
// or if the current ancestor list is longer than that one from the possible // or if the current ancestor list is longer than that one from the possible
// parent earlier found // parent earlier found
if (!type.getClassName().equals(ct.getClassName()) if (!(type.getClassName().equals(ct.getClassName()))
&& (parent == null && (parent == null
|| (parent.getAncestors() != null || (parent.getAncestors() != null
&& ct.getAncestors() != null && ct.getAncestors() != null
&& parent.getAncestors().length() < ct.getAncestors().length()))) { && parent.getAncestors().length() < ct.getAncestors().
length())
|| !(parent.getClassName().equals(ct.getClassName())))) {
//System.out.printf("Setting parent to '%s'...\n",
//ct.getClassName());
parent = ct; parent = ct;
parents.add(ct);
} }
} }
// If there is a valid parent content type create the pedigree // If there is a valid parent content type create the pedigree
if (parent != null && !parent.getClassName().equals(type.getClassName())) { if (parent != null && !parent.getClassName().equals(type.getClassName())) {
//System.out.printf("Setting ancestors...\n");
if (parent.getAncestors() != null) { if (parent.getAncestors() != null) {
String parentAncestors = parent.getAncestors(); String parentAncestors = parent.getAncestors();
StringTokenizer strTok = new StringTokenizer(parentAncestors, "/"); StringTokenizer strTok = new StringTokenizer(parentAncestors,
"/");
// Add parent ancestors to this content types ancestor list // Add parent ancestors to this content types ancestor list
// Also while we iterate through the list, we also need to add // Also while we iterate through the list, we also need to add
@ -369,16 +398,29 @@ public class ContentTypeHelperImpl implements ContentTypeHelper {
// The db is broken. There is no content type for this ID // The db is broken. There is no content type for this ID
} }
//System.out.printf("Adding ancestor '%s'\n", ctID.toString());
// Add parent ancestor // Add parent ancestor
type.addAncestor(ctID); type.addAncestor(ctID);
} }
} }
// Add parent to ancestor list // Add parent to ancestor list
//System.out.printf(
// "Adding parent '%s' to ancestor list of content type '%s'...\n",
// parent.getClassName(), type.getClassName());
type.addAncestor(parent.getID()); type.addAncestor(parent.getID());
// Add this to parent descendants // Add this to parent descendants
// //System.out.printf("Adding '%s' to descendants of parent '%s'...\n",
// type.getClassName(), parent.getClassName());
// parent.addDescendants(type.getID());
for(ContentType p: parents) {
parent.addDescendants(type.getID()); parent.addDescendants(type.getID());
//System.out.printf("Adding '%s' to descendants of parent '%s'...\n",
// type.getClassName(), p.getClassName());
} }
} }
//System.out.printf("Finished create pedigree for content type '%s'.\n\n",
// type.getClassName());
}
} }

View File

@ -225,11 +225,11 @@ public class ItemSearchFolderBrowser extends Table {
} }
itemColl.addFilter(or); itemColl.addFilter(or);
} }
itemColl.addOrder("isFolder desc"); itemColl.addOrder("isFolder desc");
itemColl.addOrder("lower(item." itemColl.addOrder("lower(item." + ContentItem.NAME + ") ");
+ ContentItem.NAME + ") ");
return itemColl; return itemColl;
} }
@ -361,6 +361,7 @@ public class ItemSearchFolderBrowser extends Table {
} }
public boolean nextRow() { public boolean nextRow() {
System.out.println("test");
return m_itemColl != null ? m_itemColl.next() : false; return m_itemColl != null ? m_itemColl.next() : false;
} }