1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
package net.sf.webphotos.model; |
21 | |
|
22 | |
import java.io.Serializable; |
23 | |
import javax.persistence.*; |
24 | |
import net.sf.webphotos.entity.HasID; |
25 | |
import net.sf.webphotos.entity.PhotoEntity; |
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | 0 | @Entity |
32 | |
@Table(name = "FOTOS") |
33 | |
@NamedQueries({ |
34 | |
@NamedQuery(name = "PhotoVO.findByFotoid", query = "SELECT f FROM PhotoVO f WHERE f.fotoid = :fotoid"), |
35 | |
@NamedQuery(name = "PhotoVO.findByAlbumid", query = "SELECT f FROM PhotoVO f WHERE f.album.albumid = :albumid"), |
36 | |
@NamedQuery(name = "PhotoVO.findByNmfoto", query = "SELECT f FROM PhotoVO f WHERE f.nmfoto = :nmfoto"), |
37 | |
@NamedQuery(name = "PhotoVO.findByLegenda", query = "SELECT f FROM PhotoVO f WHERE f.legenda = :legenda"), |
38 | |
@NamedQuery(name = "PhotoVO.findByCreditoid", query = "SELECT f FROM PhotoVO f WHERE f.creditos.creditoid = :creditoid")}) |
39 | |
public class PhotoVO extends PhotoEntity implements Serializable, HasID<Integer> { |
40 | |
|
41 | |
private static final long serialVersionUID = 1L; |
42 | |
|
43 | |
@Id |
44 | |
@Column(name = "FOTOID", nullable = false) |
45 | |
@GeneratedValue(strategy = GenerationType.IDENTITY) |
46 | |
private Integer fotoid; |
47 | |
|
48 | |
@Column(name = "NMFOTO") |
49 | |
private String nmfoto; |
50 | |
|
51 | |
@Column(name = "LEGENDA", nullable = false) |
52 | |
private String legenda; |
53 | |
|
54 | |
@ManyToOne |
55 | |
@JoinColumn(name = "CREDITOID", nullable = false) |
56 | |
private CreditsVO creditos; |
57 | |
|
58 | |
@ManyToOne |
59 | |
@JoinColumn(name = "ALBUMID", nullable = false) |
60 | |
private AlbumVO album; |
61 | |
|
62 | |
@Transient |
63 | |
private String caminhoArquivo; |
64 | |
|
65 | |
@Transient |
66 | |
private Integer largura, altura; |
67 | |
|
68 | |
|
69 | |
|
70 | |
|
71 | |
@Deprecated |
72 | 0 | public PhotoVO() { |
73 | 0 | this.creditos = new CreditsVO(); |
74 | 0 | this.album = new AlbumVO(); |
75 | 0 | this.legenda = ""; |
76 | 0 | } |
77 | |
|
78 | |
@Deprecated |
79 | |
public PhotoVO(Integer fotoid, int albumid, String legenda, int creditoid, Integer largura, Integer altura) { |
80 | 0 | this(); |
81 | 0 | this.fotoid = fotoid; |
82 | 0 | this.legenda = legenda; |
83 | 0 | this.largura = largura; |
84 | 0 | this.altura = altura; |
85 | 0 | } |
86 | |
|
87 | |
|
88 | |
|
89 | |
|
90 | |
|
91 | |
|
92 | |
|
93 | |
|
94 | 0 | public PhotoVO(String nmfoto, String legenda, CreditsVO creditos, String caminhoArquivo) { |
95 | 0 | this.nmfoto = nmfoto; |
96 | 0 | this.legenda = legenda; |
97 | 0 | this.creditos = creditos; |
98 | 0 | this.caminhoArquivo = caminhoArquivo; |
99 | 0 | } |
100 | |
|
101 | |
|
102 | |
|
103 | |
|
104 | |
|
105 | |
|
106 | |
|
107 | |
|
108 | |
public PhotoVO(String nmfoto, String legenda, CreditsVO creditos, String caminhoArquivo, AlbumVO album) { |
109 | 0 | this(nmfoto, legenda, creditos, caminhoArquivo); |
110 | 0 | this.album = album; |
111 | 0 | } |
112 | |
|
113 | |
public Integer getFotoid() { |
114 | 0 | return fotoid; |
115 | |
} |
116 | |
|
117 | |
public void setFotoid(Integer fotoid) { |
118 | 0 | this.fotoid = fotoid; |
119 | 0 | } |
120 | |
|
121 | |
public String getNmfoto() { |
122 | 0 | return nmfoto; |
123 | |
} |
124 | |
|
125 | |
public void setNmfoto(String nmfoto) { |
126 | 0 | this.nmfoto = nmfoto; |
127 | 0 | } |
128 | |
|
129 | |
@Override |
130 | |
public String getLegenda() { |
131 | 0 | return legenda; |
132 | |
} |
133 | |
|
134 | |
public void setLegenda(String legenda) { |
135 | 0 | this.legenda = legenda; |
136 | 0 | } |
137 | |
|
138 | |
@Override |
139 | |
public String toString() { |
140 | 0 | return this.getClass().getCanonicalName() + "[fotoid=" + fotoid + "]"; |
141 | |
} |
142 | |
|
143 | |
@Override |
144 | |
public CreditsVO getCreditos() { |
145 | 0 | return creditos; |
146 | |
} |
147 | |
|
148 | |
public void setCreditos(CreditsVO creditos) { |
149 | 0 | this.creditos = creditos; |
150 | 0 | } |
151 | |
|
152 | |
public AlbumVO getAlbum() { |
153 | 0 | return album; |
154 | |
} |
155 | |
|
156 | |
public void setAlbum(AlbumVO album) { |
157 | 0 | this.album = album; |
158 | 0 | } |
159 | |
|
160 | |
|
161 | |
|
162 | |
|
163 | |
public String getCaminhoArquivo() { |
164 | 0 | return caminhoArquivo; |
165 | |
} |
166 | |
|
167 | |
public Integer getAltura() { |
168 | 0 | return altura; |
169 | |
} |
170 | |
|
171 | |
public Integer getLargura() { |
172 | 0 | return largura; |
173 | |
} |
174 | |
|
175 | |
@Override |
176 | |
public Integer getId() { |
177 | 0 | return this.fotoid; |
178 | |
} |
179 | |
|
180 | |
@Override |
181 | |
public String getKey() { |
182 | 0 | return this.getId() != null ? this.getId().toString() : this.getCaminhoArquivo(); |
183 | |
} |
184 | |
} |