Skip to content

Commit

Permalink
Merging in changes provided by Mark back during pluggable_cache devel…
Browse files Browse the repository at this point in the history
…opment that don't appear to be in the repo
  • Loading branch information
Brian Ghidinelli committed Jul 12, 2014
1 parent d75845d commit 074bcd3
Show file tree
Hide file tree
Showing 6 changed files with 1,020 additions and 144 deletions.
49 changes: 33 additions & 16 deletions com/dynamic/TransferPopulator.cfc
Expand Up @@ -66,14 +66,19 @@ Mark Mandel 19/07/2005 Created
<cfargument name="name" hint="The name of the manytoone to load" type="string" required="Yes">
<cfscript>
var lazyObject = getObjectManager().getObjectLazyManyToOne(arguments.transfer.getClassName(), arguments.name);
var memento = "";
var args = structNew();

//get primary key
var key = invokePrimarykey(arguments.transfer, lazyObject.getPrimaryKey());

//pass the object over to the query maker, and get back the result
var qObject = getSQLManager().select(lazyObject, key, arguments.name);
var memento = buildMemento(qObject);
var args = structNew();

// protect against deleted objects that should not be lazy loaded
if (qObject.recordCount)
{
memento = buildMemento(qObject);

//build memento arguments
args.memento = StructNew();
Expand All @@ -84,6 +89,7 @@ Mark Mandel 19/07/2005 Created
}

getMethodInvoker().invokeMethod(arguments.transfer, "set" & arguments.name & "Memento", args);
}
</cfscript>
</cffunction>

Expand All @@ -92,15 +98,18 @@ Mark Mandel 19/07/2005 Created
<cfargument name="name" hint="The name of the manytoone to load" type="string" required="Yes">
<cfscript>
var lazyObject = getObjectManager().getObjectLazyOneToMany(arguments.transfer.getClassName(), arguments.name);
var memento = "";
var args = structNew();

//get primary key
var key = invokePrimarykey(arguments.transfer, lazyObject.getPrimaryKey());

//pass the object over to the query maker, and get back the result
var qObject = getSQLManager().select(lazyObject, key, arguments.name);

var memento = buildMemento(qObject);
var args = structNew();
if (qObject.recordCount)
{
memento = buildMemento(qObject);

//build memento arguments
args.memento = ArrayNew(1);
Expand All @@ -111,6 +120,7 @@ Mark Mandel 19/07/2005 Created
}

getMethodInvoker().invokeMethod(arguments.transfer, "set" & arguments.name & "Memento", args);
}
</cfscript>
</cffunction>

Expand All @@ -119,15 +129,18 @@ Mark Mandel 19/07/2005 Created
<cfargument name="name" hint="The name of the manytoone to load" type="string" required="Yes">
<cfscript>
var lazyObject = getObjectManager().getObjectLazyManyToMany(arguments.transfer.getClassName(), arguments.name);
var memento = "";
var args = structNew();

//get primary key
var key = invokePrimarykey(arguments.transfer, lazyObject.getPrimaryKey());

//pass the object over to the query maker, and get back the result
var qObject = getSQLManager().select(lazyObject, key, arguments.name);

var memento = buildMemento(qObject);
var args = structNew();
if (qObject.recordCount)
{
memento = buildMemento(qObject);

//build memento arguments
args.memento = ArrayNew(1);
Expand All @@ -138,6 +151,7 @@ Mark Mandel 19/07/2005 Created
}

getMethodInvoker().invokeMethod(arguments.transfer, "set" & arguments.name & "Memento", args);
}
</cfscript>
</cffunction>

Expand All @@ -155,18 +169,21 @@ Mark Mandel 19/07/2005 Created

var args = structNew();

if (qObject.recordCount)
{
//build memento arguments
args.memento = buildMemento(qObject);

getMethodInvoker().invokeMethod(arguments.transfer, "set" & arguments.name & "Memento", args);
}
</cfscript>
</cffunction>

<!------------------------------------------- PACKAGE ------------------------------------------->

<!------------------------------------------- PRIVATE ------------------------------------------->

<cffunction name="invokePrimarykey" hint="returns a primary key value for a given object" access="private" returntype="any" output="false">
<cffunction name="invokePrimarykey" hint="returns a primary key value for a given object" access="private" returntype="any" output="false">
<cfargument name="transfer" hint="The transfer to load into" type="transfer.com.TransferObject" required="Yes">
<cfargument name="primaryKey" hint="the primary key" type="transfer.com.object.AbstractBaseKey" required="Yes">
<cfscript>
Expand All @@ -178,10 +195,10 @@ Mark Mandel 19/07/2005 Created
{
return getMethodInvoker().invokeMethod(arguments.transfer, "get" & arguments.primaryKey.getName());
}
</cfscript>
</cfscript>
</cffunction>

<cffunction name="invokeCompositeKey" hint="returns a composite key for the given object" access="public" returntype="struct" output="false">
<cffunction name="invokeCompositeKey" hint="returns a composite key for the given object" access="public" returntype="struct" output="false">
<cfargument name="transfer" hint="The transfer to load into" type="transfer.com.TransferObject" required="Yes">
<cfargument name="primaryKey" hint="the primary key" type="transfer.com.object.CompositeKey" required="Yes">
<cfscript>
Expand Down Expand Up @@ -235,7 +252,7 @@ Mark Mandel 19/07/2005 Created
}

return key;
</cfscript>
</cfscript>
</cffunction>

<cffunction name="buildMemento" hint="Builds a memento from a object and query" access="private" returntype="struct" output="false">
Expand Down Expand Up @@ -330,7 +347,7 @@ Mark Mandel 19/07/2005 Created
<cfreturn mementoBuilder.getMementoStruct()>
</cffunction>

<cffunction name="buildCompositeKeyMemento" hint="builds the composite key memento" access="private" returntype="void" output="false">
<cffunction name="buildCompositeKeyMemento" hint="builds the composite key memento" access="private" returntype="void" output="false">
<cfargument name="memento" hint="the memento to append to" type="struct" required="Yes">
<cfargument name="object" hint="the object BO" type="transfer.com.object.Object" required="Yes">
<cfargument name="query" hint="the query that the data is coming from" type="query" required="Yes">
Expand Down Expand Up @@ -378,13 +395,13 @@ Mark Mandel 19/07/2005 Created
}

StructInsert(arguments.memento, object.getPrimaryKey().getName(), key);
</cfscript>
</cfscript>
</cffunction>

<cffunction name="populatePropertyMemento" hint="populates the memento with property values" access="private" returntype="void" output="false">
<cfargument name="memento" hint="the memento to be set" type="struct" required="Yes">
<cfargument name="object" hint="the object meta data" type="transfer.com.object.Object" required="Yes">
<cfargument name="qObject" hint="the query for teh object" type="query" required="Yes">
<cfargument name="qObject" hint="the query for teh object" type="query" required="Yes">
<cfscript>
//loop throough properties
var iterator = arguments.object.getPropertyIterator();
Expand All @@ -398,7 +415,7 @@ Mark Mandel 19/07/2005 Created
property.getName(),
getSQLManager().getPropertyColumnValue(arguments.qObject, arguments.object, property));
}
</cfscript>
</cfscript>
</cffunction>

<cffunction name="populateParentOneToManyMemento" hint="populates the memento with parent one to many values" access="private" returntype="void" output="false">
Expand Down Expand Up @@ -478,7 +495,7 @@ Mark Mandel 19/07/2005 Created
</cfscript>
</cffunction>

<cffunction name="populateCollectionProperty" hint="populates the memento with the collection property value" access="private" returntype="void" output="false">
<cffunction name="populateCollectionProperty" hint="populates the memento with the collection property value" access="private" returntype="void" output="false">
<cfargument name="memento" hint="the memento to be set" type="struct" required="Yes">
<cfargument name="object" hint="the object meta data" type="transfer.com.object.Object" required="Yes">
<cfargument name="collection" hint="the collection meta data" type="transfer.com.object.Collection" required="Yes">
Expand Down Expand Up @@ -508,7 +525,7 @@ Mark Mandel 19/07/2005 Created
getSQLManager().getPropertyColumnValue(arguments.qObject, arguments.object, property));
}
}
</cfscript>
</cfscript>
</cffunction>

<cffunction name="getSQLManager" access="private" returntype="transfer.com.sql.SQLManager" output="false">
Expand Down
17 changes: 11 additions & 6 deletions com/dynamic/definition/DefinitionBuffer.cfc
Expand Up @@ -95,7 +95,7 @@ Mark Mandel 05/04/2006 Created
</cfscript>
</cffunction>

<cffunction name="writeCopyOpenFunction" hint="copies the open function call for a given function" access="public" returntype="void" output="false">
<cffunction name="writeCopyOpenFunction" hint="copies the open function call for a given function" access="public" returntype="void" output="false">
<cfargument name="function" hint="The function coming through" type="any" required="Yes">
<cfargument name="defaultHint" hint="the default hint value" type="string" required="No" default="">
<cfscript>
Expand All @@ -116,6 +116,11 @@ Mark Mandel 05/04/2006 Created
metadata.hint = arguments.defaultHint;
}

if (NOT StructKeyExists(metadata, "access"))
{
metadata.access = "public";
}

writeCFFunctionOpen(metadata.name, metadata.access, metadata.returntype, metadata.hint);

if(hasParams)
Expand Down Expand Up @@ -151,7 +156,7 @@ Mark Mandel 05/04/2006 Created
</cfscript>
</cffunction>

<cffunction name="writeNamedLockOpen" hint="writes a named lock" access="public" returntype="void" output="false">
<cffunction name="writeNamedLockOpen" hint="writes a named lock" access="public" returntype="void" output="false">
<cfargument name="lockName" hint="The name of the lock" type="string" required="Yes">
<cfargument name="readOnly" hint="whether or not this is a read only lock?" type="boolean" required="No" default="false">
<cfscript>
Expand All @@ -163,7 +168,7 @@ Mark Mandel 05/04/2006 Created
}

writeLine('>');
</cfscript>
</cfscript>
</cffunction>

<cffunction name="writeNamedLockClose" hint="writes a named lock" access="public" returntype="void" output="false">
Expand All @@ -176,9 +181,9 @@ Mark Mandel 05/04/2006 Created
<cfargument name="className" hint="the classname of the object" type="string" required="Yes">
<cfargument name="name" hint="the name of the composition in question" type="string" required="Yes">

<cfscript>
writeNamedLockOpen('transfer.composition.#arguments.className#.#arguments.name#.##getSystem().identityHashCode(this)##');
</cfscript>
<cfscript>
writeNamedLockOpen('transfer.composition.#arguments.className#.#arguments.name#.##getSystem().identityHashCode(this)##');
</cfscript>

</cffunction>

Expand Down
122 changes: 0 additions & 122 deletions com/object/Function.cfc

This file was deleted.

0 comments on commit 074bcd3

Please sign in to comment.