Commit 37c9910e authored by Oskars's avatar Oskars
Browse files

Add: createPostInPage in BusinessUSer class

parent 2cd6946a
package ifaces; package ifaces;
import model.PostType; import model.PostType;
import model.Post;
public interface IPost { public interface IPost {
public void createPost(PostType postType, String msg); public Post createPost(PostType postType, String msg);
} }
...@@ -46,11 +46,15 @@ public class BusinessUser extends User implements IPost{ ...@@ -46,11 +46,15 @@ public class BusinessUser extends User implements IPost{
listOfPages.add(page); listOfPages.add(page);
} }
//IPLEMENTED METHODS //DERRIVED ABSTRACT METHODS, includes IPost interface
public void createPost(PostType postType, String message, Page page){ @Override
super.createPost(postType); public Post createPost(PostType postType, String message) {
Post newPost = new Post(postType, message); Post newPost = new Post(postType, message);
return newPost;
}
public void createPostInPage(PostType postType, String message, Page page){
Post newPost = createPost(postType, message);
for(Page pag: listOfPages) { for(Page pag: listOfPages) {
if(pag.getTitle() == page.getTitle()) { if(pag.getTitle() == page.getTitle()) {
ArrayList<Post> postsInPage = pag.getPostsInPage(); ArrayList<Post> postsInPage = pag.getPostsInPage();
......
...@@ -63,12 +63,13 @@ public class PrivateUser extends User{ ...@@ -63,12 +63,13 @@ public class PrivateUser extends User{
} }
} }
//DERRIVED ABSTRACT METHODS //DERRIVED ABSTRACT METHODS, includes IPost interface
//@Override @Override
//public void createPost(PostType postType, String message){ public Post createPost(PostType postType, String message){
// Post newPost = new Post(postType, message); Post newPost = new Post(postType, message);
// posts.add(newPost); posts.add(newPost);
//} return newPost;
}
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment