Example usage for java.lang Long compare

List of usage examples for java.lang Long compare

Introduction

In this page you can find the example usage for java.lang Long compare.

Prototype

public static int compare(long x, long y) 

Source Link

Document

Compares two long values numerically.

Usage

From source file:technology.tikal.ventas.service.pedido.PedidoRaizService.java

@RequestMapping(value = "/{pedidoId}", method = RequestMethod.POST)
public void actualizar(@PathVariable final Long pedidoId, @Valid @RequestBody final PedidoRaiz request,
        final BindingResult result) {
    if (result.hasErrors()) {
        throw new NotValidException(result);
    }//from w  w  w. jav a  2 s .  c  o m
    if (Long.compare(request.getId(), pedidoId) != 0) {
        throw new MessageSourceResolvableException(new DefaultMessageSourceResolvable(
                new String[] { "NoValidRequest.PedidoService.actualizarPedido" },
                new String[] { request.getId() + "" },
                "El id del path no corresponde al de la info mandada en el body"));
    }
    pedidoRaizController.actualizar(request);
}

From source file:technology.tikal.ventas.service.catalogo.CatalogoService.java

@RequestMapping(value = "/{idCatalogo}", method = RequestMethod.POST)
public void actualizar(@PathVariable final Long idCatalogo, @Valid @RequestBody final Catalogo request,
        final BindingResult result) {
    if (result.hasErrors()) {
        throw new NotValidException(result);
    }//from  www  .  j  a va2 s .  com
    if (request.getId() != null && Long.compare(request.getId(), idCatalogo) != 0) {
        throw new MessageSourceResolvableException(
                new DefaultMessageSourceResolvable(new String[] { "NoValidRequest.CatalogoService.actualizar" },
                        new String[] { request.getId() + "" },
                        "El id del path no corresponde al de la info mandada en el body"));
    }
    catalogoController.actualizar(idCatalogo, request);
}

From source file:technology.tikal.ventas.service.envio.EnvioService.java

@RequestMapping(value = "/{envioId}", method = RequestMethod.POST)
public void actualizar(@PathVariable final Long pedidoId, @PathVariable final Long envioId,
        @Valid @RequestBody final Envio request, final BindingResult result) {
    if (result.hasErrors()) {
        throw new NotValidException(result);
    }//w w w . j a  v a2  s  .  c  om
    if (Long.compare(request.getId(), envioId) != 0) {
        throw new MessageSourceResolvableException(new DefaultMessageSourceResolvable(
                new String[] { "NoValidRequest.PedimentoService.actualizar" },
                new String[] { request.getId() + "" },
                "El id del path no corresponde al de la info mandada en el body"));
    }
    envioController.actualizar(pedidoId, envioId, request);
}

From source file:com.spotify.heroic.common.DateRange.java

@Override
public int compareTo(DateRange other) {
    return Long.compare(start, other.start);
}

From source file:technology.tikal.ventas.service.pedido.PartidaService.java

@RequestMapping(value = "/{partidaId}", method = RequestMethod.POST)
public void actualizar(@PathVariable final Long pedidoId, @PathVariable final Long partidaId,
        @Valid @RequestBody final Partida request, final BindingResult result) {
    if (result.hasErrors()) {
        throw new NotValidException(result);
    }/*from   ww  w .  j  av a  2  s .  co  m*/
    if (Long.compare(request.getId(), partidaId) != 0) {
        throw new MessageSourceResolvableException(new DefaultMessageSourceResolvable(
                new String[] { "NoValidRequest.PartidaService.actualizarPedido" },
                new String[] { request.getId() + "" },
                "El id del path no corresponde al de la info mandada en el body"));
    }
    partidaController.actualizar(pedidoId, partidaId, request);
}

From source file:technology.tikal.ventas.service.pedido.SubPedidoService.java

@RequestMapping(value = "/{subPedidoId}", method = RequestMethod.POST)
public void actualizar(@PathVariable final Long pedidoId, @PathVariable final Long subPedidoId,
        @Valid @RequestBody final SubPedido request, final BindingResult result) {
    if (result.hasErrors()) {
        throw new NotValidException(result);
    }/* w w w  .  ja v a2s .c o  m*/
    if (Long.compare(request.getId(), subPedidoId) != 0) {
        throw new MessageSourceResolvableException(new DefaultMessageSourceResolvable(
                new String[] { "NoValidRequest.SubPedidoService.actualizarPedido" },
                new String[] { request.getId() + "" },
                "El id del path no corresponde al de la info mandada en el body"));
    }
    subPedidoController.actualizar(pedidoId, request);
}

From source file:technology.tikal.ventas.service.catalogo.ProductoService.java

@RequestMapping(value = "/{productoId}", method = RequestMethod.POST)
public void actualizar(@PathVariable final Long idCatalogo, @PathVariable final Long productoId,
        @Valid @RequestBody final Producto request, final BindingResult result) {
    if (result.hasErrors()) {
        throw new NotValidException(result);
    }/*ww  w  .  j  a  v a 2  s .com*/
    if (request.getId() != null && Long.compare(request.getId(), productoId) != 0) {
        throw new MessageSourceResolvableException(
                new DefaultMessageSourceResolvable(new String[] { "NoValidRequest.ProductoService.actualizar" },
                        new String[] { request.getId() + "" },
                        "El id del path no corresponde al de la info mandada en el body"));
    }
    productoController.actualizar(idCatalogo, productoId, request);
}

From source file:technology.tikal.ventas.service.pedimento.PedimentoService.java

@RequestMapping(value = "/{pedimentoId}", method = RequestMethod.POST)
public void actualizar(@PathVariable final Long pedidoId, @PathVariable final Long pedimentoId,
        @Valid @RequestBody final Pedimento request, final BindingResult result) {
    if (result.hasErrors()) {
        throw new NotValidException(result);
    }/*from w  ww. j  a  v  a  2  s .c  o m*/
    if (Long.compare(request.getId(), pedimentoId) != 0) {
        throw new MessageSourceResolvableException(new DefaultMessageSourceResolvable(
                new String[] { "NoValidRequest.PedimentoService.actualizar" },
                new String[] { request.getId() + "" },
                "El id del path no corresponde al de la info mandada en el body"));
    }
    pedimentoController.actualizar(pedidoId, pedimentoId, request);
}

From source file:sf.net.experimaestro.fs.XPMFileSystemProvider.java

protected Path resolvePath(Path path) {
    XPMPath _path = (XPMPath) path;/*w ww  .  jav  a 2s.  c o  m*/

    return Transaction.evaluate(em -> {
        NetworkShare share = NetworkShare.find(em, _path.getHostName(), _path.getShareName());
        NetworkShareAccess accesses[] = share.getAccess().toArray(new NetworkShareAccess[0]);
        Arrays.sort(accesses, (o1, o2) -> Long.compare(o2.getPriority(), o1.getPriority()));
        for (NetworkShareAccess access : accesses) {
            final SingleHostConnector connector = access.getConnector();
            final String hostPath = access.getPath();
            try {
                return connector.resolveFile(hostPath).resolve(_path.getLocalPath()).normalize();

            } catch (IOException e) {
                LOGGER.error(e, "Error trying to access %s from %s", hostPath, connector);
                continue;
            }
        }
        return null;
    });
}

From source file:technology.tikal.ventas.service.catalogo.LineaProductoService.java

@RequestMapping(value = "/{lineaProductoId}", method = RequestMethod.POST)
public void actualizar(@PathVariable final Long idCatalogo, @PathVariable final Long lineaProductoId,
        @Valid @RequestBody final LineaDeProductos request, final BindingResult result) {
    if (result.hasErrors()) {
        throw new NotValidException(result);
    }// w ww  .  j  ava 2s.  c  o  m
    if (request.getId() != null && Long.compare(request.getId(), lineaProductoId) != 0) {
        throw new MessageSourceResolvableException(new DefaultMessageSourceResolvable(
                new String[] { "NoValidRequest.LineaProductoService.actualizar" },
                new String[] { request.getId() + "" },
                "El id del path no corresponde al de la info mandada en el body"));
    }
    lineaProductoController.actualizar(idCatalogo, lineaProductoId, request);
}