This issue serves as a task for refactoring the JSF applicant demo portlets so that they are more similar to their PortletMVC4Spring and MVCBean counterparts. In addition, managed bean classes will be renamed according to the recommendations by Bauke Scholtz (BalusC) in his blog post titled Communication in JSF 2.0.
List of improvements:
1. Use a unique Java package for each JSF portlet variant, rather than the same `com.liferay.faces.demos` package for all. This will make debugging easier, because the IDE will not have to choose between Java classes with competing FQCNs.
2. ApplicantBackingBean.java will be renamed to ApplicantBacking.java and ApplicantModelBean.java will become a DTO POJO named Applicant.java and no longer be a managed-bean. Instead, ApplicantBacking.java will contain a getModel() method that returns an instance of Applicant.java. This will have the benefit of no longer keeping the model data in JSF @ViewScoped.
3. ApplicantViewBean.java will be renamed to ApplicantView.java and remain @ViewScoped. It is not present in all of the applicant demo portlets – only the ones that need to keep track of the rendered state of the comments field. This will limit the usage of @ViewScoped to view state information, and not model data.
4. ListModelBean.java will be renamed to ListManager.java according to the aforementioned naming convention.
5. The list of uploaded files will be retrieved from the temporary uploaded files directory, rather than keeping it in the @ViewScoped ApplicantModelBean.java class. In addition, the variants of UploadedFile.java will be replaced with a simple DTO POJO named Attachment.java which has the same source code for all of the applicant demo portlets.
6. There will be a session listener that deletes the uploaded files upon session expiration.
7. For the sake of consistency with their PortletMVC4Spring and MVCBean counterparts, src/main/resources/i18n.properties will be renamed to src/main/resources/content/portlet1.properties and be registered with a <resource-bundle/> element in WEB-INF/portlet.xml.