#69 fixed not working code, now user can take part in conference and choose participation and deposit
parent
7e4d8d4918
commit
918079ac89
@ -0,0 +1,110 @@
|
||||
package ru.ulstu.conference.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import ru.ulstu.core.model.BaseEntity;
|
||||
import ru.ulstu.user.model.User;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.EnumType;
|
||||
import javax.persistence.Enumerated;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Entity
|
||||
@Table(name = "users_conference")
|
||||
public class ConferenceUser extends BaseEntity {
|
||||
|
||||
public enum Participation {
|
||||
INTRAMURAL("Очная"),
|
||||
EXTRAMURAL("Заочная");
|
||||
|
||||
private String participationName;
|
||||
|
||||
Participation(String name) {
|
||||
this.participationName = name;
|
||||
}
|
||||
|
||||
public String getParticipation() {
|
||||
return participationName;
|
||||
}
|
||||
}
|
||||
|
||||
public enum Deposit {
|
||||
ARTICLE("Статья"),
|
||||
REPORT("Доклад"),
|
||||
PRESENTATION("Презентация");
|
||||
|
||||
private String depositName;
|
||||
|
||||
Deposit(String name) {
|
||||
this.depositName = name;
|
||||
}
|
||||
|
||||
public String getDeposit() {
|
||||
return depositName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
@Column(name = "participation", nullable = false)
|
||||
@Enumerated(value = EnumType.STRING)
|
||||
private Participation participation = Participation.INTRAMURAL;
|
||||
|
||||
@NotNull
|
||||
@Column(name = "deposit", nullable = false)
|
||||
@Enumerated(value = EnumType.STRING)
|
||||
private Deposit deposit = Deposit.ARTICLE;
|
||||
|
||||
@ManyToOne(optional = false)
|
||||
@JoinColumn(name = "users_id")
|
||||
private User user;
|
||||
|
||||
public ConferenceUser() {
|
||||
}
|
||||
|
||||
public ConferenceUser(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public ConferenceUser(@JsonProperty("id") Integer id,
|
||||
@JsonProperty("deposit") Participation participation,
|
||||
@JsonProperty("deposit") Deposit deposit,
|
||||
@JsonProperty("user") User user) {
|
||||
this.setId(id);
|
||||
this.participation = participation;
|
||||
this.deposit = deposit;
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
|
||||
public Participation getParticipation() {
|
||||
return participation;
|
||||
}
|
||||
|
||||
public void setParticipation(Participation participation) {
|
||||
this.participation = participation;
|
||||
}
|
||||
|
||||
public Deposit getDeposit() {
|
||||
return deposit;
|
||||
}
|
||||
|
||||
public void setDeposit(Deposit deposit) {
|
||||
this.deposit = deposit;
|
||||
}
|
||||
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
package ru.ulstu.conference.repository;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import ru.ulstu.user.model.UserConference;
|
||||
import ru.ulstu.conference.model.ConferenceUser;
|
||||
|
||||
public interface ConferenceUserRepository extends JpaRepository<UserConference, Integer> {
|
||||
public interface ConferenceUserRepository extends JpaRepository<ConferenceUser, Integer> {
|
||||
}
|
||||
|
@ -1,75 +0,0 @@
|
||||
package ru.ulstu.user.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import ru.ulstu.core.model.BaseEntity;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Entity
|
||||
@Table(name = "users_conference")
|
||||
public class UserConference extends BaseEntity {
|
||||
|
||||
@NotNull
|
||||
@Column(name = "participation", nullable = false)
|
||||
private String participation;
|
||||
|
||||
@NotNull
|
||||
@Column(name = "deposit", nullable = false)
|
||||
private String deposit;
|
||||
|
||||
@ManyToOne(optional = false)
|
||||
@JoinColumn(name = "users_id")
|
||||
private User user;
|
||||
|
||||
public UserConference() {
|
||||
}
|
||||
|
||||
public UserConference(String participation, String deposit, User user) {
|
||||
this.participation = participation;
|
||||
this.deposit = deposit;
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public UserConference(@JsonProperty("id") Integer id,
|
||||
@JsonProperty("participation") String participation,
|
||||
@JsonProperty("deposit") String deposit,
|
||||
@JsonProperty("user") User user) {
|
||||
this.setId(id);
|
||||
this.participation = participation;
|
||||
this.deposit = deposit;
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
|
||||
public String getParticipation() {
|
||||
return participation;
|
||||
}
|
||||
|
||||
public void setParticipation(String participation) {
|
||||
this.participation = participation;
|
||||
}
|
||||
|
||||
public String getDeposit() {
|
||||
return deposit;
|
||||
}
|
||||
|
||||
public void setDeposit(String deposit) {
|
||||
this.deposit = deposit;
|
||||
}
|
||||
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue