Skip to content

Commit 7fcf1ff

Browse files
committed
Fix #565,#566
1 parent 7accfc2 commit 7fcf1ff

File tree

3 files changed

+75
-74
lines changed

3 files changed

+75
-74
lines changed

commons-app/src/main/java/cz/cuni/mff/xrg/odcs/commons/app/pipeline/graph/Edge.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
/**
2626
* Edge represents oriented connection between nodes of the graph.
27-
*
27+
*
2828
* @author Bogo
2929
*/
3030
@Entity
@@ -60,7 +60,7 @@ public class Edge implements DataObject {
6060

6161
/**
6262
* Set script defining outputs to inputs mappings.
63-
*
63+
*
6464
* @param script
6565
*/
6666
public void setScript(String script) {
@@ -69,7 +69,7 @@ public void setScript(String script) {
6969

7070
/**
7171
* Get script defining outputs to inputs mappings.
72-
*
72+
*
7373
* @return script defining outputs to inputs mappings.
7474
*/
7575
public String getScript() {
@@ -84,7 +84,7 @@ public Edge() {
8484

8585
/**
8686
* Constructor with specification of connecting nodes.
87-
*
87+
*
8888
* @param from
8989
* @param to
9090
*/
@@ -94,7 +94,7 @@ public Edge(Node from, Node to) {
9494

9595
/**
9696
* Constructor with specification of connecting nodes and {@link DataUnit} name.
97-
*
97+
*
9898
* @param from
9999
* @param to
100100
* @param script
@@ -116,7 +116,7 @@ public Node getFrom() {
116116
public void setFrom(Node from) {
117117
this.from = from;
118118

119-
if (from != null) from.getStartNodeOfEdges().add(this);
119+
// if (from != null) from.getStartNodeOfEdges().add(this);
120120
}
121121

122122
/**
@@ -129,12 +129,12 @@ public Node getTo() {
129129
public void setTo(Node to) {
130130
this.to = to;
131131

132-
if (to != null) to.getEndNodeOfEdges().add(this);
132+
// if (to != null) to.getEndNodeOfEdges().add(this);
133133
}
134134

135135
/**
136136
* Get graph this edge is in.
137-
*
137+
*
138138
* @return graph
139139
*/
140140
public PipelineGraph getGraph() {
@@ -143,13 +143,14 @@ public PipelineGraph getGraph() {
143143

144144
/**
145145
* Set graph this edge is in.
146-
*
146+
*
147147
* @param graph
148148
*/
149149
public void setGraph(PipelineGraph graph) {
150150
this.graph = graph;
151151

152-
if (graph != null) graph.getEdges().add(this);
152+
if (graph != null)
153+
graph.getEdges().add(this);
153154
}
154155

155156
@Override

commons-app/src/main/java/cz/cuni/mff/xrg/odcs/commons/app/pipeline/graph/Node.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ public class Node implements DataObject {
6464
@OneToMany(fetch = FetchType.LAZY, mappedBy = "debugNode", orphanRemoval = true)
6565
private Set<PipelineExecution> executions = new HashSet<>();
6666

67-
@OneToMany(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY, mappedBy = "from", orphanRemoval = true)
68-
private Set<Edge> startNodeOfEdges = new HashSet<>();
69-
70-
@OneToMany(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY, mappedBy = "to", orphanRemoval = true)
71-
private Set<Edge> endNodeOfEdges = new HashSet<>();
67+
// @OneToMany(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY, mappedBy = "from", orphanRemoval = true)
68+
// private Set<Edge> startNodeOfEdges = new HashSet<>();
69+
//
70+
// @OneToMany(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY, mappedBy = "to", orphanRemoval = true)
71+
// private Set<Edge> endNodeOfEdges = new HashSet<>();
7272

7373
/**
7474
* Empty constructor for JPA.
@@ -222,21 +222,21 @@ public void setExecutions(Set<PipelineExecution> executions) {
222222
this.executions = executions;
223223
}
224224

225-
public Set<Edge> getStartNodeOfEdges() {
226-
return startNodeOfEdges;
227-
}
228-
229-
public void setStartNodeOfEdges(Set<Edge> startNodeOfEdges) {
230-
this.startNodeOfEdges = startNodeOfEdges;
231-
}
232-
233-
public Set<Edge> getEndNodeOfEdges() {
234-
return endNodeOfEdges;
235-
}
236-
237-
public void setEndNodeOfEdges(Set<Edge> endNodeOfEdges) {
238-
this.endNodeOfEdges = endNodeOfEdges;
239-
}
225+
// public Set<Edge> getStartNodeOfEdges() {
226+
// return startNodeOfEdges;
227+
// }
228+
//
229+
// public void setStartNodeOfEdges(Set<Edge> startNodeOfEdges) {
230+
// this.startNodeOfEdges = startNodeOfEdges;
231+
// }
232+
//
233+
// public Set<Edge> getEndNodeOfEdges() {
234+
// return endNodeOfEdges;
235+
// }
236+
//
237+
// public void setEndNodeOfEdges(Set<Edge> endNodeOfEdges) {
238+
// this.endNodeOfEdges = endNodeOfEdges;
239+
// }
240240

241241
public void setId(Long id) {
242242
this.id = id;

commons-app/src/test/java/cz/cuni/mff/xrg/odcs/commons/app/constraints/DatabaseConstraintsTest.java

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -514,51 +514,51 @@ Object createReferencedInstance(EntityManager em) {
514514
}.ensureReferencingInstanceDelete(Edge.class, PipelineGraph.class);
515515
}
516516

517-
@Test
518-
public void ON_DELETE_ppl_node_from_DELETE_ppl_edge() {
519-
new DeleteConstraintTest() {
520-
521-
@Override
522-
Object createReferencedInstance(EntityManager em) {
523-
em.getTransaction().begin();
524-
Node nodeFrom = new Node();
525-
DPUInstanceRecord dpuInstance = new DPUInstanceRecord();
526-
nodeFrom.setDpuInstance(dpuInstance);
527-
Edge edge = new Edge();
528-
edge.setFrom(nodeFrom);
529-
530-
em.persist(dpuInstance);
531-
em.persist(nodeFrom);
532-
em.persist(edge);
533-
534-
em.getTransaction().commit();
535-
return nodeFrom;
536-
}
537-
}.ensureReferencingInstanceDelete(Edge.class, Node.class);
538-
}
539-
540-
@Test
541-
public void ON_DELETE_ppl_node_to_DELETE_ppl_edge() {
542-
new DeleteConstraintTest() {
543-
544-
@Override
545-
Object createReferencedInstance(EntityManager em) {
546-
em.getTransaction().begin();
547-
Node nodeTo = new Node();
548-
DPUInstanceRecord dpuInstance = new DPUInstanceRecord();
549-
nodeTo.setDpuInstance(dpuInstance);
550-
Edge edge = new Edge();
551-
edge.setTo(nodeTo);
552-
553-
em.persist(dpuInstance);
554-
em.persist(nodeTo);
555-
em.persist(edge);
517+
// @Test
518+
// public void ON_DELETE_ppl_node_from_DELETE_ppl_edge() {
519+
// new DeleteConstraintTest() {
520+
//
521+
// @Override
522+
// Object createReferencedInstance(EntityManager em) {
523+
// em.getTransaction().begin();
524+
// Node nodeFrom = new Node();
525+
// DPUInstanceRecord dpuInstance = new DPUInstanceRecord();
526+
// nodeFrom.setDpuInstance(dpuInstance);
527+
// Edge edge = new Edge();
528+
// edge.setFrom(nodeFrom);
529+
//
530+
// em.persist(dpuInstance);
531+
// em.persist(nodeFrom);
532+
// em.persist(edge);
533+
//
534+
// em.getTransaction().commit();
535+
// return nodeFrom;
536+
// }
537+
// }.ensureReferencingInstanceDelete(Edge.class, Node.class);
538+
// }
556539

557-
em.getTransaction().commit();
558-
return nodeTo;
559-
}
560-
}.ensureReferencingInstanceDelete(Edge.class, Node.class);
561-
}
540+
// @Test
541+
// public void ON_DELETE_ppl_node_to_DELETE_ppl_edge() {
542+
// new DeleteConstraintTest() {
543+
//
544+
// @Override
545+
// Object createReferencedInstance(EntityManager em) {
546+
// em.getTransaction().begin();
547+
// Node nodeTo = new Node();
548+
// DPUInstanceRecord dpuInstance = new DPUInstanceRecord();
549+
// nodeTo.setDpuInstance(dpuInstance);
550+
// Edge edge = new Edge();
551+
// edge.setTo(nodeTo);
552+
//
553+
// em.persist(dpuInstance);
554+
// em.persist(nodeTo);
555+
// em.persist(edge);
556+
//
557+
// em.getTransaction().commit();
558+
// return nodeTo;
559+
// }
560+
// }.ensureReferencingInstanceDelete(Edge.class, Node.class);
561+
// }
562562

563563
@Test
564564
public void ON_DELETE_exec_schedule_DELETE_sch_sch_notification() {

0 commit comments

Comments
 (0)