public class ActivityServiceImpl extends Object implements ActivityService
ActivityDefinition,
ActivityConfigurationNOTE_PROPERTY_KEY_ACTIVITY, NOTE_PROPERTY_KEY_ACTIVITY_UNDELETABLE, NOTE_PROPERTY_VALUE_ACTIVITY, PROPERTY_KEY_GROUP| Constructor and Description |
|---|
ActivityServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
activateDeactivateActivitiesForTopic(Long topicId,
Map<ActivityDefinition,Boolean> settings)
Activate and deactivate activities for a given topic.
|
boolean |
addDefinition(ActivityDefinition definition)
Add an activity definition.
|
void |
convertToActivityNote(NoteStoringTO noteTO,
String templateId,
String templatePropertiesJSON)
Add the required properties to mark the note as an activity of the provided type.
|
List<Pair<ActivityDefinition,ActivityConfiguration>> |
getActivities(Locale locale)
Return pairs of associated activity definitions and configurations.
|
List<Pair<ActivityDefinition,Boolean>> |
getActivitySettingsForTopic(Long topicId)
Return a list of activities that can be configured per topic.
|
boolean |
isActivityActive(String templateId,
Long topicId)
Return whether an activity is active for a given topic.
|
boolean |
isActivityDeletableByUser(String templateId)
Return whether an activity is defined or configured to be deletable by the owner of the
activity message or the manager of the topic.
|
void |
removeDefinition(String templateId)
Remove an activity definition.
|
void |
storeActivityConfigurations(List<ActivityConfiguration> configurations)
Stores the provided activity configurations.
|
public void activateDeactivateActivitiesForTopic(Long topicId, Map<ActivityDefinition,Boolean> settings) throws NotFoundException, AuthorizationException, ActivityServiceException
ActivityServiceactivateDeactivateActivitiesForTopic in interface ActivityServicetopicId - the ID of the topic for which the activities should be storedsettings - a mapping from activity ID (template ID) to the active state where true means the
activity should be active and false inactiveNotFoundException - if the topic does not existAuthorizationException - if the calling user is not manager of the topicActivityServiceException - in case the existing settings couldn't be read or the new settings couldn't be
storedActivityService.isActivityActive(String, Long)public boolean addDefinition(ActivityDefinition definition)
ActivityServiceaddDefinition in interface ActivityServicedefinition - the activity definition to addpublic void convertToActivityNote(NoteStoringTO noteTO, String templateId, String templatePropertiesJSON)
ActivityServiceconvertToActivityNote in interface ActivityServicenoteTO - the transfer object to enhancetemplateId - the ID of the activitytemplatePropertiesJSON - optional string in JSON which should be passed to the template engine and can
contain any additional data the template might need. Can be null.public List<Pair<ActivityDefinition,ActivityConfiguration>> getActivities(Locale locale) throws ActivityServiceException
ActivityServicegetActivities in interface ActivityServicelocale - if not null the result will be sorted alphabetically by the name (or static name
if the definition is missing) and by internalActivityServiceException - in case the stored activity configurations couldn't be loadedpublic List<Pair<ActivityDefinition,Boolean>> getActivitySettingsForTopic(Long topicId) throws NotFoundException, AuthorizationException, ActivityServiceException
ActivityServicegetActivitySettingsForTopic in interface ActivityServicetopicId - the ID of the topic for which the activities should be retrievedNotFoundException - in case the topic was not foundAuthorizationException - in case the current user has no read access to the topicActivityServiceException - in case the stored activity configurations couldn't be loadedpublic boolean isActivityActive(String templateId, Long topicId) throws AuthorizationException, NotFoundException, ActivityServiceException
ActivityServiceisActivityActive in interface ActivityServicetemplateId - the ID of the activity definitiontopicId - the ID of the topic, can be null but the return value will be false if the
activity can be configured per topicAuthorizationException - if the user is not authorized to read the topicNotFoundException - if the topic does not existActivityServiceException - in case the stored activity configurations couldn't be loadedpublic boolean isActivityDeletableByUser(String templateId) throws ActivityServiceException
ActivityServiceActivityDefinition.DEFAULT_DELETABLE_BY_USER is returned.isActivityDeletableByUser in interface ActivityServicetemplateId - the ID of the activityActivityServiceException - in case the configuration couldn't be loadedpublic void removeDefinition(String templateId)
ActivityServiceremoveDefinition in interface ActivityServicetemplateId - the ID of the definition to remove. In case there is no definition for the ID,
nothing will happen.public void storeActivityConfigurations(List<ActivityConfiguration> configurations) throws ActivityServiceException
ActivityServicestoreActivityConfigurations in interface ActivityServiceconfigurations - the configurations to storeActivityServiceException - in case the storing of the configurations failed or a configuration was invalidCopyright © 2019 Communote team. All rights reserved.