Author: rfrovarp
Date: Thu Mar 13 15:32:04 2008
New Revision: 636905
URL: http://svn.apache.org/viewvc?rev=636905&view=rev
Log:
Rip out multiple inheritance code. Joern had previously removed the funcionality. This commit removes the portions that stayed behind. Closes bug 41702.
Modified:
lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/PublicationConfiguration.java
lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/PublicationImpl.java
lenya/trunk/src/java/org/apache/lenya/cms/publication/Publication.java
lenya/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/Usecases.java
lenya/trunk/src/modules-core/administration/usecases/usecases.jx
lenya/trunk/src/modules-core/templating/java/src/org/apache/lenya/cms/publication/templating/PublicationTemplateManagerImpl.java
Modified: lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/PublicationConfiguration.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/PublicationConfiguration.java?rev=636905&r1=636904&r2=636905&view=diff
==============================================================================
--- lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/PublicationConfiguration.java (original)
+++ lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/PublicationConfiguration.java Thu Mar 13 15:32:04 2008
@@ -231,19 +231,8 @@
}
Configuration templateConfig = config.getChild(ELEMENT_TEMPLATE, false);
- // FIXME: this is a hack. For some reason, the old code seems to
- // imply that a publication
- // can have multiple templates. This is not the case. All this code
- // should use a simple string
- // rather than arrays at some point. For now, the old array is kept,
- // to avoid having to deal
- // with all kinds of NPEs that keep cropping up...
- if (templateConfig == null) {
- this.templates = new String[0]; // ugh. empty array to keep the
- // legacy code from breaking.
- } else {
- this.templates = new String[1];
- this.templates[0] = templateConfig.getAttribute(ATTRIBUTE_ID);
+ if (templateConfig != null) {
+ this.template = templateConfig.getAttribute(ATTRIBUTE_ID);
}
Configuration templateInstantiatorConfig = config.getChild(
@@ -479,15 +468,14 @@
return getConfigurationFile().exists();
}
- private String[] templates;
+ private String template;
/**
- * @see org.apache.lenya.cms.publication.Publication#getTemplateIds()
+ * @see org.apache.lenya.cms.publication.Publication#getTemplateId()
*/
- public String[] getTemplateIds() {
+ public String getTemplateId() {
loadConfiguration();
- List list = Arrays.asList(this.templates);
- return (String[]) list.toArray(new String[list.size()]);
+ return template;
}
/**
@@ -690,9 +678,9 @@
}
}
- String[] templates = getTemplateIds();
- if (templates.length > 0) {
- config.addChild(createConfig(ELEMENT_TEMPLATE, ATTRIBUTE_ID, templates[0]));
+ String template = getTemplateId();
+ if (template != null) {
+ config.addChild(createConfig(ELEMENT_TEMPLATE, ATTRIBUTE_ID, template));
}
String instantiatorHint = getInstantiatorHint();
Modified: lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/PublicationImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/PublicationImpl.java?rev=636905&r1=636904&r2=636905&view=diff
==============================================================================
--- lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/PublicationImpl.java (original)
+++ lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/PublicationImpl.java Thu Mar 13 15:32:04 2008
@@ -138,20 +138,11 @@
private List allResourceTypes;
- protected String getFirstTemplateId() {
- String[] templateIds = getTemplateIds();
- if (templateIds.length > 0) {
- return templateIds[0];
- } else {
- return null;
- }
- }
-
public String[] getResourceTypeNames() {
if (this.allResourceTypes == null) {
this.allResourceTypes = new ArrayList();
this.allResourceTypes.addAll(Arrays.asList(this.delegate.getResourceTypeNames()));
- String templateId = getFirstTemplateId();
+ String templateId = getTemplateId();
if (templateId != null) {
try {
Publication template = getFactory().getPublication(templateId);
@@ -177,14 +168,14 @@
return delegate.getSourceURI();
}
- public String[] getTemplateIds() {
- return delegate.getTemplateIds();
+ public String getTemplateId() {
+ return delegate.getTemplateId();
}
public String getWorkflowSchema(ResourceType resourceType) {
String schema = this.delegate.getWorkflowSchema(resourceType);
- if (schema == null && getTemplateIds().length > 0) {
- String templateId = getFirstTemplateId();
+ if (schema == null && getTemplateId() != null) {
+ String templateId = getTemplateId();
try {
Publication template = getFactory().getPublication(templateId);
schema = template.getWorkflowSchema(resourceType);
Modified: lenya/trunk/src/java/org/apache/lenya/cms/publication/Publication.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/publication/Publication.java?rev=636905&r1=636904&r2=636905&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/publication/Publication.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/publication/Publication.java Thu Mar 13 15:32:04 2008
@@ -230,9 +230,9 @@
Proxy getProxy(String area, boolean isSslProtected);
/**
- * @return The templates of the publication.
+ * @return The template of the publication.
*/
- String[] getTemplateIds();
+ String getTemplateId();
/**
* @return the URI base for this publication
Modified: lenya/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/Usecases.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/Usecases.java?rev=636905&r1=636904&r2=636905&view=diff
==============================================================================
--- lenya/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/Usecases.java (original)
+++ lenya/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/Usecases.java Thu Mar 13 15:32:04 2008
@@ -63,7 +63,7 @@
Publication pub = getPublication();
setParameter("publicationId", pub.getId());
- setParameter("templates", pub.getTemplateIds());
+ setParameter("template", pub.getTemplateId());
for (int u = 0; u < usecases.length; u++) {
for (int r = 0; r < roles.length; r++) {
Modified: lenya/trunk/src/modules-core/administration/usecases/usecases.jx
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/administration/usecases/usecases.jx?rev=636905&r1=636904&r2=636905&view=diff
==============================================================================
--- lenya/trunk/src/modules-core/administration/usecases/usecases.jx (original)
+++ lenya/trunk/src/modules-core/administration/usecases/usecases.jx Thu Mar 13 15:32:04 2008
@@ -32,16 +32,16 @@
<form method="post" id="form-usecases">
<input type="hidden" name="lenya.usecase" value="${usecase.getName()}"/>
<input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <p><i18n:text>usecase-policies-message</i18n:text></p>
- <jx:if test="${usecase.getParameter('templates').size() > 0}">
+ <p><i18n:text>usecase-policies-message</i18n:text></p>
+ <jx:if test="${usecase.getParameter('template')}">
<p><strong>Note:</strong><br/>
If you submit this form, all usecase permissions
are stored for the publication "<jx:out value="${usecase.getParameter('publicationId')}"/>".
If you want to change the inherited usecase permissions of a template publication, please go
- to the administration GUI of one of the templates
- (<jx:forEach var="template" items="${usecase.getParameter('templates')}">
- <a href="${'/' + template + '/authoring/index.html?lenya.usecase=admin.usecases'}"><jx:out value="${template}"/></a>
- </jx:forEach>).
+ to the administration GUI of the template
+ (
+ <a href="${'/' + usecase.getParameter('template') + '/authoring/index.html?lenya.usecase=admin.usecases'}"><jx:out value="${usecase.getParameter('template')}"/></a>
+ ).
</p>
</jx:if>
<jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
Modified: lenya/trunk/src/modules-core/templating/java/src/org/apache/lenya/cms/publication/templating/PublicationTemplateManagerImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/templating/java/src/org/apache/lenya/cms/publication/templating/PublicationTemplateManagerImpl.java?rev=636905&r1=636904&r2=636905&view=diff
==============================================================================
--- lenya/trunk/src/modules-core/templating/java/src/org/apache/lenya/cms/publication/templating/PublicationTemplateManagerImpl.java (original)
+++ lenya/trunk/src/modules-core/templating/java/src/org/apache/lenya/cms/publication/templating/PublicationTemplateManagerImpl.java Thu Mar 13 15:32:04 2008
@@ -161,10 +161,10 @@
publications.add(publication);
- String[] templateIds = publication.getTemplateIds();
- for (int i = 0; i < templateIds.length; i++) {
+ String templateId = publication.getTemplateId();
+ if(templateId != null) {
try {
- Publication template = publication.getFactory().getPublication(templateIds[i]);
+ Publication template = publication.getFactory().getPublication(templateId);
Publication[] templateTemplates = getPublications(template);
publications.addAll(Arrays.asList(templateTemplates));
} catch (PublicationException e) {
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.