PersonNames is no longer an embeddedable entity.
parent
6e1f390a34
commit
1b10e695b7
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "@librecms/ccm-cms",
|
"name": "@librecms/ccm-cms",
|
||||||
"version": "7.0.0-SNAPSHOT.2023-01-28T095804",
|
"version": "7.0.0-SNAPSHOT.2023-01-28T144335",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@librecms/ccm-cms",
|
"name": "@librecms/ccm-cms",
|
||||||
"version": "7.0.0-SNAPSHOT.2023-01-28T095804",
|
"version": "7.0.0-SNAPSHOT.2023-01-28T144335",
|
||||||
"license": "LGPL-3.0-or-later",
|
"license": "LGPL-3.0-or-later",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tiptap/core": "^2.0.0-beta.127",
|
"@tiptap/core": "^2.0.0-beta.127",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@librecms/ccm-cms",
|
"name": "@librecms/ccm-cms",
|
||||||
"version": "7.0.0-SNAPSHOT.2023-01-28T095804",
|
"version": "7.0.0-SNAPSHOT.2023-01-28T144335",
|
||||||
"description": "JavaScript stuff for ccm-cms",
|
"description": "JavaScript stuff for ccm-cms",
|
||||||
"main": "target/generated-resources/assets/@content-sections/cms-admin.js",
|
"main": "target/generated-resources/assets/@content-sections/cms-admin.js",
|
||||||
"types": "target/generated-resources/assets/@content-sections/cms-admin.d.ts",
|
"types": "target/generated-resources/assets/@content-sections/cms-admin.d.ts",
|
||||||
|
|
|
||||||
|
|
@ -106,12 +106,10 @@ public class ContactEntry implements Serializable {
|
||||||
// this.key = key;
|
// this.key = key;
|
||||||
// }
|
// }
|
||||||
public ContactEntryKey getKey() {
|
public ContactEntryKey getKey() {
|
||||||
|
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setKey(final ContactEntryKey key) {
|
public void setKey(final ContactEntryKey key) {
|
||||||
|
|
||||||
this.key = key;
|
this.key = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -135,7 +133,6 @@ public class ContactEntry implements Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object obj) {
|
public boolean equals(final Object obj) {
|
||||||
|
|
||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@ package org.librecms.assets;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||||
|
import org.hibernate.annotations.Cascade;
|
||||||
|
import org.hibernate.annotations.CascadeType;
|
||||||
import org.hibernate.envers.Audited;
|
import org.hibernate.envers.Audited;
|
||||||
import org.librecms.ui.contentsections.assets.MvcAssetEditKit;
|
import org.librecms.ui.contentsections.assets.MvcAssetEditKit;
|
||||||
import org.librecms.ui.contentsections.assets.PersonCreateStep;
|
import org.librecms.ui.contentsections.assets.PersonCreateStep;
|
||||||
|
|
@ -34,10 +36,12 @@ import java.util.Objects;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.ElementCollection;
|
import javax.persistence.ElementCollection;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.FetchType;
|
||||||
import javax.persistence.JoinColumn;
|
import javax.persistence.JoinColumn;
|
||||||
import javax.persistence.JoinTable;
|
import javax.persistence.JoinTable;
|
||||||
import javax.persistence.NamedQueries;
|
import javax.persistence.NamedQueries;
|
||||||
import javax.persistence.NamedQuery;
|
import javax.persistence.NamedQuery;
|
||||||
|
import javax.persistence.OneToMany;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import static org.librecms.CmsConstants.*;
|
import static org.librecms.CmsConstants.*;
|
||||||
|
|
@ -77,14 +81,17 @@ public class Person extends ContactableEntity {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@ElementCollection
|
// @ElementCollection(fetch = FetchType.EAGER)
|
||||||
@JoinTable(
|
// @JoinTable(
|
||||||
joinColumns = {
|
// joinColumns = {
|
||||||
@JoinColumn(name = "PERSON_ID")
|
// @JoinColumn(name = "PERSON_ID")
|
||||||
},
|
// },
|
||||||
name = "PERSON_NAMES",
|
// name = "PERSON_NAMES",
|
||||||
schema = DB_SCHEMA
|
// schema = DB_SCHEMA
|
||||||
)
|
// )
|
||||||
|
@OneToMany
|
||||||
|
@JoinColumn(name = "PERSON_ID")
|
||||||
|
@Cascade(CascadeType.ALL)
|
||||||
private List<PersonName> personNames;
|
private List<PersonName> personNames;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -18,21 +18,36 @@
|
||||||
*/
|
*/
|
||||||
package org.librecms.assets;
|
package org.librecms.assets;
|
||||||
|
|
||||||
|
import org.hibernate.envers.Audited;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Embeddable;
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
import static org.librecms.CmsConstants.DB_SCHEMA;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
@Embeddable
|
@Entity
|
||||||
|
@Audited
|
||||||
|
@Table(name = "PERSON_NAMES", schema = DB_SCHEMA)
|
||||||
public class PersonName implements Serializable {
|
public class PersonName implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Column(name ="PERSON_NAME_ID")
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||||
|
private long personNameId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The surname/familyname of the person
|
* The surname/familyname of the person
|
||||||
*/
|
*/
|
||||||
|
|
@ -59,6 +74,14 @@ public class PersonName implements Serializable {
|
||||||
@Column(name = "SUFFIX")
|
@Column(name = "SUFFIX")
|
||||||
private String suffix;
|
private String suffix;
|
||||||
|
|
||||||
|
public long getPersonNameId() {
|
||||||
|
return personNameId;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setPersonNameId(final long personNameId) {
|
||||||
|
this.personNameId = personNameId;
|
||||||
|
}
|
||||||
|
|
||||||
public String getSurname() {
|
public String getSurname() {
|
||||||
return surname;
|
return surname;
|
||||||
}
|
}
|
||||||
|
|
@ -94,6 +117,7 @@ public class PersonName implements Serializable {
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = 5;
|
int hash = 5;
|
||||||
|
hash = 79 * hash + (int) (personNameId ^ (personNameId >>> 32));
|
||||||
hash = 79 * hash + Objects.hashCode(surname);
|
hash = 79 * hash + Objects.hashCode(surname);
|
||||||
hash = 79 * hash + Objects.hashCode(givenName);
|
hash = 79 * hash + Objects.hashCode(givenName);
|
||||||
hash = 79 * hash + Objects.hashCode(prefix);
|
hash = 79 * hash + Objects.hashCode(prefix);
|
||||||
|
|
@ -103,7 +127,6 @@ public class PersonName implements Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object obj) {
|
public boolean equals(final Object obj) {
|
||||||
|
|
||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -117,6 +140,9 @@ public class PersonName implements Serializable {
|
||||||
if (!other.canEqual(this)) {
|
if (!other.canEqual(this)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (personNameId != other.getPersonNameId()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (!Objects.equals(surname, other.getSurname())) {
|
if (!Objects.equals(surname, other.getSurname())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -143,12 +169,14 @@ public class PersonName implements Serializable {
|
||||||
|
|
||||||
return String.format(
|
return String.format(
|
||||||
"%s{ "
|
"%s{ "
|
||||||
|
+ "personNameId = %d, "
|
||||||
+ "surname = \"%s\", "
|
+ "surname = \"%s\", "
|
||||||
+ "givenName = \"%s\", "
|
+ "givenName = \"%s\", "
|
||||||
+ "prefix = \"%s\", "
|
+ "prefix = \"%s\", "
|
||||||
+ "suffix = \"%s\"%s"
|
+ "suffix = \"%s\"%s"
|
||||||
+ " }",
|
+ " }",
|
||||||
super.toString(),
|
super.toString(),
|
||||||
|
personNameId,
|
||||||
surname,
|
surname,
|
||||||
givenName,
|
givenName,
|
||||||
prefix,
|
prefix,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
alter table ccm_cms.person_names add column person_name_id int8;
|
||||||
|
update ccm_cms.person_names set person_name_id = nextval('hibernate_sequence');
|
||||||
|
alter table ccm_cms.person_names alter COLUMN person_name_id set not null;
|
||||||
|
alter table ccm_cms.person_names add primary key (person_name_id);
|
||||||
|
|
||||||
|
alter table ccm_cms.person_names_aud add column person_name_id int8;
|
||||||
|
update ccm_cms.person_names_aud set person_name_id = (select person_name_id from ccm_cms.person_names where ccm_cms.person_names.person_id = ccm_cms.person_names_aud.person_id);
|
||||||
|
alter table ccm_cms.person_names_aud drop constraint person_names_aud_pkey;
|
||||||
|
alter table ccm_cms.person_names_aud add primary key (person_name_id, rev, revtype);
|
||||||
|
|
||||||
|
create table CCM_CMS.Person_PersonName_AUD (
|
||||||
|
REV int4 not null,
|
||||||
|
PERSON_ID int8 not null,
|
||||||
|
PERSON_NAME_ID int8 not null,
|
||||||
|
REVTYPE int2,
|
||||||
|
REVEND int4,
|
||||||
|
primary key (REV, REVTYPE, PERSON_ID, PERSON_NAME_ID)
|
||||||
|
);
|
||||||
|
insert into ccm_cms.person_personname_aud (rev, person_id, person_name_id, revtype, revend) (select rev, person_id, person_name_id, revtype, revend from ccm_cms.person_names_aud);
|
||||||
|
|
||||||
|
alter table ccm_cms.person_names_aud drop column person_id;
|
||||||
|
|
||||||
|
alter table CCM_CMS.Person_PersonName_AUD
|
||||||
|
add constraint FKljtnu2oi4hkqwrmw8n0jhegp7
|
||||||
|
foreign key (REV)
|
||||||
|
references CCM_CORE.CCM_REVISIONS;
|
||||||
|
|
||||||
|
alter table CCM_CMS.Person_PersonName_AUD
|
||||||
|
add constraint FKnc3guy1nhw5pa0b62hdmqwd6k
|
||||||
|
foreign key (REVEND)
|
||||||
|
references CCM_CORE.CCM_REVISIONS;
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
alter table ccm_cms.person_names add column person_name_id int8;
|
||||||
|
update ccm_cms.person_names set person_name_id = nextval('hibernate_sequence');
|
||||||
|
alter table ccm_cms.person_names alter COLUMN person_name_id set not null;
|
||||||
|
alter table ccm_cms.person_names add primary key (person_name_id);
|
||||||
|
|
||||||
|
alter table ccm_cms.person_names_aud add column person_name_id int8;
|
||||||
|
update ccm_cms.person_names_aud set person_name_id = (select person_name_id from ccm_cms.person_names where ccm_cms.person_names.person_id = ccm_cms.person_names_aud.person_id);
|
||||||
|
alter table ccm_cms.person_names_aud drop constraint person_names_aud_pkey;
|
||||||
|
alter table ccm_cms.person_names_aud add primary key (person_name_id, rev, revtype);
|
||||||
|
|
||||||
|
create table CCM_CMS.Person_PersonName_AUD (
|
||||||
|
REV int4 not null,
|
||||||
|
PERSON_ID int8 not null,
|
||||||
|
PERSON_NAME_ID int8 not null,
|
||||||
|
REVTYPE int2,
|
||||||
|
REVEND int4,
|
||||||
|
primary key (REV, REVTYPE, PERSON_ID, PERSON_NAME_ID)
|
||||||
|
);
|
||||||
|
insert into ccm_cms.person_personname_aud (rev, person_id, person_name_id, revtype, revend) (select rev, person_id, person_name_id, revtype, revend from ccm_cms.person_names_aud);
|
||||||
|
|
||||||
|
alter table ccm_cms.person_names_aud drop column person_id;
|
||||||
|
|
||||||
|
alter table CCM_CMS.Person_PersonName_AUD
|
||||||
|
add constraint FKljtnu2oi4hkqwrmw8n0jhegp7
|
||||||
|
foreign key (REV)
|
||||||
|
references CCM_CORE.CCM_REVISIONS;
|
||||||
|
|
||||||
|
alter table CCM_CMS.Person_PersonName_AUD
|
||||||
|
add constraint FKnc3guy1nhw5pa0b62hdmqwd6k
|
||||||
|
foreign key (REVEND)
|
||||||
|
references CCM_CORE.CCM_REVISIONS;
|
||||||
|
|
@ -18,12 +18,22 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.configuration;
|
package org.libreccm.configuration;
|
||||||
|
|
||||||
import javax.persistence.*;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
|
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.persistence.ElementCollection;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.FetchType;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.JoinTable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A setting class for storing a set of strings. This can be used to generate
|
* A setting class for storing a set of strings. This can be used to generate
|
||||||
* enums which can be configured by the administrator.
|
* enums which can be configured by the administrator.
|
||||||
|
|
|
||||||
|
|
@ -149,8 +149,6 @@ public abstract class AbstractEntityImExporter<T extends Exportable> {
|
||||||
*
|
*
|
||||||
* @param data The entity data to import
|
* @param data The entity data to import
|
||||||
*
|
*
|
||||||
* @return The imported entity.
|
|
||||||
*
|
|
||||||
* @throws ImportExpection If the import fails.
|
* @throws ImportExpection If the import fails.
|
||||||
*
|
*
|
||||||
* @see #findExistingEntity(java.lang.String)
|
* @see #findExistingEntity(java.lang.String)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue