Skip to main content

Collaboration

Collaboration extension enables two groups of functions:

  • Writing comments to individual features

  • Sending notifications at defined events

Main configuration is stored in collaboration.xml which is stored in extensions folder.

Example of collaboration.xml:

<?xml version="1.0" encoding="utf-8"?>
<ber:collaboration xmlns:ber="http://www.berit.com/ber"
xmlns:xlink="http://www.w3.org/1999/xlink">
<ber:version>
<ber:metadata>1</ber:metadata>
<ber:minClient>5140</ber:minClient>
<ber:minAS>12601</ber:minAS>
</ber:version>
<ber:subscription>
<ber:notification>
<ber:email>
<ber:smtpHostName>smtp.intranet.local</ber:smtpHostName>
<ber:smtpPort>25</ber:smtpPort>
<!-- <ber:smtpUser>${smtpUser}</ber:smtpUser>
<ber:smtpPassword>${smtpPassword}</ber:smtpPassword>
<ber:smtpUseSSL>${smtpUseSSL}</ber:smtpUseSSL> -->
<ber:senderEmailAddress>SAMO@asseco-ce.com</ber:senderEmailAddress>
</ber:email>
</ber:notification>
<ber:subscriptionConfigurations>
<ber:subscriptionConfiguration>
<ber:featureTypes>
<ber:featureTypeRef id="ft_1"/>
<ber:featureTypeRef id="ft_ab*"/>
</ber:featureTypes>
<ber:defaultEvents>
<ber:event>commentCreated</ber:event>
</ber:defaultEvents>
<ber:autoSubscriptions>
<ber:autoSubscription>
<ber:onEvents>
<ber:event>featureCreated</ber:event>
</ber:onEvents>
<ber:subscribeToEvents>
<ber:event>featureUpdated</ber:event>
<ber:event>commentCreated</ber:event>
<ber:event>commentUpdated</ber:event>
</ber:subscribeToEvents>
</ber:autoSubscription>
<ber:autoSubscription>
<ber:onEvents>
<ber:event>commentCreated</ber:event>
</ber:onEvents>
<ber:subscribeToEvents>
<ber:event>commentCreated</ber:event>
<ber:event>commentUpdated</ber:event>
</ber:subscribeToEvents>
</ber:autoSubscription>
</ber:autoSubscriptions>
</ber:subscriptionConfiguration>
</ber:subscriptionConfigurations>
</ber:subscription>
<ber:commentConfigurations>
<ber:commentConfiguration>
<ber:featureTypes>
<ber:featureTypeRef id="ft_1"/>
<ber:featureTypeRef id="ft_2"/>
<ber:featureTypeRef id="ft_3" />
<ber:featureTypeRef id="ft_4" />
<ber:featureTypeRef id="ft_ab*"/>
</ber:featureTypes>
</ber:commentConfiguration>
</ber:commentConfigurations>
</ber:collaboration>

Writing comments to individual features

The component for writing comments to features is displayed for feature types defined in commentConfiguration section.

These feature types are automatically added to the system group collaboration-comments.

tip

When defining feature types, it’s possible to use mask with asterisk “*” as a wildcard.

Sending notifications at defined events

Notifications can be sent to the users at defined events done by other users. These events include creating of comment, editing of comment, update of feature.

Subscribing to notification

The notifications are sent to the users who subscribed to particular events on individual features. The subscriptions are stored in SAMO_COLLAB_SUBSCRIPTION table in database.

The table includes following columns:

  • ENTITY_ID – FID of the subscribed feature

  • ENTITY_TYPE_ID – feature type id of the subscribed feature

  • EVENT – subscribed event which should trigger the notification. Possible values: commentCreated, commentUpdated, featureUpdated

  • USER_ID – user, who gets the notification (email is taken from SEC_USER.EMAIL)

The subscriptions (=entries in the table) can be filled by some client functionality or automatically by collaboration extension.

Configuration of automatic subscription is included inautoSubscriptionsincollaboration.xml. This configuration defines events when the user automatically subscribes to defined events on given feature.

Following configuration defines – the user, who creates the feature, automatically subscribes to notifications when the created feature is updated, comment is created or updated on the feature by another user:

<ber:autoSubscription>
<ber:onEvents>
<ber:event>featureCreated</ber:event>
</ber:onEvents>
<ber:subscribeToEvents>
<ber:event>featureUpdated</ber:event>
<ber:event>commentCreated</ber:event>
<ber:event>commentUpdated</ber:event>
</ber:subscribeToEvents>
</ber:autoSubscription>

Notification form

The notification is sent as email message. The sender configuration is included inemailsection ofcollaboration.xml.

The addressee of the message is the email configured for the subscribing user in Security.

The email content is configured by creating templates stored underlids-as\resources\template folder.

The template names are derived from the event:

  • commentCreatedSubject.txt – defines email subject for commentCreated event

  • commentCreatedBody.html – defines email body for commentCreated event

  • commentUpdatedSubject.txt – defines email subject for commentUpdated event

  • commentUpdatedBody.html – defines email body for commentUpdated event

  • featureUpdatedSubject.txt – defines email subject for featureUpdated event

  • featureUpdatedBody.html – defines email body for featureUpdated event

The templates can include following variables, which are replaced by appropriate values when creating the email

  • user.username, user.eMail, user.firstName, user.lastName, user.principal – properties of the user who did the change activating the event

  • entity.entityTypeName – feature type name of the affected feature

  • entity.featureInfo – feature info of the affected feature

  • payload.changedComment.body – new state of the comment

  • payload.originalComment.body – original state of the comment (for commentUpdated event)

  • payload.changedAttributes.attributeName – changed attribute name

  • payload.changedAttributes.attributeType – changed attribute data type

  • payload.changedAttributes.attributeId – changed attribute id

  • payload.changedAttributes.attributeOriginalValue – original attribute value

  • payload.changedAttributes.attributeChangedValue – new attribute value

Example of commentCreatedSubject.txt:

User ${user.username} created comment to ${entity.entityTypeName} (${(entity.featureInfo)!})

Example of featureUpdatedBody.html:

<#assign s = 'border: 1px solid black; border-collapse: collapse; padding: 10px;'>
<p>
User ${user.username} updated ${entity.entityTypeName} (${(entity.featureInfo)!}).
</p>
<#assign s = 'border: 1px solid black; border-collapse: collapse; padding: 10px;'>

<table style="${s}">
<tr>
<th style="${s}">Attribute</th>
<th style="${s}">Original value</th>
<th style="${s}">Updated value</th>
</tr>
<#list payload.changedAttributes as changedAttr>
<tr>
<td style="${s}">${changedAttr.attributeName}</td>
<td style="${s}">
<#if changedAttr.attributeType == "DATE" || changedAttr.attributeType == "SHORT_DATE">
${(changedAttr.attributeOriginalValue?number_to_datetime)!}
<#else>
${(changedAttr.attributeOriginalValue)!}
</#if>
</td>
<td style="${s}">
<#if changedAttr.attributeType == "DATE" || changedAttr.attributeType == "SHORT_DATE">
${(changedAttr.attributeChangedValue?number_to_datetime)!}
<#else>
${(changedAttr.attributeChangedValue)!}
</#if>
</td>
</tr>
</#list>
</table>