BrightSide Workbench Full Report + Source Code
StarIt.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2013 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Affero General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Affero General Public License for more details.
14  *
15  * You should have received a copy of the GNU Affero General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 package org.turro.contacts;
20 
21 import java.io.Serializable;
22 import java.util.Date;
23 import javax.persistence.Column;
24 import javax.persistence.Entity;
25 import javax.persistence.GeneratedValue;
26 import javax.persistence.Id;
27 import javax.persistence.JoinColumn;
28 import javax.persistence.ManyToOne;
29 import javax.persistence.Temporal;
30 import org.turro.entities.Entities;
31 import org.turro.entities.IElephantEntity;
32 import org.turro.path.Path;
33 
38 @Entity
39 @org.hibernate.annotations.GenericGenerator(name = "hibernate-uuid", strategy = "uuid")
40 public class StarIt implements Serializable {
41 
42  @Id
43  @GeneratedValue(generator = "hibernate-uuid")
44  @Column(name="IDENTIFIER")
45  private String id;
46 
47  @Column(name="STARIT_PATH")
48  private String path;
49 
50  @ManyToOne
51  @JoinColumn(name="CREATOR_FK")
52  private org.turro.contacts.Contact creator;
53 
54  @Temporal(value = javax.persistence.TemporalType.TIMESTAMP)
55  private java.util.Date dateCreation;
56 
57  private int stars;
58 
59  private String author_ip;
60 
61  public String getId() {
62  return id;
63  }
64 
65  public void setId(String id) {
66  this.id = id;
67  }
68 
69  public String getPath() {
70  return path;
71  }
72 
73  public void setPath(String path) {
74  this.path = path;
75  }
76 
77  public Contact getCreator() {
78  return creator;
79  }
80 
81  public void setCreator(Contact creator) {
82  this.creator = creator;
83  }
84 
85  public Date getDateCreation() {
86  return dateCreation;
87  }
88 
89  public void setDateCreation(Date dateCreation) {
90  this.dateCreation = dateCreation;
91  }
92 
93  public int getStars() {
94  return stars;
95  }
96 
97  public void setStars(int stars) {
98  this.stars = stars;
99  }
100 
101  public String getAuthor_ip() {
102  return author_ip;
103  }
104 
105  public void setAuthor_ip(String author_ip) {
106  this.author_ip = author_ip;
107  }
108 
109  /* Helpers */
110 
111  public String getName() {
112  if(creator != null) {
113  return creator.getName();
114  } else {
115  return author_ip;
116  }
117  }
118 
119  /* Entity help */
120 
122  return Entities.getController(new Path(path).getTill(2));
123  }
124 
125 }
void setDateCreation(Date dateCreation)
Definition: StarIt.java:89
void setPath(String path)
Definition: StarIt.java:73
void setStars(int stars)
Definition: StarIt.java:97
void setId(String id)
Definition: StarIt.java:65
IElephantEntity getOwnerEntity()
Definition: StarIt.java:121
void setCreator(Contact creator)
Definition: StarIt.java:81
void setAuthor_ip(String author_ip)
Definition: StarIt.java:105
static IElephantEntity getController(String path)
Definition: Entities.java:78