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);
}
}
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);
}
}
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;
}
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;
}
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);
}
Aggregations