All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.babyfish.jimmer.sql.kt.impl.KTriggersImpl.kt Maven / Gradle / Ivy

There is a newer version: 0.9.35
Show newest version
package org.babyfish.jimmer.sql.kt.impl

import org.babyfish.jimmer.meta.ImmutableProp
import org.babyfish.jimmer.meta.ImmutableType
import org.babyfish.jimmer.runtime.ImmutableSpi
import org.babyfish.jimmer.sql.event.Triggers
import org.babyfish.jimmer.sql.event.AssociationListener
import org.babyfish.jimmer.sql.event.EntityListener
import org.babyfish.jimmer.sql.kt.KTriggers
import java.sql.Connection
import kotlin.reflect.KClass

internal class KTriggersImpl(
    private val javaTriggers: Triggers
): KTriggers {

    override fun  addEntityListener(entityType: KClass, listener: EntityListener) {
        javaTriggers.addEntityListener(entityType.java, listener)
    }

    override fun addEntityListener(immutableType: ImmutableType?, listener: EntityListener<*>) {
        javaTriggers.addEntityListener(immutableType, listener)
    }

    override fun removeEntityListener(immutableType: ImmutableType?, listener: EntityListener<*>) {
        javaTriggers.removeEntityListener(immutableType, listener)
    }

    override fun  removeEntityListener(entityType: KClass, listener: EntityListener) {
        javaTriggers.removeEntityListener(entityType.java, listener)
    }

    override fun addAssociationListener(prop: ImmutableProp?, listener: AssociationListener) {
        javaTriggers.addAssociationListener(prop, listener)
    }

    override fun removeAssociationListener(prop: ImmutableProp?, listener: AssociationListener) {
        javaTriggers.removeAssociationListener(prop, listener)
    }

    override fun fireEntityTableChange(oldRow: Any, newRow: Any, con: Connection?, reason: Any?) {
        javaTriggers.fireEntityTableChange(oldRow, newRow, con, reason)
    }

    override fun fireMiddleTableDelete(prop: ImmutableProp, sourceId: Any, targetId: Any, con: Connection?, reason: Any?) {
        javaTriggers.fireMiddleTableDelete(prop, sourceId, targetId, con, reason)
    }

    override fun fireMiddleTableInsert(prop: ImmutableProp, sourceId: Any, targetId: Any, con: Connection?, reason: Any?) {
        javaTriggers.fireMiddleTableInsert(prop, sourceId, targetId, con, reason)
    }

    override fun fireAssociationEvict(prop: ImmutableProp, sourceId: Any, con: Connection?, reason: Any?) {
        javaTriggers.fireAssociationEvict(prop, sourceId, con, reason)
    }

    override val isTransaction: Boolean
        get() = javaTriggers.isTransaction
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy