public void update(String id, String title, MenuVisibility visibility, String link, int order) { Menu menu = this.read(id); if (StringUtils.hasText(title)) menu.setTitle(title); if (StringUtils.hasText(link)) menu.setTitle(link); if (visibility != null) menu.setVisibility(visibility); if (order > 0) menu.setOrder(order); this.menuRepository.save(menu); }
public void create(String id, String title, MenuVisibility visibility, String link, int order) { Menu menu = new Menu(); menu.setId(id); menu.setTitle(title); menu.setVisibility(visibility); menu.setLink(link); if (order > 0) { menu.setOrder(order); } this.menuRepository.insert(menu); }