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-94f89814c4df
parent
0a5ca7025d
commit
f69a9e3e4d
|
|
@ -54,6 +54,7 @@ import javax.persistence.OneToOne;
|
|||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import org.hibernate.search.annotations.IndexedEmbedded;
|
||||
|
||||
import static org.librecms.CmsConstants.*;
|
||||
|
||||
|
|
@ -197,7 +198,7 @@ public class ContentItem extends CcmObject implements Serializable,
|
|||
}
|
||||
)
|
||||
)
|
||||
// @Field
|
||||
@IndexedEmbedded
|
||||
private LocalizedString title;
|
||||
|
||||
/**
|
||||
|
|
@ -211,7 +212,7 @@ public class ContentItem extends CcmObject implements Serializable,
|
|||
joinColumns = {
|
||||
@JoinColumn(name = "OBJECT_ID")}
|
||||
))
|
||||
// @Field
|
||||
@IndexedEmbedded
|
||||
private LocalizedString description;
|
||||
|
||||
/**
|
||||
|
|
@ -219,7 +220,7 @@ public class ContentItem extends CcmObject implements Serializable,
|
|||
*/
|
||||
@Column(name = "VERSION")
|
||||
@Enumerated(EnumType.STRING)
|
||||
// @Field
|
||||
@Field
|
||||
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.FieldBridge;
|
||||
import org.hibernate.search.annotations.IndexedEmbedded;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@OneToMany(mappedBy = "object")
|
||||
@IndexedEmbedded(includePaths = {"grantedPrivilege", "grantee.name"})
|
||||
@XmlElementWrapper(name = "permissions", namespace = CORE_XML_NS)
|
||||
@XmlElement(name = "permission", namespace = CORE_XML_NS)
|
||||
@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.XmlRootElement;
|
||||
import org.hibernate.annotations.Type;
|
||||
import org.hibernate.search.annotations.Field;
|
||||
|
||||
/**
|
||||
* A helper class for localisable string properties. This class is declared as
|
||||
|
|
@ -63,6 +64,7 @@ public class LocalizedString implements Serializable {
|
|||
@Basic
|
||||
@Lob
|
||||
@Type(type = "org.hibernate.type.TextType")
|
||||
@Field
|
||||
@XmlElementWrapper(name = "values", namespace = L10N_XML_NS)
|
||||
@XmlElement(name = "value", namespace = L10N_XML_NS)
|
||||
private Map<Locale, String> values;
|
||||
|
|
|
|||
|
|
@ -42,6 +42,9 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
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.DB_SCHEMA;
|
||||
|
|
@ -90,6 +93,7 @@ public class Permission implements Serializable, Portable {
|
|||
* The granted privilege.
|
||||
*/
|
||||
@Column(name = "granted_privilege")
|
||||
@Field
|
||||
@XmlElement(name = "privilege", namespace = CORE_XML_NS)
|
||||
private String grantedPrivilege;
|
||||
|
||||
|
|
@ -98,6 +102,7 @@ public class Permission implements Serializable, Portable {
|
|||
*/
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "OBJECT_ID")
|
||||
@ContainedIn
|
||||
@JsonManagedReference(value = "permission-object")
|
||||
private CcmObject object;
|
||||
|
||||
|
|
@ -105,6 +110,7 @@ public class Permission implements Serializable, Portable {
|
|||
* The role to which the permission is granted.
|
||||
*/
|
||||
@ManyToOne
|
||||
@IndexedEmbedded
|
||||
@JoinColumn(name = "GRANTEE_ID")
|
||||
@JsonManagedReference(value = "permission-role")
|
||||
private Role grantee;
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ import java.util.HashSet;
|
|||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
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.DB_SCHEMA;
|
||||
|
|
@ -140,6 +141,7 @@ public class Role implements Serializable, Portable {
|
|||
* numbers 0 to 9, the {@code -} (dash) and the {@code _} (underscore).
|
||||
*/
|
||||
@Column(name = "NAME", length = 512, nullable = false)
|
||||
@Field
|
||||
@NotBlank
|
||||
@Pattern(regexp = "[a-zA-Z0-9\\-_]*")
|
||||
@XmlElement(name = "name", namespace = CORE_XML_NS)
|
||||
|
|
|
|||
Loading…
Reference in New Issue