incorporating:

r1621 | chrisg23 | 2007-09-13 14:43:12 +0200 (Do, 13 Sep 2007) | 1 line

Sourceforge patch 1707913 - final part of performance improvement changes. Prevent excessively setting content section as the context of contentitems, and don't give text assets a security context (they don't need one as they are never accesed outside their owner)


git-svn-id: https://svn.libreccm.org/ccm/trunk@6 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2008-02-15 00:12:38 +00:00
parent 28a22df347
commit 5a5b9a2042
2 changed files with 17 additions and 9 deletions

View File

@ -322,10 +322,7 @@ public class ContentItem extends VersionedACSObject implements CustomCopy {
if (PARENT.equals(name)) { if (PARENT.equals(name)) {
ContentItem ci = (ContentItem) dobj; ContentItem ci = (ContentItem) dobj;
if (newVal == null) { if (newVal != null) {
PermissionService.setContext
(ci, ci.getContentSection());
} else {
PermissionService.setContext PermissionService.setContext
(ci.getOID(), ((DataObject) newVal).getOID()); (ci.getOID(), ((DataObject) newVal).getOID());
} }
@ -429,22 +426,28 @@ public class ContentItem extends VersionedACSObject implements CustomCopy {
} }
} }
/*
removed cg - object observer sets context based
on parent whenever parent is updated
protected void afterSave() { protected void afterSave() {
super.afterSave(); super.afterSave();
s_log.info("******After Save of object " + getOID());
// Set the object's context to its parent object for // Set the object's context to its parent object for
// permissioning. // permissioning.
if (m_wasNew) { if (m_wasNew) {
final ACSObject parent = getParent(); final ACSObject parent = getParent();
if (parent == null) { if (parent == null) {
s_log.info("parent is null - set context to content section");
PermissionService.setContext(this, getContentSection()); PermissionService.setContext(this, getContentSection());
} else { } else {
s_log.info("parent is " + parent.getOID());
PermissionService.setContext(this, parent); PermissionService.setContext(this, parent);
} }
} }
} }
*/
private void setDefaultContentSection() { private void setDefaultContentSection() {
s_log.debug("Setting the default content section"); s_log.debug("Setting the default content section");

View File

@ -104,7 +104,9 @@ public class TextPageBody extends TextAssetBody {
TextPage item = getTextPage(s); TextPage item = getTextPage(s);
TextAsset t = new TextAsset(); TextAsset t = new TextAsset();
t.setName(item.getName() + "_text_" + item.getID()); t.setName(item.getName() + "_text_" + item.getID());
t.setParent(item); // no need - cg. Text doesn't need a security context,
// and ownership of text is recorded in text_pages
// t.setParent(item);
return t; return t;
} }
@ -118,7 +120,10 @@ public class TextPageBody extends TextAssetBody {
protected void updateTextAsset(PageState s, TextAsset a) { protected void updateTextAsset(PageState s, TextAsset a) {
TextPage t = getTextPage(s); TextPage t = getTextPage(s);
Assert.assertNotNull(t); Assert.assertNotNull(t);
a.setParent(t); // no need - cg. Text doesn't need a security context,
// and ownership of text is recorded in text_pages
// a.setParent(t);
t.setTextAsset(a); t.setTextAsset(a);
a.save(); a.save();
t.save(); t.save();