Various fixes for the following tickets:

- 1551: The URL created internally for a text asset (body text of an article) 
        could be longer than 200 characters. Now the URL is trimmed to fit into
	the length limit definied in PDL. 
- 1556: The links of content items in various tables were wrong. They were 
        pointing to the wrong content section because 
	CMS.getContext().getContentSection() was used to get the content section (which is
	the current content section). Instead the content section returned by 
	item.getContentSection() has to be used to create correct links.


git-svn-id: https://svn.libreccm.org/ccm/trunk@2073 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2013-02-18 16:19:44 +00:00
parent 91c2b394a5
commit 4121b7a83d
31 changed files with 68 additions and 49 deletions

View File

@ -189,7 +189,7 @@ public class GenericContactPersonSheet
return new Label(value.toString()); return new Label(value.toString());
} }
ContentSection section = CMS.getContext().getContentSection(); ContentSection section = person.getContentSection();//CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
return new Link(value.toString(), resolver.generateItemURL(state, person, section, person.getVersion())); return new Link(value.toString(), resolver.generateItemURL(state, person, section, person.getVersion()));

View File

@ -265,7 +265,7 @@ public class GenericOrganizationalUnitContactTable extends Table implements
} catch (DataObjectNotFoundException ex) { } catch (DataObjectNotFoundException ex) {
return new Label(value.toString()); return new Label(value.toString());
} }
ContentSection section = CMS.getContext().getContentSection(); ContentSection section = contact.getContentSection();//CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = Link link =
new Link(String.format("%s (%s)", new Link(String.format("%s (%s)",

View File

@ -244,7 +244,7 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements
ex); ex);
return new Label(value.toString()); return new Label(value.toString());
} }
ContentSection section = CMS.getContext().getContentSection(); ContentSection section = person.getContentSection();//CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = Link link =
new Link(String.format("%s", new Link(String.format("%s",

View File

@ -195,8 +195,7 @@ public class GenericOrganizationalUnitSubordinateOrgaUnitsTable
subordinateOrgaUnit); subordinateOrgaUnit);
if (canEdit) { if (canEdit) {
final ContentSection section = CMS.getContext(). final ContentSection section = subordinateOrgaUnit.getContentSection();//CMS.getContext().getContentSection();
getContentSection();
final ItemResolver resolver = section.getItemResolver(); final ItemResolver resolver = section.getItemResolver();
final Link link = final Link link =
new Link(value.toString(), new Link(value.toString(),

View File

@ -182,8 +182,7 @@ public class GenericOrganizationalUnitSuperiorOrgaUnitsTable extends Table {
superiorOrgaUnit); superiorOrgaUnit);
if (canEdit) { if (canEdit) {
final ContentSection section = CMS.getContext(). final ContentSection section = superiorOrgaUnit.getContentSection();//CMS.getContext().getContentSection();
getContentSection();
final ItemResolver resolver = section.getItemResolver(); final ItemResolver resolver = section.getItemResolver();
final Link link = new Link(value.toString(), final Link link = new Link(value.toString(),
resolver.generateItemURL(state, resolver.generateItemURL(state,

View File

@ -257,7 +257,7 @@ public class GenericPersonContactTable extends Table implements
} catch (DataObjectNotFoundException ex) { } catch (DataObjectNotFoundException ex) {
return new Label(value.toString()); return new Label(value.toString());
} }
ContentSection section = CMS.getContext().getContentSection(); ContentSection section = contact.getContentSection(); //CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = Link link =
new Link(String.format("%s (%s)", new Link(String.format("%s (%s)",

View File

@ -136,7 +136,7 @@ public class GenericPersonOrgaUnitsTable extends Table {
//final com.arsdigita.cms.SecurityManager securityManager = CMS.getSecurityManager(state); //final com.arsdigita.cms.SecurityManager securityManager = CMS.getSecurityManager(state);
final GenericOrganizationalUnit orgaUnit = new GenericOrganizationalUnit((BigDecimal) key); final GenericOrganizationalUnit orgaUnit = new GenericOrganizationalUnit((BigDecimal) key);
final ContentSection section = CMS.getContext().getContentSection(); final ContentSection section = orgaUnit.getContentSection();//CMS.getContext().getContentSection();
final ItemResolver resolver = section.getItemResolver(); final ItemResolver resolver = section.getItemResolver();
final Link link = new Link(value.toString(), final Link link = new Link(value.toString(),
resolver.generateItemURL(state, resolver.generateItemURL(state,

View File

@ -129,7 +129,7 @@ public class SimpleXMLGenerator implements XMLGenerator {
* @param useContext The use context * @param useContext The use context
*/ */
public void generateXML(final PageState state, final Element parent, final String useContext) { public void generateXML(final PageState state, final Element parent, final String useContext) {
final long start = System.nanoTime(); //final long start = System.nanoTime();
//ContentSection section = CMS.getContext().getContentSection(); //ContentSection section = CMS.getContext().getContentSection();
ContentItem item = getContentItem(state); ContentItem item = getContentItem(state);
@ -193,7 +193,7 @@ public class SimpleXMLGenerator implements XMLGenerator {
content = cache.get(item.getOID()); content = cache.get(item.getOID());
} else { } else {
content = startElement(useContext); content = startElement(useContext);
final ContentItemXMLRenderer renderer = new ContentItemXMLRenderer(content); final ContentItemXMLRenderer renderer = new ContentItemXMLRenderer(content);
@ -202,13 +202,13 @@ public class SimpleXMLGenerator implements XMLGenerator {
renderer.setWrapObjects(false); renderer.setWrapObjects(false);
renderer.setRevisitFullObject(true); renderer.setRevisitFullObject(true);
System.out.printf("Prepared renderer in %d ms\n", (System.nanoTime() - start) //System.out.printf("Prepared renderer in %d ms\n", (System.nanoTime() - start)
/ 1000000); // / 1000000);
renderer.walk(item, ADAPTER_CONTEXT); renderer.walk(item, ADAPTER_CONTEXT);
System.out.printf("Rendered standard item xml in %d ms\n", (System.nanoTime() - start) //System.out.printf("Rendered standard item xml in %d ms\n", (System.nanoTime() - start)
/ 1000000); // / 1000000);
//parent.addContent(content); //parent.addContent(content);
@ -220,23 +220,25 @@ public class SimpleXMLGenerator implements XMLGenerator {
* 2011-10-23 jensp: It is now possible to disable the use of * 2011-10-23 jensp: It is now possible to disable the use of
* extra XML. * extra XML.
*/ */
final long extraXMLStart = System.nanoTime(); //final long extraXMLStart = System.nanoTime();
if (useExtraXml) { if (useExtraXml) {
for (ExtraXMLGenerator generator : item.getExtraXMLGenerators()) { for (ExtraXMLGenerator generator : item.getExtraXMLGenerators()) {
generator.setListMode(listMode); generator.setListMode(listMode);
generator.generateXML(item, content, state); generator.generateXML(item, content, state);
} }
} }
System.out. // System.out.
printf("Rendered ExtraXML in %d ms\n", (System.nanoTime() - extraXMLStart) / 1000000); // printf("Rendered ExtraXML in %d ms\n", (System.nanoTime() - extraXMLStart) / 1000000);
System.out.printf(" -----\n"); // System.out.printf(" -----\n");
cache.put(item.getOID(), content); if (USE_CACHE) {
cache.put(item.getOID(), content);
}
} }
parent.addContent(content); parent.addContent(content);
System.out.printf("Rendered item in %d ms\n\n", (System.nanoTime() - start) / 1000000); //System.out.printf("Rendered item in %d ms\n\n", (System.nanoTime() - start) / 1000000);
} }
} }

View File

@ -105,7 +105,14 @@ public class GenericArticleBody extends TextAssetBody {
protected TextAsset createTextAsset(PageState s) { protected TextAsset createTextAsset(PageState s) {
GenericArticle item = getGenericArticle(s); GenericArticle item = getGenericArticle(s);
TextAsset t = new TextAsset(); TextAsset t = new TextAsset();
final int nameLen = item.getName().length();
final int idLen = item.getID().toString().length();
final int len = nameLen + 6 + idLen;
if (len < 200) {
t.setName(item.getName() + "_text_" + item.getID()); t.setName(item.getName() + "_text_" + item.getID());
} else {
t.setName(item.getName().substring(0, 200 - (len - 200)) + "_text_" + item.getID());
}
// no need - cg. Text doesn't need a security context, // no need - cg. Text doesn't need a security context,
// and ownership of text is recorded in text_pages // and ownership of text is recorded in text_pages
// t.setParent(item); // t.setParent(item);

View File

@ -380,7 +380,7 @@ public abstract class DomainObjectTraversal {
final String path, final String path,
final String context, final String context,
final OID oid) { final OID oid) {
final long start = System.nanoTime(); //final long start = System.nanoTime();
final String propName = prop.getName(); final String propName = prop.getName();
//System.out.printf("Processing property %30s...\n", propName); //System.out.printf("Processing property %30s...\n", propName);
@ -478,7 +478,7 @@ public abstract class DomainObjectTraversal {
//System.out.printf("\tProcssed assoc in %3d ms.\n ", (System.nanoTime() - assocStart) / 1000000); //System.out.printf("\tProcssed assoc in %3d ms.\n ", (System.nanoTime() - assocStart) / 1000000);
} }
System.out.printf("Processed property %30s in %3d ms.\n", propName, (System.nanoTime() - start) / 1000000); //System.out.printf("Processed property %30s in %3d ms.\n", propName, (System.nanoTime() - start) / 1000000);
} }
protected void walkDataAssociations(final DomainObjectTraversalAdapter adapter, protected void walkDataAssociations(final DomainObjectTraversalAdapter adapter,

View File

@ -112,6 +112,7 @@ public class ArticleInCollectedVolumeCollectedVolumeSheet
article); article);
} }
} }
private class ArticleInCollectedVolumeCollectedVolumeSheetModel private class ArticleInCollectedVolumeCollectedVolumeSheetModel
@ -166,6 +167,7 @@ public class ArticleInCollectedVolumeCollectedVolumeSheet
public Object getKeyAt(int columnIndex) { public Object getKeyAt(int columnIndex) {
return collectedVolume.getID(); return collectedVolume.getID();
} }
} }
private class EditCellRenderer private class EditCellRenderer
@ -197,8 +199,7 @@ public class ArticleInCollectedVolumeCollectedVolumeSheet
} catch (ObjectNotFoundException ex) { } catch (ObjectNotFoundException ex) {
return new Label(value.toString()); return new Label(value.toString());
} }
ContentSection section = ContentSection section = collectedVolume.getContentSection();//CMS.getContext().getContentSection();
CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = new Link(value.toString(), Link link = new Link(value.toString(),
resolver.generateItemURL(state, resolver.generateItemURL(state,
@ -219,6 +220,7 @@ public class ArticleInCollectedVolumeCollectedVolumeSheet
return label; return label;
} }
} }
} }
private class DeleteCellRenderer private class DeleteCellRenderer
@ -255,6 +257,7 @@ public class ArticleInCollectedVolumeCollectedVolumeSheet
return label; return label;
} }
} }
} }
@Override @Override
@ -276,4 +279,5 @@ public class ArticleInCollectedVolumeCollectedVolumeSheet
public void headSelected(TableActionEvent event) { public void headSelected(TableActionEvent event) {
//Nothing to do //Nothing to do
} }
} }

View File

@ -183,7 +183,7 @@ public class ArticleInJournalJournalSheet
} catch (ObjectNotFoundException ex) { } catch (ObjectNotFoundException ex) {
return new Label(value.toString()); return new Label(value.toString());
} }
ContentSection section = CMS.getContext().getContentSection(); ContentSection section = journal.getContentSection();//CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = Link link =
new Link(journal.getTitle(), new Link(journal.getTitle(),

View File

@ -213,7 +213,7 @@ public class CollectedVolumeArticlesTable
return new Label(value.toString()); return new Label(value.toString());
} }
ContentSection section = CMS.getContext().getContentSection(); ContentSection section = article.getContentSection();//CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = Link link =
new Link(value.toString(), new Link(value.toString(),

View File

@ -161,7 +161,7 @@ public class ExpertiseOrdererSheet
return new Label(value.toString()); return new Label(value.toString());
} }
ContentSection section = CMS.getContext().getContentSection(); ContentSection section = orderer.getContentSection();//CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = Link link =
new Link(String.format("%s (%s)", new Link(String.format("%s (%s)",

View File

@ -162,7 +162,7 @@ public class ExpertiseOrganizationSheet
return new Label(value.toString()); return new Label(value.toString());
} }
ContentSection section = CMS.getContext().getContentSection(); ContentSection section = orga.getContentSection();//CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = Link link =
new Link(String.format("%s (%s)", new Link(String.format("%s (%s)",

View File

@ -88,6 +88,7 @@ public class GenericOrganizationalUnitPublicationsTable
return new Model(table, state, orgaunit); return new Model(table, state, orgaunit);
} }
} }
private class Model implements TableModel { private class Model implements TableModel {
@ -137,6 +138,7 @@ public class GenericOrganizationalUnitPublicationsTable
public Object getKeyAt(int columnIndex) { public Object getKeyAt(int columnIndex) {
return publications.getPublication().getID(); return publications.getPublication().getID();
} }
} }
private class EditCellRenderer private class EditCellRenderer
@ -160,8 +162,7 @@ public class GenericOrganizationalUnitPublicationsTable
publication); publication);
if (canEdit) { if (canEdit) {
final ContentSection section = CMS.getContext(). final ContentSection section = publication.getContentSection();//CMS.getContext().getContentSection();
getContentSection();
final ItemResolver resolver = section.getItemResolver(); final ItemResolver resolver = section.getItemResolver();
final Link link = new Link(value.toString(), final Link link = new Link(value.toString(),
resolver.generateItemURL( resolver.generateItemURL(
@ -175,6 +176,7 @@ public class GenericOrganizationalUnitPublicationsTable
return label; return label;
} }
} }
} }
private class DeleteCellRenderer private class DeleteCellRenderer
@ -211,6 +213,7 @@ public class GenericOrganizationalUnitPublicationsTable
return label; return label;
} }
} }
} }
private class ActionListener implements TableActionListener { private class ActionListener implements TableActionListener {
@ -238,5 +241,6 @@ public class GenericOrganizationalUnitPublicationsTable
public void headSelected(final TableActionEvent event) { public void headSelected(final TableActionEvent event) {
//Nothing //Nothing
} }
} }
} }

View File

@ -192,7 +192,7 @@ public class InProceedingsProceedingsSheet
return new Label(value.toString()); return new Label(value.toString());
} }
ContentSection section = CMS.getContext().getContentSection(); ContentSection section = proceedings.getContentSection();//CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = Link link =
new Link(String.format("%s (%s)", new Link(String.format("%s (%s)",

View File

@ -168,7 +168,7 @@ public class InternetArticleOrganizationSheet
return new Label(value.toString()); return new Label(value.toString());
} }
ContentSection section = CMS.getContext().getContentSection(); ContentSection section = organization.getContentSection();//CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = Link link =
new Link(String.format("%s (%s)", new Link(String.format("%s (%s)",

View File

@ -207,7 +207,7 @@ public class JournalArticlesTable
ex); ex);
return new Label(value.toString()); return new Label(value.toString());
} }
ContentSection section = CMS.getContext().getContentSection(); ContentSection section = article.getContentSection();//CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = Link link =
new Link(String.format("%s (%s)", new Link(String.format("%s (%s)",

View File

@ -145,7 +145,7 @@ public class OrganizationPublicationsTable extends Table {
// publication); // publication);
//if (canEdit) { //if (canEdit) {
final ContentSection section = CMS.getContext().getContentSection(); final ContentSection section = publication.getContentSection();//CMS.getContext().getContentSection();
final ItemResolver resolver = section.getItemResolver(); final ItemResolver resolver = section.getItemResolver();
final Link link = new Link(value.toString(), final Link link = new Link(value.toString(),
resolver.generateItemURL(state, resolver.generateItemURL(state,

View File

@ -145,7 +145,7 @@ public class PersonPublicationsTable extends Table {
// publication); // publication);
//if (canEdit) { //if (canEdit) {
final ContentSection section = CMS.getContext().getContentSection(); final ContentSection section = publication.getContentSection();//CMS.getContext().getContentSection();
final ItemResolver resolver = section.getItemResolver(); final ItemResolver resolver = section.getItemResolver();
final Link link = new Link(value.toString(), final Link link = new Link(value.toString(),
resolver.generateItemURL(state, resolver.generateItemURL(state,

View File

@ -165,7 +165,7 @@ public class ProceedingsOrganizerSheet
return new Label(value.toString()); return new Label(value.toString());
} }
ContentSection section = CMS.getContext().getContentSection(); ContentSection section = organizer.getContentSection();//CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = Link link =
new Link(value.toString(), new Link(value.toString(),

View File

@ -217,7 +217,7 @@ public class ProceedingsPapersTable
return new Label(value.toString()); return new Label(value.toString());
} }
ContentSection section = CMS.getContext().getContentSection(); ContentSection section = inProceedings.getContentSection();//CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = new Link(String.format("%s (%s)", Link link = new Link(String.format("%s (%s)",
value.toString(), value.toString(),

View File

@ -244,7 +244,7 @@ public class PublicationAuthorsTable
return new Label(value.toString()); return new Label(value.toString());
} }
ContentSection section = CMS.getContext().getContentSection(); ContentSection section = author.getContentSection();//CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = Link link =
new Link(value.toString(), new Link(value.toString(),

View File

@ -81,6 +81,7 @@ public class PublicationGenericOrganizationalUnitsTable extends Table {
getSelectedObject(state); getSelectedObject(state);
return new Model(table, state, publication); return new Model(table, state, publication);
} }
} }
private class Model implements TableModel { private class Model implements TableModel {
@ -127,6 +128,7 @@ public class PublicationGenericOrganizationalUnitsTable extends Table {
public Object getKeyAt(final int columnIndex) { public Object getKeyAt(final int columnIndex) {
return orgaunits.getID(); return orgaunits.getID();
} }
} }
private class EditCellRenderer private class EditCellRenderer
@ -152,8 +154,7 @@ public class PublicationGenericOrganizationalUnitsTable extends Table {
com.arsdigita.cms.SecurityManager.EDIT_ITEM, com.arsdigita.cms.SecurityManager.EDIT_ITEM,
orgaunit); orgaunit);
if (canEdit) { if (canEdit) {
final ContentSection section = CMS.getContext(). final ContentSection section = orgaunit.getContentSection();//CMS.getContext().getContentSection();
getContentSection();
final ItemResolver resolver = section.getItemResolver(); final ItemResolver resolver = section.getItemResolver();
final Link link = new Link( final Link link = new Link(
String.format("%s (%s)", String.format("%s (%s)",
@ -172,6 +173,7 @@ public class PublicationGenericOrganizationalUnitsTable extends Table {
return label; return label;
} }
} }
} }
private class DeleteCellRenderer private class DeleteCellRenderer
@ -208,6 +210,7 @@ public class PublicationGenericOrganizationalUnitsTable extends Table {
return label; return label;
} }
} }
} }
private class ActionListener implements TableActionListener { private class ActionListener implements TableActionListener {
@ -239,5 +242,6 @@ public class PublicationGenericOrganizationalUnitsTable extends Table {
public void headSelected(final TableActionEvent event) { public void headSelected(final TableActionEvent event) {
//Nothing yet //Nothing yet
} }
} }
} }

View File

@ -194,7 +194,7 @@ public class PublicationSeriesTable
return new Label(value.toString()); return new Label(value.toString());
} }
ContentSection section = CMS.getContext().getContentSection(); ContentSection section = series.getContentSection();//CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = Link link =
new Link(String.format("%s (%s)", new Link(String.format("%s (%s)",

View File

@ -171,7 +171,7 @@ public class PublicationWithPublisherSetPublisherSheet
return new Label(value.toString()); return new Label(value.toString());
} }
ContentSection section = CMS.getContext().getContentSection(); ContentSection section = publisher.getContentSection();//CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = Link link =
new Link(value.toString(), new Link(value.toString(),

View File

@ -142,7 +142,7 @@ public class PublisherPublicationsTable extends Table {
// publication); // publication);
//if (canEdit) { //if (canEdit) {
final ContentSection section = CMS.getContext().getContentSection(); final ContentSection section = publication.getContentSection();//CMS.getContext().getContentSection();
final ItemResolver resolver = section.getItemResolver(); final ItemResolver resolver = section.getItemResolver();
final Link link = new Link(value.toString(), final Link link = new Link(value.toString(),
resolver.generateItemURL(state, resolver.generateItemURL(state,

View File

@ -247,7 +247,7 @@ public class SeriesEditshipTable extends Table implements TableActionListener {
ex); ex);
return new Label(value.toString()); return new Label(value.toString());
} }
ContentSection section = CMS.getContext().getContentSection(); ContentSection section = editor.getContentSection();//CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = Link link =
new Link(String.format("%s", new Link(String.format("%s",

View File

@ -211,7 +211,7 @@ public class SeriesVolumesTable extends Table implements TableActionListener {
return new Label(value.toString()); return new Label(value.toString());
} }
ContentSection section = CMS.getContext().getContentSection(); ContentSection section = volume.getContentSection();//CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = Link link =
new Link(String.format("%s", new Link(String.format("%s",

View File

@ -167,7 +167,7 @@ public class UnPublishedOrganizationSheet
return new Label(value.toString()); return new Label(value.toString());
} }
ContentSection section = CMS.getContext().getContentSection(); ContentSection section = organization.getContentSection();//CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = Link link =
new Link(String.format("%s (%s)", new Link(String.format("%s (%s)",