Skip to content

Latest commit

 

History

History
14 lines (13 loc) · 1.81 KB

README.md

File metadata and controls

14 lines (13 loc) · 1.81 KB

Overview of Solution

  1. customerReviewExcerciseService is the bean name defined under customerreview-spring.xml implements the requirment given in the assignment.
  2. CustomerReviewExcerciseService is the interface and CustomerReviewExcerciseServiceImpl is it's implementation (Refer it's JavaDoc for implementation details)
  3. Curse Words are defined in customerreview-spring.xml and set directly on curseWords property. Alternatively I think hybris already has some config file which can be used to store these values and code can use de.hybris.platform.util.Config.getParameter("cursewords.config.property.name")
  4. I have defined two variants of getNumberOfReviews method one with range provided and one without range reading it from CustomerReviewConstants
  5. Solution is using JaloInvalidParameterException for validation errors as i saw existing code already using JaloXXXException classes to throw errors with localized messages.
    It assumes below localized properties to be defined in hybris localization files.
error.customerreview.invalidratingrange = Invalid Review Rating Range. maxRating {0} cannot be less than minRating {1}
error.customerreview.invalidratingvalue = Invalid Rating. Rating {0} cannot be less than 0
error.customerreview.comment.containscursewords" = Invalid customer Review comment. comment {0} contains cursed words.

Alternatively i could have created own exception classes for this purpose.