View Javadoc

1   package ecar.pojo;
2   
3   // Generated Aug 13, 2009 2:24:15 PM by Hibernate Tools 3.2.0.CR1
4   
5   import java.io.Serializable;
6   import java.util.HashSet;
7   import java.util.Set;
8   import javax.persistence.AttributeOverride;
9   import javax.persistence.AttributeOverrides;
10  import javax.persistence.Column;
11  import javax.persistence.EmbeddedId;
12  import javax.persistence.Entity;
13  import javax.persistence.FetchType;
14  import javax.persistence.JoinColumn;
15  import javax.persistence.JoinTable;
16  import javax.persistence.ManyToMany;
17  import javax.persistence.ManyToOne;
18  import javax.persistence.Table;
19  
20  import org.apache.commons.lang.builder.EqualsBuilder;
21  import org.apache.commons.lang.builder.HashCodeBuilder;
22  import org.apache.commons.lang.builder.ToStringBuilder;
23  import org.hibernate.annotations.Cascade;
24  import org.hibernate.annotations.CascadeType;
25  
26  import ecar.dao.ItemEstruturaDao;
27  import ecar.dao.ItemEstruturarevisaoIettrevDAO;
28  import ecar.exception.ECARException;
29  
30  /**
31   * EstrutTpFuncAcmpEtttfa generated by hbm2java
32   */
33  @Entity
34  @Table(name = "TB_ESTRUT_TP_FUNC_ACMP_ETTTFA")
35  public class EstrutTpFuncAcmpEtttfa implements Serializable, PaiFilho, ObjetoEstrutura{
36  
37    private static final long serialVersionUID = 3484315025485725861L;
38    
39    private EstrutTpFuncAcmpEtttfaPK comp_id;
40    private String indListagemImprResEtttfa;
41    private String indListagemImprCompEtttfa;
42    private String idPodeBloquearEtttfa;
43    private String idFiltroEtttfa;
44    private String indListagemTelaEtttfa;
45    private Integer seqApresentTelaCampoEtttfa;
46    private Integer larguraListagemTelaEtttfa;
47    private Integer seqApresListagemTelaEtttfa;
48    private String indRevisao;
49    private String indManterProximoNivelEtttfa;
50    private EstruturaEtt estruturaEtt;
51    private TipoFuncAcompTpfa tipoFuncAcompTpfa;
52    private Set<TipoFuncAcompTpfa> libTipoFuncAcompTpfas = new HashSet<TipoFuncAcompTpfa>(0);
53  
54    public EstrutTpFuncAcmpEtttfa() {
55    }
56  
57    public EstrutTpFuncAcmpEtttfa(EstrutTpFuncAcmpEtttfaPK comp_id) {
58      this.comp_id = comp_id;
59    }
60  
61    public EstrutTpFuncAcmpEtttfa(EstrutTpFuncAcmpEtttfaPK comp_id, String indListagemImprResEtttfa, String indListagemImprCompEtttfa, String idPodeBloquearEtttfa, String idFiltroEtttfa, String indListagemTelaEtttfa, Integer seqApresentTelaCampoEtttfa, Integer larguraListagemTelaEtttfa, Integer seqApresListagemTelaEtttfa, String indRevisao, String indManterProximoNivelEtttfa, EstruturaEtt estruturaEtt, TipoFuncAcompTpfa tipoFuncAcompTpfa, Set<TipoFuncAcompTpfa> libTipoFuncAcompTpfas) {
62      this.comp_id = comp_id;
63      this.indListagemImprResEtttfa = indListagemImprResEtttfa;
64      this.indListagemImprCompEtttfa = indListagemImprCompEtttfa;
65      this.idPodeBloquearEtttfa = idPodeBloquearEtttfa;
66      this.idFiltroEtttfa = idFiltroEtttfa;
67      this.indListagemTelaEtttfa = indListagemTelaEtttfa;
68      this.seqApresentTelaCampoEtttfa = seqApresentTelaCampoEtttfa;
69      this.larguraListagemTelaEtttfa = larguraListagemTelaEtttfa;
70      this.seqApresListagemTelaEtttfa = seqApresListagemTelaEtttfa;
71      this.indRevisao = indRevisao;
72      this.indManterProximoNivelEtttfa = indManterProximoNivelEtttfa;
73      this.estruturaEtt = estruturaEtt;
74      this.tipoFuncAcompTpfa = tipoFuncAcompTpfa;
75      this.libTipoFuncAcompTpfas = libTipoFuncAcompTpfas;
76    }
77  
78    @EmbeddedId
79    @AttributeOverrides( { @AttributeOverride(name = "codEtt", column = @Column(name = "COD_ETT", nullable = false, length = 10)), @AttributeOverride(name = "codTpfa", column = @Column(name = "COD_TPFA", nullable = false, length = 10)) })
80    public EstrutTpFuncAcmpEtttfaPK getComp_id() {
81      return this.comp_id;
82    }
83  
84    public void setComp_id(EstrutTpFuncAcmpEtttfaPK comp_id) {
85      this.comp_id = comp_id;
86    }
87  
88    @Column(name = "IND_LISTAGEM_IMPR_RES_ETTTFA", length = 1)
89    public String getIndListagemImprResEtttfa() {
90      return this.indListagemImprResEtttfa;
91    }
92  
93    public void setIndListagemImprResEtttfa(String indListagemImprResEtttfa) {
94      this.indListagemImprResEtttfa = indListagemImprResEtttfa;
95    }
96  
97    @Column(name = "IND_LISTAGEM_IMPR_COMP_ETTTFA", length = 1)
98    public String getIndListagemImprCompEtttfa() {
99      return this.indListagemImprCompEtttfa;
100   }
101 
102   public void setIndListagemImprCompEtttfa(String indListagemImprCompEtttfa) {
103     this.indListagemImprCompEtttfa = indListagemImprCompEtttfa;
104   }
105 
106   @Column(name = "IND_PODE_BLOQUEAR_ETTTFA", length = 1)
107   public String getIdPodeBloquearEtttfa() {
108     return this.idPodeBloquearEtttfa;
109   }
110 
111   public void setIdPodeBloquearEtttfa(String idPodeBloquearEtttfa) {
112     this.idPodeBloquearEtttfa = idPodeBloquearEtttfa;
113   }
114 
115   @Column(name = "IND_FILTRO_ETTTFA", length = 1)
116   public String getIdFiltroEtttfa() {
117     return this.idFiltroEtttfa;
118   }
119 
120   public void setIdFiltroEtttfa(String idFiltroEtttfa) {
121     this.idFiltroEtttfa = idFiltroEtttfa;
122   }
123 
124   @Column(name = "IND_LISTAGEM_TELA_ETTTFA", length = 1)
125   public String getIndListagemTelaEtttfa() {
126     return this.indListagemTelaEtttfa;
127   }
128 
129   public void setIndListagemTelaEtttfa(String indListagemTelaEtttfa) {
130     this.indListagemTelaEtttfa = indListagemTelaEtttfa;
131   }
132 
133   @Column(name = "SEQ_APRESENT_TELA_CAMPO_ETTTFA", length = 2)
134   public Integer getSeqApresentTelaCampoEtttfa() {
135     return this.seqApresentTelaCampoEtttfa;
136   }
137 
138   public void setSeqApresentTelaCampoEtttfa(Integer seqApresentTelaCampoEtttfa) {
139     this.seqApresentTelaCampoEtttfa = seqApresentTelaCampoEtttfa;
140   }
141 
142   @Column(name = "LARGURA_LISTAGEM_TELA_ETTTFA", length = 2)
143   public Integer getLarguraListagemTelaEtttfa() {
144     return this.larguraListagemTelaEtttfa;
145   }
146 
147   public void setLarguraListagemTelaEtttfa(Integer larguraListagemTelaEtttfa) {
148     this.larguraListagemTelaEtttfa = larguraListagemTelaEtttfa;
149   }
150 
151   @Column(name = "SEQ_APRES_LISTAGEM_TELA_ETTTFA", length = 2)
152   public Integer getSeqApresListagemTelaEtttfa() {
153     return this.seqApresListagemTelaEtttfa;
154   }
155 
156   public void setSeqApresListagemTelaEtttfa(Integer seqApresListagemTelaEtttfa) {
157     this.seqApresListagemTelaEtttfa = seqApresListagemTelaEtttfa;
158   }
159 
160   @Column(name = "IND_REVISAO", length = 1)
161   public String getIndRevisao() {
162     return this.indRevisao;
163   }
164 
165   public void setIndRevisao(String indRevisao) {
166     this.indRevisao = indRevisao;
167   }
168 
169   @Column(name = "IND_MANTER_PROXIMO_NIVEL_ETTTFA", length = 1)
170   public String getIndManterProximoNivelEtttfa() {
171     return this.indManterProximoNivelEtttfa;
172   }
173 
174   public void setIndManterProximoNivelEtttfa(String indManterProximoNivelEtttfa) {
175     this.indManterProximoNivelEtttfa = indManterProximoNivelEtttfa;
176   }
177 
178   @ManyToOne(fetch = FetchType.LAZY)
179   @JoinColumn(name = "COD_ETT", insertable = false, updatable = false)
180   public EstruturaEtt getEstruturaEtt() {
181     return this.estruturaEtt;
182   }
183 
184   public void setEstruturaEtt(EstruturaEtt estruturaEtt) {
185     this.estruturaEtt = estruturaEtt;
186   }
187 
188   @ManyToOne(fetch = FetchType.LAZY)
189   @JoinColumn(name = "COD_TPFA", insertable = false, updatable = false)
190   public TipoFuncAcompTpfa getTipoFuncAcompTpfa() {
191     return this.tipoFuncAcompTpfa;
192   }
193 
194   public void setTipoFuncAcompTpfa(TipoFuncAcompTpfa tipoFuncAcompTpfa) {
195     this.tipoFuncAcompTpfa = tipoFuncAcompTpfa;
196   }
197 
198   @ManyToMany(fetch = FetchType.EAGER)
199   @JoinTable(name = "TB_ESTRUT_TP_FUNC_ACMP_TIPO_FUNC_ACOMP_LIBERADO_PARA_ETTTPFATPFALP", joinColumns = { @JoinColumn(name = "COD_ETT", nullable = false, updatable = false), @JoinColumn(name = "COD_TPFA", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "COD_TPFA_LIBERADO_PARA", nullable = false, updatable = false) })
200   @Cascade( { CascadeType.SAVE_UPDATE })
201   public Set<TipoFuncAcompTpfa> getLibTipoFuncAcompTpfas() {
202     return this.libTipoFuncAcompTpfas;
203   }
204 
205   public void setLibTipoFuncAcompTpfas(Set<TipoFuncAcompTpfa> libTipoFuncAcompTpfas) {
206     this.libTipoFuncAcompTpfas = libTipoFuncAcompTpfas;
207   }
208 
209   public String toString() {
210     return new ToStringBuilder(this).append("comp_id", getComp_id()).toString();
211   }
212 
213   public boolean equals(Object other) {
214     if ((this == other))
215       return true;
216     if (!(other instanceof EstrutTpFuncAcmpEtttfa))
217       return false;
218     EstrutTpFuncAcmpEtttfa castOther = (EstrutTpFuncAcmpEtttfa) other;
219     return new EqualsBuilder().append(this.getEstruturaEtt(), castOther.getEstruturaEtt()).append(this.getTipoFuncAcompTpfa(), castOther.getTipoFuncAcompTpfa()).isEquals();
220   }
221 
222   public int hashCode() {
223     return new HashCodeBuilder().append(getComp_id()).toHashCode();
224   }
225 
226   public void atribuirPKPai() {
227     comp_id = new EstrutTpFuncAcmpEtttfaPK();
228     comp_id.setCodEtt(this.getEstruturaEtt().getCodEtt());
229     comp_id.setCodTpfa(this.getTipoFuncAcompTpfa().getCodTpfa());
230   }
231 
232   /*
233    * (non-Javadoc)
234    * @see ecar.pojo.ObjetoEstrutura#getNome()
235    */
236   public String iGetNome() {
237     return "Fun" + this.getTipoFuncAcompTpfa().getCodTpfa();
238   }
239 
240   public String iGetNomeOrdenarLista() {
241     return "";
242   }
243 
244   /*
245    * (non-Javadoc)
246    * @see ecar.pojo.ObjetoEstrutura#getLabel()
247    */
248   public String iGetLabel() {
249     return this.getTipoFuncAcompTpfa().getLabelTpfa();
250   }
251 
252   /*
253    * (non-Javadoc)
254    * @see ecar.pojo.ObjetoEstrutura#getLargura()
255    */
256   public Integer iGetLargura() {
257     return (this.getLarguraListagemTelaEtttfa() == null) ? Integer.valueOf(ObjetoEstrutura.DEFAULT_LARGURA_TELA_CAMPO) : this.getLarguraListagemTelaEtttfa();
258   }
259 
260   /*
261    * (non-Javadoc)
262    * @see ecar.pojo.ObjetoEstrutura#getSequenciaListagem()
263    */
264   public Integer iGetSequenciaColunaEmListagem() {
265     return (this.getSeqApresListagemTelaEtttfa() == null) ? Integer.valueOf(ObjetoEstrutura.MAX_SEQUENCIA_COLUNA_LISTAGEM) : this.getSeqApresListagemTelaEtttfa();
266   }
267 
268   /*
269    * (non-Javadoc)
270    * @see ecar.pojo.ObjetoEstrutura#iGetValor(ecar.pojo.ItemEstruturaIett)
271    */
272   public String iGetValor(ItemEstruturaIett item) throws ECARException {
273     UsuarioUsu usuarioFuncao = (UsuarioUsu) new ItemEstruturaDao(null).getValorFunAcompItemEstrutura(item, this.getTipoFuncAcompTpfa());
274 
275     SisAtributoSatb sisAtributoSatb = (SisAtributoSatb) new ItemEstruturaDao(null).getValorSatbFunAcompItemEstrutura(item, this.getTipoFuncAcompTpfa());
276 
277     String resultado = "";
278     if (usuarioFuncao != null) {
279       resultado = usuarioFuncao.getNomeUsuSent();
280     }
281     else if (sisAtributoSatb != null) {
282       resultado = sisAtributoSatb.getDescricaoSatb();
283     }
284 
285     return resultado;
286   }
287 
288   /*
289    * (non-Javadoc)
290    * @see ecar.pojo.ObjetoEstrutura#iGetSequenciaCampoEmTela()
291    */
292   public Integer iGetSequenciaCampoEmTela() {
293     return (this.getSeqApresentTelaCampoEtttfa() == null) ? Integer.valueOf(ObjetoEstrutura.MAX_SEQUENCIA_TELA_CAMPO) : this.getSeqApresentTelaCampoEtttfa();
294   }
295 
296   /*
297    * (non-Javadoc)
298    * @see ecar.pojo.ObjetoEstrutura#iGetTipo()
299    */
300   public Class iGetTipo() {
301     return this.getClass();
302   }
303 
304   /*
305    * (non-Javadoc)
306    * @see ecar.pojo.ObjetoEstrutura#iGetObrigatorio()
307    */
308   public Boolean iGetObrigatorio() {
309     return new Boolean(false);
310   }
311 
312   /*
313    * (non-Javadoc)
314    * @see ecar.pojo.ObjetoEstrutura#iGetCodigoFk(ecar.pojo.ItemEstruturaIett)
315    */
316   public String iGetValorCodFk(ItemEstruturaIett item) throws ECARException {
317     UsuarioUsu usuarioFuncao = (UsuarioUsu) new ItemEstruturaDao(null).getValorFunAcompItemEstrutura(item, this.getTipoFuncAcompTpfa());
318 
319     SisAtributoSatb sisAtributoSatb = (SisAtributoSatb) new ItemEstruturaDao(null).getValorSatbFunAcompItemEstrutura(item, this.getTipoFuncAcompTpfa());
320 
321     String resultado = "";
322     if (usuarioFuncao != null) {
323       resultado = "U" + usuarioFuncao.getCodUsu().toString();
324     }
325     else if (sisAtributoSatb != null) {
326       resultado = "G" + sisAtributoSatb.getCodSatb().toString();
327     }
328 
329     return resultado;
330   }
331 
332   /*
333    * (non-Javadoc)
334    * @see ecar.pojo.ObjetoEstrutura#iGetCodFk()
335    */
336   public String iGetCodFk() {
337     return "";
338   }
339 
340   /*
341    * (non-Javadoc)
342    * @see ecar.pojo.ObjetoEstrutura#iGetNomeFk()
343    */
344   public String iGetNomeFk() {
345     return "";
346   }
347 
348   public String iGetValor(ItemEstruturarevisaoIettrev itemRev) throws ECARException {
349     UsuarioUsu usuarioFuncao = (UsuarioUsu) new ItemEstruturarevisaoIettrevDAO(null).getValorFunAcompItemEstrutura(itemRev, this.getTipoFuncAcompTpfa());
350 
351     return (usuarioFuncao != null) ? usuarioFuncao.getNomeUsuSent() : "";
352 
353   }
354 
355   public String iGetValorCodFk(ItemEstruturarevisaoIettrev itemRev) throws ECARException {
356     UsuarioUsu usuarioFuncao = (UsuarioUsu) new ItemEstruturarevisaoIettrevDAO(null).getValorFunAcompItemEstrutura(itemRev, this.getTipoFuncAcompTpfa());
357     return (usuarioFuncao != null) ? usuarioFuncao.getCodUsu().toString() : "";
358   }
359 
360   /*
361    * (non-Javadoc)
362    * @see ecar.pojo.ObjetoEstrutura#getDica()
363    */
364   public String iGetDica() {
365     return "";
366   }
367 
368   public Boolean iGetIndOpcional() {
369     // TODO Auto-generated method stub
370     return null;
371   }
372 
373   public SisGrupoAtributoSga iGetGrupoAtributosLivres() {
374     // TODO Auto-generated method stub
375     return null;
376   }
377 
378   public Integer iGetTamanhoConteudoAtrib() {
379     // TODO Auto-generated method stub
380     return null;
381   }
382 
383   public Boolean iGetBloqueado() {
384     return ("S".equals(this.getIdPodeBloquearEtttfa()) ? new Boolean(true) : new Boolean(false));
385   }
386 
387   public Set iGetLibTipoFuncAcompTpfas() {
388     return libTipoFuncAcompTpfas;
389   }
390 
391 }