View Javadoc
1 /* 2 * Demosys. 3 * 4 * Terms of license - http://opensource.org/licenses/apachepl.php 5 */ 6 package org.demosys.web.story.action; 7 import org.apache.struts.action.ActionError; 8 import org.apache.struts.action.ActionErrors; 9 import org.apache.struts.action.ActionForm; 10 import org.apache.struts.action.ActionMapping; 11 import org.demosys.web.story.StoryView; 12 /*** 13 * Formulaire pour la creation d'une story. 14 */ 15 public class NewStoryForm extends ActionForm { 16 private String title; 17 private String description; 18 private double estimate; 19 private int priority; 20 21 public void reset(ActionMapping actionMapping, 22 javax.servlet.http.HttpServletRequest httpServletRequest) { 23 setTitle(null); 24 setDescription(null); 25 setEstimate(0); 26 setPriority(5); 27 } 28 29 30 public ActionErrors validate(ActionMapping actionMapping, 31 javax.servlet.http.HttpServletRequest httpServletRequest) { 32 ActionErrors errors = new ActionErrors(); 33 34 if (this.getTitle().length() < 2) { 35 errors.add("title", new ActionError("story.new.error.title")); 36 } 37 38 return errors; 39 } 40 41 42 public String getTitle() { 43 return title; 44 } 45 46 47 public void setTitle(String title) { 48 this.title = title; 49 } 50 51 52 public String getDescription() { 53 return description; 54 } 55 56 57 public void setDescription(String description) { 58 this.description = description; 59 } 60 61 62 public double getEstimate() { 63 return estimate; 64 } 65 66 67 public void setEstimate(double estimate) { 68 this.estimate = estimate; 69 } 70 71 72 public int getPriority() { 73 return priority; 74 } 75 76 77 public void setPriority(int priority) { 78 this.priority = priority; 79 } 80 81 82 public StoryView toStoryView() { 83 StoryView story = new StoryView(); 84 story.setTitle(getTitle()); 85 story.setDescription(getDescription()); 86 story.setEstimate(getEstimate()); 87 story.setPriority(getPriority()); 88 89 return story; 90 } 91 }

This page was automatically generated by Maven