Add user ids

This commit is contained in:
Anton Romanov 2024-04-24 11:59:48 +04:00
parent c8382c4aea
commit b49adee62a
2 changed files with 42 additions and 17 deletions

View File

@ -4,17 +4,7 @@ import org.hibernate.annotations.BatchSize;
import ru.ulstu.configuration.Constants; import ru.ulstu.configuration.Constants;
import ru.ulstu.core.model.BaseEntity; import ru.ulstu.core.model.BaseEntity;
import javax.persistence.Column; import javax.persistence.*;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Email; import javax.validation.constraints.Email;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern; import javax.validation.constraints.Pattern;
@ -28,7 +18,6 @@ import java.util.Set;
@Table(name = "users") @Table(name = "users")
public class User extends BaseEntity { public class User extends BaseEntity {
private final static String USER_ABBREVIATE_TEMPLATE = "%s %s %s"; private final static String USER_ABBREVIATE_TEMPLATE = "%s %s %s";
@NotNull @NotNull
@Pattern(regexp = Constants.LOGIN_REGEX) @Pattern(regexp = Constants.LOGIN_REGEX)
@Size(min = 1, max = 50) @Size(min = 1, max = 50)
@ -39,27 +28,22 @@ public class User extends BaseEntity {
@Size(min = 60, max = 60) @Size(min = 60, max = 60)
@Column(name = "password_hash", length = 60, nullable = false) @Column(name = "password_hash", length = 60, nullable = false)
private String password; private String password;
@NotNull @NotNull
@Size(max = 50) @Size(max = 50)
@Column(name = "first_name", length = 50, nullable = false) @Column(name = "first_name", length = 50, nullable = false)
private String firstName; private String firstName;
@NotNull @NotNull
@Size(max = 50) @Size(max = 50)
@Column(name = "last_name", length = 50, nullable = false) @Column(name = "last_name", length = 50, nullable = false)
private String lastName; private String lastName;
@Size(max = 50) @Size(max = 50)
@Column(name = "patronymic", length = 50) @Column(name = "patronymic", length = 50)
private String patronymic; private String patronymic;
@NotNull @NotNull
@Email @Email
@Size(min = 5, max = 100) @Size(min = 5, max = 100)
@Column(length = 100, nullable = false, unique = true) @Column(length = 100, nullable = false, unique = true)
private String email; private String email;
@NotNull @NotNull
@Column(nullable = false) @Column(nullable = false)
private boolean activated; private boolean activated;
@ -96,6 +80,12 @@ public class User extends BaseEntity {
@JoinColumn(name = "blocker_id") @JoinColumn(name = "blocker_id")
private User blocker; private User blocker;
private String orcId;
private String scopusId;
private String elibraryId;
public enum UserDegree { public enum UserDegree {
CANDIDATE("Кандидат технических наук"), CANDIDATE("Кандидат технических наук"),
DOCTOR("Доктор технических наук"); DOCTOR("Доктор технических наук");
@ -242,6 +232,30 @@ public class User extends BaseEntity {
this.blocker = blocker; this.blocker = blocker;
} }
public String getOrcId() {
return orcId;
}
public void setOrcId(String orcId) {
this.orcId = orcId;
}
public String getScopusId() {
return scopusId;
}
public void setScopusId(String scopusId) {
this.scopusId = scopusId;
}
public String getElibraryId() {
return elibraryId;
}
public void setElibraryId(String elibraryId) {
this.elibraryId = elibraryId;
}
public String getUserAbbreviate() { public String getUserAbbreviate() {
return String.format(USER_ABBREVIATE_TEMPLATE, return String.format(USER_ABBREVIATE_TEMPLATE,
lastName == null ? "" : lastName, lastName == null ? "" : lastName,

View File

@ -9,4 +9,15 @@
<addForeignKeyConstraint baseTableName="users" baseColumnNames="blocker_id" constraintName="fk_blocker" <addForeignKeyConstraint baseTableName="users" baseColumnNames="blocker_id" constraintName="fk_blocker"
referencedTableName="users" referencedColumnNames="id"/> referencedTableName="users" referencedColumnNames="id"/>
</changeSet> </changeSet>
<changeSet author="orion" id="20240424_000000-1">
<addColumn tableName="users">
<column name="orc_id" type="varchar(255)"/>
</addColumn>
<addColumn tableName="users">
<column name="scopus_id" type="varchar(255)"/>
</addColumn>
<addColumn tableName="users">
<column name="elibrary_id" type="varchar(255)"/>
</addColumn>
</changeSet>
</databaseChangeLog> </databaseChangeLog>