Last active
August 29, 2015 14:20
-
-
Save cmilfont/39f892c2ba2937aa5f6d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Resource | |
public class Indicacao { | |
@Autowired | |
private SessionFactory sessionFactory; | |
private List<Oportunidade> produz(Prospect prospect) { | |
// usa a sessionFactory que é seu DAO para iteragir | |
// com outras entidades do seu domain | |
} | |
@Post | |
@Consumes | |
public void indicarOportunidade(Prospect prospect) { | |
List<Oportunidade> oportunidades = produz(prospect); | |
this.result.use(json()) | |
.WithoutRoot() | |
.from(oportunidades).serialize(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RestController | |
public class Indicacao { | |
@Autowired | |
private SessionFactory sessionFactory; | |
private List<Oportunidade> oportunidades; | |
@Transactional | |
@RequestMapping("/gerar") | |
public List<Oportunidade> gerar(Prospect prospect) { | |
// usa a sessionFactory que é seu DAO para iteragir | |
// com outras entidades do seu domain | |
return oportunidades; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Resource | |
public class IndicacaoController { | |
@Autowired | |
private IndicacaoService indicacaoService; | |
@Post | |
@Consumes | |
public void indicarOportunidade(Indicacao) { | |
List oportunidades = indicacaoService.produz(Indicacao); | |
this.result.use(json()) | |
.WithoutRoot() | |
.from(oportunidades).serialize(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment