| Package: machii_info_sample.controllers |
| Inherits from: MachII.framework.Listener |
| I am the listener for Comments |
| Method Summary | |
|---|---|
| public void |
configure()
I initialize this listener as part of the framework startup. |
| public void |
createComment(Event event)
I cause a Comment to be created from the current event object. |
| public void |
deleteComment(Event event)
I cause a Comment to be deleted. |
| public comment |
getCommentByID(Event event)
I return a comment object for a given commentID |
| public query |
getComments(Event event)
I return a query containing all of the comments for a faq. |
| public void |
updateComment(Event event)
I cause a Comment to be updated from the current event object. |
| Method Detail |
|---|
| configure |
|---|
public void configure( )
I initialize this listener as part of the framework startup.
Parameters:
Code:
<cffunction name="configure" access="public" returntype="void" output="true" displayname="Listener Constructor" hint="I initialize this listener as part of the framework startup.">
<cfscript>
var appConstants = getAppManager().getPropertyManager().getProperty("appConstants");
var dsn = appConstants.getDsn();
var dbType = appConstants.getDbType();
variables.commentGateway = createObject("component","machii_info_sample.model.comment.commentGateway").init(dsn);
variables.commentDAO = CreateObject("component", "machii_info_sample.model.dao.DAOFactory").init(dsn, "machii_info").getDAOFactory(dbType).getCommentDAO();
</cfscript>
</cffunction>
| createComment |
|---|
public void createComment( Event event )
I cause a Comment to be created from the current event object.
Parameters:
| Event event |
Code:
<cffunction name="createComment" access="public" returntype="void" output="false" displayname="Create Comment" hint="I cause a Comment to be created from the current event object.">
<cfargument name="event" type="MachII.framework.Event" required="yes" displayname="Event" hint="I am the current event" />
<cfset var comment= arguments.event.getArg("comment") >
<cfset variables.commentDAO.create(comment) />
</cffunction>
| deleteComment |
|---|
public void deleteComment( Event event )
I cause a Comment to be deleted.
Parameters:
| Event event |
Code:
<cffunction name="deleteComment" access="public" returntype="void" output="true" displayname="Delete Comment" hint="I cause a Comment to be deleted.">
<cfargument name="event" type="MachII.framework.Event" required="yes" displayname="Event" hint="I am the current event" />
<cfset var comment = arguments.event.getArg("comment") >
<cfset variables.commentDAO.delete(comment) />
</cffunction>
| getCommentByID |
|---|
public comment getCommentByID( Event event )
I return a comment object for a given commentID
Parameters:
| Event event |
Code:
<cffunction name="getCommentByID" access="public" returntype="machii_info_sample.model.comment.comment" output="false" displayname="Get Comment By ID" hint="I return a comment object for a given commentID">
<cfargument name="event" type="MachII.framework.Event" required="yes" displayname="Event" hint="I am the current event, containing an ID field that identifies an comment." />
<cfset var commentID = arguments.event.getArg("commentID") >
<cfset var comment = createObject("component","machii_info_sample.model.comment.comment").init() />
<cfset variables.commentDAO.read(comment,commentID) />
<cfreturn comment />
</cffunction>
| getComments |
|---|
public query getComments( Event event )
I return a query containing all of the comments for a faq.
Parameters:
| Event event |
Code:
<cffunction name="getComments" access="public" returntype="query" output="false" displayname="Get Comments" hint="I return a query containing all of the comments for a faq.">
<cfargument name="event" type="MachII.framework.Event" required="yes" displayname="Event" hint="I am the current event" />
<cfset var faqid = arguments.event.getArg("faqID") >
<cfreturn variables.commentGateway.getComments(faqid) />
</cffunction>
| updateComment |
|---|
public void updateComment( Event event )
I cause a Comment to be updated from the current event object.
Parameters:
| Event event |
Code:
<cffunction name="updateComment" access="public" returntype="void" output="true" displayname="Update Comment" hint="I cause a Comment to be updated from the current event object.">
<cfargument name="event" type="MachII.framework.Event" required="yes" displayname="Event" hint="I am the current event" />
<cfset var comment = arguments.event.getArg("comment") >
<cfset variables.commentDAO.update(comment) />
</cffunction>