AbstractContentTypeLoader#createPedigree() um Log-Ausgabe ergänzt

git-svn-id: https://svn.libreccm.org/ccm/trunk@613 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2010-11-16 20:02:51 +00:00
parent 5f736341cc
commit 38c340cd6f
1 changed files with 33 additions and 20 deletions

View File

@ -81,10 +81,12 @@ public abstract class AbstractContentTypeLoader extends PackageLoader {
List types = handler.getContentTypes(); List types = handler.getContentTypes();
Session ssn = ctx.getSession(); Session ssn = ctx.getSession();
DataCollection sections = ssn.retrieve(ContentSection.BASE_DATA_OBJECT_TYPE); DataCollection sections = ssn.retrieve(
ContentSection.BASE_DATA_OBJECT_TYPE);
while (sections.next()) { while (sections.next()) {
ContentSection section = (ContentSection) DomainObjectFactory.newInstance(sections.getDataObject()); ContentSection section = (ContentSection) DomainObjectFactory.
newInstance(sections.getDataObject());
if (!isLoadableInto(section)) { if (!isLoadableInto(section)) {
continue; continue;
} }
@ -121,7 +123,8 @@ public abstract class AbstractContentTypeLoader extends PackageLoader {
final ContentType type, final ContentType type,
final LifecycleDefinition ld, final LifecycleDefinition ld,
final WorkflowTemplate wf) { final WorkflowTemplate wf) {
ContentTypeLifecycleDefinition.updateLifecycleDefinition(section, type, ld); ContentTypeLifecycleDefinition.updateLifecycleDefinition(section, type,
ld);
ContentTypeWorkflowTemplate.updateWorkflowTemplate(section, type, wf); ContentTypeWorkflowTemplate.updateWorkflowTemplate(section, type, wf);
} }
@ -177,7 +180,8 @@ public abstract class AbstractContentTypeLoader extends PackageLoader {
Assert.isTrue(templateIs != null, "Template not found"); Assert.isTrue(templateIs != null, "Template not found");
final BufferedReader input = new BufferedReader(new InputStreamReader(templateIs)); final BufferedReader input = new BufferedReader(new InputStreamReader(
templateIs));
final StringBuffer body = new StringBuffer(); final StringBuffer body = new StringBuffer();
@ -194,7 +198,8 @@ public abstract class AbstractContentTypeLoader extends PackageLoader {
template.setText(body.toString()); template.setText(body.toString());
TemplateManagerFactory.getInstance().addTemplate(section, type, template, TemplateManager.PUBLIC_CONTEXT); TemplateManagerFactory.getInstance().addTemplate(section, type, template,
TemplateManager.PUBLIC_CONTEXT);
template.publish(ld, new Date()); template.publish(ld, new Date());
return template; return template;
@ -218,7 +223,8 @@ public abstract class AbstractContentTypeLoader extends PackageLoader {
ContentType ct = cts.getContentType(); ContentType ct = cts.getContentType();
try { try {
Class.forName(type.getClassName()).asSubclass(Class.forName(ct.getClassName())); Class.forName(type.getClassName()).asSubclass(Class.forName(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
continue; continue;
@ -231,7 +237,8 @@ public abstract class AbstractContentTypeLoader extends PackageLoader {
&& (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 = ct; parent = ct;
} }
} }
@ -241,13 +248,19 @@ public abstract class AbstractContentTypeLoader extends PackageLoader {
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
// this content type as sibling to all entries in the ancestor list // this content type as sibling to all entries in the ancestor list
while (strTok.hasMoreElements()) { while (strTok.hasMoreElements()) {
Object token;
token = strTok.nextElement();
s_log.error(String.format(
"Trying to convert '%s' to BigDecimal...", token));
//BigDecimal ctID = (BigDecimal) strTok.nextElement();
BigDecimal ctID = (BigDecimal) strTok.nextElement(); BigDecimal ctID = (BigDecimal) strTok.nextElement();
// Get the current content type // Get the current content type