fix for remove event
This commit is contained in:
parent
2dc0b4e27c
commit
58299d749d
@ -4,6 +4,7 @@ import org.hibernate.validator.constraints.NotBlank;
|
|||||||
import ru.ulstu.core.model.BaseEntity;
|
import ru.ulstu.core.model.BaseEntity;
|
||||||
import ru.ulstu.user.model.User;
|
import ru.ulstu.user.model.User;
|
||||||
|
|
||||||
|
import javax.persistence.CascadeType;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.EnumType;
|
import javax.persistence.EnumType;
|
||||||
@ -66,6 +67,10 @@ public class Event extends BaseEntity {
|
|||||||
@JoinColumn(name = "child_id")
|
@JoinColumn(name = "child_id")
|
||||||
private Event child;
|
private Event child;
|
||||||
|
|
||||||
|
@OneToMany(cascade = CascadeType.ALL)
|
||||||
|
@JoinColumn(name = "child_id")
|
||||||
|
private List<Event> parents;
|
||||||
|
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
@ -137,4 +142,12 @@ public class Event extends BaseEntity {
|
|||||||
public void setChild(Event child) {
|
public void setChild(Event child) {
|
||||||
this.child = child;
|
this.child = child;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Event> getParents() {
|
||||||
|
return parents;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParents(List<Event> parents) {
|
||||||
|
this.parents = parents;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,8 +57,9 @@ public class EventService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void delete(Integer timelineId) {
|
public void delete(Integer eventId) {
|
||||||
Event event = eventRepository.findOne(timelineId);
|
Event event = eventRepository.findOne(eventId);
|
||||||
|
event.setParents(null);
|
||||||
eventRepository.delete(event);
|
eventRepository.delete(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user