Search in sources :

Example 1 with Validations

use of br.com.caelum.vraptor.validator.Validations in project agiletickets by caelum.

the class EstabelecimentosController method adiciona.

@Post
@Path("/estabelecimentos")
public void adiciona(final Estabelecimento estabelecimento) {
    // validando!
    validator.checking(new Validations() {

        {
            that(!Strings.isNullOrEmpty(estabelecimento.getNome()), "estabelecimento.nome", "nome.nulo");
            that(!Strings.isNullOrEmpty(estabelecimento.getEndereco()), "estabelecimento.endereco", "endereco.nulo");
        }
    });
    validator.onErrorRedirectTo(this).lista();
    diretorio.adiciona(estabelecimento);
    result.redirectTo(this).lista();
}
Also used : Validations(br.com.caelum.vraptor.validator.Validations) Path(br.com.caelum.vraptor.Path) Post(br.com.caelum.vraptor.Post)

Aggregations

Path (br.com.caelum.vraptor.Path)1 Post (br.com.caelum.vraptor.Post)1 Validations (br.com.caelum.vraptor.validator.Validations)1