Samples > Starter stores > Starter store enhancements > Social Commerce > WebSphere Commerce Dojo Enhancements API > Social Commerce services > Implement the Service Adapter API for new service providers > Add support for new service adapters
Configure profile details
You can configure the details that are displayed in the Profile widget to support the profile features and behaviors that are provided by individual service providers.
Before you begin
Review the API documentation for the com.ibm.commerce.soccom.adapter.IProfileAdapter Java interface within the Social Commerce Service Adapter API.
Procedure
- Open WebSphere Commerce Developer and switch to the Enterprise Explorer view.
- In the Enterprise Explorer view, expand SocApp > config.
- In the adapter.config file, add the configuration for additional service provider adapters:
- Use the following parameter to configure the service provider adapter to use:
/config/soccom/adapter/profile = "{service provider}"
- Configure the different types of required profile information for the new service provider adapter using an ArrayList. Name the ArrayList using the following naming convention:
config/soccom/{service provider}/profileDetails = [...]Where service provider is the name of the profile service provider, such as Pluck or Lotus Connections. The order of the profile details that are displayed within the Profile widget is determined by the order specified in the ArrayList. If a file type profile detail is specified in the configuration, that profile detail is the first item displayed in the Update Profile View. The following code snippet shows an example of an ArrayList with profile details configured for the Pluck service provider, including screen name, e-mail address, hometown, birthday, avatar, gender, and interests.
/config/soccom/pluck/profileDetails = [ { "screenname": { "name":"Screen Name", "description":"The name to be displayed instead of the user's username", "type":{"type":"string", "max_length":"30", "required":"true"} } }, { "email": { "name":"Email Address", "description":"The user's email address", "type":{"type":"string", "max_length":"60", "required":"true"} } }, { "location": { "name":"Hometown", "description":"The user's professed location", "type":{"type":"string", "max_length":"60"} } }, { "birthday": { "name":"Birthday", "description":"The user's date of birth", "type":{"type":"date", "ageRestriction":["true", "13"]} } }, { "gender": { "name":"Gender", "description":"The user's gender", "type": {"type":"set", "values": ["select one", "Male", "Female"], "defaultValue":"select one"} } }, { "avatar": { "name":"Avatar", "description":"The user's avatar photo", "type":{"type":"file"} } }, { "interests": { "name":"Interests", "description":"Descriptive paragraph about user's personal interests", "type":{"type":"string", "max_length":"150"} } } ]
- To convert these configured profile attributes to Dojo templates that the ibm.social.Profile user interface widget can use, run the profilegenerator command from a command prompt to generate the Profile.html and ProfileGeneratedNls.js files.
zero profilegenerator [-d Social Commerce service provider directory] [Social Commerce service provider]The following code snippet shows the profilegenerator command used to generate these files for the Pluck service provider:
C:\RTCworkspace\com.ibm.commerce.soccom.handler>zero profilegenerator -d "../com.ibm.commerce.soccom.pluck" pluck
Notes:
- Verify the Java executable and the zero command are in your path. The Java executable is typically located in WAS_HOME\java and the zero command is located in WCDE_INSTALL\workspace\SocCore.
- Run this command after you modify the profile detail configuration to ensure that the Profile.html and ProfileGeneratedNls.js files are synchronized.
- Ensure that the service provider used to generate the Profile.html and ProfileGeneratedNls.js files is specified in the adapter.config file located in the config directory of the running application. For example:
#------------------------------------------------------------------------------ # The Profile adapter value can be either "pluck" or "lc" (Lotus Connections) #------------------------------------------------------------------------------ /config/soccom/adapter/profile = "pluck"
- Start the application. The profile widget template is dynamically generated when the application is started.
Results
The Profile.html and ProfileGeneratedNls.js files generated in the Social Commerce service provider's project are copied from the project to the public folder of the running applications:
- ../com.ibm.commerce.soccom.service provider/public/ibm/social/nls/ProfileGeneratedNls.js
- ../com.ibm.commerce.soccom.service provider/public/ibm/social/templates/Profile.html
Related tasks
Related reference