You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(36) |
Oct
(16) |
Nov
(4) |
Dec
(1) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(13) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ndi...@us...> - 2002-10-05 00:53:04
|
Update of /cvsroot/modus/org/bacfug/modus/persistence In directory usw-pr-cvs1:/tmp/cvs-serv32037/bacfug/modus/persistence Modified Files: simplefilesystempersister.cfc simpleobjectinstance.cfc Log Message: updated to the new instance.cache instead of assuming that caching is part of the persister. Index: simplefilesystempersister.cfc =================================================================== RCS file: /cvsroot/modus/org/bacfug/modus/persistence/simplefilesystempersister.cfc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** simplefilesystempersister.cfc 14 Sep 2002 01:22:06 -0000 1.1 --- simplefilesystempersister.cfc 5 Oct 2002 00:53:01 -0000 1.2 *************** *** 23,27 **** <cffile action="write" file="#getPathFromObject(arguments.contentObject)#" output="#packet#"> <!--- put the object in the cache ---> ! <cfset cachePutObject(arguments.contentObject)> <!--- if it's not a good contentObject ---> <cfelse> --- 23,27 ---- <cffile action="write" file="#getPathFromObject(arguments.contentObject)#" output="#packet#"> <!--- put the object in the cache ---> ! <cfset instance.cache.putObject(arguments.contentObject)> <!--- if it's not a good contentObject ---> <cfelse> *************** *** 39,44 **** <!--- if this object is cached, return that one ---> <cfscript> ! if(isObjectCached(arguments.id)){ ! objectRetrieved = cacheGetObject(arguments.id); if(structCount(arguments) GT 1) return contentObjectPopulateFromInstance(arguments[2],objectRetrieved); --- 39,44 ---- <!--- if this object is cached, return that one ---> <cfscript> ! if(instance.cache.isObjectCached(arguments.id)){ ! objectRetrieved = instance.cache.getObject(arguments.id); if(structCount(arguments) GT 1) return contentObjectPopulateFromInstance(arguments[2],objectRetrieved); *************** *** 65,68 **** --- 65,69 ---- } </cfscript> + <cfset instance.cache.putObject(objectRetrieved)> <cfreturn objectRetrieved> </cffunction> Index: simpleobjectinstance.cfc =================================================================== RCS file: /cvsroot/modus/org/bacfug/modus/persistence/simpleobjectinstance.cfc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** simpleobjectinstance.cfc 12 Sep 2002 19:17:48 -0000 1.4 --- simpleobjectinstance.cfc 5 Oct 2002 00:53:01 -0000 1.5 *************** *** 43,47 **** </cfif> <!--- put the object in the cache ---> ! <cfset cachePutObject(arguments.contentObject)> <!--- if it's not a good contentObject ---> <cfelse> --- 43,47 ---- </cfif> <!--- put the object in the cache ---> ! <cfset instance.cache.putObject(arguments.contentObject)> <!--- if it's not a good contentObject ---> <cfelse> *************** *** 58,63 **** <!--- if this object is cached, return that one ---> <cfscript> ! if(isObjectCached(arguments.id)){ ! objectRetrieved = cacheGetObject(arguments.id); if(structCount(arguments) GT 1) return contentObjectPopulateFromInstance(arguments[2],objectRetrieved); --- 58,63 ---- <!--- if this object is cached, return that one ---> <cfscript> ! if(instance.cache.isObjectCached(arguments.id)){ ! objectRetrieved = instance.cache.getObject(arguments.id); if(structCount(arguments) GT 1) return contentObjectPopulateFromInstance(arguments[2],objectRetrieved); *************** *** 89,93 **** </cfif> <!--- put the object in the cache ---> ! <cfset cachePutObject(objectRetrieved)> <!--- return the object ---> <cfreturn objectRetrieved> --- 89,93 ---- </cfif> <!--- put the object in the cache ---> ! <cfset instance.cache.putObject(objectRetrieved)> <!--- return the object ---> <cfreturn objectRetrieved> *************** *** 115,124 **** for(ii = 1; ii LTE getQuery.recordCount; ii = ii + 1){ //if the object is in the cache, use that ! if(isObjectCached(getQuery.id[ii])){ ! thisInstance = cacheGetObject(getQuery.id[ii]); } else{ thisInstance = wddxToContentObject(getQuery.packet[ii]); ! cachePutObject(thisInstance); } objectArray[ii] = thisInstance; --- 115,124 ---- for(ii = 1; ii LTE getQuery.recordCount; ii = ii + 1){ //if the object is in the cache, use that ! if(instance.cache.isObjectCached(getQuery.id[ii])){ ! thisInstance = instance.cache.getObject(getQuery.id[ii]); } else{ thisInstance = wddxToContentObject(getQuery.packet[ii]); ! instance.cache.putObject(thisInstance); } objectArray[ii] = thisInstance; |
From: <ndi...@us...> - 2002-10-05 00:52:31
|
Update of /cvsroot/modus/org/bacfug/modus/persistence In directory usw-pr-cvs1:/tmp/cvs-serv31929/bacfug/modus/persistence Modified Files: basepersister.cfc Log Message: removed caching and refactored it into its own object, so we now have an instance.cache -- eventually, this should not need to be instantiated every time the persister is. Index: basepersister.cfc =================================================================== RCS file: /cvsroot/modus/org/bacfug/modus/persistence/basepersister.cfc,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** basepersister.cfc 12 Sep 2002 19:19:55 -0000 1.8 --- basepersister.cfc 5 Oct 2002 00:52:28 -0000 1.9 *************** *** 3,13 **** <cffunction name="init" access="public" hint="The initializer" returnType="org.bacfug.modus.persistence.basePersister" output="no"> <cfscript> ! //make sure the cache is initialized ! if(NOT isCacheInitialized()) ! cacheInit(); </cfscript> <cfreturn this> </cffunction> <cffunction name="save" access="public" output="no" hint="The method to save data"> <cfthrow message="save() method not implemented!" detail="You must defined a save() method for #getMetaData(this).name#."> --- 3,16 ---- <cffunction name="init" access="public" hint="The initializer" returnType="org.bacfug.modus.persistence.basePersister" output="no"> <cfscript> ! //the cache we should use ! instance.cache = createObject("component",getCachePath()); </cfscript> <cfreturn this> </cffunction> + <cffunction name="getCachePath" access="private" returntype="string" output="no" hint="returns a string with the path to the cache component to use. you can override this function in a persister implementation if you want to use a different caching mechanism other than the default."> + <cfreturn "org.bacfug.modus.caching.serverScopeCache"> + </cffunction> + <cffunction name="save" access="public" output="no" hint="The method to save data"> <cfthrow message="save() method not implemented!" detail="You must defined a save() method for #getMetaData(this).name#."> *************** *** 155,202 **** <cfreturn contentObjectFromSerializable(deserializedObject)> </cfif> ! </cffunction> ! ! <!--- is the cache primed ---> ! <cffunction name="isCacheInitialized" access="package" output="no" returnType="boolean" hint="Returns a boolean for whether the cache is initialized"> ! <cfreturn structKeyExists(server,"modus") AND structKeyExists(server.modus,"contentObjectCache") AND structKeyExists(server.modus.contentObjectCache,"objectInstances")> ! </cffunction> ! <!--- initialize the cache ---> ! <cffunction name="cacheInit" access="package" output="no" returnType="void" hint="Initializes the in-memory cache"> ! <cfparam name="server.modus" default="#structNew()#"> ! <cfscript> ! server.modus.contentObjectCache = structNew(); ! server.modus.contentObjectCache.objectInstances = structNew(); ! server.modus.contentObjectCache.objectTypes = structNew(); ! </cfscript> ! </cffunction> ! ! <!--- is a particular object instance in the cache? ---> ! <cffunction name="isObjectCached" access="package" output="no" returnType="boolean" hint="Returns a boolean for whether a particular object (Based on ID) is cached"> ! <cfargument name="id" required="yes" type="string"> ! <cfscript> ! if(NOT isCacheInitialized()){ ! cacheInit(); ! } ! </cfscript> ! <cfreturn structKeyExists(server.modus.contentObjectCache.objectInstances,arguments.id)> ! </cffunction> ! ! <!--- put an object in the cache ---> ! <cffunction name="cachePutObject" access="package" output="no" returnType="void" hint="Put a contentObject instance into the cache"> ! <cfargument name="contentObject" required="yes" type="org.bacfug.modus.baseContentObject"> ! <cfscript> ! server.modus.contentObjectCache.objectInstances[arguments.contentObject.getID()] = arguments.contentObject.makeClone(); ! </cfscript> ! </cffunction> ! ! <!--- get an object from the cache ---> ! <cffunction name="cacheGetObject" access="package" output="no" returnType="org.bacfug.modus.baseContentObject" hint="get an object instance from the cache"> ! <cfargument name="id" required="yes" type="string"> ! <cfif NOT isObjectCached(arguments.id)> ! <cfthrow type="modus.badCacheRequest" message="Object does not exist in the cache" detail="The contentObject with ID ""#arguments.id#"" does not exist in the cache. You may not request an object that is not cached."> ! </cfif> ! <cfreturn server.modus.contentObjectCache.objectInstances[arguments.id]> ! </cffunction> ! </cfcomponent> --- 158,162 ---- <cfreturn contentObjectFromSerializable(deserializedObject)> </cfif> ! </cffunction> </cfcomponent> |
From: <ndi...@us...> - 2002-10-05 00:51:45
|
Update of /cvsroot/modus/org/bacfug/modus/caching In directory usw-pr-cvs1:/tmp/cvs-serv31743a/bacfug/modus/caching Added Files: serverscopecache.cfc Log Message: an implementation of caching that uses the server scope --- NEW FILE: serverscopecache.cfc --- <cfcomponent hint="Uses the server scope for caching" extends="org.bacfug.modus.caching.baseCache"> <!--- is the cache primed ---> <cffunction name="isCacheInitialized" access="public" output="no" returnType="boolean" hint="Returns a boolean for whether the cache is initialized"> <cfreturn structKeyExists(server,"modus") AND structKeyExists(server.modus,"contentObjectCache") AND structKeyExists(server.modus.contentObjectCache,"objectInstances")> </cffunction> <!--- initialize the cache ---> <cffunction name="cacheInit" access="public" output="no" returnType="void" hint="Initializes the in-memory cache"> <cfparam name="server.modus" default="#structNew()#"> <cfscript> server.modus.contentObjectCache = structNew(); server.modus.contentObjectCache.objectInstances = structNew(); server.modus.contentObjectCache.objectTypes = structNew(); </cfscript> </cffunction> <!--- is a particular object instance in the cache? ---> <cffunction name="isObjectCached" access="public" output="no" returnType="boolean" hint="Returns a boolean for whether a particular object (Based on ID) is cached"> <cfargument name="id" required="yes" type="string"> <cfreturn structKeyExists(server.modus.contentObjectCache.objectInstances,arguments.id)> </cffunction> <!--- put an object in the cache ---> <cffunction name="putObject" access="public" output="no" returnType="void" hint="Put a contentObject instance into the cache"> <cfargument name="contentObject" required="yes" type="org.bacfug.modus.baseContentObject"> <cfscript> server.modus.contentObjectCache.objectInstances[arguments.contentObject.getID()] = arguments.contentObject.makeClone(); </cfscript> </cffunction> <!--- get an object from the cache ---> <cffunction name="getObject" access="public" output="no" returnType="org.bacfug.modus.baseContentObject" hint="get an object instance from the cache"> <cfargument name="id" required="yes" type="string"> <cfif NOT isObjectCached(arguments.id)> <cfthrow type="modus.badCacheRequest" message="Object does not exist in the cache" detail="The contentObject with ID ""#arguments.id#"" does not exist in the cache. You may not request an object that is not cached."> </cfif> <cfreturn server.modus.contentObjectCache.objectInstances[arguments.id]> </cffunction> </cfcomponent> |
From: <ndi...@us...> - 2002-10-05 00:51:23
|
Update of /cvsroot/modus/org/bacfug/modus/caching In directory usw-pr-cvs1:/tmp/cvs-serv31663/bacfug/modus/caching Added Files: basecache.cfc Log Message: moving caching to its own structure, so we build a baseCache to define the interface and provide default methods for cache implementations --- NEW FILE: basecache.cfc --- <cfcomponent hint="the base cache object"> <cffunction name="init" access="public" hint="The initializer" returnType="org.bacfug.modus.caching.baseCache" output="no"> <cfscript> //make sure the cache is initialized if(NOT isCacheInitialized()) cacheInit(); </cfscript> <cfreturn this> </cffunction> <!--- is the cache primed ---> <cffunction name="isCacheInitialized" access="package" output="no" returnType="boolean" hint="Returns a boolean for whether the cache is initialized"> <cfthrow message="isCacheInitialized() not implemented in #getMetaData(this).name#"> </cffunction> <!--- initialize the cache ---> <cffunction name="cacheInit" access="package" output="no" returnType="void" hint="Initializes the cache"> <cfthrow message="cacheInit() not implemented in #getMetaData(this).name#"> </cffunction> <!--- is a particular object instance in the cache? ---> <cffunction name="isObjectCached" access="package" output="no" returnType="boolean" hint="Returns a boolean for whether a particular object (Based on ID) is cached"> <cfthrow message="isObjectCached not implemented in #getMetaData(this).name#"> </cffunction> <!--- put an object in the cache ---> <cffunction name="putObject" access="package" output="no" returnType="void" hint="Put a contentObject instance into the cache"> <cfthrow message="putObject not implemented in #getMetaData(this).name#"> </cffunction> <!--- get an object from the cache ---> <cffunction name="getObject" access="package" output="no" returnType="org.bacfug.modus.baseContentObject" hint="get an object instance from the cache"> <cfthrow message="getObject not implemented in #getMetaData(this).name#"> </cffunction> </cfcomponent> |
From: <ndi...@us...> - 2002-10-05 00:50:36
|
Update of /cvsroot/modus/org/bacfug/modus/caching In directory usw-pr-cvs1:/tmp/cvs-serv31463/caching Log Message: Directory /cvsroot/modus/org/bacfug/modus/caching added to the repository |
From: <ndi...@us...> - 2002-10-03 05:46:57
|
Update of /cvsroot/modus/modustest/contentobjects In directory usw-pr-cvs1:/tmp/cvs-serv21839/contentobjects Modified Files: pressrelease.cfc Log Message: added the categoryPicker field to test SELECT boxes Index: pressrelease.cfc =================================================================== RCS file: /cvsroot/modus/modustest/contentobjects/pressrelease.cfc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pressrelease.cfc 3 Sep 2002 08:08:00 -0000 1.3 --- pressrelease.cfc 3 Oct 2002 05:46:55 -0000 1.4 *************** *** 18,24 **** fieldType="org.bacfug.modus.fields.yesno" defaultValue="no" ! rules="org.bacfug.modus.validation.boolean"/> <cfproperty name="label" type="instance" ! value="Press Release"> </cfcomponent> --- 18,32 ---- fieldType="org.bacfug.modus.fields.yesno" defaultValue="no" ! rules="org.bacfug.modus.validation.boolean"/> ! <cfproperty name="category" ! type="field" ! label="Category" ! fieldType="modustest.contentObjects.categoryPicker"/> ! ! ! ! <cfproperty name="label" type="instance" ! value="Press Release"/> </cfcomponent> |
From: <ndi...@us...> - 2002-10-03 05:46:40
|
Update of /cvsroot/modus/modustest/contentobjects In directory usw-pr-cvs1:/tmp/cvs-serv21711/contentobjects Added Files: categorypicker.cfc Log Message: this is a try at one way to make SELECT fields -- by just creating a field implementation that deals with it internally. Still mulling over how to build abstracted SELECT widgets, but for now this proves the underlying machinery is working. --- NEW FILE: categorypicker.cfc --- <cfcomponent extends="org.bacfug.modus.fields.baseField" hint="A simple list of categories for press releases"> <!--- override the toFormField method to make a SELECT with months in it ---> <cffunction name="toFormField" access="public" output="no" hint="returns a simple SELECT form widget" returnType="string"> <cfset var options = arrayNew(1)> <cfscript> arrayAppend(options,instance.formFieldFactory.newSelectOption("corp","Corporate")); arrayAppend(options,instance.formFieldFactory.newSelectOption("prod","Product")); arrayAppend(options,instance.formFieldFactory.newSelectOption("people","People")); </cfscript> <cfreturn instance.formFieldFactory.makeSelect(getName(),getValue(),options)> </cffunction> </cfcomponent> |
From: <ndi...@us...> - 2002-10-03 05:45:22
|
Update of /cvsroot/modus/org/bacfug/modus/form In directory usw-pr-cvs1:/tmp/cvs-serv21118/bacfug/modus/form Modified Files: formfieldfactory.cfc Log Message: had the damndest time trying to figure out why the newSelectOption method was having a null pointer error. Turns out it has something to do with having the formFieldFactory in the server scope. Not sure why, but that is fixed now. So, this is not actually any different, but has been rearranged slightly. Index: formfieldfactory.cfc =================================================================== RCS file: /cvsroot/modus/org/bacfug/modus/form/formfieldfactory.cfc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** formfieldfactory.cfc 30 Sep 2002 22:48:09 -0000 1.4 --- formfieldfactory.cfc 3 Oct 2002 05:45:19 -0000 1.5 *************** *** 1,4 **** --- 1,6 ---- <cfcomponent displayname="formFieldFactory" hint="This component can create all kinds of HTML form fields"> + <cfparam name="instance" default="#structNew()#"> + <!--- an init method ---> <cffunction name="init" access="public" output="no" returnType="org.bacfug.modus.form.formFieldFactory" hint="an initialization method"> *************** *** 37,40 **** --- 39,50 ---- <cfreturn toReturn> </cffunction> + + <!--- a method to make a struct to make a select option ---> + <cffunction name="newSelectOption" access="public" output="no" returnType="struct" hint="A quick way to make the data object necessary to pass to a SELECT box"> + <cfargument name="value" required="yes" type="variableName"> + <cfargument name="label" required="no" type="string" default="#arguments.value#"> + <cfreturn arguments> + </cffunction> + <!--- make a select field ---> <cffunction name="makeSelect" access="public" output="no" returnType="string" hint="makes a SELECT field"> *************** *** 54,57 **** --- 64,68 ---- <cfreturn toReturn> </cffunction> + <!--- make a select option ---> <cffunction name="makeSelectOption" access="public" output="no" returnType="string" hint="makes an OPTION field"> *************** *** 67,76 **** </cfscript> <cfreturn toReturn> ! </cffunction> ! <cffunction name="newSelectOption" access="public" output="no" returnType="struct" hint="Used mostly internally to create option structs to pass to a select"> ! <cfargument name="value" required="yes" type="string"> ! <cfargument name="label" required="yes" type="string" default="#arguments.value#"> ! <cfreturn duplicate(arguments)> ! </cffunction> <!--- make a checkbox ---> <cffunction name="makeCheckbox" access="public" output="no" returntype="string" hint="makes a checkbox"> --- 78,83 ---- </cfscript> <cfreturn toReturn> ! </cffunction> ! <!--- make a checkbox ---> <cffunction name="makeCheckbox" access="public" output="no" returntype="string" hint="makes a checkbox"> *************** *** 91,94 **** <cfargument name="name" required="yes" type="variableName"> <cfreturn "<input type=""file"" name=""" & arguments.name & """>"> ! </cffunction> </cfcomponent> --- 98,102 ---- <cfargument name="name" required="yes" type="variableName"> <cfreturn "<input type=""file"" name=""" & arguments.name & """>"> ! </cffunction> ! </cfcomponent> |
From: <ndi...@us...> - 2002-10-03 05:42:26
|
Update of /cvsroot/modus/org/bacfug/modus/fields In directory usw-pr-cvs1:/tmp/cvs-serv19786/bacfug/modus/fields Modified Files: basefield.cfc Log Message: some kind of strangeness is happening when the formFieldFactory is stored in the server scope and reused for each instance, so for now I am going back to creating a new instance. Hopefully, I'll figure it out and be able to go back to having one instance nicely stored. Index: basefield.cfc =================================================================== RCS file: /cvsroot/modus/org/bacfug/modus/fields/basefield.cfc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** basefield.cfc 12 Sep 2002 19:18:26 -0000 1.6 --- basefield.cfc 3 Oct 2002 05:42:22 -0000 1.7 *************** *** 23,27 **** } //set the form field factory to this instance ! instance.formFieldFactory = server.modus.formFieldFactory; </cfscript> <cfreturn this> --- 23,28 ---- } //set the form field factory to this instance ! //instance.formFieldFactory = server.modus.formFieldFactory; ! instance.formFieldFactory = createObject("component","org.bacfug.modus.form.formFieldFactory").init(); </cfscript> <cfreturn this> |
From: <ndi...@us...> - 2002-09-30 22:48:13
|
Update of /cvsroot/modus/org/bacfug/modus/form In directory usw-pr-cvs1:/tmp/cvs-serv30881/bacfug/modus/form Modified Files: formfieldfactory.cfc Log Message: initial interface for building a SELECT box Index: formfieldfactory.cfc =================================================================== RCS file: /cvsroot/modus/org/bacfug/modus/form/formfieldfactory.cfc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** formfieldfactory.cfc 3 Sep 2002 23:05:02 -0000 1.3 --- formfieldfactory.cfc 30 Sep 2002 22:48:09 -0000 1.4 *************** *** 37,40 **** --- 37,76 ---- <cfreturn toReturn> </cffunction> + <!--- make a select field ---> + <cffunction name="makeSelect" access="public" output="no" returnType="string" hint="makes a SELECT field"> + <cfargument name="name" required="yes" type="variableName"> + <cfargument name="currentValue" required="yes" type="string"> + <cfargument name="options" required="no" type="array" default="#arrayNew(1)#"> + <cfset var toReturn = "<select name=""" & arguments.name & """>"> + <cfset var ii = 0> + <cfset var thisOption = ""> + <cfscript> + for(ii = 1; ii LTE arrayLen(arguments.options); ii = ii + 1){ + thisOption = arguments.options[ii]; + toReturn = toReturn & makeSelectOption(thisOption.value,thisOption.label,NOT compare(currentValue,thisOption.value)); + } + toReturn = toReturn & "</select>"; + </cfscript> + <cfreturn toReturn> + </cffunction> + <!--- make a select option ---> + <cffunction name="makeSelectOption" access="public" output="no" returnType="string" hint="makes an OPTION field"> + <cfargument name="value" required="yes" type="string"> + <cfargument name="label" required="no" type="string" default="#arguments.value#"> + <cfargument name="selected" required="no" type="boolean" default="false"> + <cfset var toReturn = "<option value=""" & arguments.value & """"> + <cfscript> + if(arguments.selected){ + toReturn = toReturn & " SELECTED"; + } + toReturn = toReturn & ">" & htmlEditFormat(arguments.label) & "</option>"; + </cfscript> + <cfreturn toReturn> + </cffunction> + <cffunction name="newSelectOption" access="public" output="no" returnType="struct" hint="Used mostly internally to create option structs to pass to a select"> + <cfargument name="value" required="yes" type="string"> + <cfargument name="label" required="yes" type="string" default="#arguments.value#"> + <cfreturn duplicate(arguments)> + </cffunction> <!--- make a checkbox ---> <cffunction name="makeCheckbox" access="public" output="no" returntype="string" hint="makes a checkbox"> |
From: <ndi...@us...> - 2002-09-14 01:22:33
|
Update of /cvsroot/modus/org/bacfug/modus In directory usw-pr-cvs1:/tmp/cvs-serv8672/bacfug/modus Modified Files: basecontentobject.cfc Log Message: changed to use the new simpleFileSystemPersister as the default persister Index: basecontentobject.cfc =================================================================== RCS file: /cvsroot/modus/org/bacfug/modus/basecontentobject.cfc,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** basecontentobject.cfc 12 Sep 2002 19:16:20 -0000 1.12 --- basecontentobject.cfc 14 Sep 2002 01:22:30 -0000 1.13 *************** *** 15,19 **** instance.id = makeID(); //which persister will we use? Set a default. ! config.persister = "org.bacfug.modus.persistence.simpleObjectInstance"; //by default the instance.dateCreated is now() instance.dateCreated = now(); --- 15,19 ---- instance.id = makeID(); //which persister will we use? Set a default. ! config.persister = "org.bacfug.modus.persistence.simpleFileSystemPersister"; //by default the instance.dateCreated is now() instance.dateCreated = now(); |
From: <ndi...@us...> - 2002-09-14 01:22:10
|
Update of /cvsroot/modus/org/bacfug/modus/persistence In directory usw-pr-cvs1:/tmp/cvs-serv8624/bacfug/modus/persistence Added Files: simplefilesystempersister.cfc Log Message: this is the basic file system persister that we are going to use as the default persister --- NEW FILE: simplefilesystempersister.cfc --- <cfcomponent extends="org.bacfug.modus.persistence.basePersister" displayname="fileSytemByType" hint="The basic component for storing object instances under the WEB-INF directory on the file system."> <!--- information about the base directory ---> <!--- this should really be in the config!! ---> <cfparam name="instance.baseModusDir" default="#expandPath("/WEB-INF/modus/")#"> <cfparam name="instance.objectStoreDir" default="#instance.baseModusDir#objectstore/"> <!--- make sure the base directory exists ---> <cfif NOT directoryExists(instance.objectStoreDir)> <cfdirectory action="create" directory="#instance.objectStoreDir#"> </cfif> <cffunction name="save" access="public" output="no" returnType="void" hint="The method to save data"> <cfargument name="contentObject" required="yes"> <cfset var objectToSave = ""> <cfset var packet = ""> <!--- make sure we're dealing with a contentObject ---> <cfif isContentObject(arguments.contentObject)> <cfscript> //make the storage struct packet = contentObjectToWddx(arguments.contentObject); </cfscript> <!--- write the file ---> <cffile action="write" file="#getPathFromObject(arguments.contentObject)#" output="#packet#"> <!--- put the object in the cache ---> <cfset cachePutObject(arguments.contentObject)> <!--- if it's not a good contentObject ---> <cfelse> <cfthrow type="modus.badContentObject" message="Bad ContentObject" detail="A bad contentObject was passed to save() in #getMetaData(this).name#"> </cfif> </cffunction> <cffunction name="get" access="public" output="no" returnType="org.bacfug.modus.baseContentObject" hint="The method to get a particular data instance"> <cfargument name="id" type="string" required="yes"> <cfset var objectRetrieved = ""> <cfset var getQuery = ""> <cfset var packet = ""> <cfset var dirToCheck = getBaseStorageDirectory()> <!--- if this object is cached, return that one ---> <cfscript> if(isObjectCached(arguments.id)){ objectRetrieved = cacheGetObject(arguments.id); if(structCount(arguments) GT 1) return contentObjectPopulateFromInstance(arguments[2],objectRetrieved); else return objectRetrieved; } </cfscript> <!--- try getting this instance ---> <cfdirectory action="list" directory="#dirToCheck#" name="getQuery" filter="#arguments.id#*"> <cfscript> //if we found one, grab the object if(getQuery.recordCount){ objectRetrieved = getObjectFromFile(getQuery.name[1]); //if there is a second argument, it means we need to load that instance if(structCount(arguments) GT 1){ contentObjectPopulateFromInstance(arguments[2],objectRetrieved); } } //if none found, that's a bad error else{ throwError("modus.badObjectID","Bad Object ID","The ID ""#arguments.id#"" does not correspond to a known contentObject instance available from #getMetaData(this).name#"); } </cfscript> <cfreturn objectRetrieved> </cffunction> <cffunction name="getAll" access="public" returntype="array" output="no" hint="The method to get all data instances of a particular type"> <cfargument name="type" required="no" default=""> <cfset var getQuery = ""> <cfset var objectArray = arrayNew(1)> <cfset var packet = ""> <cfset var filter = "*"> <cfset var dirToCheck = getBaseStorageDirectory()> <cfscript> //if a type is passed, set the filter if(len(trim(arguments.type))){ filter = "*." & arguments.type; } </cfscript> <!--- get the appropriate files into a query ---> <cfdirectory action="list" directory="#dirToCheck#" name="getQuery" filter="#filter#"> <!--- loop through files, parsing them and putting the contents into the objectArray ---> <cfloop query="getQuery"> <cfset objectArray[currentRow] = getObjectFromFile(name)> </cfloop> <!--- return the array of objects ---> <cfreturn objectArray> </cffunction> <!--- a method to get an object from the name of its storage file ---> <cffunction name="getObjectFromFile" access="private" returnType="org.bacfug.modus.baseContentObject" output="no" hint="returns an object instance based on the name of the file"> <cfargument name="fileName" type="string" required="yes"> <cfset var packet = ""> <cftry> <cffile action="read" file="#getBaseStorageDirectory()##arguments.fileName#" variable="packet"> <cfcatch> <cfthrow type="modus.badFile" message="File does not exist" detail="The requested file ""#arguments.fileName#"" does not exist."> </cfcatch> </cftry> <!--- if there is a second argument, it means we're loading an existing object ---> <cfif structCount(arguments) GT 1> <cfreturn wddxToContentObject(packet,arguments[2])> <!--- otherwise, just return the object ---> <cfelse> <cfreturn wddxToContentObject(packet)> </cfif> </cffunction> <!--- a method to get the directory path based on an object ---> <cffunction name="getPathFromObject" access="private" returnType="string" output="no" hint="returns a full path based on an object"> <cfargument name="contentObject" type="org.bacfug.modus.baseContentObject" required="yes"> <cfset var directoryPath = getBaseStorageDirectory()> <cfset var fullPath = ""> <cfscript> //make sure the directory exists directoryInit(directoryPath); //set the full path fullPath = directoryPath & arguments.contentObject.getID() & "." & arguments.contentObject.getType(); </cfscript> <!--- now, be sure ---> <cfreturn fullPath> </cffunction> <!--- a method to get the base directory for storage ---> <cffunction name="getBaseStorageDirectory" access="private" returnType="string" output="no" hint="returns the path to the base storage directory"> <cfreturn instance.objectStoreDir> </cffunction> <!--- a method for make sure directories exist in the storage directory ---> <cffunction name="directoryInit" access="private" returnType="void" output="no" hint="a method for make sure directories exist in the storage directory"> <cfargument name="directory" required="yes" type="string"> <!--- if the directory does not exist, create it ---> <cfif NOT directoryExists(arguments.directory)> <cfdirectory action="create" directory="#arguments.directory#"> </cfif> </cffunction> <!--- a method to throw an error (DAMN YOU CFSCRIPT FOR NOT HAVING THIS FUNCTION ALREADY! ---> <cffunction name="throwError" access="private" returnType="void" output="no"> <cfargument name="type" required="yes"> <cfargument name="message" requied="yes"> <cfargument name="detail" required="no" default=""> <cfthrow type="#arguments.type#" message="#arguments.message#" detail="#arguments.detail#"> </cffunction> </cfcomponent> |
From: <ndi...@us...> - 2002-09-12 19:19:58
|
Update of /cvsroot/modus/org/bacfug/modus/persistence In directory usw-pr-cvs1:/tmp/cvs-serv29092/bacfug/modus/persistence Modified Files: basepersister.cfc Log Message: whoops, wrong method name Index: basepersister.cfc =================================================================== RCS file: /cvsroot/modus/org/bacfug/modus/persistence/basepersister.cfc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** basepersister.cfc 12 Sep 2002 19:17:10 -0000 1.7 --- basepersister.cfc 12 Sep 2002 19:19:55 -0000 1.8 *************** *** 186,190 **** <cfargument name="contentObject" required="yes" type="org.bacfug.modus.baseContentObject"> <cfscript> ! server.modus.contentObjectCache.objectInstances[arguments.contentObject.getID()] = arguments.contentObject.getClone(); </cfscript> </cffunction> --- 186,190 ---- <cfargument name="contentObject" required="yes" type="org.bacfug.modus.baseContentObject"> <cfscript> ! server.modus.contentObjectCache.objectInstances[arguments.contentObject.getID()] = arguments.contentObject.makeClone(); </cfscript> </cffunction> |
From: <ndi...@us...> - 2002-09-12 19:18:29
|
Update of /cvsroot/modus/org/bacfug/modus/fields In directory usw-pr-cvs1:/tmp/cvs-serv28545/bacfug/modus/fields Modified Files: basefield.cfc Log Message: moved the formFieldFactory into the server scope, so we don't need to create one on every request Index: basefield.cfc =================================================================== RCS file: /cvsroot/modus/org/bacfug/modus/fields/basefield.cfc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** basefield.cfc 3 Sep 2002 23:05:38 -0000 1.5 --- basefield.cfc 12 Sep 2002 19:18:26 -0000 1.6 *************** *** 19,27 **** setValue(instance.defaultValue); //if necessary, create a form field factory ! if(NOT isDefined("request.modus.formFieldFactory")){ ! request.modus.formFieldFactory = createObject("component","org.bacfug.modus.form.formFieldFactory").init(); } //set the form field factory to this instance ! instance.formFieldFactory = request.modus.formFieldFactory; </cfscript> <cfreturn this> --- 19,27 ---- setValue(instance.defaultValue); //if necessary, create a form field factory ! if(NOT isDefined("server.modus.formFieldFactory")){ ! server.modus.formFieldFactory = createObject("component","org.bacfug.modus.form.formFieldFactory").init(); } //set the form field factory to this instance ! instance.formFieldFactory = server.modus.formFieldFactory; </cfscript> <cfreturn this> |
From: <ndi...@us...> - 2002-09-12 19:17:53
|
Update of /cvsroot/modus/org/bacfug/modus/persistence In directory usw-pr-cvs1:/tmp/cvs-serv28319/bacfug/modus/persistence Modified Files: simpleobjectinstance.cfc Log Message: properly implemented caching -- should perform much better now Index: simpleobjectinstance.cfc =================================================================== RCS file: /cvsroot/modus/org/bacfug/modus/persistence/simpleobjectinstance.cfc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** simpleobjectinstance.cfc 8 Sep 2002 02:38:20 -0000 1.3 --- simpleobjectinstance.cfc 12 Sep 2002 19:17:48 -0000 1.4 *************** *** 88,91 **** --- 88,94 ---- <cfthrow type="modus.badObjectID" message="Bad Object ID" detail="The ID ""#arguments.id#"" does not correspond to a known contentObject instance available from #getMetaData(this).name#"> </cfif> + <!--- put the object in the cache ---> + <cfset cachePutObject(objectRetrieved)> + <!--- return the object ---> <cfreturn objectRetrieved> </cffunction> *************** *** 96,104 **** <cfset var objectArray = arrayNew(1)> <cfset var ii = 0> <!--- get everything we need from the database ---> <cfquery name="getQuery" datasource="#datasource#"> SELECT id, ! packet, ! type FROM objectInstances <cfif len(trim(arguments.type))> --- 99,108 ---- <cfset var objectArray = arrayNew(1)> <cfset var ii = 0> + <cfset var thisInstance = ""> <!--- get everything we need from the database ---> <cfquery name="getQuery" datasource="#datasource#"> SELECT id, ! type, ! packet FROM objectInstances <cfif len(trim(arguments.type))> *************** *** 110,114 **** //loop through the query, creating objects and populating them as we go for(ii = 1; ii LTE getQuery.recordCount; ii = ii + 1){ ! objectArray[ii] = wddxToContentObject(getQuery.packet[ii]); } </cfscript> --- 114,126 ---- //loop through the query, creating objects and populating them as we go for(ii = 1; ii LTE getQuery.recordCount; ii = ii + 1){ ! //if the object is in the cache, use that ! if(isObjectCached(getQuery.id[ii])){ ! thisInstance = cacheGetObject(getQuery.id[ii]); ! } ! else{ ! thisInstance = wddxToContentObject(getQuery.packet[ii]); ! cachePutObject(thisInstance); ! } ! objectArray[ii] = thisInstance; } </cfscript> |
From: <ndi...@us...> - 2002-09-12 19:17:12
|
Update of /cvsroot/modus/org/bacfug/modus/persistence In directory usw-pr-cvs1:/tmp/cvs-serv28154/bacfug/modus/persistence Modified Files: basepersister.cfc Log Message: got caching working. Should make performance much better. Index: basepersister.cfc =================================================================== RCS file: /cvsroot/modus/org/bacfug/modus/persistence/basepersister.cfc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** basepersister.cfc 8 Sep 2002 08:37:32 -0000 1.6 --- basepersister.cfc 12 Sep 2002 19:17:10 -0000 1.7 *************** *** 98,102 **** <!--- populate one object instance from another ---> ! <cffunction name="contentObjectPopulateFromInstance" access="package" returnType="org.bacfug.modus.baseContentObject" output="no" hint="Populates one contentObject instance from another"> <cfargument name="contentObjectPopulatee" type="org.bacfug.modus.baseContentObject" required="yes"> <cfargument name="contentObjectPopulator" type="org.bacfug.modus.baseContentObject" required="yes"> --- 98,102 ---- <!--- populate one object instance from another ---> ! <cffunction name="contentObjectPopulateFromInstance" access="public" returnType="org.bacfug.modus.baseContentObject" output="no" hint="Populates one contentObject instance from another"> <cfargument name="contentObjectPopulatee" type="org.bacfug.modus.baseContentObject" required="yes"> <cfargument name="contentObjectPopulator" type="org.bacfug.modus.baseContentObject" required="yes"> *************** *** 159,170 **** <!--- is the cache primed ---> <cffunction name="isCacheInitialized" access="package" output="no" returnType="boolean" hint="Returns a boolean for whether the cache is initialized"> ! <cfreturn structKeyExists(server,"modusCache")> </cffunction> <!--- initialize the cache ---> <cffunction name="cacheInit" access="package" output="no" returnType="void" hint="Initializes the in-memory cache"> <cfscript> ! server.modusCache = structNew(); ! server.modusCache.objectInstances = structNew(); ! server.modusCache.objectTypes = structNew(); </cfscript> </cffunction> --- 159,171 ---- <!--- is the cache primed ---> <cffunction name="isCacheInitialized" access="package" output="no" returnType="boolean" hint="Returns a boolean for whether the cache is initialized"> ! <cfreturn structKeyExists(server,"modus") AND structKeyExists(server.modus,"contentObjectCache") AND structKeyExists(server.modus.contentObjectCache,"objectInstances")> </cffunction> <!--- initialize the cache ---> <cffunction name="cacheInit" access="package" output="no" returnType="void" hint="Initializes the in-memory cache"> + <cfparam name="server.modus" default="#structNew()#"> <cfscript> ! server.modus.contentObjectCache = structNew(); ! server.modus.contentObjectCache.objectInstances = structNew(); ! server.modus.contentObjectCache.objectTypes = structNew(); </cfscript> </cffunction> *************** *** 177,198 **** cacheInit(); } ! </cfscript> ! ! ! <!--- ---> ! <!--- ---> ! <!--- ---> ! <!--- REMOVE THIS WHEN SP1 GETS INSTALLED ---> ! ! <cfreturn false> ! <!--- ---> ! <!--- ---> ! <!--- ---> ! <!--- ---> ! <!--- ---> ! ! ! ! <cfreturn structKeyExists(server.modusCache.objectInstances,arguments.id)> </cffunction> --- 178,183 ---- cacheInit(); } ! </cfscript> ! <cfreturn structKeyExists(server.modus.contentObjectCache.objectInstances,arguments.id)> </cffunction> *************** *** 201,205 **** <cfargument name="contentObject" required="yes" type="org.bacfug.modus.baseContentObject"> <cfscript> ! server.modusCache.objectInstances[arguments.contentObject.getID()] = arguments.contentObject; </cfscript> </cffunction> --- 186,190 ---- <cfargument name="contentObject" required="yes" type="org.bacfug.modus.baseContentObject"> <cfscript> ! server.modus.contentObjectCache.objectInstances[arguments.contentObject.getID()] = arguments.contentObject.getClone(); </cfscript> </cffunction> *************** *** 211,215 **** <cfthrow type="modus.badCacheRequest" message="Object does not exist in the cache" detail="The contentObject with ID ""#arguments.id#"" does not exist in the cache. You may not request an object that is not cached."> </cfif> ! <cfreturn server.modusCache.objectInstances[arguments.id]> </cffunction> --- 196,200 ---- <cfthrow type="modus.badCacheRequest" message="Object does not exist in the cache" detail="The contentObject with ID ""#arguments.id#"" does not exist in the cache. You may not request an object that is not cached."> </cfif> ! <cfreturn server.modus.contentObjectCache.objectInstances[arguments.id]> </cffunction> |
From: <ndi...@us...> - 2002-09-12 19:16:23
|
Update of /cvsroot/modus/org/bacfug/modus In directory usw-pr-cvs1:/tmp/cvs-serv27847/bacfug/modus Modified Files: basecontentobject.cfc Log Message: added a method for making a clone of the instance -- this is used right now in the caching, so we don't run into weirdness of the cache referring to instances the user is working with. Index: basecontentobject.cfc =================================================================== RCS file: /cvsroot/modus/org/bacfug/modus/basecontentobject.cfc,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** basecontentobject.cfc 12 Sep 2002 19:15:24 -0000 1.11 --- basecontentobject.cfc 12 Sep 2002 19:16:20 -0000 1.12 *************** *** 235,239 **** </cfscript> </cffunction> ! <!--- --- 235,247 ---- </cfscript> </cffunction> ! <!--- a method for making a clone ---> ! <cffunction name="makeClone" access="public" output="no" returnType="org.bacfug.modus.baseContentObject" hint="creates an exact replica of this object instance"> ! <cfset var clone = createObject("component",getType())> ! <cfscript> ! //try this ! getPersister().contentObjectPopulateFromInstance(clone,this); ! </cfscript> ! <cfreturn clone> ! </cffunction> <!--- |
From: <ndi...@us...> - 2002-09-12 19:15:28
|
Update of /cvsroot/modus/org/bacfug/modus In directory usw-pr-cvs1:/tmp/cvs-serv27447/bacfug/modus Modified Files: basecontentobject.cfc Log Message: added in getPersister() -- which is a better interface and will allow greater flexibility later on Index: basecontentobject.cfc =================================================================== RCS file: /cvsroot/modus/org/bacfug/modus/basecontentobject.cfc,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** basecontentobject.cfc 10 Sep 2002 22:33:28 -0000 1.10 --- basecontentobject.cfc 12 Sep 2002 19:15:24 -0000 1.11 *************** *** 48,52 **** setDateModified(now()); //use the save method of whichever persister we are using ! instance.persister.save(this); </cfscript> <cfelse> --- 48,52 ---- setDateModified(now()); //use the save method of whichever persister we are using ! getPersister().save(this); </cfscript> <cfelse> *************** *** 60,64 **** <cfscript> //get this instance from the persister ! instance.persister.get(arguments.id,this); //set the loaded flag instance.wasLoadedFlag = true; --- 60,64 ---- <cfscript> //get this instance from the persister ! getPersister().get(arguments.id,this); //set the loaded flag instance.wasLoadedFlag = true; *************** *** 67,71 **** <!--- get all of this type ---> <cffunction name="getAll" access="public" returnType="array" hint="get all of this type" output="no"> ! <cfreturn instance.persister.getAll(getType())> </cffunction> --- 67,71 ---- <!--- get all of this type ---> <cffunction name="getAll" access="public" returnType="array" hint="get all of this type" output="no"> ! <cfreturn getPersister().getAll(getType())> </cffunction> *************** *** 351,355 **** ---> ! <!--- a method for creating a field ---> <cffunction name="fieldAdd" access="package" output="No" returnType="void" hint="Makes a field used primarily in the properties of specific content object definition components."> --- 351,358 ---- ---> ! <cffunction name="getPersister" access="public" output="no" returnType="org.bacfug.modus.persistence.basePersister" hint="get the persister for this instance"> ! <cfreturn instance.persister> ! </cffunction> ! <!--- a method for creating a field ---> <cffunction name="fieldAdd" access="package" output="No" returnType="void" hint="Makes a field used primarily in the properties of specific content object definition components."> *************** *** 447,449 **** --- 450,453 ---- <cfreturn createUUID()> </cffunction> + </cfcomponent> |
From: <ndi...@us...> - 2002-09-10 22:33:32
|
Update of /cvsroot/modus/org/bacfug/modus In directory usw-pr-cvs1:/tmp/cvs-serv32540/bacfug/modus Modified Files: basecontentobject.cfc Log Message: added a makeID() method and use that in the init() -- this allows a contentObject type to have its own mechanism to create default id's Index: basecontentobject.cfc =================================================================== RCS file: /cvsroot/modus/org/bacfug/modus/basecontentobject.cfc,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** basecontentobject.cfc 9 Sep 2002 21:18:59 -0000 1.9 --- basecontentobject.cfc 10 Sep 2002 22:33:28 -0000 1.10 *************** *** 13,17 **** //fieldsOrderedIndex = arrayNew(1); //set a default instance.id ! instance.id = createUUID(); //which persister will we use? Set a default. config.persister = "org.bacfug.modus.persistence.simpleObjectInstance"; --- 13,17 ---- //fieldsOrderedIndex = arrayNew(1); //set a default instance.id ! instance.id = makeID(); //which persister will we use? Set a default. config.persister = "org.bacfug.modus.persistence.simpleObjectInstance"; *************** *** 443,446 **** <cfreturn theseProperties> </cffunction> ! </cfcomponent> --- 443,449 ---- <cfreturn theseProperties> </cffunction> ! <!--- a method to make a new id. this is here so that object types can override it to create their own default id mechanism ---> ! <cffunction name="makeID" access="package" output="no" returnType="uuid" hint="The mechanism to make a new id. Used in the init() and can be overridden in specific object types to have a different kind of default id"> ! <cfreturn createUUID()> ! </cffunction> </cfcomponent> |
From: <ndi...@us...> - 2002-09-09 21:19:02
|
Update of /cvsroot/modus/org/bacfug/modus In directory usw-pr-cvs1:/tmp/cvs-serv8296/bacfug/modus Modified Files: basecontentobject.cfc Log Message: fixed a bug with the sorting that broke if there are no objects to sort Index: basecontentobject.cfc =================================================================== RCS file: /cvsroot/modus/org/bacfug/modus/basecontentobject.cfc,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** basecontentobject.cfc 8 Sep 2002 08:48:55 -0000 1.8 --- basecontentobject.cfc 9 Sep 2002 21:18:59 -0000 1.9 *************** *** 266,296 **** //prime the tempQuery tempQuery = queryNew("index," & arrayToList(sortFieldsArray)); ! //resize the query to however many objects there are ! queryAddRow(tempQuery,objectCount); ! //loop through all objects, populating the appropriate columns of the query ! for(ii = 1; ii LTE objectCount; ii = ii + 1){ ! thisObject = arguments.contentObjects[ii]; ! querySetCell(tempQuery,"index",ii,ii); ! //loop through whatever fields we are sorting on, adding the values of those fields to the query ! for(ff = 1; ff LTE arrayLen(sortFieldsArray); ff = ff + 1){ ! thisFieldName = getToken(sortFieldsArray[ff],1); ! querySetCell(tempQuery,thisFieldName,lcase(thisObject.getField(thisFieldName).getValue()),ii); } } </cfscript> ! <!--- ok, now let's get the sortedQuery ---> ! <cfquery name="sortQuery" dbtype="query"> ! SELECT * ! FROM tempQuery ! ORDER BY #arguments.sortFields# ! </cfquery> ! <!--- and now, we'll populate the sortedArray ---> ! <cfscript> ! //resize the array, so it doesn't have to keep allocating more memory ! arrayResize(sortedArray,objectCount); ! for(ii = 1; ii LTE objectCount; ii = ii + 1){ ! sortedArray[ii] = arguments.contentObjects[sortQuery.index[ii]]; ! } ! </cfscript> <!--- return the sorted Array ---> <cfreturn sortedArray> --- 266,303 ---- //prime the tempQuery tempQuery = queryNew("index," & arrayToList(sortFieldsArray)); ! //if there any objects, then loop through and make them ! if(objectCount){ ! //resize the query to however many objects there are ! queryAddRow(tempQuery,objectCount); ! //loop through all objects, populating the appropriate columns of the query ! for(ii = 1; ii LTE objectCount; ii = ii + 1){ ! thisObject = arguments.contentObjects[ii]; ! querySetCell(tempQuery,"index",ii,ii); ! //loop through whatever fields we are sorting on, adding the values of those fields to the query ! for(ff = 1; ff LTE arrayLen(sortFieldsArray); ff = ff + 1){ ! thisFieldName = getToken(sortFieldsArray[ff],1); ! querySetCell(tempQuery,thisFieldName,lcase(thisObject.getField(thisFieldName).getValue()),ii); ! } } } </cfscript> ! <!--- if there are objects to sort, query them, then build the new array ---> ! <cfif objectCount> ! <!--- ok, now let's get the sortedQuery ---> ! <cfquery name="sortQuery" dbtype="query"> ! SELECT * ! FROM tempQuery ! ORDER BY #arguments.sortFields# ! </cfquery> ! <!--- and now, we'll populate the sortedArray ---> ! <cfscript> ! //resize the array, so it doesn't have to keep allocating more memory ! arrayResize(sortedArray,objectCount); ! for(ii = 1; ii LTE objectCount; ii = ii + 1){ ! sortedArray[ii] = arguments.contentObjects[sortQuery.index[ii]]; ! } ! </cfscript> ! </cfif> ! <!--- return the sorted Array ---> <cfreturn sortedArray> |
From: <ndi...@us...> - 2002-09-08 08:48:58
|
Update of /cvsroot/modus/org/bacfug/modus In directory usw-pr-cvs1:/tmp/cvs-serv32217/bacfug/modus Modified Files: basecontentobject.cfc Log Message: just rearranging code internally, a bit more logical Index: basecontentobject.cfc =================================================================== RCS file: /cvsroot/modus/org/bacfug/modus/basecontentobject.cfc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** basecontentobject.cfc 8 Sep 2002 08:38:49 -0000 1.7 --- basecontentobject.cfc 8 Sep 2002 08:48:55 -0000 1.8 *************** *** 77,137 **** </cffunction> - <!--- the sort method ---> - <!--- - - I'm really not at all satisfied with this, but it does work, for now. - - ---> - <cffunction name="sortContentObjects" access="public" output="no" returnType="array" hint="takes an array of contentObjects and sorts them based on the field(s) passed in"> - <cfargument name="contentObjects" type="array" required="yes"> - <cfargument name="sortFields" type="string" required="yes"> - <cfset var tempQuery = ""> - <cfset var sortQuery = ""> - <cfset var sortedArray = arrayNew(1)> - <cfset var objectCount = arrayLen(arguments.contentObjects)> - <cfset var sortFieldsArray = listToArray(arguments.sortFields)> - <cfset var ii = 0> - <cfset var ff = 0> - <cfset var thisObject = ""> - <cfset var thisFieldName = ""> - <cfscript> - //clean the sortFieldsArray, so we can have the sort order in there too - for(ii = 1; ii LTE arrayLen(sortFieldsArray); ii = ii + 1){ - sortFieldsArray[ii] = getToken(sortFieldsArray[ii],1); - } - //prime the tempQuery - tempQuery = queryNew("index," & arrayToList(sortFieldsArray)); - //resize the query to however many objects there are - queryAddRow(tempQuery,objectCount); - //loop through all objects, populating the appropriate columns of the query - for(ii = 1; ii LTE objectCount; ii = ii + 1){ - thisObject = arguments.contentObjects[ii]; - querySetCell(tempQuery,"index",ii,ii); - //loop through whatever fields we are sorting on, adding the values of those fields to the query - for(ff = 1; ff LTE arrayLen(sortFieldsArray); ff = ff + 1){ - thisFieldName = getToken(sortFieldsArray[ff],1); - querySetCell(tempQuery,thisFieldName,lcase(thisObject.getField(thisFieldName).getValue()),ii); - } - } - </cfscript> - <!--- ok, now let's get the sortedQuery ---> - <cfquery name="sortQuery" dbtype="query"> - SELECT * - FROM tempQuery - ORDER BY #arguments.sortFields# - </cfquery> - <!--- and now, we'll populate the sortedArray ---> - <cfscript> - //resize the array, so it doesn't have to keep allocating more memory - arrayResize(sortedArray,objectCount); - for(ii = 1; ii LTE objectCount; ii = ii + 1){ - sortedArray[ii] = arguments.contentObjects[sortQuery.index[ii]]; - } - </cfscript> - <!--- return the sorted Array ---> - <cfreturn sortedArray> - </cffunction> - - <!--- --- 77,80 ---- *************** *** 298,301 **** --- 241,300 ---- ---> + <!--- the sort method ---> + <!--- + + I'm really not at all satisfied with this, but it does work, for now. + + ---> + <cffunction name="sortContentObjects" access="public" output="no" returnType="array" hint="takes an array of contentObjects and sorts them based on the field(s) passed in"> + <cfargument name="contentObjects" type="array" required="yes"> + <cfargument name="sortFields" type="string" required="yes"> + <cfset var tempQuery = ""> + <cfset var sortQuery = ""> + <cfset var sortedArray = arrayNew(1)> + <cfset var objectCount = arrayLen(arguments.contentObjects)> + <cfset var sortFieldsArray = listToArray(arguments.sortFields)> + <cfset var ii = 0> + <cfset var ff = 0> + <cfset var thisObject = ""> + <cfset var thisFieldName = ""> + <cfscript> + //clean the sortFieldsArray, so we can have the sort order in there too + for(ii = 1; ii LTE arrayLen(sortFieldsArray); ii = ii + 1){ + sortFieldsArray[ii] = getToken(sortFieldsArray[ii],1); + } + //prime the tempQuery + tempQuery = queryNew("index," & arrayToList(sortFieldsArray)); + //resize the query to however many objects there are + queryAddRow(tempQuery,objectCount); + //loop through all objects, populating the appropriate columns of the query + for(ii = 1; ii LTE objectCount; ii = ii + 1){ + thisObject = arguments.contentObjects[ii]; + querySetCell(tempQuery,"index",ii,ii); + //loop through whatever fields we are sorting on, adding the values of those fields to the query + for(ff = 1; ff LTE arrayLen(sortFieldsArray); ff = ff + 1){ + thisFieldName = getToken(sortFieldsArray[ff],1); + querySetCell(tempQuery,thisFieldName,lcase(thisObject.getField(thisFieldName).getValue()),ii); + } + } + </cfscript> + <!--- ok, now let's get the sortedQuery ---> + <cfquery name="sortQuery" dbtype="query"> + SELECT * + FROM tempQuery + ORDER BY #arguments.sortFields# + </cfquery> + <!--- and now, we'll populate the sortedArray ---> + <cfscript> + //resize the array, so it doesn't have to keep allocating more memory + arrayResize(sortedArray,objectCount); + for(ii = 1; ii LTE objectCount; ii = ii + 1){ + sortedArray[ii] = arguments.contentObjects[sortQuery.index[ii]]; + } + </cfscript> + <!--- return the sorted Array ---> + <cfreturn sortedArray> + </cffunction> + <cffunction name="renderBasicForm" output="no" access="public" returnType="string" hint="Create a very simple form for this instance"> <cfargument name="action" default="#getFileFromPath(getBaseTemplatePath())#"> |
From: <ndi...@us...> - 2002-09-08 08:38:53
|
Update of /cvsroot/modus/org/bacfug/modus In directory usw-pr-cvs1:/tmp/cvs-serv30505/bacfug/modus Modified Files: basecontentobject.cfc Log Message: moved the sorting stuff into the baseContentObject because it did not belong in the persister. Also, I refactored it, so there is separate method just to sort any array of contentObjects, which will be much more useful once we have filtering working. At some point we may even want a component that is a contentObjectManipulator, or something like that. Index: basecontentobject.cfc =================================================================== RCS file: /cvsroot/modus/org/bacfug/modus/basecontentobject.cfc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** basecontentobject.cfc 8 Sep 2002 03:45:53 -0000 1.6 --- basecontentobject.cfc 8 Sep 2002 08:38:49 -0000 1.7 *************** *** 69,77 **** <cfreturn instance.persister.getAll(getType())> </cffunction> ! <!--- get all of this type sorted ---> ! <cffunction name="getAllSorted" access="public" returnType="array" hint="get all of this type, sorted by some fields" output="no"> <cfargument name="sortFields" required="yes" type="string"> ! <cfreturn instance.persister.getAllSorted(sortFields,getType())> </cffunction> <!--- --- 69,136 ---- <cfreturn instance.persister.getAll(getType())> </cffunction> ! ! <!--- a function for getting all instances, sorted ---> ! ! <cffunction name="getAllSorted" access="public" output="no" hint="A method to sort all instances and sort them by one or more fields"> <cfargument name="sortFields" required="yes" type="string"> ! <cfreturn sortContentObjects(getAll(),arguments.sortFields)> </cffunction> + + <!--- the sort method ---> + <!--- + + I'm really not at all satisfied with this, but it does work, for now. + + ---> + <cffunction name="sortContentObjects" access="public" output="no" returnType="array" hint="takes an array of contentObjects and sorts them based on the field(s) passed in"> + <cfargument name="contentObjects" type="array" required="yes"> + <cfargument name="sortFields" type="string" required="yes"> + <cfset var tempQuery = ""> + <cfset var sortQuery = ""> + <cfset var sortedArray = arrayNew(1)> + <cfset var objectCount = arrayLen(arguments.contentObjects)> + <cfset var sortFieldsArray = listToArray(arguments.sortFields)> + <cfset var ii = 0> + <cfset var ff = 0> + <cfset var thisObject = ""> + <cfset var thisFieldName = ""> + <cfscript> + //clean the sortFieldsArray, so we can have the sort order in there too + for(ii = 1; ii LTE arrayLen(sortFieldsArray); ii = ii + 1){ + sortFieldsArray[ii] = getToken(sortFieldsArray[ii],1); + } + //prime the tempQuery + tempQuery = queryNew("index," & arrayToList(sortFieldsArray)); + //resize the query to however many objects there are + queryAddRow(tempQuery,objectCount); + //loop through all objects, populating the appropriate columns of the query + for(ii = 1; ii LTE objectCount; ii = ii + 1){ + thisObject = arguments.contentObjects[ii]; + querySetCell(tempQuery,"index",ii,ii); + //loop through whatever fields we are sorting on, adding the values of those fields to the query + for(ff = 1; ff LTE arrayLen(sortFieldsArray); ff = ff + 1){ + thisFieldName = getToken(sortFieldsArray[ff],1); + querySetCell(tempQuery,thisFieldName,lcase(thisObject.getField(thisFieldName).getValue()),ii); + } + } + </cfscript> + <!--- ok, now let's get the sortedQuery ---> + <cfquery name="sortQuery" dbtype="query"> + SELECT * + FROM tempQuery + ORDER BY #arguments.sortFields# + </cfquery> + <!--- and now, we'll populate the sortedArray ---> + <cfscript> + //resize the array, so it doesn't have to keep allocating more memory + arrayResize(sortedArray,objectCount); + for(ii = 1; ii LTE objectCount; ii = ii + 1){ + sortedArray[ii] = arguments.contentObjects[sortQuery.index[ii]]; + } + </cfscript> + <!--- return the sorted Array ---> + <cfreturn sortedArray> + </cffunction> + <!--- |
From: <ndi...@us...> - 2002-09-08 08:37:38
|
Update of /cvsroot/modus/org/bacfug/modus/persistence In directory usw-pr-cvs1:/tmp/cvs-serv30245/bacfug/modus/persistence Modified Files: basepersister.cfc Log Message: removed the getAllSorted() and refactored it into two methods inside the baseContentObjects. Sorting really wasn't a persistence issue. Index: basepersister.cfc =================================================================== RCS file: /cvsroot/modus/org/bacfug/modus/persistence/basepersister.cfc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** basepersister.cfc 8 Sep 2002 04:15:21 -0000 1.5 --- basepersister.cfc 8 Sep 2002 08:37:32 -0000 1.6 *************** *** 21,83 **** <cfthrow message="getAll() method not implemented!" detail="You must defined a getAll() method for #getMetaData(this).name#."> </cffunction> ! ! <!--- a function for sorting ---> ! <!--- ! ! I'm really not at all satisfied with this, but it does work, for now. ! ! ---> ! <cffunction name="getAllSorted" access="public" output="no" hint="A method to sort all instances and sort them by one or more fields"> ! <cfargument name="sortFields" required="yes" type="string"> ! <cfargument name="contentObjectType" required="yes" type="string"> ! <cfset var tempQuery = ""> ! <cfset var sortQuery = ""> ! <cfset var objectArray = getAll(arguments.contentObjectType)> ! <cfset var sortedArray = arrayNew(1)> ! <cfset var objectCount = arrayLen(objectArray)> ! <cfset var sortFieldsArray = listToArray(arguments.sortFields)> ! <cfset var ii = 0> ! <cfset var ff = 0> ! <cfset var thisObject = ""> ! <cfset var thisFieldName = ""> ! <cfscript> ! //clean the sortFieldsArray, so we can have the sort order in there too ! for(ii = 1; ii LTE arrayLen(sortFieldsArray); ii = ii + 1){ ! sortFieldsArray[ii] = getToken(sortFieldsArray[ii],1); ! } ! //prime the tempQuery ! tempQuery = queryNew("index," & arrayToList(sortFieldsArray)); ! //resize the query to however many objects there are ! queryAddRow(tempQuery,objectCount); ! //loop through all objects, populating the appropriate columns of the query ! for(ii = 1; ii LTE objectCount; ii = ii + 1){ ! thisObject = objectArray[ii]; ! querySetCell(tempQuery,"index",ii,ii); ! //loop through whatever fields we are sorting on, adding the values of those fields to the query ! for(ff = 1; ff LTE arrayLen(sortFieldsArray); ff = ff + 1){ ! thisFieldName = getToken(sortFieldsArray[ff],1); ! querySetCell(tempQuery,thisFieldName,trim(thisObject.getField(thisFieldName).getValue()),ii); ! } ! } ! </cfscript> ! <!--- ok, now let's get the sortedQuery ---> ! <cfquery name="sortQuery" dbtype="query"> ! SELECT * ! FROM tempQuery ! ORDER BY #arguments.sortFields# ! </cfquery> ! <!--- and now, we'll populate the sortedArray ---> ! <cfscript> ! //resize the array, so it doesn't have to keep allocating more memory ! arrayResize(sortedArray,objectCount); ! for(ii = 1; ii LTE objectCount; ii = ii + 1){ ! sortedArray[ii] = objectArray[sortQuery.index[ii]]; ! } ! </cfscript> ! <!--- return the sorted Array ---> ! <cfreturn sortedArray> ! </cffunction> ! ! <!--- a package function to determine if an object passed is, indeed, a baseContentObject ---> <cffunction name="isContentObject" access="package" returnType="boolean" output="no" hint="determines if something is a content object"> --- 21,25 ---- <cfthrow message="getAll() method not implemented!" detail="You must defined a getAll() method for #getMetaData(this).name#."> </cffunction> ! <!--- a package function to determine if an object passed is, indeed, a baseContentObject ---> <cffunction name="isContentObject" access="package" returnType="boolean" output="no" hint="determines if something is a content object"> |
From: <ndi...@us...> - 2002-09-08 04:15:23
|
Update of /cvsroot/modus/org/bacfug/modus/persistence In directory usw-pr-cvs1:/tmp/cvs-serv15950/bacfug/modus/persistence Modified Files: basepersister.cfc Log Message: stupid white space Index: basepersister.cfc =================================================================== RCS file: /cvsroot/modus/org/bacfug/modus/persistence/basepersister.cfc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** basepersister.cfc 8 Sep 2002 03:45:16 -0000 1.4 --- basepersister.cfc 8 Sep 2002 04:15:21 -0000 1.5 *************** *** 66,70 **** FROM tempQuery ORDER BY #arguments.sortFields# ! </cfquery> <!--- and now, we'll populate the sortedArray ---> <cfscript> --- 66,70 ---- FROM tempQuery ORDER BY #arguments.sortFields# ! </cfquery> <!--- and now, we'll populate the sortedArray ---> <cfscript> |
From: <ndi...@us...> - 2002-09-08 03:48:33
|
Update of /cvsroot/modus/modustest In directory usw-pr-cvs1:/tmp/cvs-serv11151 Modified Files: index.cfm Log Message: why bother with showing if it's featured if we are doing the bold thing? Index: index.cfm =================================================================== RCS file: /cvsroot/modus/modustest/index.cfm,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** index.cfm 8 Sep 2002 03:46:35 -0000 1.3 --- index.cfm 8 Sep 2002 03:48:30 -0000 1.4 *************** *** 34,38 **** <cfset thisObj = all[ii]> ! <li><a href="#getFileFromPath(getBaseTemplatePath())#?id=#thisObj.getID()#"<cfif thisObj.getField("featured").getValue()> style="font-weight:bold;"</cfif>>#thisObj.getField("title").toHTML()#</a> (featured: #thisObj.getField("featured").toHTML()#) <br /> --- 34,38 ---- <cfset thisObj = all[ii]> ! <li><a href="#getFileFromPath(getBaseTemplatePath())#?id=#thisObj.getID()#"<cfif thisObj.getField("featured").getValue()> style="font-weight:bold;"</cfif>>#thisObj.getField("title").toHTML()#</a> <br /> |