* 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-94f89814c4dfmaster
parent
b51c08c90b
commit
a62873c8e9
|
|
@ -408,6 +408,10 @@ public class ContentType extends ACSObject {
|
|||
*/
|
||||
public void addDescendants(BigDecimal newDescendant) {
|
||||
|
||||
if (getID().equals(newDescendant)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the list of descendants from db
|
||||
String descendants = (String) get(DESCENDANTS);
|
||||
|
||||
|
|
|
|||
|
|
@ -630,7 +630,7 @@ public class Folder extends ContentItem {
|
|||
public ItemCollection(DataQuery query) {
|
||||
super(new DataQueryDataCollectionAdapter(doAlias(query), ITEM));
|
||||
|
||||
init(query, true);
|
||||
init(query, false);
|
||||
}
|
||||
|
||||
private void init(DataQuery query, boolean bSort) {
|
||||
|
|
|
|||
|
|
@ -31,12 +31,15 @@ import com.arsdigita.persistence.metadata.ObjectType;
|
|||
import com.arsdigita.search.MetadataProviderRegistry;
|
||||
import com.arsdigita.util.Assert;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
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_parent;
|
||||
// Basic Content type properties
|
||||
|
|
@ -223,7 +226,8 @@ public class ContentTypeHelperImpl implements ContentTypeHelper {
|
|||
}
|
||||
|
||||
// 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)
|
||||
&& !isInternal()) {
|
||||
s_log.debug("Registering search adapter for "
|
||||
|
|
@ -318,8 +322,13 @@ public class ContentTypeHelperImpl implements ContentTypeHelper {
|
|||
*/
|
||||
private void createPedigree(ContentType type) {
|
||||
|
||||
//System.out.printf(String.format(
|
||||
// "\n\nCreating pedigrees for content type '%s'...\n",
|
||||
// type.getClassName()));
|
||||
|
||||
// The parent content type
|
||||
ContentType parent = null;
|
||||
List<ContentType> parents = new ArrayList<ContentType> ();
|
||||
|
||||
// Get all content types
|
||||
ContentTypeCollection cts = ContentType.getAllContentTypes();
|
||||
|
|
@ -329,31 +338,51 @@ public class ContentTypeHelperImpl implements ContentTypeHelper {
|
|||
while (cts.next()) {
|
||||
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 {
|
||||
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) {
|
||||
// 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;
|
||||
}
|
||||
|
||||
// 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
|
||||
// parent earlier found
|
||||
if (!type.getClassName().equals(ct.getClassName())
|
||||
if (!(type.getClassName().equals(ct.getClassName()))
|
||||
&& (parent == null
|
||||
|| (parent.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;
|
||||
parents.add(ct);
|
||||
}
|
||||
}
|
||||
|
||||
// If there is a valid parent content type create the pedigree
|
||||
if (parent != null && !parent.getClassName().equals(type.getClassName())) {
|
||||
//System.out.printf("Setting ancestors...\n");
|
||||
if (parent.getAncestors() != null) {
|
||||
String parentAncestors = parent.getAncestors();
|
||||
|
||||
StringTokenizer strTok = new StringTokenizer(parentAncestors, "/");
|
||||
StringTokenizer strTok = new StringTokenizer(parentAncestors,
|
||||
"/");
|
||||
|
||||
// Add parent ancestors to this content types ancestor list
|
||||
// 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
|
||||
}
|
||||
|
||||
//System.out.printf("Adding ancestor '%s'\n", ctID.toString());
|
||||
// Add parent ancestor
|
||||
type.addAncestor(ctID);
|
||||
}
|
||||
}
|
||||
|
||||
// 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());
|
||||
|
||||
// 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());
|
||||
//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());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -225,11 +225,11 @@ public class ItemSearchFolderBrowser extends Table {
|
|||
}
|
||||
|
||||
itemColl.addFilter(or);
|
||||
|
||||
}
|
||||
|
||||
itemColl.addOrder("isFolder desc");
|
||||
itemColl.addOrder("lower(item."
|
||||
+ ContentItem.NAME + ") ");
|
||||
itemColl.addOrder("lower(item." + ContentItem.NAME + ") ");
|
||||
return itemColl;
|
||||
}
|
||||
|
||||
|
|
@ -361,6 +361,7 @@ public class ItemSearchFolderBrowser extends Table {
|
|||
}
|
||||
|
||||
public boolean nextRow() {
|
||||
System.out.println("test");
|
||||
return m_itemColl != null ? m_itemColl.next() : false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue