private Set<OnmsCategory> getOnmsCategoriesFromViewCategories(final Collection<Category> viewCats) { final Set<OnmsCategory> categories = new HashSet<OnmsCategory>(); for (final Category viewCat : viewCats) { final OnmsCategory category = m_categoryDao.findByName(viewCat.getName()); if (category == null) throw new ObjectRetrievalFailureException(OnmsCategory.class, viewCat.getName(), "Unable to locate OnmsCategory named: "+viewCat.getName()+" as specified in the surveillance view configuration file", null); categories.add(category); } return categories; }
public void addCategory(final String category) { m_categories.add(new Category(category)); }
public Category(final String name) { setName(name); }
@Override public void buttonClick(Button.ClickEvent event) { Def finalDef = null; if (def instanceof RowDef) { finalDef = new RowDef(); } if (def instanceof ColumnDef) { finalDef = new ColumnDef(); } Set<Object> categories = (Set<Object>) categoriesTable.getValue(); if (!labelField.isValid()) { ((SurveillanceViewsConfigUI) getUI()).notifyMessage("Error", "Please use an unique label for this category", Notification.Type.ERROR_MESSAGE); return; } if (categories.isEmpty()) { ((SurveillanceViewsConfigUI) getUI()).notifyMessage("Error", "You must choose at least one surveillance category", Notification.Type.ERROR_MESSAGE); return; } for (Object object : categories) { Category category = new Category(); category.setName(categoriesMap.get(object).getName()); finalDef.getCategories().add(category); } finalDef.setLabel(labelField.getValue()); saveActionListener.save(finalDef); close(); } });
@Override public void buttonClick(Button.ClickEvent event) { Def finalDef = null; if (def instanceof RowDef) { finalDef = new RowDef(); } if (def instanceof ColumnDef) { finalDef = new ColumnDef(); } Set<Object> categories = (Set<Object>) categoriesTable.getValue(); if (!labelField.isValid()) { ((SurveillanceViewsConfigUI) getUI()).notifyMessage("Error", "Please use an unique label for this category", Notification.Type.ERROR_MESSAGE); return; } if (categories.isEmpty()) { ((SurveillanceViewsConfigUI) getUI()).notifyMessage("Error", "You must choose at least one surveillance category", Notification.Type.ERROR_MESSAGE); return; } for (Object object : categories) { Category category = new Category(); category.setName(categoriesMap.get(object).getName()); finalDef.getCategories().add(category); } finalDef.setLabel(labelField.getValue()); saveActionListener.save(finalDef); close(); } });
private Set<OnmsCategory> getOnmsCategoriesFromViewCategories(final Collection<Category> viewCats) { final Set<OnmsCategory> categories = new HashSet<OnmsCategory>(); for (final Category viewCat : viewCats) { final OnmsCategory category = m_categoryDao.findByName(viewCat.getName()); if (category == null) throw new ObjectRetrievalFailureException(OnmsCategory.class, viewCat.getName(), "Unable to locate OnmsCategory named: "+viewCat.getName()+" as specified in the surveillance view configuration file", null); categories.add(category); } return categories; }
public void addCategory(final String category) { m_categories.add(new Category(category)); }
@Override public Set<OnmsCategory> doInTransaction(TransactionStatus transactionStatus) { final Set<OnmsCategory> categories = new HashSet<OnmsCategory>(); for (final Category viewCat : viewCats) { final OnmsCategory category = m_categoryDao.findByName(viewCat.getName()); if (category == null) { throw new ObjectRetrievalFailureException(OnmsCategory.class, viewCat.getName(), "Unable to locate OnmsCategory named: " + viewCat.getName() + " as specified in the surveillance view configuration file", null); } categories.add(category); } return categories; } });
@Override public Set<OnmsCategory> doInTransaction(TransactionStatus transactionStatus) { final Set<OnmsCategory> categories = new HashSet<OnmsCategory>(); for (final Category viewCat : viewCats) { final OnmsCategory category = m_categoryDao.findByName(viewCat.getName()); if (category == null) { throw new ObjectRetrievalFailureException(OnmsCategory.class, viewCat.getName(), "Unable to locate OnmsCategory named: " + viewCat.getName() + " as specified in the surveillance view configuration file", null); } categories.add(category); } return categories; } });
@Override public Set<String> getCategoryNames() { return getCategories().stream().map(cat -> { return cat.getName(); }).collect(Collectors.toSet()); }
@Override public boolean containsCategory(final String name) { return getCategories().stream().anyMatch(cat -> { return name.equals(cat.getName()); }); }
@Override public Set<String> getCategoryNames() { return getCategories().stream().map(cat -> { return cat.getName(); }).collect(Collectors.toSet()); }
@Override public boolean containsCategory(final String name) { return getCategories().stream().anyMatch(cat -> { return name.equals(cat.getName()); }); }