Templates
Notification templates based on html and freemarker (see freemarker.org). You can customize email template with html and use freemarker for include some logic and get access to the transferred variables.
Abstract beans
AbstractICaseDocumentNotificationBehaviour - It is used to derive common parameters that can be used by different behaviours (services, sender, order).
<bean id="example.notifications.abstractDocumentNotificationBehaviour"
class="ru.citeck.ecos.behavior.notification.AbstractICaseDocumentNotificationBehaviour" abstract="true">
<property name="nodeService" ref="nodeService"/>
<property name="policyComponent" ref="policyComponent"/>
<property name="caseStatusService" ref="caseStatusService"/>
<property name="dictionaryService" ref="dictionaryService"/>
<property name="sender" ref="documentChangeNotificationSender"/>
<property name="order" value="120"/>
</bean>
order - recommend value is 120, for correct operation.
sender - sender, which sends messages.
<bean id="AbstractNotificationSender" class="ru.citeck.ecos.notification.AbstractNotificationSender"
abstract="true">
<property name="asyncNotification" value="${notification.send.asyncronical}"/>
<property name="transactionService" ref="transactionService"/>
</bean>
asyncNotification - flag (true of false) from alfresc-global.properties. Send notification synchronously or asynchronously.
You can override this parameters in specifics behaviour.
Sender
Notification sender.
<bean id="documentChangeNotificationSender" class="ru.citeck.ecos.notification.ICaseDocumentNotificationSender"
parent="AbstractNotificationSender">
<property name="serviceRegistry" ref="ServiceRegistry" />
<property name="transactionService" ref="transactionService"/>
<property name="namespaceService" ref="namespaceService"/>
<property name="nodeOwnerDAO" ref="NodeOwnerDAO"/>
<property name="nodeService" ref="nodeService"/>
<property name="templateEngine" value="freemarker"/>
<property name="nodeVariable" value="node"/>
<property name="templateService" ref="TemplateService"/>
<property name="templateRoot" value="/app:company_home/app:dictionary/app:email_templates/app:notify_email_templates" />
<property name="defaultTemplate" value="cm:default-document-notification-template.html.ftl"/>
<property name="iCaseAspectConditions">
<map>
<entry key="exclude">
<list>
<value>urkk:contractFromLatice</value>
</list>
</entry>
</map>
</property>
<property name="excludeStatuses">
<list>
<value>draft</value>
</list>
</property>
</bean>
templateRoot - the space where the template for notification is located.
defaultTemplate - template for notification.
iCaseAspectConditions - aspect condition using for filter the sending of notification. Two keys availabe - "exclude" and "include" aspects.
excludeStatuses, includeStatuses - using for filter notifications. If you want to filter send notifications at a certain status, use this option.
Change iCase status notification
The event to send the message is triggered when the status is changed through caseStatusService (eg changes of status on case-managment).
To configure notifications for status changes, you must configure spring beans and create template.
<bean id="example.notifications.contract.changeCaseStatusToAllStatusNotificationBehaviour"
class="ru.citeck.ecos.behavior.notification.CaseStatusChangeNotificationBehaviour" init-method="init"
parent="example.notifications.abstractDocumentNotificationBehaviour">
<property name="documentNamespace" value="http://www.citeck.ru/model/contracts/1.0"/>
<property name="documentType" value="contracts"/>
<property name="notificationType" value="caseStatus"/>
<property name="caseStatus" value="AllStatus"/>
<property name="recipients">
<map>
<entry key="assocRecipients">
<list>
<value>att:initiator</value>
</list>
</entry>
</map>
</property>
<property name="subjectTemplate" value="Статус документа #{'$'}{node.properties['cm:title']} изменен"/>
<property name="enabled" value="${notification.document.change.case.status.enabled}"/>
</bean>
<bean id="example.notifications.changeCaseStatusToAdditionalApprovalNotificationBehaviour"
class="ru.citeck.ecos.behavior.notification.CaseStatusChangeNotificationBehaviour" init-method="init"
parent="example.notifications.abstractDocumentNotificationBehaviour">
<property name="documentNamespace" value="http://www.citeck.ru/model/contracts/1.0"/>
<property name="documentType" value="contracts"/>
<property name="notificationType" value="caseStatus"/>
<property name="caseStatus" value="additional-approval"/>
<property name="recipients">
<map>
<entry key="assocRecipients">
<list>
<value>urkk:initiatorSupervisor</value>
</list>
</entry>
<entry key="recipientsFromRole">
<list>
<value>additional-confirmer</value>
</list>
</entry>
</map>
</property>
<property name="subjectTemplate" value="Статус документа #{'$'}{node.properties['cm:title']} изменен"/>
<property name="enabled" value="${notification.document.change.case.status.enabled}"/>
</bean>
documentNamespace, documentType - the type of document by which the notification will be sent.
notificationType - some flag that is available in the message template. Used when writing common notification templates, allows you to determine the type of notification.
caseStatus - when the iCase is transferred to this status, a message will be sent. It is possible to specify a specific status, or the flag "AllStatus".
recipients - recipients of messages. Recipients can be taken from the association from the case (assocRecipients - the association) or from the role of the case (recipientsFromRole - id of role).
subjectTemplate - subject of email. You can use freemarker to get variables from document (node).
enabled - flag (true or false) from alfresco-global.properties to enable or disable notification.
Change attachment notifications
ICaseDocumentChangeAttachmentNotificationBehaviour - react to delete, create or upload new version of attachment (icase:document) in iCase.
Configured parameters: documentNamespace, documentType, notificationType, recipients, excludeStatuses, includeStatuses, subjectTemplate, enabled - see description in "Change iCase status notification" block.
<bean id="example.contract.changeAttachmentBehaviour"
class="ru.citeck.ecos.behavior.notification.ICaseDocumentChangeAttachmentNotificationBehaviour"
init-method="init" parent="example.notifications.abstractDocumentNotificationBehaviour">
<property name="documentNamespace" value="http://www.citeck.ru/model/contracts/1.0"/>
<property name="documentType" value="contracts"/>
<property name="notificationType" value="attachments"/>
<property name="recipients">
<map>
<entry key="assocRecipients">
<list>
<value>att:initiator</value>
</list>
</entry>
<entry key="recipientsFromRole">
<list>
<value>confirmers</value>
</list>
</entry>
</map>
</property>
<property name="excludeStatuses">
<list>
<value>draft</value>
<value>scanning</value>
</list>
</property>
<property name="subjectTemplate" value="У документа #{'$'}{node.properties['cm:title']} были изменены вложения"/>
<property name="enabled" value="${notification.document.change.attachment.enabled}"/>
</bean>
The following additional parameters are available in the html.ftl template: args.addition.method can be onCreate, onDelete or uploadNewVersion.
Change content notifications
DocumentChangeContentNotificationBehaviour - react to update, delete cm:conent of any document type in alfresco.
Configured parameters: documentNamespace, documentType, notificationType, recipients, excludeStatuses, includeStatuses, subjectTemplate, enabled - see description in "Change iCase status notification" block.
<bean id="example.contract.changeContentNotificationBehaviour"
class="ru.citeck.ecos.behavior.notification.DocumentChangeContentNotificationBehaviour" init-method="init"
parent="example.notifications.abstractDocumentNotificationBehaviour">
<property name="documentNamespace" value="http://www.citeck.ru/model/contracts/1.0"/>
<property name="documentType" value="contracts"/>
<property name="notificationType" value="changeContent"/>
<property name="recipients">
<map>
<entry key="assocRecipients">
<list>
<value>att:initiator</value>
</list>
</entry>
<entry key="recipientsFromRole">
<list>
<value>confirmers</value>
</list>
</entry>
</map>
</property>
<property name="excludeStatuses">
<list>
<value>draft</value>
<value>scanning</value>
</list>
</property>
<property name="subjectTemplate" value="В документе #{'$'}{node.properties['cm:title']} было изменено содержимое"/>
<property name="enabled" value="${notification.document.change.content.enabled}"/>
</bean>
AddNewCommentNotificationBehaviour - react to adding a new comment to the document.
Configured parameters: documentNamespace, documentType, notificationType, recipients, excludeStatuses, includeStatuses, subjectTemplate, enabled - see description in "Change iCase status notification" block
<bean id="example.addNewCommentNotificationBehaviour"
class="ru.citeck.ecos.behavior.notification.AddNewCommentNotificationBehaviour" init-method="init"
parent="example.notifications.abstractDocumentNotificationBehaviour">
<property name="personService" ref="personService"/>
<property name="contentService" ref="contentService"/>
<property name="documentNamespace" value="http://www.citeck.ru/model/contracts/1.0"/>
<property name="documentType" value="contracts"/>
<property name="notificationType" value="newComment"/>
<property name="sender" ref="documentChangeNotificationSender"/>
<property name="subjectTemplate" value="В документе №#{'$'}{node.properties['mdmvnd:vrqNumber']} добавлен новый комментарий"/>
<property name="enabled" value="${notification.example.new.comment.enabled}"/>
<property name="recipients">
<map>
<entry key="recipientsFromRole">
<list><value>initiator</value></list>
</entry>
</map>
</property>
</bean>