-to-Blog How It Works (part 3)
This Is The « -to-blog» System Architecture
3. How the Blog Admin Panel works Blog Admin Panel allows admin to manage blog list and user list and to have control over the users’ membership in blogs (grant/revoke the right to post messages to a blog). It also provides a way to view and to delete blog messages.
3. How the Blog Admin Panel works First of all admin should be able to create/update/delete blogs. BlogBean class implements all the necessary operations. Create Blog: Update Blog: Delete Blog: Create Blog: INSERT INTO blogs (id, name, ,intro) VALUES (NEXTVAL('blog_id_seq'), ?, ?, ?) Update Blog: UPDATE blogs SET name=?, =?,intro=? WHERE id=3 Delete Blog: DELETE FROM blogs WHERE id=7 SELECT * FROM blogs
3. How the Blog Admin Panel works Create User: INSERT INTO authors (id, name, ) VALUES (NEXTVAL(’author_id_seq'), ?, ?) Update User: UPDATE authors SET name=?, =? WHERE id=4 Delete User: DELETE FROM authors WHERE id=6 The second admin task is to create/update/delete users. AuthorBean class implements all the user-related operations. Please note that there is a non-deletable user - «PUBLIC». This user account should be used when admin wish to create a publicly accessible blog. I.e. anybody can post messages to such a blog. Create User: Update User: Delete User: SELECT * FROM authors
3. How the Blog Admin Panel works Make User a Blog Member: INSERT INTO groups (blog_id, author_id) VALUES (?, ?) Remove User from the Blog Member List: DELETE FROM groups WHERE blog_id=? AND author_id=? When the blogs and the users have been created, admin should assign users’ membership in blogs. BlogBean class implements the member- related operations. Each user can be a member of any number of blogs. SELECT author_id FROM groups WHERE blog_id=? AND author_id=?
3. How the Blog Admin Panel works DELETE FROM messages WHERE id=134 Sometimes admin needs to delete some messages posted to a blog (e.g. message was posted by mistake). MessageBean implements the message- related operations. Currently admin can only view and delete messages. So, the message can be modified after it has been posted. SELECT * FROM messages WHERE author_id=4 ORDER BY tstamp, blog_id