This commit is contained in:
Maxime Dagnicourt
2008-02-06 10:02:24 +00:00
parent 826ea624f0
commit a561016add

View File

@@ -9,7 +9,7 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.validation.BindException;
import org.springframework.validation.Errors;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.SimpleFormController;
import org.springframework.web.servlet.view.RedirectView;
@@ -52,12 +52,12 @@ public class ChoosePreferenceController extends SimpleFormController {
ArrayList<Preference> preferencesList = new ArrayList<Preference>();
Preference pref;
for(Article article : articleList){
pref = articleManager.getArticlePreferenceForUser(article.getId(), toto.getLogin());
pref = articleManager.getPreferenceForUserAndArticle(article.getId(), toto.getLogin());
if(pref == null){
pref = new Preference();
pref.setArticle(article);
pref.setPcMember(toto);
pref.setPreference("Indifferent");
pref.setPreferenceType(Preference.PreferenceType.INDIFFERENT);
}
preferencesList.add(pref);
}
@@ -78,8 +78,7 @@ public class ChoosePreferenceController extends SimpleFormController {
List<Preference> listPreference=fp.getPreferences();
for(Preference preference : listPreference){
articleManager.addOrUpdatePreference(
preference.getArticle().getId(),
articleManager.addPreference(preference.getArticle().getId(),
preference.getPcMember().getLogin(),
preference.getPreference());
}