public interface BadgingService
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ALL_BADGES
Assigned and earned, including non-top badges.
|
static java.lang.String |
ALL_TOP_BADGES
Assigned and top earned badges only.
|
static java.lang.String |
ALLOW_BADGES_PROP
For components supporting badge display, use this Boolean property to toggle badge display on/off.
|
static java.lang.String |
ASSIGNED_BADGES
Assigned badges only.
|
static java.lang.String |
ASSIGNED_PROP
True if this is an assigned badge.
|
static java.lang.String |
BADGE_EARNED_DATE_PROP
The date when badge was awarded.
|
static java.lang.String |
BADGE_EARNED_SCORE_PROP
The score when badge was awarded.
|
static java.lang.String |
BADGE_PATH_PROP
Path of the badge's resource/image.
|
static java.lang.String |
BADGE_PATHS_PROP
advanced badging engine specific properties
|
static java.lang.String |
BADGING_FOLDER_NAME
badging folder name located in SRP after the home users profile dir.
|
static java.lang.String |
BADGING_LEVELS_PROP |
static java.lang.String |
BADGING_RULES_PROP
badging rule property.
|
static java.lang.String |
BADGING_TYPE_PROP
badging engine type.
|
static java.lang.String |
EARNED_BADGES
Earned badges only.
|
static java.lang.String |
EARNED_TOP_BADGES
Top earned badges only.
|
static java.lang.String |
FILTER_BY_COMP_PROP
When badge display is turned on in a component, set this boolean property in the component resource to display
all the user's badges or just badges earned/assigned for this component.
|
static java.lang.String |
RESOURCE_TYPE_BADGE
A badge resource type
|
static java.lang.String |
RULE_PAGE_PATH_PROP
The containing page path of the rule's location this badge belongs to.
|
static java.lang.String |
RULE_PROP
The rule path.
|
static java.lang.String |
SITE_ID_PROP
The site the badge belongs to.
|
static java.lang.String |
THRESHOLDS_PROP
basic badging engine specific properties.
|
static java.lang.String |
THRESHOLDS_SEPARATOR |
Modifier and Type | Method and Description |
---|---|
int |
deleteBadge(ResourceResolver resolver,
java.lang.String userId,
Resource ruleResource,
Resource componentResource,
java.lang.String badgeContentPath,
boolean assigned)
Delete a user's badges where the badgeContentPath matches the input parameter.
|
java.util.List<UserBadge> |
getBadges(ResourceResolver resourceResolver,
java.lang.String userId,
Resource pageResource,
CommunityContext context,
java.lang.String badgeType)
Retrieves badges for a user.
|
java.lang.String |
getTopBadgeResourcePath(ResourceResolver resolver,
java.lang.String userId,
Resource ruleResource,
Resource componentResource)
Calculate and return the path of a user's top badge resource given a badging rule resource and a component
resource.
|
void |
saveBadge(ResourceResolver resolver,
java.lang.String userId,
Resource ruleResource,
Resource componentResource,
java.lang.String badgeContentPath,
boolean assigned,
java.util.Map<java.lang.String,java.lang.Object> props)
Save or update a user's badge.
|
static final java.lang.String RESOURCE_TYPE_BADGE
static final java.lang.String BADGING_TYPE_PROP
static final java.lang.String BADGING_RULES_PROP
static final java.lang.String BADGING_FOLDER_NAME
static final java.lang.String RULE_PAGE_PATH_PROP
static final java.lang.String BADGE_PATH_PROP
static final java.lang.String SITE_ID_PROP
static final java.lang.String RULE_PROP
static final java.lang.String ASSIGNED_PROP
static final java.lang.String BADGE_EARNED_SCORE_PROP
static final java.lang.String BADGE_EARNED_DATE_PROP
static final java.lang.String ALL_BADGES
static final java.lang.String ALL_TOP_BADGES
static final java.lang.String ASSIGNED_BADGES
static final java.lang.String EARNED_BADGES
static final java.lang.String EARNED_TOP_BADGES
static final java.lang.String THRESHOLDS_PROP
static final java.lang.String THRESHOLDS_SEPARATOR
static final java.lang.String BADGE_PATHS_PROP
static final java.lang.String BADGING_LEVELS_PROP
static final java.lang.String ALLOW_BADGES_PROP
static final java.lang.String FILTER_BY_COMP_PROP
java.util.List<UserBadge> getBadges(@Nonnull ResourceResolver resourceResolver, @Nonnull java.lang.String userId, Resource pageResource, CommunityContext context, java.lang.String badgeType) throws RepositoryException
resourceResolver
- resolver used for reading badge resourcesuserId
- the user's useridpageResource
- restrict badges that are in this resource (and above) only. null for no path restrictions.
Note that a resource in a community restricts badges to that community so no need to set the context
parameter.context
- restrict badges to this community. null for no community restrictions. Useful for retrieving all
badges for a specific community by setting pageResource to null.badgeType
- the badge type to retrieve: ALL, ASSIGNED, EARNEDUserBadge
objects for the user.RepositoryException
- thrown if unable to retrieve the scorevoid saveBadge(@Nonnull ResourceResolver resolver, @Nonnull java.lang.String userId, Resource ruleResource, Resource componentResource, @Nonnull java.lang.String badgeContentPath, @Nonnull boolean assigned, java.util.Map<java.lang.String,java.lang.Object> props) throws RepositoryException, PersistenceException
resolver
- resolver used for writing the badgeuserId
- the user's useridruleResource
- the badging rule the badge was earned from. Can't be null for earned badges.componentResource
- the resource where the rule was located (Not necessarily at a component. Could be at
jcr:content, etc.). Can't be null for earned badges.badgeContentPath
- the path for the badge content resource containing the imageassigned
- true if this badge is an assigned badge, false for an earned badgeprops
- any addition properties to store with the badgeRepositoryException
- error saving badgePersistenceException
- error saving badgeint deleteBadge(@Nonnull ResourceResolver resolver, @Nonnull java.lang.String userId, Resource ruleResource, Resource componentResource, @Nonnull java.lang.String badgeContentPath, boolean assigned) throws RepositoryException, PersistenceException
resolver
- resolver used for writing the badgeuserId
- the user's useridruleResource
- the badging rule the badge was earned from. Can't be null for earned badges.componentResource
- the resource where the rule was located (Not necessarily at a component. Could be at
jcr:content, etc.). Can't be null for earned badges.badgeContentPath
- the path for the badge content resource containing the imageassigned
- true for only assigned badgesRepositoryException
- error saving badgePersistenceException
- error saving badgejava.lang.String getTopBadgeResourcePath(@Nonnull ResourceResolver resolver, @Nonnull java.lang.String userId, @Nonnull Resource ruleResource, @Nonnull Resource componentResource) throws RepositoryException
resolver
- resolver used for reading user generated contentuserId
- the userid of userruleResource
- the badging rule resourcecomponentResource
- the component resource (location of where scoring/badging rules were located)RepositoryException
- thrown if unable to calculate resource pathCopyright © 2010 - 2020 Adobe. All Rights Reserved