Skip to content

Commit

Permalink
feat: 新增插件修改回调事件 #9566
Browse files Browse the repository at this point in the history
  • Loading branch information
hejieehe committed Oct 26, 2023
1 parent 5b04b6e commit 43290a6
Showing 1 changed file with 0 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,6 @@ open class DefaultModelCheckPlugin constructor(

override fun beforeUpdateElementInExistsModel(existModel: Model, sourceModel: Model?, param: BeforeUpdateParam) {
recursiveElement(existModel = existModel) {
logger.info("beforeUpdateElementInExistsModel,element[${JsonUtil.toJson(it, false)}]")
updatePrepare(sourceModel, it, param)
}
}
Expand Down Expand Up @@ -548,23 +547,12 @@ open class DefaultModelCheckPlugin constructor(
}

override fun afterCreateElementInExistsModel(existModel: Model, sourceModel: Model?, param: AfterCreateParam) {
val sourceModelStr = if (sourceModel != null) {
JsonUtil.toJson(sourceModel, false)
} else {
""
}
logger.info(
"afterCreateElementInExistsModel|existModel[${JsonUtil.toJson(existModel, false)}]|" +
"sourceModel[$sourceModelStr]"
)
recursiveElement(existModel = existModel) {
createPrepare(sourceModel, it, param)
}
}

private fun createPrepare(sourceModel: Model?, originElement: Element, param: AfterCreateParam) {
logger.info("createPrepare The element(${originElement.name}/${originElement.id})," +
"sourceModel|[$sourceModel]")
if (sourceModel == null || !sourceModel.elementExist(originElement)) {
logger.info("The element(${originElement.name}/${originElement.id}) is create")
ElementBizRegistrar.getPlugin(originElement)?.afterCreate(
Expand Down

0 comments on commit 43290a6

Please sign in to comment.