01: package com.technoetic.xplanner.tags;
02:
03: import com.technoetic.xplanner.domain.UserStory;
04: import com.technoetic.xplanner.domain.repository.UserStoryRepository;
05: import com.technoetic.xplanner.security.AuthenticationException;
06: import net.sf.hibernate.HibernateException;
07:
08: import java.util.ArrayList;
09: import java.util.List;
10:
11: public class StoryOptionsTag extends OptionsTag {
12: private int actualStoryId;
13:
14: public void setActualStoryId(int actualStoryId) {
15: this .actualStoryId = actualStoryId;
16: }
17:
18: protected UserStoryRepository getUserStoryRepository() {
19: return new UserStoryRepository(getSession(), getAuthorizer(),
20: getLoggedInUserId());
21: }
22:
23: protected List getOptions() throws HibernateException,
24: AuthenticationException {
25: UserStoryRepository userStoryRepository = getUserStoryRepository();
26: List stories = userStoryRepository
27: .fetchStoriesWeCanMoveTasksTo(actualStoryId);
28: List options = new ArrayList();
29: for (int i = 0; i < stories.size(); i++) {
30: UserStory s = (UserStory) stories.get(i);
31: options.add(new StoryModel(new IterationModel(
32: userStoryRepository.getIteration(s)), s));
33: }
34: return options;
35: }
36: }
|