Portlet Factory, Version 6.1.2
Example: Profile Selection Class
Here is a sample implementation of a custom profile selection class. In this example, a special profile is selected on Mondays, and on all other days a default profile is returned.
import com.bowstreet.webapp.ModelInstanceCreator; import com.bowstreet.profiles.*; import javax.servlet.http.*; import java.util.Map; public class SampleProfileSelection extends SelectionHandlerBase String selectProfile(HttpServletRequest request, ProfileSet profileSet, String modelName, String explicitProfile, ModelInstanceCreator modelInstanceCreator) // Get the day of the week Calendar calendar = new GregorianCalendar(); int day = calendar.get(Calendar.DAY_OF_WEEK); // if it's Monday then get the Monday Profile if(day == Calendar.MONDAY) return profileSet.getProfile("Monday").getName(); else return profileSet.DEFAULT; }Parent topic: Using the ProfileSelection interface
Library | Support |