This post is primarily for developers using the NixMash Blog App, as we’ve added Categories and here are the rules. It may also be interesting to developers who appreciate the level of detail that can go into seemingly simple data points.
First a screenshot of the Categories Administration page. The two checkboxes represent the properties IS_ACTIVE and IS_DEFAULT. More on those in a second.
- While WordPress supports multiple categories per Post, only a single category can be assigned per post in the NixMash Blog app.
- All posts not assigned a category are assigned UNCATEGORIZED, or Category_Id 1L. Posts imported from WordPress and not assigned a category will have this Id already assigned, otherwise the posts’ first assigned WordPress category
- As the focus of Blogs often change over time, we support an ACTIVE status. When INACTIVE, categories will not appear in the Post Editor Category Selection.
- A single category is assigned the DEFAULT CATEGORY status, which simply means it appears first in the Post Editor Category Selection for ease of use
- When a category is deleted, all posts assigned that category are assigned the UNCATEGORIZED category.
- The UNCATEGORIZED category cannot be changed or deleted.
The tests to confirm the Category Rules are primarily found in the PostServiceTests Class of the JPA Module, as the PostService layer is where the rules are enforced.
Source Code Notes for this Post
Source code discussed in this post can be found in my NixMash Blog project located on GitHub.