View Javadoc

1   package ch.odi.justblog.command;
2   
3   import ch.odi.justblog.api.Blog;
4   import ch.odi.justblog.api.Entry;
5   
6   /***
7    * Posts the current entry to the current blog. 
8    *
9    * @author oglueck
10   */
11  public class PostEntry implements Command {
12      
13      /***
14       * 
15       */
16      public PostEntry() {
17      }
18  
19      /***
20       * Posts the entry to the blog. Then sets the entry in the session.
21       */
22      public void execute(ISession session) throws CommandException {
23          Blog blog = session.getBlog();
24          Entry entry = session.getEntry();
25          try {
26              blog.post(entry);
27          } catch (Throwable e) {
28              throw new CommandException(e);
29          }
30      }
31  
32  }