Skip to content

Commit

Permalink
OEntity#resetToNew method was added.
Browse files Browse the repository at this point in the history
  • Loading branch information
andrii0lomakin committed Sep 11, 2024
1 parent 8ff94ec commit 2e4cfa6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@ interface OEntity : Entity {
override fun getId(): OEntityId

fun save(): OEntity

fun resetToNew()
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,9 @@ class OReadonlyVertexEntity(vertex: OVertex, store: OEntityStore) : OVertexEntit
override fun requireActiveWritableTransaction(): OStoreTransaction {
throw IllegalArgumentException("Can't update readonly entity (id=${id})")
}

override fun resetToNew() {
throw UnsupportedOperationException("Not supported in readonly entity")
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ open class OVertexEntity(internal val vertex: OVertex, private val store: OEntit
return true
}

override fun resetToNew() {
vertex.resetToNew()
}

private fun requireActiveTx(): OStoreTransaction {
return store.requireActiveTransaction()
}
Expand Down

0 comments on commit 2e4cfa6

Please sign in to comment.