In CB-10.0 and newer, you can be notified, whenever a tracker is attached/detached or synchronized with a remote source
by implementing and deploying a TrackerSynchronizationListener:
import java.util.Map;
import org.springframework.transaction.TransactionStatus;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.intland.codebeamer.event.util.VetoException;
import com.intland.codebeamer.manager.util.SyncStatistics;
import com.intland.codebeamer.manager.util.TrackerSyncConfigurationDto;
import com.intland.codebeamer.persistence.dto.AssociationDto;
import com.intland.codebeamer.persistence.dto.TrackerDto;
import com.intland.codebeamer.persistence.dto.base.VersionReferenceDto;
/**
* The interface of listeners, that want to be notified, whenever a tracker is attached/detached or synchronized with a remote source
*/
public interface TrackerSynchronizationListener extends EventListener {
/**
* This method gets called before and after a tracker synchronization with a remote source is configured, but before the transaction is committed <ul>
* <li><code>event.getSource()</code> is the {@link TrackerSyncConfigurationDto}</li>
* <li><code>event.getSecondarySource()</code> is the {@link AssociationDto} from the remote source to the target tracker</li>
* <li><code>event.getData()</code> are the synchronization settings to be set in form of a JSON object</li>
* </ul>
* @throws VetoException (only upon {@link BaseEvent#isPreEvent()}) if the listener rejects the synchronization configuration for any reason
*/
default void trackerSynchronizationConfigured(BaseEvent<TrackerSyncConfigurationDto,AssociationDto<?,TrackerDto>,ObjectNode> event) throws VetoException {}
/**
* This method gets called before and after a tracker synchronization with a remote source is removed, but before the transaction is committed <ul>
* <li><code>event.getSource()</code> is the {@link AssociationDto} between the remote source and the tracker to be removed</li>
* <li><code>event.getSecondarySource()</code> is a {@link VersionReferenceDto} identifying the remote source where to detach the tracker from</li>
* <li><code>event.getData()</code> are the synchronization settings to be removed</li>
* </ul>
* @throws VetoException (only upon {@link BaseEvent#isPreEvent()}) if the listener rejects the removal of the synchronization for any reason
*/
default void trackerSynchronizationRemoved(BaseEvent<AssociationDto<?,TrackerDto>,VersionReferenceDto<?>,Map<String,Object>> event) throws VetoException {}
/**
* This method gets called after a tracker was synchronized with a remote source, but before the transaction is committed <ul>
* <li><code>event.isPreEvent()</code> is always false.</li>
* <li><code>event.isPostEvent()</code> is always true.</li>
* <li><code>event.getSource()</code> is the {@link TrackerSyncConfigurationDto}</li>
* <li><code>event.getSecondarySource()</code> is the {@link TransactionStatus} of the synchronization</li>
* <li><code>event.getData()</code> are the {@link SyncStatistics}</li>
* </ul>
*/
default void trackerSynchronized(BaseEvent<TrackerSyncConfigurationDto,TransactionStatus,SyncStatistics> event) {}
}
The type of the TrackerSyncConfigurationDto identifies the type of synchronization:
Unlike other listeners, there is no DefaultTrackerSynchronizationListener implementation, that would send Tracker Synchronization notification emails to registered Tracker notification subscribers.