com.konakart.bl
Class ReviewMgr

java.lang.Object
  extended by com.konakart.bl.BaseMgr
      extended by com.konakart.bl.ReviewMgr
All Implemented Interfaces:
ReviewMgrIf

public class ReviewMgr
extends BaseMgr
implements ReviewMgrIf

Reviews Manager


Field Summary
protected static org.apache.commons.logging.Log log
          Log
 
Fields inherited from class com.konakart.bl.BaseMgr
templateBaseDir
 
Constructor Summary
ReviewMgr(KKEngIf eng)
          Constructor
 
Method Summary
 Reviews getAllReviews(DataDescriptorIf dataDesc)
          Calls the getReviewsPerProduct method with a negative productId value so that it is not included in the Where clause of the query
protected  int getCount(org.apache.torque.util.Criteria c)
          This method is mainly used for paging.
 Review getReview(int reviewId)
          Returns a review for the given reviewId
protected  Reviews getReviews(DataDescriptorIf dataDesc, int productId, int reviewId)
          Returns an array of reviews for the given productId if reviewId is set to a negative number.
 Reviews getReviewsPerProduct(DataDescriptorIf dataDesc, int productId)
          Returns an array of reviews for the given productId
protected  void manageDataDescriptor(DataDescriptorIf dataDesc, org.apache.torque.util.Criteria c)
          Provides common code to deal with the management of the DataDescriptor
 int writeReview(java.lang.String sessionId, ReviewIf review)
          A new customer review is added to the system.
 
Methods inherited from class com.konakart.bl.BaseMgr
addInsertAttr, addInsertAttr, checkRequired, getAdminEngMgr, getBasketMgr, getBillingMgr, getBookableProductMgr, getCatMgr, getConfigMgr, getCookieMgr, getCurrMgr, getCustMgr, getCustomerIdFromSession, getCustomerStatsMgr, getCustomerTagMgr, getEmailMgr, getEng, getLangMgr, getManuMgr, getMiscItemMgr, getMode, getModeString, getMqMgr, getMultiStoreMgr, getNewCriteria, getNewCriteria, getOrderMgr, getOrderTotalMgr, getPaymentMgr, getProdMgr, getPromMgr, getRewardPointMgr, getSecMgr, getShippingMgr, getSolrMgr, getStoreId, getTaxMgr, getTemplate, getTemplateRoot, getVelocityContextMgr, getWishListMgr, init, isEnterprise, isMultiStoreShareCustomers, isMultiStoreShareProducts
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.commons.logging.Log log
Log

Constructor Detail

ReviewMgr

public ReviewMgr(KKEngIf eng)
          throws java.lang.Exception
Constructor

Parameters:
eng -
Throws:
java.lang.Exception
Method Detail

getAllReviews

public Reviews getAllReviews(DataDescriptorIf dataDesc)
                      throws org.apache.torque.TorqueException,
                             com.workingdogs.village.DataSetException,
                             KKException
Calls the getReviewsPerProduct method with a negative productId value so that it is not included in the Where clause of the query

Specified by:
getAllReviews in interface ReviewMgrIf
Parameters:
dataDesc -
Returns:
Returns all reviews
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKException

getReview

public Review getReview(int reviewId)
                 throws org.apache.torque.TorqueException,
                        com.workingdogs.village.DataSetException,
                        KKException
Returns a review for the given reviewId

Specified by:
getReview in interface ReviewMgrIf
Parameters:
reviewId -
Returns:
Returns a Review object
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKException

getReviewsPerProduct

public Reviews getReviewsPerProduct(DataDescriptorIf dataDesc,
                                    int productId)
                             throws org.apache.torque.TorqueException,
                                    com.workingdogs.village.DataSetException,
                                    KKException
Returns an array of reviews for the given productId

Specified by:
getReviewsPerProduct in interface ReviewMgrIf
Parameters:
dataDesc -
productId -
Returns:
Returns a Reviews object
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKException

getReviews

protected Reviews getReviews(DataDescriptorIf dataDesc,
                             int productId,
                             int reviewId)
                      throws org.apache.torque.TorqueException,
                             com.workingdogs.village.DataSetException,
                             KKException
Returns an array of reviews for the given productId if reviewId is set to a negative number. Otherwise it returns the review identified by the reviewId.

Parameters:
dataDesc -
productId -
reviewId -
Returns:
Returns a Reviews object
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKException

manageDataDescriptor

protected void manageDataDescriptor(DataDescriptorIf dataDesc,
                                    org.apache.torque.util.Criteria c)
Provides common code to deal with the management of the DataDescriptor

Parameters:
dataDesc -
c -

writeReview

public int writeReview(java.lang.String sessionId,
                       ReviewIf review)
                throws java.lang.Exception
A new customer review is added to the system. The process for adding a new review is to :
  1. Get the customer's id from the session
  2. Get the customer's name from the CustomerMgr
  3. Write into the reviews table followed by the reviews description table in one transaction
All of the above actions are performed as a transaction. In the case of MySQL, the transaction doesn't work unless the tables are defined as using the InnoDB or BDB engines. A table can be transformed using the following syntax : Alter table t Engine = InnoDB;. The standard engine seems to be MyIsam which doesn't support transactions.

Specified by:
writeReview in interface ReviewMgrIf
Parameters:
sessionId -
review -
Returns:
int : Review Primary Key or a negative value for an error
Throws:
java.lang.Exception

getCount

protected int getCount(org.apache.torque.util.Criteria c)
                throws org.apache.torque.TorqueException,
                       com.workingdogs.village.DataSetException
This method is mainly used for paging.

Parameters:
c -
Returns:
The number of records present in the database matching the given criteria
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException


Copyright © 2011 DS Data Systems UK Ltd.