Search in sources :

Example 11 with SwaggerAsyncResponse

use of com.crivano.swaggerservlet.SwaggerAsyncResponse in project balcaovirtual by trf2-jus-br.

the class ConfigLocalidadesGet method run.

@Override
public void run(Request req, Response resp, BalcaojusContext ctx) throws Exception {
    Future<SwaggerAsyncResponse<ILocalidadeGet.Response>> future = SwaggerCall.callAsync("obter localidades", Utils.getApiPassword(req.sistema), "GET", Utils.getApiUrl(req.sistema) + "/localidade", null, ILocalidadeGet.Response.class);
    SwaggerAsyncResponse<ILocalidadeGet.Response> sar = future.get();
    if (sar.getException() != null)
        throw sar.getException();
    ILocalidadeGet.Response r = (ILocalidadeGet.Response) sar.getResp();
    resp.list = new ArrayList<>();
    for (IdNome idNome : r.list) {
        Localidade o = new Localidade();
        o.id = idNome.id;
        o.nome = idNome.nome;
        resp.list.add(o);
    }
}
Also used : SwaggerAsyncResponse(com.crivano.swaggerservlet.SwaggerAsyncResponse) Localidade(br.jus.trf2.balcaojus.IBalcaojus.Localidade) SwaggerAsyncResponse(com.crivano.swaggerservlet.SwaggerAsyncResponse) IdNome(br.jus.trf2.sistemaprocessual.ISistemaProcessual.IdNome) ILocalidadeGet(br.jus.trf2.sistemaprocessual.ISistemaProcessual.ILocalidadeGet)

Example 12 with SwaggerAsyncResponse

use of com.crivano.swaggerservlet.SwaggerAsyncResponse in project balcaovirtual by trf2-jus-br.

the class ConfigTiposDocumentoPeticaoInicialGet method run.

@Override
public void run(Request req, Response resp, BalcaojusContext ctx) throws Exception {
    Future<SwaggerAsyncResponse<ILocalidadeGet.Response>> future = SwaggerCall.callAsync("obter tipos de documento para petição inicial", Utils.getApiPassword(req.sistema), "GET", Utils.getApiUrl(req.sistema) + "/peticao/inicial/tipos-documento", null, ILocalidadeGet.Response.class);
    SwaggerAsyncResponse<ILocalidadeGet.Response> sar = future.get();
    if (sar.getException() != null)
        throw sar.getException();
    ILocalidadeGet.Response r = (ILocalidadeGet.Response) sar.getResp();
    resp.list = new ArrayList<>();
    for (IdNome idNome : r.list) {
        TipoDocumentoPeticaoInicial o = new TipoDocumentoPeticaoInicial();
        o.id = idNome.id;
        o.nome = idNome.nome;
        resp.list.add(o);
    }
}
Also used : SwaggerAsyncResponse(com.crivano.swaggerservlet.SwaggerAsyncResponse) SwaggerAsyncResponse(com.crivano.swaggerservlet.SwaggerAsyncResponse) TipoDocumentoPeticaoInicial(br.jus.trf2.balcaojus.IBalcaojus.TipoDocumentoPeticaoInicial) IdNome(br.jus.trf2.sistemaprocessual.ISistemaProcessual.IdNome) ILocalidadeGet(br.jus.trf2.sistemaprocessual.ISistemaProcessual.ILocalidadeGet)

Example 13 with SwaggerAsyncResponse

use of com.crivano.swaggerservlet.SwaggerAsyncResponse in project balcaovirtual by trf2-jus-br.

the class ProcessoNumeroPeticaoIntercorrenteValidarGet method run.

@Override
public void run(Request req, Response resp, BalcaojusContext ctx) throws Exception {
    Usuario u = BalcaojusServlet.getPrincipal();
    if (u.usuarios.get(req.sistema) == null)
        throw new PresentableUnloggedException("Login inválido para " + Utils.getName(req.sistema));
    Future<SwaggerAsyncResponse<IUsuarioUsernameProcessoNumeroPeticaoIntercorrenteValidarGet.Response>> future = SwaggerCall.callAsync("obter tipos de petição intercorrente", Utils.getApiPassword(req.sistema), "GET", Utils.getApiUrl(req.sistema) + "/usuario/" + u.usuario + "/processo/" + req.numero + "/peticao-intercorrente/validar", null, IUsuarioUsernameProcessoNumeroPeticaoIntercorrenteValidarGet.Response.class);
    SwaggerAsyncResponse<IUsuarioUsernameProcessoNumeroPeticaoIntercorrenteValidarGet.Response> sar = future.get();
    if (sar.getException() != null)
        throw sar.getException();
    IUsuarioUsernameProcessoNumeroPeticaoIntercorrenteValidarGet.Response r = (IUsuarioUsernameProcessoNumeroPeticaoIntercorrenteValidarGet.Response) sar.getResp();
    if (r.tipos != null && r.tipos.size() > 0) {
        resp.tipos = new ArrayList<>();
        for (TipoPeticaoIntercorrente t : r.tipos) {
            ConfigTipoPeticaoIntercorrente tpi = new ConfigTipoPeticaoIntercorrente();
            tpi.sistema = req.sistema;
            tpi.id = t.id;
            tpi.descricao = t.descricao;
            resp.tipos.add(tpi);
        }
    }
    if (r.avisos != null && r.avisos.size() > 0) {
        resp.avisos = new ArrayList<>();
        for (AvisoPeticaoIntercorrente a : r.avisos) {
            ConfigAvisoPeticaoIntercorrente api = new ConfigAvisoPeticaoIntercorrente();
            api.id = a.id;
            api.evento = a.evento;
            api.data = a.data;
            resp.avisos.add(api);
        }
    }
    resp.identencerraprazos = r.identencerraprazos;
    resp.sigilo = r.sigilo;
    resp.parte = r.parte;
}
Also used : SwaggerAsyncResponse(com.crivano.swaggerservlet.SwaggerAsyncResponse) Usuario(br.jus.trf2.balcaojus.AutenticarPost.Usuario) ConfigAvisoPeticaoIntercorrente(br.jus.trf2.balcaojus.IBalcaojus.ConfigAvisoPeticaoIntercorrente) AvisoPeticaoIntercorrente(br.jus.trf2.sistemaprocessual.ISistemaProcessual.AvisoPeticaoIntercorrente) IUsuarioUsernameProcessoNumeroPeticaoIntercorrenteValidarGet(br.jus.trf2.sistemaprocessual.ISistemaProcessual.IUsuarioUsernameProcessoNumeroPeticaoIntercorrenteValidarGet) TipoPeticaoIntercorrente(br.jus.trf2.sistemaprocessual.ISistemaProcessual.TipoPeticaoIntercorrente) ConfigTipoPeticaoIntercorrente(br.jus.trf2.balcaojus.IBalcaojus.ConfigTipoPeticaoIntercorrente) ConfigAvisoPeticaoIntercorrente(br.jus.trf2.balcaojus.IBalcaojus.ConfigAvisoPeticaoIntercorrente) SwaggerAsyncResponse(com.crivano.swaggerservlet.SwaggerAsyncResponse) PresentableUnloggedException(com.crivano.swaggerservlet.PresentableUnloggedException) ConfigTipoPeticaoIntercorrente(br.jus.trf2.balcaojus.IBalcaojus.ConfigTipoPeticaoIntercorrente)

Example 14 with SwaggerAsyncResponse

use of com.crivano.swaggerservlet.SwaggerAsyncResponse in project balcaovirtual by trf2-jus-br.

the class MesaIdDocumentoId2DevolverPost method run.

@Override
public void run(Request req, Response resp, BalcaojusContext ctx) throws Exception {
    if (!req.sistema.contains(".eproc"))
        throw new Exception("Operação disponível apenas para o Eproc");
    Usuario u = BalcaojusServlet.getPrincipal();
    if (u.usuarios.get(req.sistema) == null)
        throw new PresentableUnloggedException("Login inválido para " + Utils.getName(req.sistema));
    IUsuarioUsernameMesaIdDocumentoId2DevolverPost.Request q = new IUsuarioUsernameMesaIdDocumentoId2DevolverPost.Request();
    q.lembrete = req.lembrete;
    Future<SwaggerAsyncResponse<IUsuarioUsernameMesaIdDocumentoId2DevolverPost.Response>> future = SwaggerCall.callAsync(getContext(), Utils.getApiEprocPassword(req.sistema), "POST", Utils.getApiEprocUrl(req.sistema) + "/usuario/" + u.usuario + "/mesa/null/documento/" + req.id2 + "/devolver", q, IUsuarioUsernameMesaIdDocumentoId2DevolverPost.Response.class);
    SwaggerAsyncResponse<IUsuarioUsernameMesaIdDocumentoId2DevolverPost.Response> sar = future.get();
    if (sar.getException() != null)
        throw sar.getException();
    IUsuarioUsernameMesaIdDocumentoId2DevolverPost.Response r = (IUsuarioUsernameMesaIdDocumentoId2DevolverPost.Response) sar.getResp();
    resp.status = r.status;
}
Also used : SwaggerAsyncResponse(com.crivano.swaggerservlet.SwaggerAsyncResponse) SwaggerAsyncResponse(com.crivano.swaggerservlet.SwaggerAsyncResponse) Usuario(br.jus.trf2.balcaojus.AutenticarPost.Usuario) PresentableUnloggedException(com.crivano.swaggerservlet.PresentableUnloggedException) IUsuarioUsernameMesaIdDocumentoId2DevolverPost(br.jus.trf2.sistemaprocessual.ISistemaProcessual.IUsuarioUsernameMesaIdDocumentoId2DevolverPost) PresentableUnloggedException(com.crivano.swaggerservlet.PresentableUnloggedException)

Example 15 with SwaggerAsyncResponse

use of com.crivano.swaggerservlet.SwaggerAsyncResponse in project balcaovirtual by trf2-jus-br.

the class VotosIdAcompanharPost method run.

@Override
public void run(Request req, Response resp, BalcaojusContext ctx) throws Exception {
    if (!req.sistema.contains(".eproc"))
        throw new Exception("Operação disponível apenas para o Eproc");
    Usuario u = BalcaojusServlet.getPrincipal();
    if (u.usuarios.get(req.sistema) == null)
        throw new PresentableUnloggedException("Login inválido para " + Utils.getName(req.sistema));
    IUsuarioUsernameMesaIdDocumentoId2SalvarPost.Request q = new IUsuarioUsernameMesaIdDocumentoId2SalvarPost.Request();
    Future<SwaggerAsyncResponse<IUsuarioUsernameVotosIdAcompanharPost.Response>> future = SwaggerCall.callAsync(getContext(), Utils.getApiEprocPassword(req.sistema), "POST", Utils.getApiEprocVotosUrl(req.sistema) + "/acompanha_relator?sigla=" + u.usuario + "&id_sessao_item=" + req.id, q, IUsuarioUsernameVotosIdAcompanharPost.Response.class);
    SwaggerAsyncResponse<IUsuarioUsernameVotosIdAcompanharPost.Response> sar = future.get();
    if (sar.getException() != null)
        throw sar.getException();
    IUsuarioUsernameVotosIdAcompanharPost.Response r = (IUsuarioUsernameVotosIdAcompanharPost.Response) sar.getResp();
    resp.status = r.status;
    resp.voto = VotosGet.buildVoto(req.sistema, r.voto);
}
Also used : SwaggerAsyncResponse(com.crivano.swaggerservlet.SwaggerAsyncResponse) SwaggerAsyncResponse(com.crivano.swaggerservlet.SwaggerAsyncResponse) Usuario(br.jus.trf2.balcaojus.AutenticarPost.Usuario) PresentableUnloggedException(com.crivano.swaggerservlet.PresentableUnloggedException) IUsuarioUsernameMesaIdDocumentoId2SalvarPost(br.jus.trf2.sistemaprocessual.ISistemaProcessual.IUsuarioUsernameMesaIdDocumentoId2SalvarPost) IUsuarioUsernameVotosIdAcompanharPost(br.jus.trf2.sistemaprocessual.ISistemaProcessual.IUsuarioUsernameVotosIdAcompanharPost) PresentableUnloggedException(com.crivano.swaggerservlet.PresentableUnloggedException)

Aggregations

SwaggerAsyncResponse (com.crivano.swaggerservlet.SwaggerAsyncResponse)16 Usuario (br.jus.trf2.balcaojus.AutenticarPost.Usuario)9 PresentableUnloggedException (com.crivano.swaggerservlet.PresentableUnloggedException)9 IdNome (br.jus.trf2.sistemaprocessual.ISistemaProcessual.IdNome)4 ILocalidadeGet (br.jus.trf2.sistemaprocessual.ISistemaProcessual.ILocalidadeGet)2 IUsuarioUsernameMesaIdDocumentoId2SalvarPost (br.jus.trf2.sistemaprocessual.ISistemaProcessual.IUsuarioUsernameMesaIdDocumentoId2SalvarPost)2 JsonObject (com.google.gson.JsonObject)2 ModalidadePoloProcessual (br.jus.cnj.intercomunicacao_2_2.ModalidadePoloProcessual)1 TipoAssuntoProcessual (br.jus.cnj.intercomunicacao_2_2.TipoAssuntoProcessual)1 TipoCabecalhoProcesso (br.jus.cnj.intercomunicacao_2_2.TipoCabecalhoProcesso)1 TipoDocumento (br.jus.cnj.intercomunicacao_2_2.TipoDocumento)1 TipoParametro (br.jus.cnj.intercomunicacao_2_2.TipoParametro)1 TipoParte (br.jus.cnj.intercomunicacao_2_2.TipoParte)1 TipoPessoa (br.jus.cnj.intercomunicacao_2_2.TipoPessoa)1 TipoPoloProcessual (br.jus.cnj.intercomunicacao_2_2.TipoPoloProcessual)1 TipoQualificacaoPessoa (br.jus.cnj.intercomunicacao_2_2.TipoQualificacaoPessoa)1 TipoRepresentanteProcessual (br.jus.cnj.intercomunicacao_2_2.TipoRepresentanteProcessual)1 ServicoIntercomunicacao222 (br.jus.cnj.servico_intercomunicacao_2_2.ServicoIntercomunicacao222)1 UsuarioDetalhe (br.jus.trf2.balcaojus.AutenticarPost.UsuarioDetalhe)1 Assunto (br.jus.trf2.balcaojus.IBalcaojus.Assunto)1