CCM NG: Hibernate Search annotations for CcmObject, ContentItem and some associated objects
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4494 8810af33-2d31-482b-a856-94f89814c4dfccm-docs
parent
e10ab7704e
commit
c1e471e87d
|
|
@ -54,6 +54,7 @@ import javax.persistence.OneToOne;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import javax.persistence.Temporal;
|
import javax.persistence.Temporal;
|
||||||
import javax.persistence.TemporalType;
|
import javax.persistence.TemporalType;
|
||||||
|
import org.hibernate.search.annotations.IndexedEmbedded;
|
||||||
|
|
||||||
import static org.librecms.CmsConstants.*;
|
import static org.librecms.CmsConstants.*;
|
||||||
|
|
||||||
|
|
@ -197,7 +198,7 @@ public class ContentItem extends CcmObject implements Serializable,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
// @Field
|
@IndexedEmbedded
|
||||||
private LocalizedString title;
|
private LocalizedString title;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -211,7 +212,7 @@ public class ContentItem extends CcmObject implements Serializable,
|
||||||
joinColumns = {
|
joinColumns = {
|
||||||
@JoinColumn(name = "OBJECT_ID")}
|
@JoinColumn(name = "OBJECT_ID")}
|
||||||
))
|
))
|
||||||
// @Field
|
@IndexedEmbedded
|
||||||
private LocalizedString description;
|
private LocalizedString description;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -219,7 +220,7 @@ public class ContentItem extends CcmObject implements Serializable,
|
||||||
*/
|
*/
|
||||||
@Column(name = "VERSION")
|
@Column(name = "VERSION")
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
// @Field
|
@Field
|
||||||
private ContentItemVersion version;
|
private ContentItemVersion version;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ import static org.libreccm.core.CoreConstants.DB_SCHEMA;
|
||||||
|
|
||||||
import org.hibernate.search.annotations.Field;
|
import org.hibernate.search.annotations.Field;
|
||||||
import org.hibernate.search.annotations.FieldBridge;
|
import org.hibernate.search.annotations.FieldBridge;
|
||||||
|
import org.hibernate.search.annotations.IndexedEmbedded;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Root class of all entities in LibreCCM which need categorisation and
|
* Root class of all entities in LibreCCM which need categorisation and
|
||||||
|
|
@ -121,6 +122,7 @@ public class CcmObject implements Identifiable, Serializable {
|
||||||
* Permissions granted on this object.
|
* Permissions granted on this object.
|
||||||
*/
|
*/
|
||||||
@OneToMany(mappedBy = "object")
|
@OneToMany(mappedBy = "object")
|
||||||
|
@IndexedEmbedded(includePaths = {"grantedPrivilege", "grantee.name"})
|
||||||
@XmlElementWrapper(name = "permissions", namespace = CORE_XML_NS)
|
@XmlElementWrapper(name = "permissions", namespace = CORE_XML_NS)
|
||||||
@XmlElement(name = "permission", namespace = CORE_XML_NS)
|
@XmlElement(name = "permission", namespace = CORE_XML_NS)
|
||||||
@JsonBackReference(value = "permission-object")
|
@JsonBackReference(value = "permission-object")
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
import org.hibernate.annotations.Type;
|
import org.hibernate.annotations.Type;
|
||||||
|
import org.hibernate.search.annotations.Field;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A helper class for localisable string properties. This class is declared as
|
* A helper class for localisable string properties. This class is declared as
|
||||||
|
|
@ -63,6 +64,7 @@ public class LocalizedString implements Serializable {
|
||||||
@Basic
|
@Basic
|
||||||
@Lob
|
@Lob
|
||||||
@Type(type = "org.hibernate.type.TextType")
|
@Type(type = "org.hibernate.type.TextType")
|
||||||
|
@Field
|
||||||
@XmlElementWrapper(name = "values", namespace = L10N_XML_NS)
|
@XmlElementWrapper(name = "values", namespace = L10N_XML_NS)
|
||||||
@XmlElement(name = "value", namespace = L10N_XML_NS)
|
@XmlElement(name = "value", namespace = L10N_XML_NS)
|
||||||
private Map<Locale, String> values;
|
private Map<Locale, String> values;
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,9 @@ import javax.xml.bind.annotation.XmlRootElement;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import org.hibernate.search.annotations.ContainedIn;
|
||||||
|
import org.hibernate.search.annotations.Field;
|
||||||
|
import org.hibernate.search.annotations.IndexedEmbedded;
|
||||||
|
|
||||||
import static org.libreccm.core.CoreConstants.CORE_XML_NS;
|
import static org.libreccm.core.CoreConstants.CORE_XML_NS;
|
||||||
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
|
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
|
||||||
|
|
@ -90,6 +93,7 @@ public class Permission implements Serializable, Portable {
|
||||||
* The granted privilege.
|
* The granted privilege.
|
||||||
*/
|
*/
|
||||||
@Column(name = "granted_privilege")
|
@Column(name = "granted_privilege")
|
||||||
|
@Field
|
||||||
@XmlElement(name = "privilege", namespace = CORE_XML_NS)
|
@XmlElement(name = "privilege", namespace = CORE_XML_NS)
|
||||||
private String grantedPrivilege;
|
private String grantedPrivilege;
|
||||||
|
|
||||||
|
|
@ -98,6 +102,7 @@ public class Permission implements Serializable, Portable {
|
||||||
*/
|
*/
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "OBJECT_ID")
|
@JoinColumn(name = "OBJECT_ID")
|
||||||
|
@ContainedIn
|
||||||
@JsonManagedReference(value = "permission-object")
|
@JsonManagedReference(value = "permission-object")
|
||||||
private CcmObject object;
|
private CcmObject object;
|
||||||
|
|
||||||
|
|
@ -105,6 +110,7 @@ public class Permission implements Serializable, Portable {
|
||||||
* The role to which the permission is granted.
|
* The role to which the permission is granted.
|
||||||
*/
|
*/
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
|
@IndexedEmbedded
|
||||||
@JoinColumn(name = "GRANTEE_ID")
|
@JoinColumn(name = "GRANTEE_ID")
|
||||||
@JsonManagedReference(value = "permission-role")
|
@JsonManagedReference(value = "permission-role")
|
||||||
private Role grantee;
|
private Role grantee;
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import org.hibernate.search.annotations.Field;
|
||||||
|
|
||||||
import static org.libreccm.core.CoreConstants.CORE_XML_NS;
|
import static org.libreccm.core.CoreConstants.CORE_XML_NS;
|
||||||
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
|
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
|
||||||
|
|
@ -140,6 +141,7 @@ public class Role implements Serializable, Portable {
|
||||||
* numbers 0 to 9, the {@code -} (dash) and the {@code _} (underscore).
|
* numbers 0 to 9, the {@code -} (dash) and the {@code _} (underscore).
|
||||||
*/
|
*/
|
||||||
@Column(name = "NAME", length = 512, nullable = false)
|
@Column(name = "NAME", length = 512, nullable = false)
|
||||||
|
@Field
|
||||||
@NotBlank
|
@NotBlank
|
||||||
@Pattern(regexp = "[a-zA-Z0-9\\-_]*")
|
@Pattern(regexp = "[a-zA-Z0-9\\-_]*")
|
||||||
@XmlElement(name = "name", namespace = CORE_XML_NS)
|
@XmlElement(name = "name", namespace = CORE_XML_NS)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue