BrightSide Workbench Full Report + Source Code
org.turro.dossier.util.DossierSitemap Class Reference
Inheritance diagram for org.turro.dossier.util.DossierSitemap:
Collaboration diagram for org.turro.dossier.util.DossierSitemap:

Public Member Functions

Collection< Sitemaps.SitemapLink > getLinks ()
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 45 of file DossierSitemap.java.

Member Function Documentation

◆ getLinks()

Collection<Sitemaps.SitemapLink> org.turro.dossier.util.DossierSitemap.getLinks ( )

Implements org.turro.elephant.sitemap.IElephantSitemap.

Definition at line 48 of file DossierSitemap.java.

48  {
49  ArrayList<Sitemaps.SitemapLink> list = new ArrayList<>();
50  String path = ElephantContext.getEntityWebContext("/dossier");
51  if(!Strings.isBlank(path)) {
52  // TODO: make the exact selection the context do
53  WhereClause wc = new WhereClause();
54  wc.addClause("select d.id from Dossier as d");
55  wc.addClause("where d.category.knowledgeBase = TRUE");
56  wc.addClause("and d.publishable = TRUE");
57  Dao dao = new DossierPU();
58  for(Long dossierId : (List<Long>) dao.getResultList(wc)) {
59  Dossier dossier = dao.find(Dossier.class, dossierId);
60  String ewu = EntityWebUrls.getUrlFromEntity(dossier);
61  if(!Strings.isBlank(ewu)) {
62  Sitemaps.SitemapLink sml = new Sitemaps.SitemapLink(
63  ElephantContext.getRootWebPath() + path + ewu);
64  FileAttach fa = new FileAttach(DossierPU.getObjectPath(dossier));
65  Repository repository = fa.getPublishableRepository(Application.getApplication().getConstructor());
66  for(RepositoryFile rf : repository.getRepositoryFiles("/", "*.jpg,*.png")) {
67  sml.addImage(rf.getWebPath());
68  }
69  list.add(sml);
70  }
71  }
72  }
73  path = ElephantContext.getEntityWebContext("/project");
74  if(!Strings.isBlank(path)) {
75  // TODO: make the exact selection the context do
76  WhereClause wc = new WhereClause();
77  wc.addClause("select d.id from Dossier as d");
78  wc.addClause("where d.category.ownsProjects = TRUE");
79  wc.addClause("and d.publishable = TRUE");
80  wc.addClause("and d.type = :type");
81  wc.addNamedValue("type", DossierType.TYPE_PROJECT);
82  Dao dao = new DossierPU();
83  for(Long dossierId : (List<Long>) dao.getResultList(wc)) {
84  Dossier dossier = dao.find(Dossier.class, dossierId);
85  String ewu = EntityWebUrls.getUrlFromEntity(dossier);
86  if(!Strings.isBlank(ewu)) {
87  Sitemaps.SitemapLink sml = new Sitemaps.SitemapLink(
88  ElephantContext.getRootWebPath() + path + ewu);
89  FileAttach fa = new FileAttach(DossierPU.getObjectPath(dossier));
90  Repository repository = fa.getPublishableRepository(Application.getApplication().getConstructor());
91  for(RepositoryFile rf : repository.getRepositoryFiles("/", "*.jpg,*.png")) {
92  sml.addImage(rf.getWebPath());
93  }
94  list.add(sml);
95  }
96  }
97  }
98  return list;
99  }
Here is the call graph for this function:

The documentation for this class was generated from the following file: