View Javadoc

1   /**
2    * 
3    */
4   package de.tivsource.page.entity.subsumption;
5   
6   import java.util.SortedSet;
7   
8   import javax.persistence.Basic;
9   import javax.persistence.CascadeType;
10  import javax.persistence.Entity;
11  import javax.persistence.FetchType;
12  import javax.persistence.ManyToMany;
13  import javax.persistence.Table;
14  
15  import org.hibernate.annotations.SortNatural;
16  import org.hibernate.envers.Audited;
17  
18  import de.tivsource.page.entity.contentitem.ContentItem;
19  
20  /**
21   * @author Marc Michele
22   *
23   */
24  @Audited
25  @Entity
26  @Table(name = "Subsumption")
27  public class Subsumption extends ContentItem {
28  
29      @Basic
30      @org.hibernate.annotations.Type(type = "yes_no")
31      private Boolean showTitles = true;
32  
33      @Basic
34      @org.hibernate.annotations.Type(type = "yes_no")
35      private Boolean showDescriptions = true;
36  
37      @Basic
38      @org.hibernate.annotations.Type(type = "yes_no")
39      private Boolean showDates = true;
40  
41      @Basic
42      @org.hibernate.annotations.Type(type = "yes_no")
43      private Boolean showPictures = true;
44  
45      @ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.EAGER, targetEntity = ContentItem.class)
46      @SortNatural
47      private SortedSet<ContentItem> contentItems;
48  
49      /**
50       * @return the showTitles
51       */
52      public Boolean getShowTitles() {
53          return showTitles;
54      }
55  
56      /**
57       * @param showTitles the showTitles to set
58       */
59      public void setShowTitles(Boolean showTitles) {
60          this.showTitles = showTitles;
61      }
62  
63      /**
64       * @return the showDescriptions
65       */
66      public Boolean getShowDescriptions() {
67          return showDescriptions;
68      }
69  
70      /**
71       * @param showDescriptions the showDescriptions to set
72       */
73      public void setShowDescriptions(Boolean showDescriptions) {
74          this.showDescriptions = showDescriptions;
75      }
76  
77      /**
78       * @return the showDates
79       */
80      public Boolean getShowDates() {
81          return showDates;
82      }
83  
84      /**
85       * @param showDates the showDates to set
86       */
87      public void setShowDates(Boolean showDates) {
88          this.showDates = showDates;
89      }
90  
91      /**
92       * @return the showPictures
93       */
94      public Boolean getShowPictures() {
95          return showPictures;
96      }
97  
98      /**
99       * @param showPictures the showPictures to set
100      */
101     public void setShowPictures(Boolean showPictures) {
102         this.showPictures = showPictures;
103     }
104 
105     /**
106      * @return the contentItems
107      */
108     public SortedSet<ContentItem> getContentItems() {
109         return contentItems;
110     }
111 
112     /**
113      * @param contentItems the contentItems to set
114      */
115     public void setContentItems(SortedSet<ContentItem> contentItems) {
116         this.contentItems = contentItems;
117     }
118 
119     /* (non-Javadoc)
120      * @see de.tivsource.page.entity.contentitem.ContentItem#getUrl()
121      */
122     @Override
123     public String getUrl() {
124         StringBuffer stringBuffer = new StringBuffer();
125         stringBuffer.append("/");
126         stringBuffer.append("subsumption/");
127         stringBuffer.append(this.getTechnical());
128         stringBuffer.append("/");
129         stringBuffer.append("index.html");
130         return stringBuffer.toString();
131     }
132 
133     @Override
134     public int compareTo(ContentItem o) {
135         if (o.getCreated().after(this.getCreated())) {
136             return 1;
137         } else if (o.getCreated().before(this.getCreated())) {
138             return -1;
139         } else {
140             return o.getUuid().compareTo(this.getUuid());
141         }
142     }
143 
144 }// Ende class