Skip to content

Commit

Permalink
Blog - Buscar Posts por Professor
Browse files Browse the repository at this point in the history
  • Loading branch information
Dugo03 committed Nov 27, 2015
1 parent 118a162 commit 8237566
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
plataformaAmorim/.classpath
4 changes: 0 additions & 4 deletions plataformaAmorim/build/classes/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
/br/
/grupo.hbm.xml
/hibernate.cfg.xml
/hibernate.cfg.xml-ambiente1
/log4j.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

Expand All @@ -19,8 +20,11 @@
import org.apache.log4j.Logger;

import br.com.muranodesign.business.BlogService;
import br.com.muranodesign.business.OficinaProfessorService;
import br.com.muranodesign.business.OficinaService;
import br.com.muranodesign.model.Blog;
import br.com.muranodesign.model.Oficina;
import br.com.muranodesign.model.OficinaProfessor;
import br.com.muranodesign.util.StringUtil;
import br.com.muranodesign.util.Upload;

Expand Down Expand Up @@ -150,6 +154,29 @@ public List<Blog> getBlogOficina(@PathParam("id") int id) {
List<Blog> obj = new BlogService().listarOficina(id);
return obj;
}

@Path("BlogProfessor/{id}")
@GET
@Produces("application/json")
public List<Blog> getBlogProfessor(@PathParam("id") int id){
logger.debug("Lista Blog por Professor " + id);
List<Blog> resultado = new ArrayList<Blog>();
List<OficinaProfessor> oficinasProfessor;
List<Oficina> oficinas = new ArrayList<Oficina>();
//List<Cores> cores = new ArrayList<Cores>();

oficinasProfessor = new OficinaProfessorService().listarProfessor(id);

for (OficinaProfessor oficinaProfessor : oficinasProfessor) {
oficinas.add(new OficinaService().listarkey(oficinaProfessor.getOficina().getIdoficina()).get(0));
}

for (Oficina oficina : oficinas){
resultado.addAll(new BlogService().listarOficina(oficina.getIdoficina()));
}

return resultado;
}

/**
*
Expand Down

0 comments on commit 8237566

Please sign in to comment.