CCM NG/ccm-cms: Annotations for Hibernate Search

git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4490 8810af33-2d31-482b-a856-94f89814c4df

Former-commit-id: fa1af66913
pull/2/head
jensp 2016-12-19 15:35:58 +00:00
parent 3545fd665b
commit c8ad4a3a10
2 changed files with 10 additions and 0 deletions

View File

@ -20,6 +20,8 @@ package org.librecms.contentsection;
import org.hibernate.envers.Audited; import org.hibernate.envers.Audited;
import org.hibernate.envers.RelationTargetAuditMode; import org.hibernate.envers.RelationTargetAuditMode;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Indexed;
import org.libreccm.categorization.Categorization; import org.libreccm.categorization.Categorization;
import org.libreccm.core.CcmObject; import org.libreccm.core.CcmObject;
import org.libreccm.l10n.LocalizedString; import org.libreccm.l10n.LocalizedString;
@ -63,6 +65,7 @@ import static org.librecms.CmsConstants.*;
@Entity @Entity
@Audited @Audited
@Table(name = "CONTENT_ITEMS", schema = DB_SCHEMA) @Table(name = "CONTENT_ITEMS", schema = DB_SCHEMA)
@Indexed
@NamedQueries({ @NamedQueries({
@NamedQuery( @NamedQuery(
name = "ContentItem.findByType", name = "ContentItem.findByType",
@ -150,6 +153,7 @@ public class ContentItem extends CcmObject implements Serializable,
private static final long serialVersionUID = 5897287630227129653L; private static final long serialVersionUID = 5897287630227129653L;
@Column(name = "ITEM_UUID", nullable = false) @Column(name = "ITEM_UUID", nullable = false)
@Field
private String itemUuid; private String itemUuid;
/** /**
@ -168,6 +172,7 @@ public class ContentItem extends CcmObject implements Serializable,
} }
) )
) )
@Field
private LocalizedString name; private LocalizedString name;
/** /**
@ -176,6 +181,7 @@ public class ContentItem extends CcmObject implements Serializable,
@OneToOne @OneToOne
@JoinColumn(name = "CONTENT_TYPE_ID") @JoinColumn(name = "CONTENT_TYPE_ID")
@Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED) @Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)
@Field
private ContentType contentType; private ContentType contentType;
/** /**
@ -191,6 +197,7 @@ public class ContentItem extends CcmObject implements Serializable,
} }
) )
) )
@Field
private LocalizedString title; private LocalizedString title;
/** /**
@ -204,6 +211,7 @@ public class ContentItem extends CcmObject implements Serializable,
joinColumns = { joinColumns = {
@JoinColumn(name = "OBJECT_ID")} @JoinColumn(name = "OBJECT_ID")}
)) ))
@Field
private LocalizedString description; private LocalizedString description;
/** /**
@ -211,6 +219,7 @@ public class ContentItem extends CcmObject implements Serializable,
*/ */
@Column(name = "VERSION") @Column(name = "VERSION")
@Enumerated(EnumType.STRING) @Enumerated(EnumType.STRING)
@Field
private ContentItemVersion version; private ContentItemVersion version;
/** /**

View File

@ -121,6 +121,7 @@ public class CcmObject implements Identifiable, Serializable {
* Permissions granted on this object. * Permissions granted on this object.
*/ */
@OneToMany(mappedBy = "object") @OneToMany(mappedBy = "object")
@Field
@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")