@Matt Quackenbush
thanks so much for taking the time to help me out :) that makes sense. kinda 
starting to get it. I think its going to be one of those things I need to do 
real world things with before I see the benefits. at the moment all I seem to 
be doing is adding extra overhead lol. 

is there any rules on this i.e. when an object is an object and should be used, 
when a service layer should be used and why not direct access etc? my UML sort 
of shows systems where I think I would need several service, gateways and 
objects but some cross over, is this normal? how do you organise your apps?

---------------------------------------------------------------------------- 

admin.cfc is an object which I passed around it also does my validation and 
cleans data. you stated that I could do things like below in the admin.cfc...

changePassword()     
sendTempPassword() 

is that not something my gataway should handle on its own accessed via the 
service layer?
 

@ Kevan Stannard

Sorry I was more trying to find out if the concepts of passing objects and 
'service' gateway is being used in the correct context. not the best example 
for login I know.



some stuff in admin.cfc
------------------------------

<cfcomponent displayname="adminusers" output="false">
<cfproperty name="adminId" type="numeric" default="" />
<cfproperty name="firstname" type="string" default="" />
<cfproperty name="surname" type="string" default="" />
<cfproperty name="email" type="string" default="" />
<cfproperty name="username" type="string" default="" />
<cfproperty name="password" type="string" default="" />
<cfproperty name="role" type="string" default="" />
<cfproperty name="lastLogin" type="string" default="" />
<cfproperty name="flag" type="boolean" default="" />
<cfproperty name="IP" type="string" default="" />
<cfproperty name="userLog" type="string" default="" />
<cfproperty name="createddatetime" type="date" default="" />
<!---PROPERTIES--->
<cfset variables.instance = StructNew() />
<!---INITIALIZATION / CONFIGURATION--->
<cffunction name="init" access="public" returntype="adminusers" output="false">
  <cfargument name="adminId" type="string" required="false" default="" />
  <cfargument name="firstname" type="string" required="false" default="" />
  <cfargument name="surname" type="string" required="false" default="" />
  <cfargument name="email" type="string" required="false" default="" />
  <cfargument name="username" type="string" required="false" default="" />
  <cfargument name="password" type="string" required="false" default="" />
  <cfargument name="role" type="string" required="false" default="" />
  <cfargument name="lastLogin" type="string" required="false" default="" />
  <cfargument name="flag" type="string" required="false" default="" />
  <cfargument name="IP" type="string" required="false" default="" />
  <cfargument name="userLog" type="string" required="false" default="" />
  <cfargument name="createddatetime" type="string" required="false" default="" 
/>
  <!--- run setters --->
  <cfset setadminId(arguments.adminId) />
  <cfset setfirstname(arguments.firstname) />
  <cfset setsurname(arguments.surname) />
  <cfset setemail(arguments.email) />
  <cfset setusername(arguments.username) />
  <cfset setpassword(arguments.password) />
  <cfset setrole(arguments.role) />
  <cfset setlastLogin(arguments.lastLogin) />
  <cfset setflag(arguments.flag) />
  <cfset setIP(arguments.IP) />
  <cfset setuserLog(arguments.userLog) />
  <cfset setcreateddatetime(arguments.createddatetime) />
  <cfreturn this />
</cffunction>
<!---PUBLIC FUNCTIONS--->
<cffunction name="setMemento" access="public" returntype="adminusers" 
output="false">
  <cfargument name="memento" type="struct" required="yes"/>
  <cfset variables.instance = arguments.memento />
  <cfreturn this />
</cffunction>
<cffunction name="getMemento" access="public" returntype="struct" 
output="false" >
  <cfreturn variables.instance />
</cffunction>
<!---Validation Checks--->
<cffunction name="validateUser" access="public" returntype="array" 
output="false">
<cfargument name="formData" type="struct" required="true" />
  <cfset var errors = arrayNew(1) />
<!--- username --->
  <cfif (NOT len(trim(formData.username)))>
    <cfset ArrayAppend(errors, "Username is required") />
  </cfif>
  <cfif (len(trim(formData.username)) AND NOT 
IsSimpleValue(trim(formData.username)))>
     <cfset ArrayAppend(errors, "Username is not a string") />
  </cfif>
  <cfif (len(trim(formData.username)) GT 12)>
     <cfset ArrayAppend(errors, "Username is too long") />
  </cfif>
 <!--- password --->
  <cfif (NOT len(trim(formData.password)))>
    <cfset ArrayAppend(errors, "Password is required") /> 
  </cfif>
  <cfif (len(trim(formData.password)) AND NOT 
IsSimpleValue(trim(formData.password)))>
    <cfset ArrayAppend(errors, "Password is not a string") /> 
  </cfif>
  <cfif (len(trim(formData.password)) GT 80)>
    <cfset ArrayAppend(errors, "Password is too long") /> 
  </cfif> 
  <cfreturn errors />   
</cffunction>




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325471
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to