Added missing UUID columns

master
Jens Pelzetter 2022-11-07 21:16:48 +01:00
parent 801629d139
commit 5f5b310899
10 changed files with 153 additions and 10 deletions

View File

@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonIdentityReference;
import com.fasterxml.jackson.annotation.ObjectIdGenerators; import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import org.hibernate.envers.Audited; import org.hibernate.envers.Audited;
import org.libreccm.core.CcmObjects; import org.libreccm.core.CcmObjects;
import org.libreccm.imexport.Exportable;
import org.librecms.assets.ContactableEntity; import org.librecms.assets.ContactableEntity;
import java.io.Serializable; import java.io.Serializable;
@ -33,7 +34,7 @@ import static org.scientificcms.contenttypes.scidepartment.SciDepartmentConstant
generator = ObjectIdGenerators.PropertyGenerator.class, generator = ObjectIdGenerators.PropertyGenerator.class,
property = "uuid" property = "uuid"
) )
public class Contact implements Serializable { public class Contact implements Exportable, Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -42,6 +43,9 @@ public class Contact implements Serializable {
@GeneratedValue(strategy = GenerationType.AUTO) @GeneratedValue(strategy = GenerationType.AUTO)
private long contactId; private long contactId;
@Column(name = "uuid", unique = true, nullable = false)
private String uuid;
@Column(name = "CONTACT_TYPE", length = 255, nullable = true) @Column(name = "CONTACT_TYPE", length = 255, nullable = true)
private String contactType; private String contactType;
@ -66,6 +70,15 @@ public class Contact implements Serializable {
this.contactId = contactId; this.contactId = contactId;
} }
@Override
public String getUuid() {
return uuid;
}
protected void setUuid(final String uuid) {
this.uuid = uuid;
}
public String getContactType() { public String getContactType() {
return contactType; return contactType;
} }
@ -102,6 +115,7 @@ public class Contact implements Serializable {
public int hashCode() { public int hashCode() {
int hash = 7; int hash = 7;
hash = 41 * hash + (int) (contactId ^ (contactId >>> 32)); hash = 41 * hash + (int) (contactId ^ (contactId >>> 32));
hash = 41 * hash * Objects.hashCode(uuid);
hash = 41 * hash + Objects.hashCode(contactType); hash = 41 * hash + Objects.hashCode(contactType);
hash = 41 * hash + (int) (order ^ (order >>> 32)); hash = 41 * hash + (int) (order ^ (order >>> 32));
hash = 41 * hash + CcmObjects.hashCodeUsingUuid(department); hash = 41 * hash + CcmObjects.hashCodeUsingUuid(department);
@ -127,6 +141,9 @@ public class Contact implements Serializable {
if (contactId != other.getContactId()) { if (contactId != other.getContactId()) {
return false; return false;
} }
if (!Objects.equals(uuid, other.getUuid())) {
return false;
}
if (!Objects.equals(contactType, other.getContactType())) { if (!Objects.equals(contactType, other.getContactType())) {
return false; return false;
} }
@ -140,7 +157,6 @@ public class Contact implements Serializable {
} }
public boolean canEqual(final Object obj) { public boolean canEqual(final Object obj) {
return obj instanceof Contact; return obj instanceof Contact;
} }
@ -153,6 +169,7 @@ public class Contact implements Serializable {
return String.format( return String.format(
"%s{ " "%s{ "
+ "contactId = %d, " + "contactId = %d, "
+ "uuid = %s, "
+ "contactType = \"%s\", " + "contactType = \"%s\", "
+ "order = %d, " + "order = %d, "
+ "project = { %s } " + "project = { %s } "
@ -160,6 +177,7 @@ public class Contact implements Serializable {
+ " }", + " }",
super.toString(), super.toString(),
contactId, contactId,
uuid,
contactType, contactType,
order, order,
Optional Optional

View File

@ -2,6 +2,8 @@ package org.scientificcms.contenttypes.scidepartment;
import org.libreccm.auditing.AbstractAuditedEntityRepository; import org.libreccm.auditing.AbstractAuditedEntityRepository;
import java.util.UUID;
import javax.enterprise.context.RequestScoped; import javax.enterprise.context.RequestScoped;
/** /**
@ -39,4 +41,9 @@ public class ContactRepository
return contact.getContactId() == 0; return contact.getContactId() == 0;
} }
@Override
public void initNewEntity(final Contact contact) {
contact.setUuid(UUID.randomUUID().toString());
}
} }

View File

@ -3,6 +3,7 @@ package org.scientificcms.contenttypes.scidepartment;
import com.fasterxml.jackson.annotation.JsonIdentityReference; import com.fasterxml.jackson.annotation.JsonIdentityReference;
import org.hibernate.envers.Audited; import org.hibernate.envers.Audited;
import org.libreccm.core.CcmObjects; import org.libreccm.core.CcmObjects;
import org.libreccm.imexport.Exportable;
import org.scientificcms.contenttypes.sciproject.SciProject; import org.scientificcms.contenttypes.sciproject.SciProject;
import java.io.Serializable; import java.io.Serializable;
@ -27,7 +28,7 @@ import static org.scientificcms.contenttypes.scidepartment.SciDepartmentConstant
@Entity @Entity
@Audited @Audited
@Table(name = "DEPARTMENT_PROJECTS", schema = DB_SCHEMA) @Table(name = "DEPARTMENT_PROJECTS", schema = DB_SCHEMA)
public class DepartmentProject implements Serializable { public class DepartmentProject implements Exportable, Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -36,6 +37,9 @@ public class DepartmentProject implements Serializable {
@GeneratedValue(strategy = GenerationType.AUTO) @GeneratedValue(strategy = GenerationType.AUTO)
private long departmentProjectId; private long departmentProjectId;
@Column(name = "uuid", unique = true, nullable = false)
private String uuid;
@ManyToOne @ManyToOne
@JoinColumn(name = "DEPARTMENT_ID") @JoinColumn(name = "DEPARTMENT_ID")
@JsonIdentityReference(alwaysAsId = true) @JsonIdentityReference(alwaysAsId = true)
@ -54,6 +58,15 @@ public class DepartmentProject implements Serializable {
this.departmentProjectId = departmentProjectId; this.departmentProjectId = departmentProjectId;
} }
@Override
public String getUuid() {
return uuid;
}
protected void setUuid(final String uuid) {
this.uuid = uuid;
}
public SciDepartment getDepartment() { public SciDepartment getDepartment() {
return department; return department;
} }
@ -73,9 +86,9 @@ public class DepartmentProject implements Serializable {
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 7; int hash = 7;
hash hash = 59 * hash
= 59 * hash + (int) (departmentProjectId ^ (departmentProjectId + (int) (departmentProjectId ^ (departmentProjectId >>> 32));
>>> 32)); hash = 59 * hash + Objects.hashCode(uuid);
hash = 59 * hash + CcmObjects.hashCodeUsingUuid(department); hash = 59 * hash + CcmObjects.hashCodeUsingUuid(department);
hash = 59 * hash + CcmObjects.hashCodeUsingUuid(project); hash = 59 * hash + CcmObjects.hashCodeUsingUuid(project);
return hash; return hash;
@ -100,6 +113,9 @@ public class DepartmentProject implements Serializable {
if (departmentProjectId != other.getDepartmentProjectId()) { if (departmentProjectId != other.getDepartmentProjectId()) {
return false; return false;
} }
if (!Objects.equals(uuid, other.getUuid())) {
return false;
}
if (!CcmObjects.equalsUsingUuid(department, other.getDepartment())) { if (!CcmObjects.equalsUsingUuid(department, other.getDepartment())) {
return false; return false;
} }
@ -119,11 +135,13 @@ public class DepartmentProject implements Serializable {
return String.format( return String.format(
"%s{ " "%s{ "
+ "departmentProjectId = %d, " + "departmentProjectId = %d, "
+ "uuid = %s, "
+ "department = { %s }, " + "department = { %s }, "
+ "project = { %s}%s" + "project = { %s}%s"
+ " }", + " }",
super.toString(), super.toString(),
departmentProjectId, departmentProjectId,
uuid,
Optional Optional
.ofNullable(department) .ofNullable(department)
.map( .map(

View File

@ -2,6 +2,8 @@ package org.scientificcms.contenttypes.scidepartment;
import org.libreccm.auditing.AbstractAuditedEntityRepository; import org.libreccm.auditing.AbstractAuditedEntityRepository;
import java.util.UUID;
import javax.enterprise.context.RequestScoped; import javax.enterprise.context.RequestScoped;
/** /**
@ -39,4 +41,9 @@ public class DepartmentProjectRepository
return project.getDepartmentProjectId() == 0; return project.getDepartmentProjectId() == 0;
} }
@Override
public void initNewEntity(final DepartmentProject project) {
project.setUuid(UUID.randomUUID().toString());
}
} }

View File

@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonIdentityReference;
import com.fasterxml.jackson.annotation.ObjectIdGenerators; import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import org.hibernate.envers.Audited; import org.hibernate.envers.Audited;
import org.libreccm.core.CcmObjects; import org.libreccm.core.CcmObjects;
import org.libreccm.imexport.Exportable;
import org.librecms.assets.Person; import org.librecms.assets.Person;
import java.io.Serializable; import java.io.Serializable;
@ -35,7 +36,7 @@ import static org.scientificcms.contenttypes.scidepartment.SciDepartmentConstant
generator = ObjectIdGenerators.PropertyGenerator.class, generator = ObjectIdGenerators.PropertyGenerator.class,
property = "uuid" property = "uuid"
) )
public class Membership implements Serializable { public class Membership implements Exportable, Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -44,6 +45,9 @@ public class Membership implements Serializable {
@GeneratedValue(strategy = GenerationType.AUTO) @GeneratedValue(strategy = GenerationType.AUTO)
private long membershipId; private long membershipId;
@Column(name = "uuid", unique = true, nullable = false)
private String uuid;
@Column(name = "MEMBER_ROLE", length = 255, nullable = true) @Column(name = "MEMBER_ROLE", length = 255, nullable = true)
private String role; private String role;
@ -69,6 +73,15 @@ public class Membership implements Serializable {
this.membershipId = membershipId; this.membershipId = membershipId;
} }
@Override
public String getUuid() {
return uuid;
}
protected void setUuid(final String uuid) {
this.uuid = uuid;
}
public String getRole() { public String getRole() {
return role; return role;
} }
@ -104,8 +117,8 @@ public class Membership implements Serializable {
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 7; int hash = 7;
hash = 37 * hash hash = 37 * hash + (int) (membershipId ^ (membershipId >>> 32));
+ (int) (membershipId ^ (membershipId >>> 32)); hash = 37 * hash + Objects.hashCode(uuid);
hash = 37 * hash + Objects.hashCode(role); hash = 37 * hash + Objects.hashCode(role);
hash = 37 * hash + Objects.hashCode(status); hash = 37 * hash + Objects.hashCode(status);
hash = 37 * hash + CcmObjects.hashCodeUsingUuid(department); hash = 37 * hash + CcmObjects.hashCodeUsingUuid(department);
@ -132,6 +145,9 @@ public class Membership implements Serializable {
if (membershipId != other.getMembershipId()) { if (membershipId != other.getMembershipId()) {
return false; return false;
} }
if (!Objects.equals(uuid, other.getUuid())) {
return false;
}
if (!Objects.equals(role, other.getRole())) { if (!Objects.equals(role, other.getRole())) {
return false; return false;
} }
@ -158,6 +174,7 @@ public class Membership implements Serializable {
return String.format( return String.format(
"%s{ " "%s{ "
+ "membershipId = %d, " + "membershipId = %d, "
+ "uuid = %s, "
+ "role = \"%s\", " + "role = \"%s\", "
+ "status = \"%s\"," + "status = \"%s\","
+ "project = { %s }, " + "project = { %s }, "
@ -165,6 +182,7 @@ public class Membership implements Serializable {
+ " }", + " }",
super.toString(), super.toString(),
membershipId, membershipId,
uuid,
role, role,
Objects.toString(status), Objects.toString(status),
Optional Optional

View File

@ -2,6 +2,8 @@ package org.scientificcms.contenttypes.scidepartment;
import org.libreccm.auditing.AbstractAuditedEntityRepository; import org.libreccm.auditing.AbstractAuditedEntityRepository;
import java.util.UUID;
import javax.enterprise.context.RequestScoped; import javax.enterprise.context.RequestScoped;
/** /**
@ -37,4 +39,9 @@ public class MembershipRepository
return membership.getMembershipId() == 0; return membership.getMembershipId() == 0;
} }
@Override
public void initNewEntity(final Membership membership) {
membership.setUuid(UUID.randomUUID().toString());
}
} }

View File

@ -0,0 +1,30 @@
alter table SCI_TYPES_DEPARTMENT.DEPARTMENT_CONTACTS
add column uuid varchar(255);
update SCI_TYPES_DEPARTMENT.DEPARTMENT_CONTACTS set uuid = random_uuid();
alter table SCI_TYPES_DEPARTMENT.DEPARTMENT_CONTACTS
alter column uuid set not null;
alter table SCI_TYPES_DEPARTMENT.DEPARTMENT_CONTACTS
add constraint UK_cj8lfjkv543vx69md42sk1voy unique (uuid);
alter table SCI_TYPES_DEPARTMENT.DEPARTMENT_CONTACTS_AUD
add column uuid varchar(255);
alter table SCI_TYPES_DEPARTMENT.DEPARTMENT_MEMBERSHIPS
add column uuid varchar(255);
update SCI_TYPES_DEPARTMENT.DEPARTMENT_MEMBERSHIPS set uuid = random_uuid();
alter table SCI_TYPES_DEPARTMENT.DEPARTMENT_MEMBERSHIPS
alter column uuid set not null;
alter table SCI_TYPES_DEPARTMENT.DEPARTMENT_MEMBERSHIPS
add constraint UK_eam1w4v274hfskf9o68q7whho unique (uuid);
alter table SCI_TYPES_DEPARTMENT.DEPARTMENT_MEMBERSHIPS_AUD
add column uuid varchar(255);
alter table SCI_TYPES_DEPARTMENT.DEPARTMENT_PROJECTS
add column uuid varchar(255);
update SCI_TYPES_DEPARTMENT.DEPARTMENT_PROJECTS set uuid = random_uuid();
alter table SCI_TYPES_DEPARTMENT.DEPARTMENT_PROJECTS
alter column uuid set not null;
alter table SCI_TYPES_DEPARTMENT.DEPARTMENT_PROJECTS
add constraint UK_nvmvbgwo422wsh4td2jcx6cv7 unique (uuid);
alter table SCI_TYPES_DEPARTMENT.DEPARTMENT_PROJECTS_AUD
add column uuid varchar(255);

View File

@ -0,0 +1,30 @@
alter table SCI_TYPES_DEPARTMENT.DEPARTMENT_CONTACTS
add column uuid varchar(255);
update SCI_TYPES_DEPARTMENT.DEPARTMENT_CONTACTS set uuid = gen_random_uuid();
alter table SCI_TYPES_DEPARTMENT.DEPARTMENT_CONTACTS
alter column uuid set not null;
alter table SCI_TYPES_DEPARTMENT.DEPARTMENT_CONTACTS
add constraint UK_cj8lfjkv543vx69md42sk1voy unique (uuid);
alter table SCI_TYPES_DEPARTMENT.DEPARTMENT_CONTACTS_AUD
add column uuid varchar(255);
alter table SCI_TYPES_DEPARTMENT.DEPARTMENT_MEMBERSHIPS
add column uuid varchar(255);
update SCI_TYPES_DEPARTMENT.DEPARTMENT_MEMBERSHIPS set uuid = gen_random_uuid();
alter table SCI_TYPES_DEPARTMENT.DEPARTMENT_MEMBERSHIPS
alter column uuid set not null;
alter table SCI_TYPES_DEPARTMENT.DEPARTMENT_MEMBERSHIPS
add constraint UK_eam1w4v274hfskf9o68q7whho unique (uuid);
alter table SCI_TYPES_DEPARTMENT.DEPARTMENT_MEMBERSHIPS_AUD
add column uuid varchar(255);
alter table SCI_TYPES_DEPARTMENT.DEPARTMENT_PROJECTS
add column uuid varchar(255);
update SCI_TYPES_DEPARTMENT.DEPARTMENT_PROJECTS set uuid = gen_random_uuid();
alter table SCI_TYPES_DEPARTMENT.DEPARTMENT_PROJECTS
alter column uuid set not null;
alter table SCI_TYPES_DEPARTMENT.DEPARTMENT_PROJECTS
add constraint UK_nvmvbgwo422wsh4td2jcx6cv7 unique (uuid);
alter table SCI_TYPES_DEPARTMENT.DEPARTMENT_PROJECTS_AUD
add column uuid varchar(255);

View File

@ -335,6 +335,13 @@
<groupId>org.wildfly.plugins</groupId> <groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-jar-maven-plugin</artifactId> <artifactId>wildfly-jar-maven-plugin</artifactId>
<configuration> <configuration>
<cliSessions>
<cli-session>
<script-files>
<script>./set-transaction-timeout.cli</script>
</script-files>
</cli-session>
</cliSessions>
<jvmArguments> <jvmArguments>
<arg>-agentlib:jdwp=transport=dt_socket,server=y,suspend=${libreccm.debug.suspend},address=${libreccm.debug.port}</arg> <arg>-agentlib:jdwp=transport=dt_socket,server=y,suspend=${libreccm.debug.suspend},address=${libreccm.debug.port}</arg>
</jvmArguments> </jvmArguments>

View File

@ -0,0 +1 @@
/subsystem=transactions:write-attribute(name=default-timeout,value=3600)