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

Add: createPostInPage in BusinessUSer class

parent 2cd6946a
package ifaces;
import model.PostType;
import model.Post;
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{
listOfPages.add(page);
}
//IPLEMENTED METHODS
public void createPost(PostType postType, String message, Page page){
super.createPost(postType);
//DERRIVED ABSTRACT METHODS, includes IPost interface
@Override
public Post createPost(PostType postType, String 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) {
if(pag.getTitle() == page.getTitle()) {
ArrayList<Post> postsInPage = pag.getPostsInPage();
......
......@@ -63,12 +63,13 @@ public class PrivateUser extends User{
}
}
//DERRIVED ABSTRACT METHODS
//@Override
//public void createPost(PostType postType, String message){
// Post newPost = new Post(postType, message);
// posts.add(newPost);
//}
//DERRIVED ABSTRACT METHODS, includes IPost interface
@Override
public Post createPost(PostType postType, String message){
Post newPost = new Post(postType, message);
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