-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cria serviço para salvar Ordens, com repository do Panache
- Loading branch information
1 parent
2488f19
commit b9e0547
Showing
4 changed files
with
69 additions
and
2 deletions.
There are no files selected for viewing
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
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
11 changes: 11 additions & 0 deletions
11
src/main/java/br/com/dominio/ordem/repositorio/OrdemRepository.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package br.com.dominio.ordem.repositorio; | ||
|
||
import javax.enterprise.context.ApplicationScoped; | ||
|
||
import br.com.dominio.ordem.Ordem; | ||
import io.quarkus.hibernate.orm.panache.PanacheRepository; | ||
|
||
@ApplicationScoped | ||
public class OrdemRepository implements PanacheRepository<Ordem> { | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/br/com/infraestrutura/ordem/OrdemResource.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package br.com.infraestrutura.ordem; | ||
|
||
import javax.inject.Inject; | ||
import javax.transaction.Transactional; | ||
import javax.ws.rs.Consumes; | ||
import javax.ws.rs.POST; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.core.MediaType; | ||
|
||
import br.com.aplicacao.ordem.OrdemDTO; | ||
import br.com.dominio.ordem.repositorio.OrdemRepository; | ||
|
||
@Path("/ordens") | ||
public class OrdemResource { | ||
|
||
@Inject | ||
OrdemRepository ordemRepository; | ||
|
||
@POST | ||
@Transactional | ||
@Consumes(MediaType.APPLICATION_JSON) | ||
public void insere(OrdemDTO ordemDTO) { | ||
this.ordemRepository.persist(ordemDTO.converteParaAEntidade()); | ||
} | ||
|
||
} |