Example usage for org.springframework.context.support DefaultMessageSourceResolvable DefaultMessageSourceResolvable

List of usage examples for org.springframework.context.support DefaultMessageSourceResolvable DefaultMessageSourceResolvable

Introduction

In this page you can find the example usage for org.springframework.context.support DefaultMessageSourceResolvable DefaultMessageSourceResolvable.

Prototype

public DefaultMessageSourceResolvable(@Nullable String[] codes, @Nullable Object[] arguments,
        @Nullable String defaultMessage) 

Source Link

Document

Create a new DefaultMessageSourceResolvable.

Usage

From source file:com.github.pjungermann.config.specification.constraint.multi.PropertyGetterAccessFailedError.java

/**
 * The error message to be rendered.//from   w ww .j  a  va  2s  .co m
 *
 * @return the error message to be rendered.
 */
@NotNull
@Override
public MessageSourceResolvable getMessage() {
    final String code = getMessageCode();

    return new DefaultMessageSourceResolvable(new String[] { code },
            new Object[] { key.key, key.collectionKey, entry, getterName }, code);
}

From source file:technology.tikal.ventas.controller.producto.imp.CatalogoControllerImp.java

@Override
public Catalogo crear(Catalogo request) {
    if (request.getId() != null) {
        throw new MessageSourceResolvableException(new DefaultMessageSourceResolvable(
                new String[] { "NoValidRequest.CatalogoControllerImp.crearPedido" },
                new String[] { request.getId() + "" }, "El pedido no debe tener id en la creacion"));
    }//w w w . jav a  2s . c o m
    if (request instanceof CatalogoOfy) {
        dao.guardar((CatalogoOfy) request);
        return request;
    } else {
        throw new MessageSourceResolvableException(new DefaultMessageSourceResolvable(
                new String[] { "NoValidRequest.CatalogoControllerImp.crearPedido" },
                new String[] { request.getId() + "" }, "El catalogo no es de un tipo valido"));
    }
}

From source file:com.github.pjungermann.config.specification.FailedToLoadSpecificationError.java

@NotNull
@Override/* w  w  w. j  ava2 s  .  c  o  m*/
public MessageSourceResolvable getMessage() {
    final String code = getMessageCode();

    return new DefaultMessageSourceResolvable(new String[] { code }, getMessageArguments(), code);
}

From source file:com.github.pjungermann.config.specification.constraint.multi.NoCollectionError.java

/**
 * The error message to be rendered./* w ww.j  a  va 2  s . c  om*/
 *
 * @return the error message to be rendered.
 */
@NotNull
@Override
public MessageSourceResolvable getMessage() {
    final String code = getMessageCode();

    return new DefaultMessageSourceResolvable(new String[] { code },
            new Object[] { key.key, key.collectionKey, value }, code);
}

From source file:technology.tikal.ventas.controller.producto.imp.LineaProductoControllerImp.java

@Override
public LineaDeProductos crear(Long idCatalogo, LineaDeProductos request) {
    CatalogoOfy catalogo = (CatalogoOfy) catalogoController.cargar(idCatalogo);
    if (request.getId() != null) {
        throw new MessageSourceResolvableException(new DefaultMessageSourceResolvable(
                new String[] { "NoValidRequest.LineaProductoControllerImp.crearPedido" },
                new String[] { request.getId() + "" }, "El pedido no debe tener id en la creacion"));
    }//from   w  ww . ja va2s .  co m
    LineaDeProductosOfy nuevo = LineaProductoFactory.create(catalogo, request);
    nuevo.update(request);
    dao.guardar(catalogo, nuevo);
    return nuevo;
}

From source file:technology.tikal.ventas.controller.pedido.impl.PedidoRaizControllerImp.java

@Override
public PedidoRaiz crear(PedidoRaiz request) {
    if (request.getId() != null) {
        throw new MessageSourceResolvableException(new DefaultMessageSourceResolvable(
                new String[] { "NoValidRequest.PedidoRaizControllerImp.crear" },
                new String[] { request.getId() + "" }, "El pedido no debe tener id en la creacion"));
    }//from w  ww.jav a2 s.  co  m
    pedidoDao.guardar((PedidoRaizOfy) request);
    return request;
}

From source file:com.github.pjungermann.config.specification.constraint.InvalidConstraintConfigError.java

@NotNull
@Override//from www  . jav  a2 s.  c om
public MessageSourceResolvable getMessage() {
    final SourceLine sourceLine = constraint.definedAt();

    return new DefaultMessageSourceResolvable(new String[] { MESSAGE_CODE },
            new Object[] { constraint.getKey(), constraint.getName(), expectation, sourceLine }, MESSAGE_CODE);
}

From source file:technology.tikal.ventas.controller.pedido.impl.SubPedidoControllerImp.java

@Override
public SubPedido crear(Long pedidoId, SubPedido request) {
    if (request.getId() != null) {
        throw new MessageSourceResolvableException(new DefaultMessageSourceResolvable(
                new String[] { "NoValidRequest.SubPedidoControllerImp.crear" },
                new String[] { request.getId() + "" }, "El pedido no debe tener id en la creacion"));
    }// w  ww. j  a  va 2  s .c  om
    PedidoRaiz pedidoRaiz = pedidoRaizController.get(pedidoId);
    if (pedidoRaiz instanceof PedidoCompuesto) {
        SubPedidoOfy nuevo = PedidoFactory.createSubPedido(request, (PedidoCompuesto) pedidoRaiz);
        nuevo.update(request);
        pedidoDao.guardar(nuevo);
        return nuevo;
    } else {
        throw new MessageSourceResolvableException(new DefaultMessageSourceResolvable(
                new String[] { "NoValidPedido.SubPedidoControllerImp.crear" }, new String[] { pedidoId + "" },
                "El pedido no es compuesto"));
    }
}

From source file:com.github.pjungermann.config.errors.ConfigFileError.java

@NotNull
@Override// ww  w .ja v  a 2s  .  c o m
public MessageSourceResolvable getMessage() {
    final String code = getMessageCode();

    return new DefaultMessageSourceResolvable(new String[] { code, DEFAULT_MESSAGE_CODE },
            getMessageArguments(), code);
}

From source file:technology.tikal.ventas.controller.producto.imp.ProductoDeLineaControllerImp.java

@Override
public ProductoDeLinea crear(Long idCatalogo, Long lineaProductoId, ProductoDeLinea request) {
    CatalogoOfy catalogo = (CatalogoOfy) catalogoController.cargar(idCatalogo);
    LineaDeProductosOfy lineaProducto = (LineaDeProductosOfy) lineaProductoController.cargar(idCatalogo,
            lineaProductoId);//from   w  w  w . ja  v  a2  s  .  co m
    if (request.getId() != null) {
        throw new MessageSourceResolvableException(new DefaultMessageSourceResolvable(
                new String[] { "NoValidRequest.ProductoDeLineaControllerImp.crear" },
                new String[] { request.getId() + "" }, "El producto no debe tener id en la creacion"));
    }
    ProductoDeLineaOfy nuevo = ProductoFactory.create(catalogo, lineaProducto, request);
    nuevo.update(request);
    dao.guardar(catalogo, nuevo);
    return nuevo;
}