Class SocialServicesImpl<T extends SocialUgc>
- java.lang.Object
-
- org.craftercms.social.services.social.impl.SocialServicesImpl<T>
-
- All Implemented Interfaces:
SocialServices
public class SocialServicesImpl<T extends SocialUgc> extends Object implements SocialServices
-
-
Constructor Summary
Constructors Constructor Description SocialServicesImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<? extends String,Object>
approveComment(UGC ugc, org.craftercms.profile.api.Profile profile)
long
countAllFlaggedUgs(String context, int start, int pageSize, List sortOrder)
long
countByModerationStatus(ModerationStatus status, String thread, String contextId)
Counts all Comments with the given Moderation status.Iterable<T>
findAllFlaggedUgs(String context, int start, int pageSize, List sortOrder)
Returns all Flagged UGCIterable<T>
findByModerationStatus(ModerationStatus status, String thread, String contextId, int start, int limit, List sort)
Finds all Comments with the given Moderation status.SocialUgc
flag(String ugcId, String contextId, String reason, String userId)
Flags the given UGC, with a given reason why.SocialUgc
moderate(String ugcId, ModerationStatus moderationStatus, String userId, String contextId)
Change the moderation Status of the given UGC.void
setProfileServiceRestClient(org.craftercms.profile.api.services.ProfileService profileService)
void
setReactor(reactor.core.Reactor reactor)
void
setTenantConfigurationServiceImpl(TenantConfigurationService tenantConfigurationService)
void
setUgcPipeline(UgcPipeline ugcPipeline)
void
setUgcRepository(UGCRepository<T> ugcRepository)
boolean
unFlag(String ugcId, String flagId, String userId, String contextId)
Unflags the given UGC for the given reason.protected void
unvoteDown(SocialUgc ugc, String userId)
SocialUgc
vote(String ugcId, VoteOptions voteOptions, String userId, String contextId)
Executes the given UserContentInteraction for the given User Content Action.protected void
voteUp(T ugc, String userId)
-
-
-
Method Detail
-
vote
public SocialUgc vote(String ugcId, VoteOptions voteOptions, String userId, String contextId) throws SocialException
Description copied from interface:SocialServices
Executes the given UserContentInteraction for the given User Content Action.Implementers must check if the current user is allowed to removeWatcher UGC and that the user belongs to the same ugc context
.- Specified by:
vote
in interfaceSocialServices<T extends SocialUgc>
- Parameters:
ugcId
- Id of the UGC.voteOptions
- Interaction to be executed.userId
- Id of the user that is interacting with the content.contextId
- Context of the UGC.- Returns:
- A new Public (secure) UGC.
- Throws:
SocialException
- if attribute can be deleted.
-
flag
public SocialUgc flag(String ugcId, String contextId, String reason, String userId) throws SocialException
Description copied from interface:SocialServices
Flags the given UGC, with a given reason why.Implementers must check if the current user is allowed to removeWatcher UGC and that the user belongs to the same ugc context
.- Specified by:
flag
in interfaceSocialServices<T extends SocialUgc>
- Parameters:
ugcId
- Id of the UGC to flag.contextId
- Context of the UGC.reason
- The reason for flagging this ugc.userId
- Id of the user that is flagging this UGC.- Returns:
- A new (updated) Public (secure) UGC.
- Throws:
SocialException
-
unFlag
public boolean unFlag(String ugcId, String flagId, String userId, String contextId) throws SocialException
Description copied from interface:SocialServices
Unflags the given UGC for the given reason.Implementers must check if the current user is allowed to removeWatcher UGC and that the user belongs to the same ugc context
.- Specified by:
unFlag
in interfaceSocialServices<T extends SocialUgc>
- Parameters:
ugcId
- Id of the UGC to unflag.flagId
- Id of the flag to delete.userId
- Id of the user that is unflagging this UGC.contextId
- Context of the UGC.- Returns:
- A new (updated) Public (secure) UGC.
- Throws:
SocialException
-
moderate
public SocialUgc moderate(String ugcId, ModerationStatus moderationStatus, String userId, String contextId) throws SocialException
Description copied from interface:SocialServices
Change the moderation Status of the given UGC.- Specified by:
moderate
in interfaceSocialServices<T extends SocialUgc>
- Parameters:
ugcId
- Id of the UGC to change moderation status.moderationStatus
- new Moderation Status.userId
- Id of the user that is changing the status.contextId
- Context of the UGC.- Throws:
SocialException
-
findByModerationStatus
public Iterable<T> findByModerationStatus(ModerationStatus status, String thread, String contextId, int start, int limit, List sort) throws UGCException
Description copied from interface:SocialServices
Finds all Comments with the given Moderation status. Optional: filter the thread- Specified by:
findByModerationStatus
in interfaceSocialServices<T extends SocialUgc>
- Parameters:
status
- ModerationStatus to filter.thread
- Thread owner of the comments (optional)contextId
- Context of the UGC.start
- Where to to start the count.limit
- Amount of Comments to return.sort
- Sort Fields.- Returns:
- An Iterable with the results.
- Throws:
UGCException
-
countByModerationStatus
public long countByModerationStatus(ModerationStatus status, String thread, String contextId) throws UGCException
Description copied from interface:SocialServices
Counts all Comments with the given Moderation status. Optional: filter the thread- Specified by:
countByModerationStatus
in interfaceSocialServices<T extends SocialUgc>
- Parameters:
status
- ModerationStatus to filter.thread
- Thread owner of the comments (optional)contextId
- Context of the UGC.- Returns:
- Number of Results.
- Throws:
UGCException
-
findAllFlaggedUgs
public Iterable<T> findAllFlaggedUgs(String context, int start, int pageSize, List sortOrder)
Description copied from interface:SocialServices
Returns all Flagged UGC- Specified by:
findAllFlaggedUgs
in interfaceSocialServices<T extends SocialUgc>
- Parameters:
context
- Context of the UGCstart
- Where to start the count.pageSize
- Amount of Comments to returnsortOrder
- Sort Fields.- Returns:
- An Iterable with the results.
-
countAllFlaggedUgs
public long countAllFlaggedUgs(String context, int start, int pageSize, List sortOrder)
- Specified by:
countAllFlaggedUgs
in interfaceSocialServices<T extends SocialUgc>
-
approveComment
public Map<? extends String,Object> approveComment(UGC ugc, org.craftercms.profile.api.Profile profile) throws org.craftercms.profile.api.exceptions.ProfileException, SocialException
- Specified by:
approveComment
in interfaceSocialServices<T extends SocialUgc>
- Throws:
org.craftercms.profile.api.exceptions.ProfileException
SocialException
-
setUgcRepository
public void setUgcRepository(UGCRepository<T> ugcRepository)
-
setReactor
public void setReactor(reactor.core.Reactor reactor)
-
setUgcPipeline
public void setUgcPipeline(UgcPipeline ugcPipeline)
-
setTenantConfigurationServiceImpl
public void setTenantConfigurationServiceImpl(TenantConfigurationService tenantConfigurationService)
-
setProfileServiceRestClient
public void setProfileServiceRestClient(org.craftercms.profile.api.services.ProfileService profileService)
-
-