Accessing profiles from linked Java object methods

 

To determine the current profile being used by the model or access the profile values for the current profile in an LJO method, we can access the current profile through the com.bowstreet.generation.ProfileData interface. For more information about the methods available in the ProfileData interface, see its Javadoc.

In the LJO Java file you will need to include the following import statements:

import com.bowstreet.webapp.*;

import com.bowstreet.webapp.structures.*;

import com.bowstreet.generation.ProfileData;

 

To get the current the name of the current profile being applied to the model, use code similar to the following: (where "ProfileSetName" is the name of the profile set associated with your model)

public String getCurrentProfileName(WebAppAccess waa) {

   WebAppImpl webApp = (WebAppImpl)waa.getWebApp();

   RegenSettings regenSettings = webApp.getRegenSettings();

   ProfileData profileData = regenSettings.getProfileData();

   return profileData.getProfile("ProfileSetName").getName();

}

 

To get the current value of a profile entry, use code similar to the following: (where "ProfileSetName" is the name of the profile set associated with your model)

public String getCurrentProfileName(WebAppAccess waa) {

   WebAppImpl webApp = (WebAppImpl)waa.getWebApp();

   RegenSettings regenSettings = webApp.getRegenSettings();

   ProfileData profileData = regenSettings.getProfileData();

   return profileData.getString("ProfileSetName:EntryName");

}