public static void runExample(
DfaServices dfaServices, DfaSession session, String groupName, long spotlightConfigurationId)
throws Exception {
// Request the service.
SpotlightRemote service = dfaServices.get(session, SpotlightRemote.class);
// Create the spotlight activity group.
SpotlightActivityGroup spotlightActivityGroup = new SpotlightActivityGroup();
spotlightActivityGroup.setId(0);
spotlightActivityGroup.setName(groupName);
spotlightActivityGroup.setSpotlightConfigurationId(spotlightConfigurationId);
// The type ID for for a counter group is 1. See GetActivityTypes.java
spotlightActivityGroup.setGroupType(1);
// Save the activity group.
SpotlightActivityGroupSaveResult activityGroupSaveResult =
service.saveSpotlightActivityGroup(spotlightActivityGroup);
// Display the new activity group ID.
if (activityGroupSaveResult != null) {
System.out.printf("Activity group with ID \"%s\" was created.%n",
activityGroupSaveResult.getId());