Mercurial > hg > openmind
view src/main/java/org/mpi/openmind/repository/bo/ViewerAttribute.java @ 56:467843399e70
Fixs for lost relation, when editing clone entities in parallel
author | jurzua <jjjurzua@hotmail.com> |
---|---|
date | Mon, 28 Nov 2016 14:26:10 +0100 |
parents | c23ae718fdd3 |
children |
line wrap: on
line source
package org.mpi.openmind.repository.bo; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.PrePersist; import javax.persistence.PreUpdate; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import cl.maps.duplex.DuplexKey; /** * * This class is used to generate automatically view pages. * * possible values for term: * WITNESS|source:is_part_of|CODEX:identifier * * @author jurzua */ @Entity @Table(name="viewer_attribute") public class ViewerAttribute implements Cloneable, Comparable<ViewerAttribute>{ public static Integer SHOW_ALWAYS = 0; public static Integer SHOW_WITH_CONTENT = 1; public static Integer HIDE = 2; public static String ALIGN_LEFT = "left"; public static String ALIGN_RIGHT = "right"; public static String ALIGN_CENTER = "center"; public static Integer CONTENT_TEXT = 0; public static Integer CONTENT_DATE = 1; @Override public Object clone() throws CloneNotSupportedException { return super.clone(); } @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name="id") private Long id; @Column(name="page", columnDefinition="varchar(255)") private Long page; @Column(name="label", columnDefinition="varchar(255)") private String label; @Column(name="display_mode") private Integer displayMode = SHOW_WITH_CONTENT; @Column(name="text_align") private String textAlign = ALIGN_RIGHT; @Column(name="query", columnDefinition="varchar(255)") private String query; @Column(name="position") private Integer index; @Column(name="user") private String user; @Column(name="content_type") private Integer contentType; @Temporal(TemporalType.TIMESTAMP) @Column(name="created") private Date created; @Temporal(TemporalType.TIMESTAMP) @Column(name="updated") private Date updated; public boolean isPersistent(){ return (this.id != null); } public DuplexKey<Long, Long> getKey(){ return new DuplexKey<Long, Long>(this.page, this.id); } @PrePersist protected void onCreate() { updated = created = new Date(); } @PreUpdate protected void onUpdate() { updated = new Date(); } public Long getPage() { return page; } public void setPage(Long page) { this.page = page; } public String getLabel() { return label; } public void setLabel(String label) { this.label = label; } public Integer getDisplayMode() { return displayMode; } public void setDisplayMode(Integer displayMode) { this.displayMode = displayMode; } public String getQuery() { return query; } public void setQuery(String query) { this.query = query; } public Integer getIndex() { return index; } public void setIndex(Integer index) { this.index = index; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getUser() { return user; } public void setUser(String user) { this.user = user; } public int compareTo(ViewerAttribute o) { return this.index - o.index; } public Date getCreated() { return created; } public void setCreated(Date created) { this.created = created; } public Date getUpdated() { return updated; } public void setUpdated(Date updated) { this.updated = updated; } public String getTextAlign() { return textAlign; } public void setTextAlign(String textAlign) { this.textAlign = textAlign; } public Integer getContentType() { return contentType; } public void setContentType(Integer contentType) { this.contentType = contentType; } }