Début de la validation pour l'ajout de conférence.
L'ajout des membres existant marche. Policy failures: Code warning - failed on resource ConferenceValidator.java. Reason: Class is a raw type. References to generic type Class<T> should be parameterized, line 10 - failed on resource validation. Reason: Class is a raw type. References to generic type Class<T> should be parameterized, line 10 - failed on resource AddConferenceController.java. Reason: HashSet is a raw type. References to generic type HashSet<E> should be parameterized, line 149 - failed on resource AddConferenceController.java. Reason: Iterator is a raw type. References to generic type Iterator<E> should be parameterized, line 108 - failed on resource AddConferenceController.java. Reason: Iterator is a raw type. References to generic type Iterator<E> should be parameterized, line 115 ... and more. Override reason: go
This commit is contained in:
@@ -8,9 +8,9 @@
|
||||
|
||||
<form:form commandName="formConference" name="monForm">
|
||||
|
||||
<fmt:message key="conference.title" /> <input type="text" name="title"/> <br/><br />
|
||||
<fmt:message key="conference.description" /> <textarea name="description"></textarea> <br/><br />
|
||||
<fmt:message key="conference.otherInformations" /> <textarea name="otherInformations"></textarea> <br/><br />
|
||||
<fmt:message key="conference.title" /> <form:input path="title"/> <form:errors path="title" /> <br/><br />
|
||||
<fmt:message key="conference.description" /> <form:textarea path="description" /> <form:errors path="description" /> <br/><br />
|
||||
<fmt:message key="conference.otherInformations" /> <form:textarea path="otherInformations" /> <br/><br />
|
||||
|
||||
<input type="submit" align="middle" name="_target1" value="Next" />
|
||||
|
||||
|
||||
@@ -12,12 +12,12 @@
|
||||
|
||||
<form:form commandName="formConference" name="monForm">
|
||||
|
||||
<fmt:message key="conference2.start" /><input onclick="ds_sh(this);" name="date" style="cursor: text" /><br /><br />
|
||||
<fmt:message key="conference2.end" /><input onclick="ds_sh(this);" name="date2" style="cursor: text" /><br /><br />
|
||||
<fmt:message key="conference2.start" /><form:input onclick="ds_sh(this);" path="dateStart" cssStyle="cursor: text" /> <form:errors path="dateStart" /><br /><br />
|
||||
<fmt:message key="conference2.end" /><form:input onclick="ds_sh(this);" path="dateEnd" cssStyle="cursor: text" /> <form:errors path="dateEnd" /><br /><br />
|
||||
<br />
|
||||
|
||||
<fmt:message key="conference2.article" /><input onclick="ds_sh(this);" name="date3" style="cursor: text" /><br /><br />
|
||||
<fmt:message key="conference2.evaluation" /><input onclick="ds_sh(this);" name="date4" style="cursor: text" /><br /><br />
|
||||
<fmt:message key="conference2.article" /><form:input onclick="ds_sh(this);" path="dateArticle" cssStyle="cursor: text" /> <form:errors path="dateArticle" /><br /><br />
|
||||
<fmt:message key="conference2.evaluation" /><form:input onclick="ds_sh(this);" path="dateEvaluation" cssStyle="cursor: text" /> <form:errors path="dateEvaluation" /><br /><br />
|
||||
|
||||
|
||||
<input type="submit" name="_target0" value="Back">
|
||||
|
||||
@@ -9,13 +9,17 @@
|
||||
|
||||
<form:form commandName="formConference" name="monForm">
|
||||
|
||||
<fieldset><legend>Information</legend> Page's numbers <input
|
||||
type="text"> File's type : <select>
|
||||
<option>PDF</option>
|
||||
<option>Tex/Latec</option>
|
||||
<option>Word</option>
|
||||
<form:errors path="*" />
|
||||
|
||||
</select></fieldset>
|
||||
<fieldset><legend>Information</legend>
|
||||
Page's numbers <form:input path="pageNumber" />
|
||||
File's type : <form:select path="fileType">
|
||||
<form:option value="" />
|
||||
<form:option value="PDF" />
|
||||
<form:option value="Tex/Latec" />
|
||||
<form:option value="Word" />
|
||||
|
||||
</form:select></fieldset>
|
||||
|
||||
<br />
|
||||
|
||||
@@ -23,7 +27,7 @@
|
||||
|
||||
<br />
|
||||
|
||||
Informations compl<70>mentaires : <textarea></textarea>
|
||||
Informations compl<70>mentaires : <form:textarea path="sendInfo" />
|
||||
|
||||
<br />
|
||||
<br />
|
||||
|
||||
@@ -22,7 +22,7 @@ var peopleCache = { };
|
||||
var viewed = -1;
|
||||
|
||||
function fillTable() {
|
||||
AddCriteriaJS.getUsers(function(people) {
|
||||
AddCriteriaJS.getUsersFiltered(function(people) {
|
||||
// Delete all the rows except for the "pattern" row
|
||||
dwr.util.removeAllRows("personbody", { filter:function(tr) {
|
||||
return (tr.id != "pattern");
|
||||
@@ -77,12 +77,22 @@ function deletePerson(eleid) {
|
||||
if (confirm("Are you sure you want to delete " + person.name + "?")) {
|
||||
dwr.engine.beginBatch();
|
||||
AddCriteriaJS.deletePerson(person);
|
||||
filterUser(null, dwr.util.getValue("myfilter"));
|
||||
fillTable();
|
||||
fillTable2();
|
||||
dwr.engine.endBatch();
|
||||
}
|
||||
}
|
||||
|
||||
Event.observe(window, 'load', function() {
|
||||
new Form.Element.Observer('myfilter', 1, filterUser)
|
||||
});
|
||||
|
||||
function filterUser(el, value) {
|
||||
AddCriteriaJS.fillUser(value);
|
||||
setTimeout("fillTable()", 500);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
@@ -92,11 +102,8 @@ function deletePerson(eleid) {
|
||||
|
||||
<form:form commandName="formConference" name="monForm">
|
||||
|
||||
Filter <input id="myfilter" type="text" />
|
||||
<table border="1">
|
||||
<tr align="right">
|
||||
<td></td>
|
||||
<td>Filter <input id="filter" type="text"/></td>
|
||||
</tr>
|
||||
<tbody id="personbody">
|
||||
<tr id="pattern" style="display: none;">
|
||||
<td><span id="tablePerson">Person</span></td>
|
||||
@@ -107,6 +114,9 @@ function deletePerson(eleid) {
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
Add a new member <br />
|
||||
Mail: <input id="mail" type="text" />
|
||||
|
||||
|
||||
<br />
|
||||
<table border="1">
|
||||
@@ -123,7 +133,7 @@ function deletePerson(eleid) {
|
||||
<br />
|
||||
|
||||
<input type="submit" align="middle" name="_target3" value="Back">
|
||||
<input type="submit" align="middle" name="_finish" value="Next" />
|
||||
<input type="submit" align="middle" name="_finish" value="Finish" />
|
||||
|
||||
|
||||
</form:form>
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
<prop key="/dispatchArticle.htm">
|
||||
DispatchArticleController
|
||||
</prop>
|
||||
<prop key="/addConference5.htm">
|
||||
<!-- <prop key="/addConference5.htm">
|
||||
AddConferenceController5
|
||||
</prop>
|
||||
<prop key="/addConference4.htm">
|
||||
@@ -54,7 +54,7 @@
|
||||
</prop>
|
||||
<prop key="/addConference2.htm">
|
||||
AddConferenceController2
|
||||
</prop>
|
||||
</prop> -->
|
||||
<prop key="/addConference.htm">
|
||||
AddConferenceController
|
||||
</prop>
|
||||
@@ -134,7 +134,7 @@
|
||||
<property name="conferenceManager" ref="conferenceManager" />
|
||||
</bean>
|
||||
|
||||
<bean id="AddConferenceController5"
|
||||
<!-- <bean id="AddConferenceController5"
|
||||
class="org.yacos.web.chairman.controller.AddConferenceController">
|
||||
<dwr:remote javascript="AddCriteriaJS" />
|
||||
<property name="sessionForm" value="true" />
|
||||
@@ -174,16 +174,21 @@
|
||||
value="org.yacos.web.chairman.form.FormConference" />
|
||||
<property name="conferenceManager" ref="conferenceManager" />
|
||||
<property name="userManager" ref="userManager" />
|
||||
</bean>
|
||||
</bean> -->
|
||||
|
||||
<bean id="AddConferenceController"
|
||||
class="org.yacos.web.chairman.controller.AddConferenceController">
|
||||
<dwr:remote javascript="AddCriteriaJS" />
|
||||
<property name="sessionForm" value="true" />
|
||||
<property name="commandName" value="formConference" />
|
||||
<property name="commandClass"
|
||||
value="org.yacos.web.chairman.form.FormConference" />
|
||||
<property name="conferenceManager" ref="conferenceManager" />
|
||||
<property name="userManager" ref="userManager" />
|
||||
<property name="validator" ref="ConferenceValidator"/>
|
||||
</bean>
|
||||
|
||||
<bean id="ConferenceValidator" class="org.yacos.web.chairman.validation.ConferenceValidator">
|
||||
</bean>
|
||||
|
||||
<bean id="EvaluationController"
|
||||
|
||||
@@ -20,9 +20,10 @@ import org.yacos.core.conferences.IConferenceManager;
|
||||
import org.yacos.core.users.IUserManager;
|
||||
import org.yacos.core.users.User;
|
||||
import org.yacos.web.chairman.form.FormConference;
|
||||
import org.yacos.web.chairman.validation.ConferenceValidator;
|
||||
|
||||
|
||||
// TODO : Clean this class
|
||||
//TODO : Clean this class
|
||||
public class AddConferenceController extends AbstractWizardFormController {
|
||||
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
@@ -44,17 +45,18 @@ public class AddConferenceController extends AbstractWizardFormController {
|
||||
this.conferenceManager = conferenceManager;
|
||||
}
|
||||
|
||||
|
||||
// ###########################################################
|
||||
|
||||
private static int nextPerson = 1;
|
||||
|
||||
private List<PersonBean> listPersonBean;
|
||||
private List<PersonBean> listPersonFiltered;
|
||||
private List<PersonBean> listPersonAdded;
|
||||
|
||||
public void initPerson() {
|
||||
listPersonBean = new ArrayList<PersonBean>();
|
||||
listPersonAdded = new ArrayList<PersonBean>();
|
||||
listPersonFiltered = new ArrayList<PersonBean>();
|
||||
List<User> listUsers = userManager.getUsers();
|
||||
for (Iterator i = listUsers.iterator(); i.hasNext();) {
|
||||
User user = (User) i.next();
|
||||
@@ -62,33 +64,74 @@ public class AddConferenceController extends AbstractWizardFormController {
|
||||
PersonBean pb = new PersonBean();
|
||||
pb.setId(getNextPerson());
|
||||
pb.setName(user.getFirstName());
|
||||
// TODO : voir login FIX (because, we need the login to tie the user with the conf)
|
||||
pb.setLogin(user.getLogin());
|
||||
listPersonBean.add(pb);
|
||||
}
|
||||
}
|
||||
|
||||
public void fillUser(String text) {
|
||||
if (text.equals(""))
|
||||
listPersonFiltered = new ArrayList<PersonBean>();
|
||||
else {
|
||||
listPersonFiltered = new ArrayList<PersonBean>();
|
||||
for (Iterator i = listPersonBean.iterator(); i.hasNext();) {
|
||||
PersonBean b = (PersonBean) i.next();
|
||||
|
||||
if (b.getName().toLowerCase().contains(text.toLowerCase()))
|
||||
listPersonFiltered.add(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setPerson(PersonBean b) {
|
||||
if (b.getId() == -1) {
|
||||
b.setId(getNextPerson());
|
||||
}
|
||||
|
||||
//listPersonAdded.remove(b);
|
||||
listPersonAdded.add(b);
|
||||
listPersonBean.remove(b);
|
||||
PersonBean truePerson = getTruePerson(b.getLogin());
|
||||
|
||||
listPersonAdded.remove(truePerson);
|
||||
listPersonAdded.add(truePerson);
|
||||
listPersonBean.remove(truePerson);
|
||||
listPersonFiltered.remove(truePerson);
|
||||
}
|
||||
|
||||
public void deletePerson(PersonBean b) {
|
||||
listPersonAdded.remove(b);
|
||||
listPersonBean.add(b);
|
||||
|
||||
// FIXME b different du b d'avant (dans le set...)
|
||||
PersonBean truePerson = getTruePerson(b.getLogin());
|
||||
|
||||
listPersonAdded.remove(truePerson);
|
||||
listPersonBean.add(truePerson);
|
||||
}
|
||||
|
||||
public PersonBean getTruePerson(String login) {
|
||||
for (Iterator i = listPersonBean.iterator(); i.hasNext();) {
|
||||
PersonBean b = (PersonBean) i.next();
|
||||
|
||||
if (b.getLogin().equals(login))
|
||||
return b;
|
||||
}
|
||||
|
||||
for (Iterator i = listPersonAdded.iterator(); i.hasNext();) {
|
||||
PersonBean b = (PersonBean) i.next();
|
||||
|
||||
if (b.getLogin().equals(login))
|
||||
return b;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private static synchronized int getNextPerson()
|
||||
{
|
||||
return nextPerson++;
|
||||
}
|
||||
|
||||
public List<PersonBean> getUsersFiltered() {
|
||||
return listPersonFiltered;
|
||||
}
|
||||
|
||||
public List<PersonBean> getUsers() {
|
||||
return listPersonBean;
|
||||
}
|
||||
@@ -98,16 +141,12 @@ public class AddConferenceController extends AbstractWizardFormController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ###########################################################
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private static int nextId = 1;
|
||||
|
||||
private Set criteria = new HashSet();
|
||||
private Set criteria = new HashSet();;
|
||||
|
||||
public Set getAllCriteria() {
|
||||
return criteria;
|
||||
@@ -131,14 +170,6 @@ public class AddConferenceController extends AbstractWizardFormController {
|
||||
return nextId++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ###########################################################
|
||||
|
||||
|
||||
@@ -148,13 +179,7 @@ public class AddConferenceController extends AbstractWizardFormController {
|
||||
}
|
||||
|
||||
protected Object formBackingObject(HttpServletRequest request) throws ModelAndViewDefiningException {
|
||||
logger.info("je passe ici");
|
||||
FormConference conference = (FormConference)request.getSession().getAttribute("conferenceForm");
|
||||
if (conference==null) {
|
||||
conference = new FormConference();
|
||||
logger.info("je passe ici la 1ère fois");
|
||||
request.getSession().setAttribute("conferenceForm", conference);
|
||||
}
|
||||
FormConference conference = new FormConference();
|
||||
return conference;
|
||||
}
|
||||
|
||||
@@ -165,48 +190,26 @@ public class AddConferenceController extends AbstractWizardFormController {
|
||||
}*/
|
||||
}
|
||||
|
||||
protected Map referenceData(HttpServletRequest request, int page) {
|
||||
/*if (page == 0) {
|
||||
List creditCardTypes = new ArrayList();
|
||||
creditCardTypes.add("Visa");
|
||||
creditCardTypes.add("MasterCard");
|
||||
creditCardTypes.add("American Express");
|
||||
Map model = new HashMap();
|
||||
model.put("creditCardTypes", creditCardTypes);
|
||||
return model;
|
||||
}*/
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
/*protected int getTargetPage(HttpServletRequest request, Object command, Errors errors, int currentPage) {
|
||||
FormConference conference = (FormConference) command;
|
||||
if (currentPage == 0) {
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return 2;
|
||||
}
|
||||
}*/
|
||||
|
||||
protected void validatePage(Object command, Errors errors, int page) {
|
||||
FormConference conference = (FormConference) command;
|
||||
/*OrderValidator orderValidator = (OrderValidator) getValidator();
|
||||
errors.setNestedPath("order");
|
||||
ConferenceValidator conferenceValidator = (ConferenceValidator) getValidator();
|
||||
switch (page) {
|
||||
case 0:
|
||||
orderValidator.validateCreditCard(orderForm.getOrder(), errors);
|
||||
orderValidator.validateBillingAddress(orderForm.getOrder(), errors);
|
||||
conferenceValidator.validateFirstPage(conference, errors);
|
||||
break;
|
||||
case 1:
|
||||
orderValidator.validateShippingAddress(orderForm.getOrder(), errors);
|
||||
conferenceValidator.validateSecondPage(conference, errors);
|
||||
break;
|
||||
case 2:
|
||||
conferenceValidator.validateThirdPage(conference, errors);
|
||||
break;
|
||||
}
|
||||
errors.setNestedPath("");*/
|
||||
}
|
||||
|
||||
protected ModelAndView processFinish(
|
||||
HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) {
|
||||
FormConference conference = (FormConference) command;
|
||||
|
||||
/*this.petStore.insertOrder(orderForm.getOrder());
|
||||
request.getSession().removeAttribute("sessionCart");
|
||||
Map model = new HashMap();
|
||||
|
||||
@@ -4,6 +4,15 @@ public class PersonBean {
|
||||
|
||||
private int id;
|
||||
private String name;
|
||||
private String login;
|
||||
|
||||
public String getLogin() {
|
||||
return login;
|
||||
}
|
||||
|
||||
public void setLogin(String login) {
|
||||
this.login = login;
|
||||
}
|
||||
|
||||
public PersonBean() {}
|
||||
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
package org.yacos.web.chairman.form;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class FormConference {
|
||||
|
||||
private Integer id;
|
||||
private String title;
|
||||
private String description;
|
||||
private String otherInformations;
|
||||
private Date dateAbstract;
|
||||
private Date dateArticle;
|
||||
private Date dateEvaluation;
|
||||
private Date dateStart;
|
||||
private Date dateEnd;
|
||||
|
||||
private String typeAction;
|
||||
private String dateArticle;
|
||||
private String dateEvaluation;
|
||||
private String dateStart;
|
||||
private String dateEnd;
|
||||
|
||||
private int pageNumber;
|
||||
private String fileType;
|
||||
private String sendInfo;
|
||||
|
||||
public FormConference () {}
|
||||
|
||||
@@ -50,54 +50,59 @@ public class FormConference {
|
||||
this.otherInformations = otherInformations;
|
||||
}
|
||||
|
||||
public Date getDateAbstract() {
|
||||
return dateAbstract;
|
||||
public int getPageNumber() {
|
||||
return pageNumber;
|
||||
}
|
||||
|
||||
public void setDateAbstract(Date dateAbstract) {
|
||||
this.dateAbstract = dateAbstract;
|
||||
public void setPageNumber(int pageNumber) {
|
||||
this.pageNumber = pageNumber;
|
||||
}
|
||||
|
||||
public Date getDateArticle() {
|
||||
public String getFileType() {
|
||||
return fileType;
|
||||
}
|
||||
|
||||
public void setFileType(String fileType) {
|
||||
this.fileType = fileType;
|
||||
}
|
||||
|
||||
public String getSendInfo() {
|
||||
return sendInfo;
|
||||
}
|
||||
|
||||
public void setSendInfo(String sendInfo) {
|
||||
this.sendInfo = sendInfo;
|
||||
}
|
||||
|
||||
public String getDateArticle() {
|
||||
return dateArticle;
|
||||
}
|
||||
|
||||
public void setDateArticle(Date dateArticle) {
|
||||
public void setDateArticle(String dateArticle) {
|
||||
this.dateArticle = dateArticle;
|
||||
}
|
||||
|
||||
public Date getDateEvaluation() {
|
||||
public String getDateEvaluation() {
|
||||
return dateEvaluation;
|
||||
}
|
||||
|
||||
public void setDateEvaluation(Date dateEvaluation) {
|
||||
public void setDateEvaluation(String dateEvaluation) {
|
||||
this.dateEvaluation = dateEvaluation;
|
||||
}
|
||||
|
||||
public Date getDateStart() {
|
||||
public String getDateStart() {
|
||||
return dateStart;
|
||||
}
|
||||
|
||||
public void setDateStart(Date dateStart) {
|
||||
public void setDateStart(String dateStart) {
|
||||
this.dateStart = dateStart;
|
||||
}
|
||||
|
||||
public Date getDateEnd() {
|
||||
public String getDateEnd() {
|
||||
return dateEnd;
|
||||
}
|
||||
|
||||
public void setDateEnd(Date dateEnd) {
|
||||
public void setDateEnd(String dateEnd) {
|
||||
this.dateEnd = dateEnd;
|
||||
}
|
||||
|
||||
public String getTypeAction() {
|
||||
return typeAction;
|
||||
}
|
||||
|
||||
public void setTypeAction(String typeAction) {
|
||||
this.typeAction = typeAction;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package org.yacos.web.chairman.validation;
|
||||
|
||||
import org.springframework.validation.Errors;
|
||||
import org.springframework.validation.ValidationUtils;
|
||||
import org.springframework.validation.Validator;
|
||||
import org.yacos.web.chairman.form.FormConference;
|
||||
|
||||
public class ConferenceValidator implements Validator {
|
||||
|
||||
public boolean supports(Class commandClass) {
|
||||
return FormConference.class.isAssignableFrom(commandClass);
|
||||
}
|
||||
|
||||
public void validate(Object obj, Errors errors) {
|
||||
validateFirstPage((FormConference) obj, errors);
|
||||
validateSecondPage((FormConference) obj, errors);
|
||||
validateThirdPage((FormConference) obj, errors);
|
||||
}
|
||||
|
||||
public void validateFirstPage(FormConference conference, Errors errors) {
|
||||
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "title", "TITLE_REQUIRED", "A title is required");
|
||||
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "description", "DESCRIPTION_REQUIRED", "A description is required");
|
||||
}
|
||||
|
||||
public void validateSecondPage(FormConference conference, Errors errors) {
|
||||
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "dateStart", "DATE_REQUIRED", "A date is required");
|
||||
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "dateEnd", "DATE_REQUIRED", "A date is required");
|
||||
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "dateArticle", "DATE_REQUIRED", "A date is required");
|
||||
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "dateEvaluation", "DATE_REQUIRED", "A date is required");
|
||||
}
|
||||
|
||||
public void validateThirdPage(FormConference conference, Errors errors) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user