Package ecar.exception

Examples of ecar.exception.PermissaoAcessoLinkException


                                                                     seguranca.getGruposAcesso(  ) );
                }
            } catch ( Exception e )
            {
                //NAO EXISTE O TIPO DE ACOMPANHAMENTO;
                throw new PermissaoAcessoLinkException( ErroPermissaoAcessoLinkEnum.TIPO_DE_ACOMPANHAMENTO_INEXISTENTE );
            }

            try
            {
                if ( ( referencia_hidden != null ) && ! referencia_hidden.equals( "" ) )
                {
                    periodosConsiderados =
                        acompReferenciaDao.getPeriodosAnterioresOrdenado( Long.valueOf( referencia_hidden ),
                                                                          qtdePeriodosAnteriores,
                                                                          Long.valueOf( codTipoAcompanhamento ),
                                                                          false );
                }
            } catch ( Exception e )
            {
                //NAO EXISTE A REFERENCIA;
                throw new PermissaoAcessoLinkException( ErroPermissaoAcessoLinkEnum.REFERENCIA_INEXISTENTE );
            }

            try
            {
                // Busca cole��o com o per�odo a ser considereado
                if ( ( codAri != null ) && ! codAri.equals( "" ) )
                {
                    ari = (AcompReferenciaItemAri) ariDao.buscar( AcompReferenciaItemAri.class,
                                                                  Long.valueOf( codAri ) );
                    item = ari.getItemEstruturaIett(  );
                }
            } catch ( Exception e )
            {
                //NAO EXISTE O ACOMPANHAMENTO;
                throw new PermissaoAcessoLinkException( ErroPermissaoAcessoLinkEnum.ACOMPANHAMENTO_INEXISTENTE );
            }

            if ( ( item.getIndAtivoIett(  ) == null ) ||
                     "".equals( item.getIndAtivoIett(  ).trim(  ) ) ||
                     "N".equals( item.getIndAtivoIett(  ).toUpperCase(  ) ) )
            {
                //O ITEM EST� INATIVO;
                throw new PermissaoAcessoLinkException( ErroPermissaoAcessoLinkEnum.ITEM_INATIVO );

                //verifica se o usu�rio pode "Gerar Per�odo de Acompanhamento"
            } else if ( permissaoAdministradorAcompanhamento )
            {
                permissaoLapis = true;
            } else
            {
                itPeriodosAcao = periodosConsiderados.iterator(  );
                mapAcao = acompReferenciaItemDao.criarMapPeriodoAri( periodosConsiderados, item );
                tpfaOrdenadosPorEstrutura = tipoFuncAcompDao.getFuncaoAcompOrderByEstruturas(  );

                if ( ( itPeriodosAcao != null ) && itPeriodosAcao.hasNext(  ) )
                {
                    //Pega s� o per�odo selecionado (Aref), que � o primeiro
                    acompReferencia = (AcompReferenciaAref) itPeriodosAcao.next(  );

                    if ( ! mapAcao.isEmpty(  ) && mapAcao.containsKey( acompReferencia ) )
                    {
                        AcompReferenciaItemAri ariAcao = (AcompReferenciaItemAri) mapAcao.get( acompReferencia );

                        //Pega os Arels do Ari selecionado
                        List relatorios =
                            acompReferenciaItemDao.getAcompRelatorioArelOrderByFuncaoAcomp( ariAcao,
                                                                                            tpfaOrdenadosPorEstrutura );
                        Iterator itRelatorios = relatorios.iterator(  );

                        if ( itRelatorios != null )
                        {
                            while ( itRelatorios.hasNext(  ) )
                            {
                                AcompRelatorioArel relatorio = (AcompRelatorioArel) itRelatorios.next(  );

                                ItemEstUsutpfuacIettutfa itemEstUsu =
                                    itemEstUsuDao.buscar( item.getCodIett(  ),
                                                          relatorio.getTipoFuncAcompTpfa(  ).getCodTpfa(  ) );

                                //Verifica se a permiss�o � de grupo ou usu�rio
                                if ( ( itemEstUsu != null ) && ( usuario != null ) )
                                {
                                    if ( itemEstUsu.getUsuarioUsu(  ) != null )
                                    {
                                        usuarioLogadoEmiteParecer = itemEstUsu.getUsuarioUsu(  ).getCodUsu(  )
                                                                              .equals( usuario.getCodUsu(  ) );
                                    } else if ( itemEstUsu.getSisAtributoSatb(  ) != null )
                                    {
                                        if ( itemEstUsu.getSisAtributoSatb(  ).getUsuarioAtributoUsuas(  ) != null )
                                        {
                                            Iterator itUsuarios =
                                                itemEstUsu.getSisAtributoSatb(  ).getUsuarioAtributoUsuas(  ).iterator(  );

                                            if ( itUsuarios != null )
                                            {
                                                while ( itUsuarios.hasNext(  ) )
                                                {
                                                    UsuarioAtributoUsua usuarioAtributoUsua =
                                                        (UsuarioAtributoUsua) itUsuarios.next(  );

                                                    if ( ( usuarioAtributoUsua != null ) &&
                                                             ( usuarioAtributoUsua.getUsuarioUsu(  ) != null ) &&
                                                             usuarioAtributoUsua.getUsuarioUsu(  ).getCodUsu(  )
                                                                                    .equals( usuario.getCodUsu(  ) ) )
                                                    {
                                                        usuarioLogadoEmiteParecer = true;

                                                        break;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }

                                if ( usuarioLogadoEmiteParecer == true )
                                {
                                    break;
                                }
                            }
                        }
                    }

                    if ( ! ( usuarioLogadoEmiteParecer || permissaoLapis ) )
                    {
                        //N�O TEM PERMISSAO PARA ACESSAR O ACOMPANHAMENTO
                        throw new PermissaoAcessoLinkException( ErroPermissaoAcessoLinkEnum.SEM_PERMISSAO_ACOMPANHAMENTO );
                    }
                }
            }
        } catch ( ECARException e )
        {
            this.logger.error( e );
            throw new PermissaoAcessoLinkException( e );
        }
    }
View Full Code Here


                                                                     seguranca.getGruposAcesso(  ) );
                }
            } catch ( Exception e )
            {
                //NAO EXISTE O TIPO DE ACOMPANHAMENTO;
                throw new PermissaoAcessoLinkException( ErroPermissaoAcessoLinkEnum.TIPO_DE_ACOMPANHAMENTO_INEXISTENTE );
            }

            try
            {
                if ( ( referencia_hidden != null ) && ! referencia_hidden.equals( "" ) )
                {
                    periodosConsiderados =
                        acompReferenciaDao.getPeriodosAnterioresOrdenado( Long.valueOf( referencia_hidden ),
                                                                          qtdePeriodosAnteriores,
                                                                          Long.valueOf( codTipoAcompanhamento ),
                                                                          false );
                }
            } catch ( Exception e )
            {
                //NAO EXISTE A REFERENCIA;
                throw new PermissaoAcessoLinkException( ErroPermissaoAcessoLinkEnum.REFERENCIA_INEXISTENTE );
            }

            try
            {
                // Busca cole��o com o per�odo a ser considereado
                if ( ( codAri != null ) && ! codAri.equals( "" ) )
                {
                    ari = (AcompReferenciaItemAri) ariDao.buscar( AcompReferenciaItemAri.class,
                                                                  Long.valueOf( codAri ) );
                    item = ari.getItemEstruturaIett(  );
                }
            } catch ( Exception e )
            {
                //NAO EXISTE O ACOMPANHAMENTO;
                throw new PermissaoAcessoLinkException( ErroPermissaoAcessoLinkEnum.ACOMPANHAMENTO_INEXISTENTE );
            }

            if ( ( item.getIndAtivoIett(  ) == null ) ||
                     "".equals( item.getIndAtivoIett(  ).trim(  ) ) ||
                     "N".equals( item.getIndAtivoIett(  ).toUpperCase(  ) ) )
            {
                //O ITEM EST� INATIVO;
                throw new PermissaoAcessoLinkException( ErroPermissaoAcessoLinkEnum.ITEM_INATIVO );

                //verifica se o usu�rio pode "Gerar Per�odo de Acompanhamento"
            } else if ( permissaoAdministradorAcompanhamento )
            {
                permissaoLapis = true;
            } else
            {
                itPeriodosAcao = periodosConsiderados.iterator(  );
                mapAcao = acompReferenciaItemDao.criarMapPeriodoAri( periodosConsiderados, item );
                tpfaOrdenadosPorEstrutura = tipoFuncAcompDao.getFuncaoAcompOrderByEstruturas(  );

                if ( ( itPeriodosAcao != null ) && itPeriodosAcao.hasNext(  ) )
                {
                    //Pega s� o per�odo selecionado (Aref), que � o primeiro
                    acompReferencia = (AcompReferenciaAref) itPeriodosAcao.next(  );

                    if ( ! mapAcao.isEmpty(  ) && mapAcao.containsKey( acompReferencia ) )
                    {
                        AcompReferenciaItemAri ariAcao = (AcompReferenciaItemAri) mapAcao.get( acompReferencia );

                        //Pega os Arels do Ari selecionado
                        List relatorios =
                            acompReferenciaItemDao.getAcompRelatorioArelOrderByFuncaoAcomp( ariAcao,
                                                                                            tpfaOrdenadosPorEstrutura );
                        Iterator itRelatorios = relatorios.iterator(  );

                        if ( itRelatorios != null )
                        {
                            while ( itRelatorios.hasNext(  ) )
                            {
                                AcompRelatorioArel relatorio = (AcompRelatorioArel) itRelatorios.next(  );

                                ItemEstUsutpfuacIettutfa itemEstUsu =
                                    itemEstUsuDao.buscar( item.getCodIett(  ),
                                                          relatorio.getTipoFuncAcompTpfa(  ).getCodTpfa(  ) );

                                //Verifica se a permiss�o � de grupo ou usu�rio
                                if ( ( itemEstUsu != null ) && ( usuario != null ) )
                                {
                                    if ( itemEstUsu.getUsuarioUsu(  ) != null )
                                    {
                                        usuarioLogadoEmiteParecer = itemEstUsu.getUsuarioUsu(  ).getCodUsu(  )
                                                                              .equals( usuario.getCodUsu(  ) );
                                    } else if ( itemEstUsu.getSisAtributoSatb(  ) != null )
                                    {
                                        if ( itemEstUsu.getSisAtributoSatb(  ).getUsuarioAtributoUsuas(  ) != null )
                                        {
                                            Iterator itUsuarios =
                                                itemEstUsu.getSisAtributoSatb(  ).getUsuarioAtributoUsuas(  ).iterator(  );

                                            if ( itUsuarios != null )
                                            {
                                                while ( itUsuarios.hasNext(  ) )
                                                {
                                                    UsuarioAtributoUsua usuarioAtributoUsua =
                                                        (UsuarioAtributoUsua) itUsuarios.next(  );

                                                    if ( ( usuarioAtributoUsua != null ) &&
                                                             ( usuarioAtributoUsua.getUsuarioUsu(  ) != null ) &&
                                                             usuarioAtributoUsua.getUsuarioUsu(  ).getCodUsu(  )
                                                                                    .equals( usuario.getCodUsu(  ) ) )
                                                    {
                                                        usuarioLogadoEmiteParecer = true;

                                                        break;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }

                                if ( usuarioLogadoEmiteParecer == true )
                                {
                                    break;
                                }
                            }
                        }
                    }

                    if ( ! ( usuarioLogadoEmiteParecer || permissaoLapis ) )
                    {
                        //N�O TEM PERMISSAO PARA ACESSAR O ACOMPANHAMENTO
                        throw new PermissaoAcessoLinkException( ErroPermissaoAcessoLinkEnum.SEM_PERMISSAO_ACOMPANHAMENTO );
                    }
                }
            }
        } catch ( ECARException e )
        {
            this.logger.error( e );
            throw new PermissaoAcessoLinkException( e );
        }
    }
View Full Code Here

            tipoAcompanhamento = (TipoAcompanhamentoTa) taDao.buscar(TipoAcompanhamentoTa.class, Long.valueOf(codTipoAcompanhamento));
            permissaoAdministradorAcompanhamento = estruturaAcessoDao.temPermissoesAcessoAcomp(tipoAcompanhamento, seguranca.getGruposAcesso());
         
        } catch(Exception e) {
          //NAO EXISTE O TIPO DE ACOMPANHAMENTO;
          throw new PermissaoAcessoLinkException(ErroPermissaoAcessoLinkEnum.TIPO_DE_ACOMPANHAMENTO_INEXISTENTE);
        }
       
       
        try {

          if(referencia_hidden != null && !referencia_hidden.equals("")) {
            periodosConsiderados = acompReferenciaDao.getPeriodosAnterioresOrdenado(Long.valueOf(referencia_hidden), qtdePeriodosAnteriores, 
                    Long.valueOf(codTipoAcompanhamento), false);
          }   
         
        } catch(Exception e) {
          //NAO EXISTE A REFERENCIA;
          throw new PermissaoAcessoLinkException(ErroPermissaoAcessoLinkEnum.REFERENCIA_INEXISTENTE);
        }
       
       
        try{
          // Busca cole��o com o per�odo a ser considereado
          if(codAri != null && !codAri.equals("")) {
            ari = (AcompReferenciaItemAri) ariDao.buscar(AcompReferenciaItemAri.class, Long.valueOf(codAri));
            item = ari.getItemEstruturaIett();
         
        } catch(Exception e) {
          //NAO EXISTE O ACOMPANHAMENTO;
          throw new PermissaoAcessoLinkException(ErroPermissaoAcessoLinkEnum.ACOMPANHAMENTO_INEXISTENTE);
        }
       
       
        if (item.getIndAtivoIett() == null || "".equals(item.getIndAtivoIett().trim()) || "N".equals(item.getIndAtivoIett().toUpperCase())) {
         
          //O ITEM EST� INATIVO;
          throw new PermissaoAcessoLinkException(ErroPermissaoAcessoLinkEnum.ITEM_INATIVO);
       
        //verifica se o usu�rio pode "Gerar Per�odo de Acompanhamento"
        } else if(permissaoAdministradorAcompanhamento) {
          permissaoLapis = true;
         
        } else
         
         
          itPeriodosAcao = periodosConsiderados.iterator();
          mapAcao = acompReferenciaItemDao.criarMapPeriodoAri(periodosConsiderados, item);
          tpfaOrdenadosPorEstrutura = tipoFuncAcompDao.getFuncaoAcompOrderByEstruturas();
         
     
          if(itPeriodosAcao != null && itPeriodosAcao.hasNext()) {
            //Pega s� o per�odo selecionado (Aref), que � o primeiro
            acompReferencia = (AcompReferenciaAref) itPeriodosAcao.next();
            if(!mapAcao.isEmpty() && mapAcao.containsKey(acompReferencia)) {
              AcompReferenciaItemAri ariAcao = (AcompReferenciaItemAri) mapAcao.get(acompReferencia);
                     
              //Pega os Arels do Ari selecionado
              List relatorios = acompReferenciaItemDao.getAcompRelatorioArelOrderByFuncaoAcomp(ariAcao, tpfaOrdenadosPorEstrutura);
              Iterator itRelatorios = relatorios.iterator();
             
              if(itRelatorios != null) {
                while(itRelatorios.hasNext()){                       
                  AcompRelatorioArel relatorio = (AcompRelatorioArel) itRelatorios.next();                   
                         
                  ItemEstUsutpfuacIettutfa itemEstUsu
                            = itemEstUsuDao.buscar(item.getCodIett(), relatorio.getTipoFuncAcompTpfa().getCodTpfa());
                          
                  //Verifica se a permiss�o � de grupo ou usu�rio
                  if(itemEstUsu!=null && usuario != null) {                            
                    if (itemEstUsu.getUsuarioUsu() != null) {
                      usuarioLogadoEmiteParecer = itemEstUsu.getUsuarioUsu().getCodUsu().equals(usuario.getCodUsu());
                    } else if (itemEstUsu.getSisAtributoSatb() != null) {
                      if (itemEstUsu.getSisAtributoSatb().getUsuarioAtributoUsuas() != null) {
                        Iterator itUsuarios = itemEstUsu.getSisAtributoSatb().getUsuarioAtributoUsuas().iterator();
                        if(itUsuarios != null) {
                          while (itUsuarios.hasNext()) {
                            UsuarioAtributoUsua usuarioAtributoUsua = (UsuarioAtributoUsua) itUsuarios.next();
                              if (usuarioAtributoUsua!=null && usuarioAtributoUsua.getUsuarioUsu()!=null &&
                                  usuarioAtributoUsua.getUsuarioUsu().getCodUsu().equals(usuario.getCodUsu())){
                                usuarioLogadoEmiteParecer = true;
                                break;
                              }
                          }
                        } 
                      }
                    }
                  } 
                 
                  if(usuarioLogadoEmiteParecer==true)
                    break;                     
               
               
              }
             
            }
           
            if(!(usuarioLogadoEmiteParecer || permissaoLapis)) { 
              //N�O TEM PERMISSAO PARA ACESSAR O ACOMPANHAMENTO
              throw new PermissaoAcessoLinkException(ErroPermissaoAcessoLinkEnum.SEM_PERMISSAO_ACOMPANHAMENTO);
           
           
          } 
         
        }
         
      }  catch(ECARException e) {
        this.logger.error(e);
        throw new PermissaoAcessoLinkException(e);
      }
     
    } 
View Full Code Here

                        (ItemEstruturaIett) this.buscar( ItemEstruturaIett.class,
                                                         Long.valueOf( codIett ) );
                } catch ( Exception e )
                {
                    //ITEM_INEXISTENTE;
                    throw new PermissaoAcessoLinkException( ErroPermissaoAcessoLinkEnum.ITEM_INEXISTENTE );
                }
            }

            //verifica se existe a aba passada como parametro para a estrutura
            if ( ( codAba != null ) && ! codAba.equals( "" ) )
            {
                if ( ( item != null ) && ( item.getEstruturaEtt(  ) != null ) )
                {
                    estruturaEtt = item.getEstruturaEtt(  );
                    estruturaFuncao =
                        estruturaFuncaoDao.getLabelFuncao( estruturaEtt,
                                                           Long.valueOf( codAba ) );
                }

                if ( estruturaFuncao == null )
                {
                    //ABA_INEXISTENTE;
                    throw new PermissaoAcessoLinkException( ErroPermissaoAcessoLinkEnum.ABA_INEXISTENTE );
                }
            }

            //VERIFICA A PERMISSAO DE ACESSO DO ITEM
            if ( item != null )
            {
                if ( ( ( item.getIndAtivoIett(  ) != null ) && ! "".equals( item.getIndAtivoIett(  ).trim(  ) ) ) &&
                         ! "N".equals( item.getIndAtivoIett(  ).toUpperCase(  ) ) )
                {
                    // verifica se o usuario tem permissao de acessar o item em cadastro
                    ValidaPermissao validaPermissao = new ValidaPermissao(  );
                    validaPermissao.permissoesItem( item,
                                                    seguranca.getUsuario(  ),
                                                    seguranca.getGruposAcesso(  ) );

                    boolean permissaoAcessoItem = validaPermissao.permissaoConsultarItem(  );

                    if ( ! permissaoAcessoItem )
                    {
                        // SEM_PERMISSAO;
                        throw new PermissaoAcessoLinkException( ErroPermissaoAcessoLinkEnum.SEM_PERMISSAO_ITEM );
                    }
                } else
                {
                    //  ITEM_INATIVO;
                    throw new PermissaoAcessoLinkException( ErroPermissaoAcessoLinkEnum.ITEM_INATIVO );
                }
            }
        } catch ( ECARException e )
        {
            this.logger.error( e );
            throw new PermissaoAcessoLinkException( e );
        }
    }
View Full Code Here

                        (ItemEstruturaIett) this.buscar( ItemEstruturaIett.class,
                                                         Long.valueOf( codIett ) );
                } catch ( Exception e )
                {
                    //ITEM_INEXISTENTE;
                    throw new PermissaoAcessoLinkException( ErroPermissaoAcessoLinkEnum.ITEM_INEXISTENTE );
                }
            }

            //verifica se existe a aba passada como parametro para a estrutura
            if ( ( codAba != null ) && ! codAba.equals( "" ) )
            {
                if ( ( item != null ) && ( item.getEstruturaEtt(  ) != null ) )
                {
                    estruturaEtt = item.getEstruturaEtt(  );
                    estruturaFuncao =
                        estruturaFuncaoDao.getLabelFuncao( estruturaEtt,
                                                           Long.valueOf( codAba ) );
                }

                if ( estruturaFuncao == null )
                {
                    //ABA_INEXISTENTE;
                    throw new PermissaoAcessoLinkException( ErroPermissaoAcessoLinkEnum.ABA_INEXISTENTE );
                }
            }

            //VERIFICA A PERMISSAO DE ACESSO DO ITEM
            if ( item != null )
            {
                if ( ( ( item.getIndAtivoIett(  ) != null ) && ! "".equals( item.getIndAtivoIett(  ).trim(  ) ) ) &&
                         ! "N".equals( item.getIndAtivoIett(  ).toUpperCase(  ) ) )
                {
                    // verifica se o usuario tem permissao de acessar o item em cadastro
                    ValidaPermissao validaPermissao = new ValidaPermissao(  );
                    validaPermissao.permissoesItem( item,
                                                    seguranca.getUsuario(  ),
                                                    seguranca.getGruposAcesso(  ) );

                    boolean permissaoAcessoItem = validaPermissao.permissaoConsultarItem(  );

                    if ( ! permissaoAcessoItem )
                    {
                        // SEM_PERMISSAO;
                        throw new PermissaoAcessoLinkException( ErroPermissaoAcessoLinkEnum.SEM_PERMISSAO_ITEM );
                    }
                } else
                {
                    //  ITEM_INATIVO;
                    throw new PermissaoAcessoLinkException( ErroPermissaoAcessoLinkEnum.ITEM_INATIVO );
                }
            }
        } catch ( ECARException e )
        {
            this.logger.error( e );
            throw new PermissaoAcessoLinkException( e );
        }

        /*try{

                if(!codIett.equals("")) {
View Full Code Here

                                                                     seguranca.getGruposAcesso(  ) );
                }
            } catch ( Exception e )
            {
                //NAO EXISTE O TIPO DE ACOMPANHAMENTO;
                throw new PermissaoAcessoLinkException( ErroPermissaoAcessoLinkEnum.TIPO_DE_ACOMPANHAMENTO_INEXISTENTE );
            }

            try
            {
                if ( ( referencia_hidden != null ) && ! referencia_hidden.equals( "" ) )
                {
                    periodosConsiderados =
                        acompReferenciaDao.getPeriodosAnterioresOrdenado( Long.valueOf( referencia_hidden ),
                                                                          qtdePeriodosAnteriores,
                                                                          Long.valueOf( codTipoAcompanhamento ),
                                                                          false );
                }
            } catch ( Exception e )
            {
                //NAO EXISTE A REFERENCIA;
                throw new PermissaoAcessoLinkException( ErroPermissaoAcessoLinkEnum.REFERENCIA_INEXISTENTE );
            }

            try
            {
                // Busca cole��o com o per�odo a ser considereado
                if ( ( codAri != null ) && ! codAri.equals( "" ) )
                {
                    ari = (AcompReferenciaItemAri) ariDao.buscar( AcompReferenciaItemAri.class,
                                                                  Long.valueOf( codAri ) );
                    item = ari.getItemEstruturaIett(  );
                }
            } catch ( Exception e )
            {
                //NAO EXISTE O ACOMPANHAMENTO;
                throw new PermissaoAcessoLinkException( ErroPermissaoAcessoLinkEnum.ACOMPANHAMENTO_INEXISTENTE );
            }

            //verifica se o usu�rio pode "Gerar Per�odo de Acompanhamento"
            if ( permissaoAdministradorAcompanhamento )
            {
                permissaoLapis = true;
            } else
            {
                itPeriodosAcao = periodosConsiderados.iterator(  );
                mapAcao = acompReferenciaItemDao.criarMapPeriodoAri( periodosConsiderados, item );
                tpfaOrdenadosPorEstrutura = tipoFuncAcompDao.getFuncaoAcompOrderByEstruturas(  );

                if ( ( itPeriodosAcao != null ) && itPeriodosAcao.hasNext(  ) )
                {
                    //Pega s� o per�odo selecionado (Aref), que � o primeiro
                    acompReferencia = (AcompReferenciaAref) itPeriodosAcao.next(  );

                    if ( ! mapAcao.isEmpty(  ) && mapAcao.containsKey( acompReferencia ) )
                    {
                        AcompReferenciaItemAri ariAcao = (AcompReferenciaItemAri) mapAcao.get( acompReferencia );

                        //Pega os Arels do Ari selecionado
                        List relatorios =
                            acompReferenciaItemDao.getAcompRelatorioArelOrderByFuncaoAcomp( ariAcao,
                                                                                            tpfaOrdenadosPorEstrutura );
                        Iterator itRelatorios = relatorios.iterator(  );

                        if ( itRelatorios != null )
                        {
                            while ( itRelatorios.hasNext(  ) )
                            {
                                AcompRelatorioArel relatorio = (AcompRelatorioArel) itRelatorios.next(  );

                                ItemEstUsutpfuacIettutfa itemEstUsu =
                                    itemEstUsuDao.buscar( item.getCodIett(  ),
                                                          relatorio.getTipoFuncAcompTpfa(  ).getCodTpfa(  ) );

                                //Verifica se a permiss�o � de grupo ou usu�rio
                                if ( ( itemEstUsu != null ) && ( usuario != null ) )
                                {
                                    if ( itemEstUsu.getUsuarioUsu(  ) != null )
                                    {
                                        usuarioLogadoEmiteParecer = itemEstUsu.getUsuarioUsu(  ).getCodUsu(  )
                                                                              .equals( usuario.getCodUsu(  ) );
                                    } else if ( itemEstUsu.getSisAtributoSatb(  ) != null )
                                    {
                                        if ( itemEstUsu.getSisAtributoSatb(  ).getUsuarioAtributoUsuas(  ) != null )
                                        {
                                            Iterator itUsuarios =
                                                itemEstUsu.getSisAtributoSatb(  ).getUsuarioAtributoUsuas(  ).iterator(  );

                                            if ( itUsuarios != null )
                                            {
                                                while ( itUsuarios.hasNext(  ) )
                                                {
                                                    UsuarioAtributoUsua usuarioAtributoUsua =
                                                        (UsuarioAtributoUsua) itUsuarios.next(  );

                                                    if ( ( usuarioAtributoUsua != null ) &&
                                                             ( usuarioAtributoUsua.getUsuarioUsu(  ) != null ) &&
                                                             usuarioAtributoUsua.getUsuarioUsu(  ).getCodUsu(  )
                                                                                    .equals( usuario.getCodUsu(  ) ) )
                                                    {
                                                        usuarioLogadoEmiteParecer = true;

                                                        break;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }

                                if ( usuarioLogadoEmiteParecer == true )
                                {
                                    break;
                                }
                            }
                        }
                    }

                    if ( ! ( usuarioLogadoEmiteParecer || permissaoLapis ) )
                    {
                        //N�O TEM PERMISSAO PARA ACESSAR O ACOMPANHAMENTO
                        throw new PermissaoAcessoLinkException( ErroPermissaoAcessoLinkEnum.SEM_PERMISSAO_ACOMPANHAMENTO );
                    }
                }
            }
        } catch ( ECARException e )
        {
            this.logger.error( e );
            throw new PermissaoAcessoLinkException( e );
        }
    }
View Full Code Here

                        (ItemEstruturaIett) this.buscar( ItemEstruturaIett.class,
                                                         Long.valueOf( codIett ) );
                } catch ( Exception e )
                {
                    //ITEM_INEXISTENTE;
                    throw new PermissaoAcessoLinkException( ErroPermissaoAcessoLinkEnum.ITEM_INEXISTENTE );
                }
            }

            //verifica se existe a aba passada como parametro para a estrutura
            if ( ( codAba != null ) && ! codAba.equals( "" ) )
            {
                if ( ( item != null ) && ( item.getEstruturaEtt(  ) != null ) )
                {
                    estruturaEtt = item.getEstruturaEtt(  );
                    estruturaFuncao =
                        estruturaFuncaoDao.getLabelFuncao( estruturaEtt,
                                                           Long.valueOf( codAba ) );
                }

                if ( estruturaFuncao == null )
                {
                    //ABA_INEXISTENTE;
                    throw new PermissaoAcessoLinkException( ErroPermissaoAcessoLinkEnum.ABA_INEXISTENTE );
                }
            }

            //VERIFICA A PERMISSAO DE ACESSO DO ITEM
            if ( item != null )
            {
                if ( ( ( item.getIndAtivoIett(  ) != null ) && ! "".equals( item.getIndAtivoIett(  ).trim(  ) ) ) &&
                         ! "N".equals( item.getIndAtivoIett(  ).toUpperCase(  ) ) )
                {
                    // verifica se o usuario tem permissao de acessar o item em cadastro
                    ValidaPermissao validaPermissao = new ValidaPermissao(  );
                    validaPermissao.permissoesItem( item,
                                                    seguranca.getUsuario(  ),
                                                    seguranca.getGruposAcesso(  ) );

                    boolean permissaoAcessoItem = validaPermissao.permissaoConsultarItem(  );

                    if ( ! permissaoAcessoItem )
                    {
                        // SEM_PERMISSAO;
                        throw new PermissaoAcessoLinkException( ErroPermissaoAcessoLinkEnum.SEM_PERMISSAO_ITEM );
                    }
                } else
                {
                    //  ITEM_INATIVO;
                    throw new PermissaoAcessoLinkException( ErroPermissaoAcessoLinkEnum.ITEM_INATIVO );
                }
            }
        } catch ( ECARException e )
        {
            this.logger.error( e );
            throw new PermissaoAcessoLinkException( e );
        }
    }
View Full Code Here

                                                                     seguranca.getGruposAcesso(  ) );
                }
            } catch ( Exception e )
            {
                //NAO EXISTE O TIPO DE ACOMPANHAMENTO;
                throw new PermissaoAcessoLinkException( ErroPermissaoAcessoLinkEnum.TIPO_DE_ACOMPANHAMENTO_INEXISTENTE );
            }

            try
            {
                if ( ( referencia_hidden != null ) && ! referencia_hidden.equals( "" ) )
                {
                    periodosConsiderados =
                        acompReferenciaDao.getPeriodosAnterioresOrdenado( Long.valueOf( referencia_hidden ),
                                                                          qtdePeriodosAnteriores,
                                                                          Long.valueOf( codTipoAcompanhamento ),
                                                                          false );
                }
            } catch ( Exception e )
            {
                //NAO EXISTE A REFERENCIA;
                throw new PermissaoAcessoLinkException( ErroPermissaoAcessoLinkEnum.REFERENCIA_INEXISTENTE );
            }

            try
            {
                // Busca cole��o com o per�odo a ser considereado
                if ( ( codAri != null ) && ! codAri.equals( "" ) )
                {
                    ari = (AcompReferenciaItemAri) ariDao.buscar( AcompReferenciaItemAri.class,
                                                                  Long.valueOf( codAri ) );
                    item = ari.getItemEstruturaIett(  );
                }
            } catch ( Exception e )
            {
                //NAO EXISTE O ACOMPANHAMENTO;
                throw new PermissaoAcessoLinkException( ErroPermissaoAcessoLinkEnum.ACOMPANHAMENTO_INEXISTENTE );
            }

            //verifica se o usu�rio pode "Gerar Per�odo de Acompanhamento"
            if ( permissaoAdministradorAcompanhamento )
            {
                permissaoLapis = true;
            } else
            {
                itPeriodosAcao = periodosConsiderados.iterator(  );
                mapAcao = acompReferenciaItemDao.criarMapPeriodoAri( periodosConsiderados, item );
                tpfaOrdenadosPorEstrutura = tipoFuncAcompDao.getFuncaoAcompOrderByEstruturas(  );

                if ( ( itPeriodosAcao != null ) && itPeriodosAcao.hasNext(  ) )
                {
                    //Pega s� o per�odo selecionado (Aref), que � o primeiro
                    acompReferencia = (AcompReferenciaAref) itPeriodosAcao.next(  );

                    if ( ! mapAcao.isEmpty(  ) && mapAcao.containsKey( acompReferencia ) )
                    {
                        AcompReferenciaItemAri ariAcao = (AcompReferenciaItemAri) mapAcao.get( acompReferencia );

                        //Pega os Arels do Ari selecionado
                        List relatorios =
                            acompReferenciaItemDao.getAcompRelatorioArelOrderByFuncaoAcomp( ariAcao,
                                                                                            tpfaOrdenadosPorEstrutura );
                        Iterator itRelatorios = relatorios.iterator(  );

                        if ( itRelatorios != null )
                        {
                            while ( itRelatorios.hasNext(  ) )
                            {
                                AcompRelatorioArel relatorio = (AcompRelatorioArel) itRelatorios.next(  );

                                ItemEstUsutpfuacIettutfa itemEstUsu =
                                    itemEstUsuDao.buscar( item.getCodIett(  ),
                                                          relatorio.getTipoFuncAcompTpfa(  ).getCodTpfa(  ) );

                                //Verifica se a permiss�o � de grupo ou usu�rio
                                if ( ( itemEstUsu != null ) && ( usuario != null ) )
                                {
                                    if ( itemEstUsu.getUsuarioUsu(  ) != null )
                                    {
                                        usuarioLogadoEmiteParecer = itemEstUsu.getUsuarioUsu(  ).getCodUsu(  )
                                                                              .equals( usuario.getCodUsu(  ) );
                                    } else if ( itemEstUsu.getSisAtributoSatb(  ) != null )
                                    {
                                        if ( itemEstUsu.getSisAtributoSatb(  ).getUsuarioAtributoUsuas(  ) != null )
                                        {
                                            Iterator itUsuarios =
                                                itemEstUsu.getSisAtributoSatb(  ).getUsuarioAtributoUsuas(  ).iterator(  );

                                            if ( itUsuarios != null )
                                            {
                                                while ( itUsuarios.hasNext(  ) )
                                                {
                                                    UsuarioAtributoUsua usuarioAtributoUsua =
                                                        (UsuarioAtributoUsua) itUsuarios.next(  );

                                                    if ( ( usuarioAtributoUsua != null ) &&
                                                             ( usuarioAtributoUsua.getUsuarioUsu(  ) != null ) &&
                                                             usuarioAtributoUsua.getUsuarioUsu(  ).getCodUsu(  )
                                                                                    .equals( usuario.getCodUsu(  ) ) )
                                                    {
                                                        usuarioLogadoEmiteParecer = true;

                                                        break;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }

                                if ( usuarioLogadoEmiteParecer == true )
                                {
                                    break;
                                }
                            }
                        }
                    }

                    if ( ! ( usuarioLogadoEmiteParecer || permissaoLapis ) )
                    {
                        //N�O TEM PERMISSAO PARA ACESSAR O ACOMPANHAMENTO
                        throw new PermissaoAcessoLinkException( ErroPermissaoAcessoLinkEnum.SEM_PERMISSAO_ACOMPANHAMENTO );
                    }
                }
            }
        } catch ( ECARException e )
        {
            this.logger.error( e );
            throw new PermissaoAcessoLinkException( e );
        }

        /*int posicao = 0;


View Full Code Here

                                                                     seguranca.getGruposAcesso(  ) );
                }
            } catch ( Exception e )
            {
                //NAO EXISTE O TIPO DE ACOMPANHAMENTO;
                throw new PermissaoAcessoLinkException( ErroPermissaoAcessoLinkEnum.TIPO_DE_ACOMPANHAMENTO_INEXISTENTE );
            }

            try
            {
                if ( ( referencia_hidden != null ) && ! referencia_hidden.equals( "" ) )
                {
                    periodosConsiderados =
                        acompReferenciaDao.getPeriodosAnterioresOrdenado( Long.valueOf( referencia_hidden ),
                                                                          qtdePeriodosAnteriores,
                                                                          Long.valueOf( codTipoAcompanhamento ),
                                                                          false );
                }
            } catch ( Exception e )
            {
                //NAO EXISTE A REFERENCIA;
                throw new PermissaoAcessoLinkException( ErroPermissaoAcessoLinkEnum.REFERENCIA_INEXISTENTE );
            }

            try
            {
                // Busca cole��o com o per�odo a ser considereado
                if ( ( codAri != null ) && ! codAri.equals( "" ) )
                {
                    ari = (AcompReferenciaItemAri) ariDao.buscar( AcompReferenciaItemAri.class,
                                                                  Long.valueOf( codAri ) );
                    item = ari.getItemEstruturaIett(  );
                }
            } catch ( Exception e )
            {
                //NAO EXISTE O ACOMPANHAMENTO;
                throw new PermissaoAcessoLinkException( ErroPermissaoAcessoLinkEnum.ACOMPANHAMENTO_INEXISTENTE );
            }

            //verifica se o usu�rio pode "Gerar Per�odo de Acompanhamento"
            if ( permissaoAdministradorAcompanhamento )
            {
                permissaoLapis = true;
            } else
            {
                itPeriodosAcao = periodosConsiderados.iterator(  );
                mapAcao = acompReferenciaItemDao.criarMapPeriodoAri( periodosConsiderados, item );
                tpfaOrdenadosPorEstrutura = tipoFuncAcompDao.getFuncaoAcompOrderByEstruturas(  );

                if ( ( itPeriodosAcao != null ) && itPeriodosAcao.hasNext(  ) )
                {
                    //Pega s� o per�odo selecionado (Aref), que � o primeiro
                    acompReferencia = (AcompReferenciaAref) itPeriodosAcao.next(  );

                    if ( ! mapAcao.isEmpty(  ) && mapAcao.containsKey( acompReferencia ) )
                    {
                        AcompReferenciaItemAri ariAcao = (AcompReferenciaItemAri) mapAcao.get( acompReferencia );

                        //Pega os Arels do Ari selecionado
                        List relatorios =
                            acompReferenciaItemDao.getAcompRelatorioArelOrderByFuncaoAcomp( ariAcao,
                                                                                            tpfaOrdenadosPorEstrutura );
                        Iterator itRelatorios = relatorios.iterator(  );

                        if ( itRelatorios != null )
                        {
                            while ( itRelatorios.hasNext(  ) )
                            {
                                AcompRelatorioArel relatorio = (AcompRelatorioArel) itRelatorios.next(  );

                                ItemEstUsutpfuacIettutfa itemEstUsu =
                                    itemEstUsuDao.buscar( item.getCodIett(  ),
                                                          relatorio.getTipoFuncAcompTpfa(  ).getCodTpfa(  ) );

                                //Verifica se a permiss�o � de grupo ou usu�rio
                                if ( ( itemEstUsu != null ) && ( usuario != null ) )
                                {
                                    if ( itemEstUsu.getUsuarioUsu(  ) != null )
                                    {
                                        usuarioLogadoEmiteParecer = itemEstUsu.getUsuarioUsu(  ).getCodUsu(  )
                                                                              .equals( usuario.getCodUsu(  ) );
                                    } else if ( itemEstUsu.getSisAtributoSatb(  ) != null )
                                    {
                                        if ( itemEstUsu.getSisAtributoSatb(  ).getUsuarioAtributoUsuas(  ) != null )
                                        {
                                            Iterator itUsuarios =
                                                itemEstUsu.getSisAtributoSatb(  ).getUsuarioAtributoUsuas(  ).iterator(  );

                                            if ( itUsuarios != null )
                                            {
                                                while ( itUsuarios.hasNext(  ) )
                                                {
                                                    UsuarioAtributoUsua usuarioAtributoUsua =
                                                        (UsuarioAtributoUsua) itUsuarios.next(  );

                                                    if ( ( usuarioAtributoUsua != null ) &&
                                                             ( usuarioAtributoUsua.getUsuarioUsu(  ) != null ) &&
                                                             usuarioAtributoUsua.getUsuarioUsu(  ).getCodUsu(  )
                                                                                    .equals( usuario.getCodUsu(  ) ) )
                                                    {
                                                        usuarioLogadoEmiteParecer = true;

                                                        break;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }

                                if ( usuarioLogadoEmiteParecer == true )
                                {
                                    break;
                                }
                            }
                        }
                    }

                    if ( ! ( usuarioLogadoEmiteParecer || permissaoLapis ) )
                    {
                        //N�O TEM PERMISSAO PARA ACESSAR O ACOMPANHAMENTO
                        throw new PermissaoAcessoLinkException( ErroPermissaoAcessoLinkEnum.SEM_PERMISSAO_ACOMPANHAMENTO );
                    }
                }
            }
        } catch ( ECARException e )
        {
            this.logger.error( e );
            throw new PermissaoAcessoLinkException( e );
        }

/*                        int posicao = 0;


View Full Code Here

                        (ItemEstruturaIett) this.buscar( ItemEstruturaIett.class,
                                                         Long.valueOf( codIett ) );
                } catch ( Exception e )
                {
                    //ITEM_INEXISTENTE;
                    throw new PermissaoAcessoLinkException( ErroPermissaoAcessoLinkEnum.ITEM_INEXISTENTE );
                }
            }

            //verifica se existe a aba passada como parametro para a estrutura
            if ( ( codAba != null ) && ! codAba.equals( "" ) )
            {
                if ( ( item != null ) && ( item.getEstruturaEtt(  ) != null ) )
                {
                    estruturaEtt = item.getEstruturaEtt(  );
                    estruturaFuncao =
                        estruturaFuncaoDao.getLabelFuncao( estruturaEtt,
                                                           Long.valueOf( codAba ) );
                }

                if ( estruturaFuncao == null )
                {
                    //ABA_INEXISTENTE;
                    throw new PermissaoAcessoLinkException( ErroPermissaoAcessoLinkEnum.ABA_INEXISTENTE );
                }
            }

            //VERIFICA A PERMISSAO DE ACESSO DO ITEM
            if ( item != null )
            {
                if ( ( ( item.getIndAtivoIett(  ) != null ) && ! "".equals( item.getIndAtivoIett(  ).trim(  ) ) ) &&
                         ! "N".equals( item.getIndAtivoIett(  ).toUpperCase(  ) ) )
                {
                    // verifica se o usuario tem permissao de acessar o item em cadastro
                    ValidaPermissao validaPermissao = new ValidaPermissao(  );
                    validaPermissao.permissoesItem( item,
                                                    seguranca.getUsuario(  ),
                                                    seguranca.getGruposAcesso(  ) );

                    boolean permissaoAcessoItem = validaPermissao.permissaoConsultarItem(  );

                    if ( ! permissaoAcessoItem )
                    {
                        // SEM_PERMISSAO;
                        throw new PermissaoAcessoLinkException( ErroPermissaoAcessoLinkEnum.SEM_PERMISSAO_ITEM );
                    }
                } else
                {
                    //  ITEM_INATIVO;
                    throw new PermissaoAcessoLinkException( ErroPermissaoAcessoLinkEnum.ITEM_INATIVO );
                }
            }
        } catch ( ECARException e )
        {
            this.logger.error( e );
            throw new PermissaoAcessoLinkException( e );
        }

        /*try{

                if(!codIett.equals("")) {
View Full Code Here

TOP

Related Classes of ecar.exception.PermissaoAcessoLinkException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.