LRP-614 practice question 8 of 25
The recommended way to validate a user against an external system when adding a user through the UI or a web service is to:
Full set: 144 questionsThe recommended approach is to create a service wrapper hook. This method intercepts calls to Liferay's core services, such as UserService. Since both the user interface (Control Panel) and web service endpoints ultimately invoke the UserService to add or update users, placing validation logic in a service wrapper ensures it is executed regardless of the entry point. This centralized approach is robust, maintainable, and aligns with Liferay's recommended development practices for modifying business logic. By wrapping the addUser or updateUser methods, you can perform the external validation before the original Liferay logic is executed.
A. A model listener acts at the persistence layer, just before the object is saved to the database. While it can be used for validation, the service layer is the more appropriate location for business logic.
C. A Struts action hook is specific to the UI layer. It would not be triggered when a user is created via a web service call, thus failing to meet the full requirements of the question.
D. An Ext plugin is a legacy and highly invasive method for customization. Liferay strongly recommends using hooks over Ext plugins due to their complexity and maintenance overhead.
1. Liferay Portal 6.2 Developer's Guide: In the "Hooks" chapter, the section "Overriding a Service with a Hook" describes using service wrappers to add custom logic. It states, "You can add custom logic before or after a call to any of Liferay’s services... For example, you could add a custom validation check to the addUser method of the User service." This directly supports using a service wrapper for validation that applies to all service callers. (See Chapter 7: Hooks -> Overriding a Service with a Hook).
2. Liferay University Courseware (LRP-614): The official training materials for the LRP-614 exam emphasize hooks as the primary mechanism for customization. The module on hooks explicitly contrasts the different types, highlighting that Struts action hooks are for the presentation layer, while service wrappers modify the business logic layer, making them suitable for universal validation logic. (See Module: Liferay Customization, Section: Hooks).
Keep practicing
Take the free LRP-614 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other LRP-614 practice questions
- Question 1The best way to add a new language key to the portal is through:
- Question 2In a JSP that includes the tag, the method to check permissions is:
- Question 3A hook plugin can be used to: (Please select all correct answers.)
- Question 4An administrator would like to add a new travel preferences section in the Miscellaneous …
- Question 5The following statements about plugins are true: (Please select all correct answers.)
- Question 6All Service Builder entities contain a local reference to: (Please select all correct ans…
