incporporating APLAWS patches 1686 & 1687:
r1686 | chrisg23 | 2007-10-23 16:11:16 +0200 (Di, 23 Okt 2007) Change sql to a version that both Oracle and Postgres understand ------------------------------------------------------------------------ r1687 | chrisg23 | 2007-10-23 16:16:50 +0200 (Di, 23 Okt 2007) sourceforge patch [1803373] - don't stream out blob data until it's actually needed. Note this is configurable so that by default there is no behaviour change, but really it would be unusual to actively want the overhead of the additional streamout. Credit to matt at magpie for this one git-svn-id: https://svn.libreccm.org/ccm/trunk@35 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
9428bd1ffc
commit
8138d560a3
|
|
@ -14,10 +14,10 @@
|
|||
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
--
|
||||
alter table application_types
|
||||
add (container_group_id NUMBER);
|
||||
add container_group_id integer;
|
||||
|
||||
alter table applications
|
||||
add (container_group_id NUMBER);
|
||||
add container_group_id integer;
|
||||
|
||||
alter table application_types add
|
||||
constraint applic_typ_cont_gro_id_f_lszuh foreign key (container_group_id)
|
||||
|
|
|
|||
|
|
@ -34,4 +34,6 @@
|
|||
storage="ccm-core/core-xml.properties"/>
|
||||
<config class="com.arsdigita.xml.formatters.DateFormatterConfig"
|
||||
storage="ccm-core/date-formatter.properties"/>
|
||||
<config class="com.arsdigita.domain.DomainConfig"
|
||||
storage="ccm-core/domain.properties"/>
|
||||
</registry>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
package com.arsdigita.domain;
|
||||
|
||||
|
||||
public class Domain {
|
||||
|
||||
|
||||
private static DomainConfig s_config;
|
||||
|
||||
/**
|
||||
* Gets the <code>DomainConfig</code> object.
|
||||
*/
|
||||
public static final DomainConfig getConfig() {
|
||||
if (s_config == null) {
|
||||
s_config = new DomainConfig();
|
||||
s_config.load("ccm-core/domain.properties");
|
||||
}
|
||||
return s_config;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.arsdigita.domain;
|
||||
|
||||
import com.arsdigita.runtime.AbstractConfig;
|
||||
import com.arsdigita.util.parameter.BooleanParameter;
|
||||
import com.arsdigita.util.parameter.Parameter;
|
||||
|
||||
public final class DomainConfig extends AbstractConfig {
|
||||
|
||||
private final BooleanParameter m_queryBlobContent;
|
||||
|
||||
public DomainConfig() {
|
||||
|
||||
m_queryBlobContent = new BooleanParameter(
|
||||
"waf.domain.query_file_attachment_blob", Parameter.OPTIONAL,
|
||||
Boolean.TRUE);
|
||||
|
||||
register(m_queryBlobContent);
|
||||
loadInfo();
|
||||
}
|
||||
|
||||
public boolean queryBlobContentForFileAttachments() {
|
||||
return ((Boolean) get(m_queryBlobContent)).booleanValue();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
waf.domain.query_file_attachment_blob.title=Unnecessarily Query Blobs?
|
||||
waf.domain.query_file_attachment_blob.purpose=Allows you to prevent an unnecessary and expensive query on cms_files.content. For legacy reasons the defualt is true - go on set it to false.. (assuming that you have ccm-cms-assets-fileattachment loaded)
|
||||
waf.domain.query_file_attachment_blob.example=true|false
|
||||
waf.domain.query_file_attachment_blob.format=[boolean]
|
||||
|
|
@ -22,9 +22,12 @@ import com.arsdigita.util.Assert;
|
|||
|
||||
import com.arsdigita.persistence.metadata.ObjectType;
|
||||
import com.arsdigita.persistence.metadata.Property;
|
||||
import com.arsdigita.persistence.DataCollection;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import com.arsdigita.persistence.DataAssociation;
|
||||
import com.arsdigita.persistence.DataAssociationCursor;
|
||||
import com.arsdigita.persistence.DataQuery;
|
||||
import com.arsdigita.persistence.DataQueryDataCollectionAdapter;
|
||||
import com.arsdigita.persistence.OID;
|
||||
import com.arsdigita.persistence.SessionManager;
|
||||
|
||||
|
|
@ -323,15 +326,38 @@ public abstract class DomainObjectTraversal {
|
|||
|
||||
endRole(obj, path, prop);
|
||||
} else if (propValue instanceof DataAssociation) {
|
||||
|
||||
|
||||
// see #25808 - this hack prevents the content field of cms_files
|
||||
// (which is a blob) from being queried when all we need is a list
|
||||
// of the files on an item..
|
||||
if (prop.getName().equals("fileAttachments") && !Domain.getConfig().queryBlobContentForFileAttachments()) { // make true a config
|
||||
DataQuery fileAttachmentsQuery = SessionManager.getSession().retrieveQuery("com.arsdigita.cms.contentassets.fileAttachmentsQuery");
|
||||
|
||||
fileAttachmentsQuery.setParameter("item_id", obj.getOID().get("id"));
|
||||
|
||||
DataCollection files = new DataQueryDataCollectionAdapter(fileAttachmentsQuery, "file");
|
||||
|
||||
while(files.next()) {
|
||||
DataObject file = files.getDataObject();
|
||||
walk(adapter,
|
||||
DomainObjectFactory.newInstance
|
||||
(file),
|
||||
appendToPath(path, propName),
|
||||
context,
|
||||
null);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if( s_log.isDebugEnabled() ) {
|
||||
s_log.debug( prop.getName() + " is a DataAssociation" );
|
||||
}
|
||||
|
||||
beginAssociation(obj, path, prop);
|
||||
|
||||
|
||||
DataAssociationCursor daCursor =
|
||||
((DataAssociation)propValue).getDataAssociationCursor();
|
||||
|
||||
|
||||
while (daCursor.next()) {
|
||||
DataObject link = daCursor.getLink();
|
||||
DomainObject linkObj = null;
|
||||
|
|
@ -345,8 +371,8 @@ public abstract class DomainObjectTraversal {
|
|||
context,
|
||||
linkObj);
|
||||
}
|
||||
|
||||
endAssociation(obj, path, prop);
|
||||
}
|
||||
} else {
|
||||
// Unknown property value type - do nothing
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue