Examples of UsuarioBO


Examples of es.ua.dccia.negocio.UsuarioBO

    }
   
    @GET
    @Produces("image/jpg")
    public Response getImagenPerfil(@PathParam("login") String login, @Context ServletContext servletContext) {
        UsuarioBO usuarioBO = new UsuarioBO();
        if (usuarioBO.getUsuario(login)==null)
            throw new CustomNotFoundException("Usuario '" + login + "' no encontrado: ");
        File imag = new File(servletContext.getRealPath("/")+IImagenService.PROFILE_FOLDER+login+"_o."+IImagenService.DEFAULT_FORMAT);
        if (!imag.exists())
            throw new WebApplicationException("Error interno: la imagen de perfil no existe", Response.Status.INTERNAL_SERVER_ERROR);
        return Response.ok(imag).build();
View Full Code Here

Examples of es.ua.dccia.negocio.UsuarioBO

@WebServlet("/usuario")
public class GetUsuario extends MustacheServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        UsuarioBO ubo = new UsuarioBO();
        String login = req.getParameter("login");
        if (login==null)
            throw new MueveteException("Falta el parámetro 'login'");
        else
            Usuario usuario = ubo.getUsuario(login);
            Map m = new HashMap();
            m.put("usuario", usuario);
            render(m, "usuario", resp);
        }
    }
View Full Code Here

Examples of es.ua.dccia.negocio.UsuarioBO

@Path("/loginDisponible/{login}")
public class LoginDisponible {
    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String loginDisponible(@PathParam("login") String login) {
        UsuarioBO usuarioBO = new UsuarioBO();
        if (usuarioBO.getUsuario(login)==null)
            return "OK";
        else
            return "no";
    }
View Full Code Here

Examples of es.ua.dccia.negocio.UsuarioBO

public class UsuarioResource {
    @POST
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    public Response registrar(@Valid Usuario u, @Context UriInfo uriInfo) {
        UsuarioBO usuarioBO = new UsuarioBO();
        try {
            u.setRol(Tokens.DEFAULT_USER_ROLE);
            usuarioBO.registrar(u);
        } catch(MueveteException me) {
            return Response.status(Response.Status.BAD_REQUEST).entity("Error al crear usuario").build();
        }
        URI uri = uriInfo.getAbsolutePathBuilder().path("{login}").build(u.getLogin());   
        return Response.created(uri).build();
View Full Code Here

Examples of es.ua.dccia.negocio.UsuarioBO

   
    @Path("{login}")
    @GET
    @Produces(MediaType.APPLICATION_JSON)   
    public Usuario getUsuario(@PathParam("login") String login) {
        Usuario buscado = new UsuarioBO().getUsuario(login);
        if (buscado!=null) {
            buscado.setFirmas(null);
            buscado.setPeticiones(null);
            return buscado;
        }
View Full Code Here

Examples of es.ua.dccia.negocio.UsuarioBO

    @RolesAllowed("registrado")
    public String actualizaUsuario(@PathParam("login") String login, UsuarioTO uto, @Context SecurityContext sc) {
        //comprobar que se intenta modificar el usuario logueado actualmente
        if (!login.equals(sc.getUserPrincipal().getName()))
            throw new CustomWebAppException("No puedes modificar los datos de otro usuario", Response.Status.FORBIDDEN);
        UsuarioBO ubo = new UsuarioBO();
        //Si estamos intentando cambiar el password, comprobar que el usuario sabe su password antiguo
        if (uto.getNewPassword()!=null && !ubo.getUsuario(login).getPassword().equals(uto.getOldPassword()))
           throw new CustomWebAppException("La antigua contraseña no es correcta", Response.Status.FORBIDDEN);
        ubo.modificar(uto);
        return "OK";
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.