Übersetzungsfehler in ContentTypes korrigiert.

siblings -> decendants geändert.

Tabellenfeld umbenannt alle Methoden und Felder in den Java-Klassen umbenannt

git-svn-id: https://svn.libreccm.org/ccm/trunk@708 8810af33-2d31-482b-a856-94f89814c4df
master
quasi 2011-01-24 08:30:05 +00:00
parent 0c25d0f051
commit 99d35d7607
11 changed files with 62 additions and 169 deletions

View File

@ -27,10 +27,10 @@ object type ContentType extends ACSObject {
String[1..1] label = content_types.label VARCHAR(1000); String[1..1] label = content_types.label VARCHAR(1000);
String[0..1] description = content_types.description VARCHAR(4000); String[0..1] description = content_types.description VARCHAR(4000);
String[0..1] className = content_types.classname VARCHAR(200); String[0..1] className = content_types.classname VARCHAR(200);
// Quasimodo: Store the information about ancenstors and siblings, so we // Quasimodo: Store the information about ancenstors and decendants, so we
// can make use of extending content types // can make use of extending content types
String[0..1] ancestors = content_types.ancestors VARCHAR(2000); String[0..1] ancestors = content_types.ancestors VARCHAR(2000);
String[0..1] siblings = content_types.siblings VARCHAR(2000); String[0..1] decendants = content_types.decendants VARCHAR(2000);
String[1..1] mode = content_types.mode CHAR(1); String[1..1] mode = content_types.mode CHAR(1);
BigDecimal[0..1] itemFormID = content_types.item_form_id INTEGER; BigDecimal[0..1] itemFormID = content_types.item_form_id INTEGER;
@ -64,7 +64,7 @@ association {
do { do {
select select
t.type_id, t.object_type, t.label, t.description, t.classname, t.type_id, t.object_type, t.label, t.description, t.classname,
t.ancestors, t.siblings, t.mode, t.item_form_id t.ancestors, t.decendats, t.mode, t.item_form_id
from from
content_types t, content_section_type_map m, authoring_kits a content_types t, content_section_type_map m, authoring_kits a
where where
@ -79,7 +79,7 @@ association {
creatableContentTypes.description = t.description; creatableContentTypes.description = t.description;
creatableContentTypes.className = t.classname; creatableContentTypes.className = t.classname;
creatableContentTypes.ancestors = t.ancestors; creatableContentTypes.ancestors = t.ancestors;
creatableContentTypes.siblings = t.siblings; creatableContentTypes.decendats = t.decendats;
creatableContentTypes.mode = t.mode; creatableContentTypes.mode = t.mode;
creatableContentTypes.itemFormID = t.item_form_id; creatableContentTypes.itemFormID = t.item_form_id;
} }
@ -112,7 +112,7 @@ association {
do { do {
select select
t.type_id, t.object_type, t.label, t.description, t.classname, t.type_id, t.object_type, t.label, t.description, t.classname,
t.ancestors, t.siblings, t.mode, t.item_form_id t.ancestors, t.decendats, t.mode, t.item_form_id
from from
content_types t content_types t
where where
@ -127,7 +127,7 @@ association {
notAssociatedContentTypes.description = t.description; notAssociatedContentTypes.description = t.description;
notAssociatedContentTypes.className = t.classname; notAssociatedContentTypes.className = t.classname;
notAssociatedContentTypes.ancestors = t.ancestors; notAssociatedContentTypes.ancestors = t.ancestors;
notAssociatedContentTypes.siblings = t.siblings; notAssociatedContentTypes.decendats = t.decendats;
notAssociatedContentTypes.mode = t.mode; notAssociatedContentTypes.mode = t.mode;
notAssociatedContentTypes.itemFormID = t.item_form_id; notAssociatedContentTypes.itemFormID = t.item_form_id;
} }
@ -156,7 +156,7 @@ query registeredContentTypes {
do { do {
select select
t.type_id, t.object_type, t.label, t.type_id, t.object_type, t.label,
t.description, t.classname, t.ancestors, t.siblings, t.description, t.classname, t.ancestors, t.decendats,
t.mode, t.item_form_id t.mode, t.item_form_id
from content_types t from content_types t
where t.mode != 'I' where t.mode != 'I'
@ -169,7 +169,7 @@ query registeredContentTypes {
type.description = t.description; type.description = t.description;
type.className = t.classname; type.className = t.classname;
type.ancestors = t.ancestors; type.ancestors = t.ancestors;
type.siblings = t.siblings; type.decendats = t.decendats;
type.mode = t.mode; type.mode = t.mode;
type.itemFormID = t.item_form_id; type.itemFormID = t.item_form_id;
} }

View File

@ -30,10 +30,7 @@ create table content_types (
description varchar(4000), description varchar(4000),
classname varchar(200), classname varchar(200),
ancestors varchar(2000), ancestors varchar(2000),
siblings varchar(2000), decendats varchar(2000),
-- is_internal char(1) default '0' not null
-- constraint content_types_is_internal_ck
-- check ( is_internal in ('0', '1') ),
mode char(1) default '' not null mode char(1) default '' not null
constraint content_types_mode_ck constraint content_types_mode_ck
check ( mode in ('D', 'H', 'I') ), check ( mode in ('D', 'H', 'I') ),

View File

@ -779,7 +779,7 @@ public class ContentSection extends Application {
return types; return types;
} }
public ContentTypeCollection getSiblingsOfContentType(ContentType ct) { public ContentTypeCollection getDecendantsOfContentType(ContentType ct) {
ContentTypeCollection ctc = getContentTypes(); ContentTypeCollection ctc = getContentTypes();
// The Filter Factory // The Filter Factory
@ -791,9 +791,9 @@ public class ContentSection extends Application {
// The content type must be either of the requested type // The content type must be either of the requested type
or.addFilter(ff.equals(ContentType.ID, ct.ID)); or.addFilter(ff.equals(ContentType.ID, ct.ID));
// Or must be a sibling of the requested type // Or must be a decendant of the requested type
try { try {
StringTokenizer strTok = new StringTokenizer(ct.getSiblings(), "/"); StringTokenizer strTok = new StringTokenizer(ct.getDecendants(), "/");
while (strTok.hasMoreElements()) { while (strTok.hasMoreElements()) {
or.addFilter(ff.equals(ContentType.ID, (String) strTok.nextElement())); or.addFilter(ff.equals(ContentType.ID, (String) strTok.nextElement()));
} }

View File

@ -70,7 +70,7 @@ public class ContentType extends ACSObject {
public static final String ITEM_FORM_ID = "itemFormID"; public static final String ITEM_FORM_ID = "itemFormID";
public static final String ITEM_FORM = "itemForm"; public static final String ITEM_FORM = "itemForm";
public static final String ANCESTORS = "ancestors"; public static final String ANCESTORS = "ancestors";
public static final String SIBLINGS = "siblings"; public static final String DECENDANTS = "decendats";
/** /**
* Default constructor. This creates a new folder. * Default constructor. This creates a new folder.
@ -343,14 +343,14 @@ public class ContentType extends ACSObject {
} }
/** /**
* Add an ancestor to the list of siblings, if not already in the list * Add an ancestor to the list of decendats, if not already in the list
* @param newAncestor ID of the ancestor to add * @param newAncestor ID of the ancestor to add
*/ */
public void addAncestor(BigDecimal newAncestor) { public void addAncestor(BigDecimal newAncestor) {
// Get the list of siblings from db // Get the list of decendats from db
String ancestors = (String) get(ANCESTORS); String ancestors = (String) get(ANCESTORS);
// Only add if the newSibling in not yet in the list // Only add if the newAncestor in not yet in the list
if (ancestors == null) { if (ancestors == null) {
ancestors = newAncestor.toString(); ancestors = newAncestor.toString();
} else if (!ancestors.contains(newAncestor.toString())) { } else if (!ancestors.contains(newAncestor.toString())) {
@ -368,11 +368,11 @@ public class ContentType extends ACSObject {
} }
/** /**
* Remove an ancestor id from the list of siblings * Remove an ancestor id from the list of decendats
* @param ancestor ID to be removed * @param ancestor ID to be removed
*/ */
public void delAncestor(BigDecimal ancestor) { public void delAncestor(BigDecimal ancestor) {
// Get the list of siblings from db // Get the list of decendats from db
String ancestors = (String) get(ANCESTORS); String ancestors = (String) get(ANCESTORS);
// Only try to remove from a non-empty string // Only try to remove from a non-empty string
@ -403,65 +403,65 @@ public class ContentType extends ACSObject {
} }
/** /**
* Add a sibling to the list of siblings, if not already in list * Add a decendant to the list of decendats, if not already in list
* @param newSibling ID of the sibling to add * @param newDecendant ID of the decendant to add
*/ */
public void addSiblings(BigDecimal newSibling) { public void addDecendants(BigDecimal newDecendant) {
// Get the list of siblings from db // Get the list of decendats from db
String siblings = (String) get(SIBLINGS); String decendats = (String) get(DECENDANTS);
// Only add if the newSibling in not yet in the list // Only add if the newDecendant in not yet in the list
if (siblings == null) { if (decendats == null) {
siblings = newSibling.toString(); decendats = newDecendant.toString();
} else if (!siblings.contains(newSibling.toString())) { } else if (!decendats.contains(newDecendant.toString())) {
if (siblings.length() == 0) { if (decendats.length() == 0) {
// First entry in list // First entry in list
siblings = newSibling.toString(); decendats = newDecendant.toString();
} else { } else {
// Additional entry in the list // Additional entry in the list
siblings += "/" + newSibling.toString(); decendats += "/" + newDecendant.toString();
} }
} }
// Write new data back to db // Write new data back to db
set(SIBLINGS, siblings); set(DECENDANTS, decendats);
} }
/** /**
* Get the list of siblings * Get the list of decendats
* @return * @return
*/ */
public String getSiblings() { public String getDecendants() {
return (String) get(SIBLINGS); return (String) get(DECENDANTS);
} }
/** /**
* Remove a sibling from the list of siblings * Remove a decendant from the list of decendats
* @param sibling ID to be removed * @param decendant ID to be removed
*/ */
public void delSiblings(BigDecimal sibling) { public void delDecendants(BigDecimal decendant) {
// Get the list of siblings from db // Get the list of decendats from db
String siblings = (String) get(SIBLINGS); String decendats = (String) get(DECENDANTS);
// Only try to remove from a non-empty string // Only try to remove from a non-empty string
if (siblings != null && siblings.length() > 0) { if (decendats != null && decendats.length() > 0) {
// Remove ancestor ID from list // Remove ancestor ID from list
siblings.replace(sibling.toString(), ""); decendats.replace(decendant.toString(), "");
// Delete the additional slash // Delete the additional slash
siblings.replace("//", "/"); decendats.replace("//", "/");
// If the list only contains a single slash, // If the list only contains a single slash,
// we have just removed the last list entry, so the list is empty // we have just removed the last list entry, so the list is empty
if (siblings.equals("/")) { if (decendats.equals("/")) {
siblings = ""; decendats = "";
} }
} }
// Write new data back to db // Write new data back to db
set(SIBLINGS, siblings); set(DECENDANTS, decendats);
} }
////////////////////////////////////// //////////////////////////////////////
@ -558,7 +558,7 @@ public class ContentType extends ACSObject {
return new ContentTypeCollection(dc); return new ContentTypeCollection(dc);
} }
public static ContentTypeCollection getSiblingsOf(ContentType ct) { public static ContentTypeCollection getDecendantsOf(ContentType ct) {
ContentTypeCollection ctc = ContentType.getRegisteredContentTypes(); ContentTypeCollection ctc = ContentType.getRegisteredContentTypes();
// The Filter Factory // The Filter Factory
@ -570,9 +570,9 @@ public class ContentType extends ACSObject {
// The content type must be either of the requested type // The content type must be either of the requested type
or.addFilter(ff.equals(ContentType.ID, ct.ID)); or.addFilter(ff.equals(ContentType.ID, ct.ID));
// Or must be a sibling of the requested type // Or must be a decendant of the requested type
try { try {
StringTokenizer strTok = new StringTokenizer(ct.getSiblings(), "/"); StringTokenizer strTok = new StringTokenizer(ct.getDecendants(), "/");
while (strTok.hasMoreElements()) { while (strTok.hasMoreElements()) {
or.addFilter(ff.equals(ContentType.ID, (String) strTok.nextElement())); or.addFilter(ff.equals(ContentType.ID, (String) strTok.nextElement()));
} }

View File

@ -357,14 +357,14 @@ public class ContentTypeHelperImpl implements ContentTypeHelper {
// 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
// this content type as sibling to all entries in the ancestor list // this content type as decendant to all entries in the ancestor list
while (strTok.hasMoreElements()) { while (strTok.hasMoreElements()) {
BigDecimal ctID = new BigDecimal(strTok.nextToken()); BigDecimal ctID = new BigDecimal(strTok.nextToken());
// Get the current content type // Get the current content type
try { try {
ContentType ct = new ContentType(ctID); ContentType ct = new ContentType(ctID);
ct.addSiblings(ctID); ct.addDecendants(ctID);
} catch (Exception ex) { } catch (Exception ex) {
// The db is broken. There is no content type for this ID // The db is broken. There is no content type for this ID
} }
@ -377,8 +377,8 @@ public class ContentTypeHelperImpl implements ContentTypeHelper {
// Add parent to ancestor list // Add parent to ancestor list
type.addAncestor(parent.getID()); type.addAncestor(parent.getID());
// Add this to parent siblings // Add this to parent decendats
parent.addSiblings(type.getID()); parent.addDecendants(type.getID());
} }
} }
} }

View File

@ -216,7 +216,7 @@ public class ItemSearchFolderBrowser extends Table {
try { try {
ContentType ct = new ContentType(singleTypeID); ContentType ct = new ContentType(singleTypeID);
StringTokenizer strTok = new StringTokenizer(ct.getSiblings(), "/"); StringTokenizer strTok = new StringTokenizer(ct.getDecendants(), "/");
while (strTok.hasMoreElements()) { while (strTok.hasMoreElements()) {
or.addFilter(ff.equals(ContentItem.CONTENT_TYPE + "." + ContentType.ID, (String) strTok.nextElement())); or.addFilter(ff.equals(ContentItem.CONTENT_TYPE + "." + ContentType.ID, (String) strTok.nextElement()));
} }

View File

@ -112,7 +112,7 @@ public abstract class NewItemForm extends Form {
if (parentType == null) { if (parentType == null) {
typesCollection = section.getCreatableContentTypes(); typesCollection = section.getCreatableContentTypes();
} else { } else {
typesCollection = section.getSiblingsOfContentType(parentType); typesCollection = section.getDecendantsOfContentType(parentType);
} }
typesCollection.addOrder(ContentType.LABEL); typesCollection.addOrder(ContentType.LABEL);

View File

@ -56,13 +56,13 @@ public class ContentTypeFilterWidget extends FilterWidget {
} }
public ContentTypeFilterWidget(ContentSection section, ContentType parentType) { public ContentTypeFilterWidget(ContentSection section, ContentType parentType) {
this(section.getSiblingsOfContentType(parentType)); this(section.getDecendantsOfContentType(parentType));
m_section = section; m_section = section;
m_parentType = parentType; m_parentType = parentType;
} }
public ContentTypeFilterWidget(ContentType parentType) { public ContentTypeFilterWidget(ContentType parentType) {
this(ContentType.getSiblingsOf(parentType)); this(ContentType.getDecendantsOf(parentType));
m_parentType = parentType; m_parentType = parentType;
} }
@ -108,7 +108,7 @@ public class ContentTypeFilterWidget extends FilterWidget {
if (parentType == null) { if (parentType == null) {
typesCollection = section.getContentTypes(); typesCollection = section.getContentTypes();
} else { } else {
typesCollection = section.getSiblingsOfContentType(parentType); typesCollection = section.getDecendantsOfContentType(parentType);
} }
} else { } else {
@ -116,7 +116,7 @@ public class ContentTypeFilterWidget extends FilterWidget {
if (parentType == null) { if (parentType == null) {
typesCollection = ContentType.getRegisteredContentTypes(); typesCollection = ContentType.getRegisteredContentTypes();
} else { } else {
typesCollection = ContentType.getSiblingsOf(parentType); typesCollection = ContentType.getDecendantsOf(parentType);
} }
} }

View File

@ -98,118 +98,10 @@ public class CreateGenericContentTypes extends Program {
tc.commitTxn(); // save database additions for re-reading tc.commitTxn(); // save database additions for re-reading
// add the dependency hierarchie to any installed ct
/* Das sollte ueberfluessig sein.
tc.beginTxn();
ContentTypeCollection ctc = ContentType.getAllContentTypes();
s_log.debug("Starte content types update");
while (ctc.next()) {
ContentType ct = ctc.getContentType();
s_log.debug("Verarbeite " + ct.getClassName());
createPedigree(ct);
}
tc.commitTxn();
*/
} }
}.run(); }.run();
} }
/**
* Generates the pedigree for new content types created during update.
*
* Copy 'nd pasted from AbstractContentType / Loader
* @param type The new content type
*/
private void createPedigree(ContentType type) {
// The parent content type
ContentType parent = null;
// Get all content types
ContentTypeCollection cts = ContentType.getAllContentTypes();
// This is a brute force method, but I can't come up with something
// better atm without changing either all Loader or the xml-files.
while (cts.next()) {
ContentType ct = cts.getContentType();
try {
Class.forName(type.getClassName()).asSubclass(Class.forName(ct.getClassName()));
} catch (Exception ex) {
// This cast is not valid so type is not a subclass of ct
continue;
}
s_log.debug("Possible Parent: " + ct.getClassName());
// 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())
&& (parent == null
|| (parent.getAncestors() != null
&& ct.getAncestors() != null
&& parent.getAncestors().length() < ct.getAncestors().length()))) {
parent = ct;
}
}
// If there is a valid parent content type create the pedigree
if (parent != null && !parent.getClassName().equals(type.getClassName())) {
s_log.debug(type.getClassName() + " is a subtype of "
+ parent.getClassName());
if (parent.getAncestors() != null) {
String parentAncestors = parent.getAncestors();
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
// this content type as sibling to all entries in the ancestor list
while (strTok.hasMoreElements()) {
BigDecimal ctID = (BigDecimal) strTok.nextElement();
// Get the current content type
try {
ContentType ct = new ContentType(ctID);
ct.addSiblings(ctID);
} catch (Exception ex) {
s_log.error("The db is broken.");
// The db is broken. There is no content type for this ID
}
// Add parent ancestor
type.addAncestor(ctID);
}
}
// Add parent to ancestor list
type.addAncestor(parent.getID());
// Add this to parent siblings
parent.addSiblings(type.getID());
}
s_log.debug("Method Pedigree finished");
}
} }

View File

@ -73,12 +73,14 @@ public class BaseQueryComponent extends QueryComponent {
m_filters = new HashSet(); m_filters = new HashSet();
} }
@Override
public void register(Page p) { public void register(Page p) {
super.register(p); super.register(p);
findFilters(m_filters); findFilters(m_filters);
} }
@Override
public void register(Form form, FormModel model) { public void register(Form form, FormModel model) {
if (s_log.isDebugEnabled()) { if (s_log.isDebugEnabled()) {
s_log.debug("Adding " + m_terms.getName() + " to form model"); s_log.debug("Adding " + m_terms.getName() + " to form model");
@ -117,6 +119,7 @@ public class BaseQueryComponent extends QueryComponent {
} }
@Override
public void generateXML(PageState state, public void generateXML(PageState state,
Element parent) { Element parent) {
Element content = generateParent(parent); Element content = generateParent(parent);

View File

@ -70,6 +70,7 @@ public class ResultsPane extends SimpleComponent {
m_relative = false; m_relative = false;
} }
@Override
public void generateXML(PageState state, Element parent) { public void generateXML(PageState state, Element parent) {
if (!m_query.hasQuery(state)) { if (!m_query.hasQuery(state)) {
if (s_log.isDebugEnabled()) { if (s_log.isDebugEnabled()) {