These Java and .NET code samples demonstrate how to implement user profiles in the Web application.
In the following code samples, the application recognizes the end user as Jane Smith, looks up some database tables and determines that she is 19 years old, female, a college student and likes R&B music. These characteristics map to the following Oracle Commerce user profiles created in Oracle Commerce Developer Studio:
User profiles can be any string. The user profiles supplied to ENEQuery
must exactly match those configured in Oracle Commerce Developer Studio.
Example 96. Java example of implementing user profiles
// User profiles can be any string. The user profiles must // exactly match those configured in Developer Studio. // Add this import statement at the top of your file: // import java.util.*; Set profiles = new HashSet(); // Collect all the profiles into a single Set object. profiles.add("young_woman"); profiles.add("r_and_b_music_fan"); profiles.add("college_student"); // Augment the query with the profile information. eneQuery.setProfiles(profiles);
Example 97. .NET example of implementing user profiles
// Make sure you have the following statement at the top // of your file: // using System.Collections.Specialized; StringCollection profiles = new StringCollection(); // Collect all the profiles into a single StringCollection object. profiles.Add("young_woman"); profiles.Add("r_and_b_music_fan"); profiles.Add("college_student"); // Augment the query with the profile information. eneQuery.Profiles = profiles;