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)) {
ContentItem ci = (ContentItem) dobj;
if (newVal == null) {
PermissionService.setContext
(ci, ci.getContentSection());
} else {
if (newVal != null) {
PermissionService.setContext
(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() {
super.afterSave();
s_log.info("******After Save of object " + getOID());
// Set the object's context to its parent object for
// permissioning.
if (m_wasNew) {
final ACSObject parent = getParent();
if (parent == null) {
s_log.info("parent is null - set context to content section");
PermissionService.setContext(this, getContentSection());
} else {
s_log.info("parent is " + parent.getOID());
PermissionService.setContext(this, parent);
}
}
}
*/
private void setDefaultContentSection() {
s_log.debug("Setting the default content section");

View File

@ -104,7 +104,9 @@ public class TextPageBody extends TextAssetBody {
TextPage item = getTextPage(s);
TextAsset t = new TextAsset();
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;
}
@ -118,7 +120,10 @@ public class TextPageBody extends TextAssetBody {
protected void updateTextAsset(PageState s, TextAsset a) {
TextPage t = getTextPage(s);
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);
a.save();
t.save();