Author: vbriand Date: 2011-03-18 18:09:22 +0100 (Fri, 18 Mar 2011) New Revision: 36 Url: http://chorem.org/repositories/revision/chorem/36 Log: New class with validation for adding a task Added: trunk/chorem-web/src/main/java/org/chorem/gepeto/action/TaskAction.java trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/TaskAction-validation.xml Modified: trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectAction.java trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties trunk/chorem-web/src/main/resources/struts.xml Modified: trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectAction.java =================================================================== --- trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectAction.java 2011-03-18 16:04:03 UTC (rev 35) +++ trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectAction.java 2011-03-18 17:09:22 UTC (rev 36) @@ -10,6 +10,7 @@ /** * Project management class * + * @author vbriand */ public class ProjectAction extends BaseAction { @@ -53,6 +54,7 @@ * * @return INPUT if the mandatory fields haven't all been filled in * @return SUCCESS if the project has been added + * @return ERROR if an error occurred */ public String add() { String result = INPUT; Added: trunk/chorem-web/src/main/java/org/chorem/gepeto/action/TaskAction.java =================================================================== --- trunk/chorem-web/src/main/java/org/chorem/gepeto/action/TaskAction.java (rev 0) +++ trunk/chorem-web/src/main/java/org/chorem/gepeto/action/TaskAction.java 2011-03-18 17:09:22 UTC (rev 36) @@ -0,0 +1,123 @@ +/** + * + */ +package org.chorem.gepeto.action; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.action.BaseAction; + +/** + * Task management class + * + * @author vbriand + */ +public class TaskAction extends BaseAction { + + private static final long serialVersionUID = -3938480897148282089L; + + private static final Log log = LogFactory.getLog(TaskAction.class); + + protected String name; + protected String description; + protected String price; + protected String estimatedDays; + protected String beginDate; + protected String estimatedEndDate; + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * @param description the description to set + */ + public void setDescription(String description) { + this.description = description; + } + + /** + * @return the price + */ + public String getPrice() { + return price; + } + + /** + * @param price the price to set + */ + public void setPrice(String price) { + this.price = price; + } + + /** + * @return the estimatedDays + */ + public String getEstimatedDays() { + return estimatedDays; + } + + /** + * @param estimatedDays the estimatedDays to set + */ + public void setEstimatedDays(String estimatedDays) { + this.estimatedDays = estimatedDays; + } + + /** + * @return the beginDate + */ + public String getBeginDate() { + return beginDate; + } + + /** + * @param beginDate the beginDate to set + */ + public void setBeginDate(String beginDate) { + this.beginDate = beginDate; + } + + /** + * @return the estimatedEndDate + */ + public String getEstimatedEndDate() { + return estimatedEndDate; + } + + /** + * @param estimatedEndDate the estimatedEndDate to set + */ + public void setEstimatedEndDate(String estimatedEndDate) { + this.estimatedEndDate = estimatedEndDate; + } + + /** + * Adds a new task + * + * @return INPUT if the mandatory fields haven't all been filled in + * @return SUCCESS if the task has been added successfully + * @return ERROR if an error occurred + */ + public String add() { + //TODO: implement + return SUCCESS; + } +} Property changes on: trunk/chorem-web/src/main/java/org/chorem/gepeto/action/TaskAction.java ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties =================================================================== --- trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-18 16:04:03 UTC (rev 35) +++ trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-18 17:09:22 UTC (rev 36) @@ -35,9 +35,15 @@ chorem.gepeto.task=Task {0} chorem.gepeto.task.add=Add a new task chorem.gepeto.task.beginDate=Begin date +chorem.gepeto.task.beginDate.required=You must enter the begin date for this task chorem.gepeto.task.description=Description +chorem.gepeto.task.description.required=You must describe the task chorem.gepeto.task.estimatedDays=Estimated days +chorem.gepeto.task.estimatedDays.required=You must enter the estimated number of days for this task chorem.gepeto.task.estimatedEndDate=Estimated end date +chorem.gepeto.task.estimatedEndDate.required=You must enter the estimated end date for this task chorem.gepeto.task.name=Task name +chorem.gepeto.task.name.required=You must enter the task name chorem.gepeto.task.price=Price +chorem.gepeto.task.price.required=You must enter the task price chorem.home=Home Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties =================================================================== --- trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-18 16:04:03 UTC (rev 35) +++ trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-18 17:09:22 UTC (rev 36) @@ -35,9 +35,15 @@ chorem.gepeto.task=T\u00E2che {0} chorem.gepeto.task.add=Ajouter une nouvelle t\u00E2che chorem.gepeto.task.beginDate=Date de d\u00E9but +chorem.gepeto.task.beginDate.required=Vous devez renseigner la date de d\u00E9but de la t\u00E2che chorem.gepeto.task.description=Description +chorem.gepeto.task.description.required=Vous devez d\u00E9crire la t\u00E2che chorem.gepeto.task.estimatedDays=Nombre de jours estim\u00E9s +chorem.gepeto.task.estimatedDays.required=Vous devez renseigner le nombre de jours estim\u00E9s chorem.gepeto.task.estimatedEndDate=Date de fin estim\u00E9e +chorem.gepeto.task.estimatedEndDate.required=Vous devez renseigner la date de fin de la t\u00E2che chorem.gepeto.task.name=Nom de la t\u00E2che +chorem.gepeto.task.name.required=Vous devez donner un nom \u00E0 cette t\u00E2che chorem.gepeto.task.price=Prix +chorem.gepeto.task.price.required=Vous devez donner un prix \u00E0 cette t\u00E2che chorem.home=Accueil Added: trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/TaskAction-validation.xml =================================================================== --- trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/TaskAction-validation.xml (rev 0) +++ trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/TaskAction-validation.xml 2011-03-18 17:09:22 UTC (rev 36) @@ -0,0 +1,36 @@ +<!DOCTYPE validators PUBLIC + "-//OpenSymphony Group//XWork Validator 1.0.2//EN" + "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> + +<validators> + <field name="name"> + <field-validator type="requiredstring"> + <message key="chorem.gepeto.task.name.required" /> + </field-validator> + </field> + <field name="description"> + <field-validator type="requiredstring"> + <message key="chorem.gepeto.task.description.required" /> + </field-validator> + </field> + <field name="price"> + <field-validator type="requiredstring"> + <message key="chorem.gepeto.task.price.required" /> + </field-validator> + </field> + <field name="estimatedDays"> + <field-validator type="requiredstring"> + <message key="chorem.gepeto.task.estimatedDays.required" /> + </field-validator> + </field> + <field name="beginDate"> + <field-validator type="requiredstring"> + <message key="chorem.gepeto.task.beginDate.required" /> + </field-validator> + </field> + <field name="estimatedEndDate"> + <field-validator type="requiredstring"> + <message key="chorem.gepeto.task.estimatedEndDate.required" /> + </field-validator> + </field> +</validators> Property changes on: trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/TaskAction-validation.xml ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: trunk/chorem-web/src/main/resources/struts.xml =================================================================== --- trunk/chorem-web/src/main/resources/struts.xml 2011-03-18 16:04:03 UTC (rev 35) +++ trunk/chorem-web/src/main/resources/struts.xml 2011-03-18 17:09:22 UTC (rev 36) @@ -44,9 +44,14 @@ <action name="removeProject" class="org.chorem.gepeto.action.ProjectAction" method="delete"> <result type="redirectAction">home</result> </action> - <action name="addTaskPage"> + <action name="addTask_input"> <result>/WEB-INF/jsp/gepeto/addTask.jsp</result> </action> + <action name="addTask" class="org.chorem.gepeto.action.TaskAction" method="add"> + <result name="input">/WEB-INF/jsp/gepeto/addTask.jsp</result> + <result name="error">/WEB-INF/jsp/gepeto/addTask.jsp</result> + <result type="redirectAction">home</result> + </action> <action name="addProjectOrder"> <result>/WEB-INF/jsp/gepeto/addProjectOrder.jsp</result> </action>