001package de.deepamehta.core.service.event;
002
003import de.deepamehta.core.AssociationType;
004import de.deepamehta.core.service.EventListener;
005
006
007
008/**
009 * ### FIXDOC
010 * Allows a plugin to modify type definitions -- exisisting ones <i>and</i> future ones.
011 * Plugins get a opportunity to visit (and modify) each type definition extacly once.
012 * <p>
013 * This hook is triggered in 2 situations:
014 * <ul>
015 *  <li>for each type that <i>exists</i> already while a plugin clean install.
016 *  <li>for types created (interactively by the user, or programmatically by a migration) <i>after</i>
017 *      the plugin has been installed.
018 * </ul>
019 * This hook is typically used by plugins which provide cross-cutting concerns by affecting <i>all</i>
020 * type definitions of a DeepaMehta installation. Typically such a plugin adds new data fields to types
021 * or relates types with specific topics.
022 * <p>
023 * Examples of plugins which use this hook:
024 * <ul>
025 *  <li>The "DeepaMehta 4 Workspaces" plugin adds a "Workspaces" field to all types.
026 *  <li>The "DeepaMehta 4 Time" plugin adds timestamp fields to all types.
027 *  <li>The "DeepaMehta 4 Access Control" plugin adds a "Creator" field to all types and relates them to a user.
028 * </ul>
029 *
030 * @param   assocType   the type to be modified. The passed object is actually an instance of a {@link AssociationType}
031 *                      subclass that is backed by the database. That is, modifications by e.g.
032 *                      {@link AssociationType#addDataField} are persistent.
033 *                      <p>
034 *                      Note: at the time the hook is triggered the type exists already in the database, in
035 *                      particular the underlying type topic has an ID already. That is, the type is ready for
036 *                      e.g. being related to other topics.
037 */
038public interface IntroduceAssociationTypeListener extends EventListener {
039
040    void introduceAssociationType(AssociationType assocType);
041}