@Override public int compareTo(final Category o) { if (o instanceof Label) { final Label other = (Label) o; final int thisVal = displayOrder; final int anotherVal = other.getDisplayOrder(); return thisVal < anotherVal ? -1 : thisVal == anotherVal ? 0 : 1; } else { return super.compareTo(o); } }
@Override public boolean equals(Object o) { if (o == null) { return false; } if (!(o instanceof CategoryImpl)) { return false; } CategoryImpl other = (CategoryImpl) o; return name.equals(other.getName()); }
@Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + (ownerName == null ? 0 : ownerName.hashCode()); return result; }
@Override public void addCategory(final String name, final String iconCSSStyle, final String previewCSSStyleName, final String cssStyleName) throws CategoryAlreadyExistsException { FacadeUtil.checkArgsNotNull(name); final Set<Category> categories = EnvTool.getJournalQueriers().getCategories(Arrays.asList(name)); if (categories != null && !categories.isEmpty()) { throw new CategoryAlreadyExistsException(name); } final CategoryImpl newCategory = new CategoryImpl(name); newCategory.setIconCSSStyle(iconCSSStyle); newCategory.setPreviewCSSStyleName(previewCSSStyleName); newCategory.setReadonlyCSSStyleName(cssStyleName); EnvTool.getRecorder().recordNewCategory(newCategory); }
@Override public boolean equals(final Object anObject) { if (anObject == null) { return false; } if (!(anObject instanceof LabelImpl)) { return false; } final LabelImpl other = (LabelImpl) anObject; return super.equals(other) && getOwnerName().equals(other.getOwnerName()); }
@Override public Set<Category> getAllCategories() { final Set<Category> categories = EnvTool.getJournalQueriers().getAllCategories(); final Set<Category> result = new HashSet<Category>(); for (final Category category : categories) { result.add(new CategoryImpl(category)); } return result; }
@Override public Category updateCategoryByUUID(final String uuid, final String name, final String iconCSSStyle, final String previewCSSStyleName, final String cssStyleName) throws CategoryNotFoundException, CategoryAlreadyExistsException { FacadeUtil.checkArgsNotNull(uuid, name); final CategoryImpl category = EnvTool.getJournalQueriers().getCategoryByUUID(uuid); if (category == null) { throw new CategoryNotFoundException(name); } final Set<Category> categories = EnvTool.getJournalQueriers().getCategories(Arrays.asList(name)); if (categories != null && !categories.isEmpty()) { if (!categories.iterator().next().getUUID().equals(uuid)) { throw new CategoryAlreadyExistsException(name); } } category.setIconCSSStyle(iconCSSStyle); category.setPreviewCSSStyleName(previewCSSStyleName); category.setReadonlyCSSStyleName(cssStyleName); category.setName(name); return new CategoryImpl(category); }
@Override public boolean equals(final Object anObject) { if (anObject == null) { return false; } if (!(anObject instanceof LabelImpl)) { return false; } final LabelImpl other = (LabelImpl) anObject; return super.equals(other) && getOwnerName().equals(other.getOwnerName()); }
@Override public Set<Category> getCategories(final Set<String> names) { final Set<Category> categories = EnvTool.getJournalQueriers().getCategories(names); final Set<Category> result = new HashSet<Category>(); for (final Category category : categories) { result.add(new CategoryImpl(category)); } return result; }
@Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + (ownerName == null ? 0 : ownerName.hashCode()); return result; }
@Override public boolean equals(Object o) { if (o == null) { return false; } if (!(o instanceof CategoryImpl)) { return false; } CategoryImpl other = (CategoryImpl) o; return name.equals(other.getName()); }
@Override public int compareTo(final Category o) { if (o instanceof Label) { final Label other = (Label) o; final int thisVal = displayOrder; final int anotherVal = other.getDisplayOrder(); return thisVal < anotherVal ? -1 : thisVal == anotherVal ? 0 : 1; } else { return super.compareTo(o); } }
@Override public Set<Category> getCategoriesByUUIDs(final Set<CategoryUUID> uuids) { final Set<CategoryImpl> categories = EnvTool.getJournalQueriers().getCategoriesByUUIDs(uuids); final Set<Category> result = new HashSet<Category>(); for (final Category category : categories) { result.add(new CategoryImpl(category)); } return result; }
@Override public Set<Category> getAllCategoriesByUUIDExcept(final Set<CategoryUUID> uuids) { final Set<String> ids = new HashSet<String>(); for (final CategoryUUID categoryUUID : uuids) { ids.add(categoryUUID.getValue()); } final Set<Category> categories = EnvTool.getJournalQueriers().getAllCategoriesExcept(ids); final Set<Category> result = new HashSet<Category>(); for (final Category category : categories) { result.add(new CategoryImpl(category)); } return result; }
recorder.recordNewCategory(new CategoryImpl(name));