Skip to content
This repository has been archived by the owner on Mar 12, 2020. It is now read-only.

Commit

Permalink
Add initial entity types #19
Browse files Browse the repository at this point in the history
  • Loading branch information
tdauth committed Apr 9, 2019
1 parent 4a7e4e8 commit 9394eac
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package de.retest.guistatemachine.api.neo4j
import de.retest.recheck.ui.descriptors.SutState
import org.neo4j.ogm.annotation.{EndNode, RelationshipEntity, StartNode}

@RelationshipEntity(`type` = "EXECUTED")
class ActionTransitionEntity(start: SutState, end: SutState) extends Entity {

def this() = this(null, null)

@StartNode val s = start

@EndNode val e = end
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package de.retest.guistatemachine.api.neo4j

import org.neo4j.ogm.annotation.{GeneratedValue, Id}

abstract class Entity {
@Id @GeneratedValue private val id = 0L
def getId: Long = id
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package de.retest.guistatemachine.api.neo4j

import org.neo4j.ogm.session.SessionFactory

// TODO #19 Use sessions to modify the state graph.
object Neo4jSessionFactory {
private val sessionFactory = new SessionFactory("de.retest.guistatemachine.api.neo4j")

def getSession() = sessionFactory.openSession()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package de.retest.guistatemachine.api.neo4j

import de.retest.recheck.ui.descriptors.SutState
import org.neo4j.ogm.annotation.typeconversion.Convert
import org.neo4j.ogm.annotation.{GeneratedValue, Id, _}

// TODO #19 Use this entity and sessions instead of manual transactions.
@NodeEntity
class SutStateEntity(state: SutState) extends Entity {

def this() = this(null)

@Id @GeneratedValue private val id = 0L

@Convert(classOf[SutStateConverter])
private val sutState = state
}

0 comments on commit 9394eac

Please sign in to comment.