public interface ActivityService
ActivityDefinition
,
ActivityConfiguration
Modifier and Type | Field and Description |
---|---|
static String |
NOTE_PROPERTY_KEY_ACTIVITY
Key of the note property which marks a note as an activity.
|
static String |
NOTE_PROPERTY_KEY_ACTIVITY_UNDELETABLE
Key of the note property which marks an activity as not deletable.
|
static String |
NOTE_PROPERTY_VALUE_ACTIVITY
Value of the note property which marks a note as an activity.
|
static String |
PROPERTY_KEY_GROUP
the key group to be used for properties related to activities
|
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.
|
static final String NOTE_PROPERTY_KEY_ACTIVITY
static final String NOTE_PROPERTY_KEY_ACTIVITY_UNDELETABLE
static final String NOTE_PROPERTY_VALUE_ACTIVITY
static final String PROPERTY_KEY_GROUP
void activateDeactivateActivitiesForTopic(Long topicId, Map<ActivityDefinition,Boolean> settings) throws NotFoundException, AuthorizationException, ActivityServiceException
topicId
- 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
storedisActivityActive(String, Long)
boolean addDefinition(ActivityDefinition definition)
definition
- the activity definition to addvoid convertToActivityNote(NoteStoringTO noteTO, String templateId, String templatePropertiesJSON)
noteTO
- 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.List<Pair<ActivityDefinition,ActivityConfiguration>> getActivities(Locale locale) throws ActivityServiceException
locale
- 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 loadedList<Pair<ActivityDefinition,Boolean>> getActivitySettingsForTopic(Long topicId) throws NotFoundException, AuthorizationException, ActivityServiceException
topicId
- 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 loadedboolean isActivityActive(String templateId, Long topicId) throws AuthorizationException, NotFoundException, ActivityServiceException
templateId
- 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 loadedboolean isActivityDeletableByUser(String templateId) throws ActivityServiceException
ActivityDefinition.DEFAULT_DELETABLE_BY_USER
is returned.templateId
- the ID of the activityActivityServiceException
- in case the configuration couldn't be loadedvoid removeDefinition(String templateId)
templateId
- the ID of the definition to remove. In case there is no definition for the ID,
nothing will happen.void storeActivityConfigurations(List<ActivityConfiguration> configurations) throws ActivityServiceException
configurations
- the configurations to storeActivityServiceException
- in case the storing of the configurations failed or a configuration was invalidCopyright © 2019 Communote team. All rights reserved.