コード例 #1
0
  private SiteEntity createSiteFixture1() {

    SiteEntity siteEntity = new SiteEntity();
    siteEntity.setKey(1);
    siteEntity.setLanguage(createLanguage("no", "Norwegian"));
    mi_forside = createMenuItem("1", "forside", null);
    mi_nyheter = createMenuItem("2", "nyheter", mi_forside);
    mi_innenriks = createMenuItem("3", "innenriks", mi_nyheter);
    siteEntity.setFirstPage(mi_forside);

    Map<CaseInsensitiveString, MenuItemEntity> topMenuItems =
        new LinkedHashMap<CaseInsensitiveString, MenuItemEntity>();
    topMenuItems.put(new CaseInsensitiveString(mi_forside.getName()), mi_forside);
    siteEntity.setTopMenuItems(topMenuItems);
    return siteEntity;
  }
コード例 #2
0
  public Element createResourceElement(final MenuItemEntity menuItem) {
    final Element objectEl = new Element("resource");
    objectEl.setAttribute("key", menuItem.getMenuItemKey().toString());
    objectEl.setAttribute("type", "menuitem");

    objectEl.addContent(createElement("name", menuItem.getName()));
    objectEl.addContent(createElement("menu-name", asEmptyIfNull(menuItem.getMenuName())));
    Element altElem = createElement("display-name", asEmptyIfNull(menuItem.getDisplayName()));
    objectEl.addContent(altElem);

    objectEl.addContent(createElement("show-in-menu", menuItem.getHidden() ? "false" : "true"));
    objectEl.addContent(createElement("keywords", asEmptyIfNull(menuItem.getKeywords())));
    objectEl.addContent(createElement("description", asEmptyIfNull(menuItem.getDescription())));
    objectEl.addContent(createElement("type", menuItem.getType().getName()));

    return objectEl;
  }