XML Mapping Informations

Jens Pelzetter 2019-11-27 20:31:38 +01:00
parent ed13e31429
commit 29c3cf7a72
2 changed files with 22 additions and 0 deletions

View File

@ -18,6 +18,8 @@
*/ */
package org.librecms.contentsection; package org.librecms.contentsection;
import com.fasterxml.jackson.annotation.JsonIgnore;
import static org.librecms.CmsConstants.*; import static org.librecms.CmsConstants.*;
import org.hibernate.envers.Audited; import org.hibernate.envers.Audited;
@ -60,6 +62,8 @@ import org.libreccm.imexport.Exportable;
import org.librecms.contentsection.privileges.ItemPrivileges; import org.librecms.contentsection.privileges.ItemPrivileges;
import javax.persistence.OrderBy; import javax.persistence.OrderBy;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
/** /**
@ -601,6 +605,7 @@ public class ContentItem extends CcmObject implements Serializable, Exportable {
@Column(name = "ITEM_UUID", nullable = false) @Column(name = "ITEM_UUID", nullable = false)
@Field @Field
@XmlElement(name = "item-uuid", namespace = CMS_XML_NS)
private String itemUuid; private String itemUuid;
/** /**
@ -620,6 +625,7 @@ public class ContentItem extends CcmObject implements Serializable, Exportable {
) )
) )
// @Field // @Field
@XmlElement(name = "name", namespace = CMS_XML_NS)
private LocalizedString name; private LocalizedString name;
/** /**
@ -629,6 +635,7 @@ public class ContentItem extends CcmObject implements Serializable, Exportable {
@JoinColumn(name = "CONTENT_TYPE_ID") @JoinColumn(name = "CONTENT_TYPE_ID")
@Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED) @Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)
// @Field // @Field
@XmlElement(name = "content-type", namespace = CMS_XML_NS)
private ContentType contentType; private ContentType contentType;
/** /**
@ -645,6 +652,7 @@ public class ContentItem extends CcmObject implements Serializable, Exportable {
) )
) )
@IndexedEmbedded @IndexedEmbedded
@XmlElement(name = "title", namespace = CMS_XML_NS)
private LocalizedString title; private LocalizedString title;
/** /**
@ -659,6 +667,7 @@ public class ContentItem extends CcmObject implements Serializable, Exportable {
@JoinColumn(name = "OBJECT_ID")} @JoinColumn(name = "OBJECT_ID")}
)) ))
@IndexedEmbedded @IndexedEmbedded
@XmlElement(name = "description", namespace = CMS_XML_NS)
private LocalizedString description; private LocalizedString description;
/** /**
@ -667,6 +676,7 @@ public class ContentItem extends CcmObject implements Serializable, Exportable {
@Column(name = "VERSION") @Column(name = "VERSION")
@Enumerated(EnumType.STRING) @Enumerated(EnumType.STRING)
@Field @Field
@XmlElement(name = "version", namespace = CMS_XML_NS)
private ContentItemVersion version; private ContentItemVersion version;
/** /**
@ -674,6 +684,7 @@ public class ContentItem extends CcmObject implements Serializable, Exportable {
*/ */
@Column(name = "LAUNCH_DATE") @Column(name = "LAUNCH_DATE")
@Temporal(TemporalType.DATE) @Temporal(TemporalType.DATE)
@XmlElement(name = "launch-date", namespace = CMS_XML_NS)
private Date launchDate; private Date launchDate;
/** /**
@ -685,16 +696,20 @@ public class ContentItem extends CcmObject implements Serializable, Exportable {
@OneToMany(mappedBy = "item", fetch = FetchType.LAZY) @OneToMany(mappedBy = "item", fetch = FetchType.LAZY)
@OrderBy("order ASC") @OrderBy("order ASC")
@XmlElementWrapper(name = "attachments", namespace = CMS_XML_NS)
@JsonIgnore
private List<AttachmentList> attachments; private List<AttachmentList> attachments;
@OneToOne() @OneToOne()
@JoinColumn(name = "LIFECYCLE_ID") @JoinColumn(name = "LIFECYCLE_ID")
@Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED) @Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)
@XmlElement(name = "lifecycle", namespace = CMS_XML_NS)
private Lifecycle lifecycle; private Lifecycle lifecycle;
@OneToOne(fetch = FetchType.LAZY) @OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "WORKFLOW_ID") @JoinColumn(name = "WORKFLOW_ID")
@Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED) @Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)
@XmlElement(name = "workflow", namespace = CMS_XML_NS)
private Workflow workflow; private Workflow workflow;
/** /**
@ -707,6 +722,7 @@ public class ContentItem extends CcmObject implements Serializable, Exportable {
@Column(name = "CREATION_DATE") @Column(name = "CREATION_DATE")
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
@NotAudited @NotAudited
@XmlElement(name = "creation-date", namespace = CMS_XML_NS)
private Date creationDate; private Date creationDate;
/** /**
@ -719,6 +735,7 @@ public class ContentItem extends CcmObject implements Serializable, Exportable {
@Column(name = "LAST_MODIFIED") @Column(name = "LAST_MODIFIED")
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
@NotAudited @NotAudited
@XmlElement(name = "last-modified", namespace = CMS_XML_NS)
private Date lastModified; private Date lastModified;
/** /**
@ -733,6 +750,7 @@ public class ContentItem extends CcmObject implements Serializable, Exportable {
*/ */
@Column(name = "CREATION_USER_NAME") @Column(name = "CREATION_USER_NAME")
@NotAudited @NotAudited
@XmlElement(name = "creation-username", namespace = CMS_XML_NS)
private String creationUserName; private String creationUserName;
/** /**
@ -747,6 +765,7 @@ public class ContentItem extends CcmObject implements Serializable, Exportable {
*/ */
@Column(name = "LAST_MODIFYING_USER_NAME") @Column(name = "LAST_MODIFYING_USER_NAME")
@NotAudited @NotAudited
@XmlElement(name = "last-modifying-username", namespace = CMS_XML_NS)
private String lastModifyingUserName; private String lastModifyingUserName;
public ContentItem() { public ContentItem() {

View File

@ -40,6 +40,8 @@ import static org.librecms.CmsConstants.*;
import org.librecms.contentsection.ContentItem; import org.librecms.contentsection.ContentItem;
import javax.xml.bind.annotation.XmlRootElement;
/** /**
* @author <a href="mailto:konerman@tzi.de">Alexander Konermann</a> * @author <a href="mailto:konerman@tzi.de">Alexander Konermann</a>
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
@ -69,6 +71,7 @@ import org.librecms.contentsection.ContentItem;
order = 2 order = 2
) )
}) })
@XmlRootElement(name = "article", namespace = CMS_XML_NS)
public class Article extends ContentItem implements Serializable { public class Article extends ContentItem implements Serializable {
private static final long serialVersionUID = 3832010184748095822L; private static final long serialVersionUID = 3832010184748095822L;