Example #1
0
  private SitemapDTO createSitemapBean(
      String sitemapName, Sitemap sitemap, URI uri, Locale locale) {
    SitemapDTO bean = new SitemapDTO();

    bean.name = sitemapName;
    bean.icon = sitemap.getIcon();
    bean.label = sitemap.getLabel();

    bean.link =
        UriBuilder.fromUri(uri)
            .path(SitemapResource.PATH_SITEMAPS)
            .path(bean.name)
            .build()
            .toASCIIString();
    bean.homepage =
        createPageBean(
            sitemap.getName(),
            sitemap.getLabel(),
            sitemap.getIcon(),
            sitemap.getName(),
            sitemap.getChildren(),
            true,
            false,
            uri,
            locale);
    return bean;
  }
Example #2
0
 public Collection<SitemapDTO> getSitemapBeans(URI uri) {
   Collection<SitemapDTO> beans = new LinkedList<SitemapDTO>();
   logger.debug(
       "Received HTTP GET request at '{}'.", UriBuilder.fromUri(uri).build().toASCIIString());
   for (SitemapProvider provider : sitemapProviders) {
     for (String modelName : provider.getSitemapNames()) {
       Sitemap sitemap = provider.getSitemap(modelName);
       if (sitemap != null) {
         SitemapDTO bean = new SitemapDTO();
         bean.name = modelName;
         bean.icon = sitemap.getIcon();
         bean.label = sitemap.getLabel();
         bean.link = UriBuilder.fromUri(uri).path(bean.name).build().toASCIIString();
         bean.homepage = new PageDTO();
         bean.homepage.link = bean.link + "/" + sitemap.getName();
         beans.add(bean);
       }
     }
   }
   return beans;
 }