List lista = new ArrayList();
try{
Mensagem properties = new Mensagem(application);
Date dataAtual = Data.getDataAtual();
SegmentoItemSgti segItemSuper = getSegmentoItemSuperDestaque(application);
String todos = null;
try {
todos = Pagina.getParamStr(request, "todos");
}catch(NullPointerException ne){
//n�o � necess�rio logar exce��o aqui
}
StringBuilder select = new StringBuilder("select i from SegmentoItemSgti i where i.indAtivoSgti = 'S' ")
.append(" and ( i.dataIniValidadeSgti <= :dataAtual")
.append(" and i.dataFimValidadeSgti >= :dataAtual )")
.append(" and i.segmentoSgt.codSgt = :codSgt ")
.append("and ((i.indUtilizTpAcessoSgti = 'N') or ")
.append("(i.indUtilizTpAcessoSgti = 'S' and i.codSgti in (")
.append("select b.comp_id.codSgti from SegmentoItemTpAcesSgtITA b ")
.append("where b.comp_id.codSatb in (")
.append("select a.comp_id.codSatb from UsuarioAtributoUsua a ")
.append("where a.comp_id.codUsu = :codUsu))))");
if ((segItemSuper != null)&&(todos == null)){
select.append(" and i.codSgti != :codSgti");
select.append(" and i.indSuperDestaqueSgti = 'S' ");
}
if (todos == ""){
select.append(" and ((i.indDestaqueSgti = 'S') or (i.indDestaqueSgti = 'N' and i.indSuperDestaqueSgti = 'S')) ");
}
String order = " order by i.dataItemSgti desc";
Query query = this.getSession().createQuery(select + order);
query.setLong("codSgt", Long.valueOf(properties.getMensagem("admPortal.materias")).longValue());
query.setDate("dataAtual", dataAtual);
query.setLong("codUsu", usuario.getCodUsu().longValue());
if ((segItemSuper != null)&&(todos == null))
query.setLong("codSgti", segItemSuper.getCodSgti().longValue());
String qtd = null, qtdPag = null, numPag = null;
try {
qtd = Pagina.getParamStr(request, "qtd");