Package net.sf.pmr.agilePlanning.domain.story

Examples of net.sf.pmr.agilePlanning.domain.story.Story


   * @see net.sf.pmr.agilePlanning.service.StoryService#deleteTask(int, int, long)
   */
  public Errors deleteTask(final int storyPersistanceId, final int persistanceId, final long persistanceVersion) {

    // find the story
    Story story = storyRepository.findByPersistanceId(storyPersistanceId);

    // if the story is not found, return a global error
    if (story == null) {
      Errors errros = AgilePlanningObjectFactory.getErrors();
      errros.reject("story.doesntExistsInDatabase");
      return errros;
    }
   
    Task taskToDelete = null;
   
    // find the task to delete
    for (Task task : story.getTasks()) {
      if (task.getPersistanceId() == persistanceId) {
        taskToDelete = task;
      }
    }
   
    // if the task is not found, return a global error
    if (taskToDelete == null) {
      Errors errros = AgilePlanningObjectFactory.getErrors();
      errros.reject("task.doesntExistsInDatabase");
      return errros;
    }
   
    // else check if the task can be deleted
    Errors errors = taskValidator.validateForDelete(taskToDelete);
   
    // else, remove the task from the set
    if (!errors.hasErrors()) {

      // update the persistanceVersion
      taskToDelete.setPersistanceVersion(persistanceVersion);

      // remove from the set
      story.getTasks().remove(taskToDelete);
     
      // persist
      this.storyRepository.addOrUpdate(story);
     
    }
View Full Code Here


    public Errors addCharge(final int storyPersistanceId, final int taskPersistanceId, final int userPersistanceId,
            final Date day, final double timeUsedToday, final double daysNeededToFinish) {


        // finding story
        Story story = storyRepository.findByPersistanceId(storyPersistanceId);

    Errors errors = AgilePlanningObjectFactory.getErrors();
       
    // if the story is not found, return a global error
    if (story == null) {
      errors.reject("story.doesntExistsInDatabase");
      return errors;
    }

     
        // building object charge
        Charge charge = AgilePlanningObjectFactory.getCharge();

        charge.setDay(day);
        charge.setDaysNeededToFinish(daysNeededToFinish);
        charge.setTimeUsedToday(timeUsedToday);

        // finding user
        User user = userRepository.findUserByPersistanceId(userPersistanceId);

        charge.setUser(user);

        // adding the charge
        for (Task task : story.getTasks()) {

            if (task.getPersistanceId() == taskPersistanceId) {

                if (task.getCharges() == null) {
View Full Code Here

    public Errors updateCharge(final Date day, final double timeUsedToday, final double daysNeededToFinish,
            final int storyPersistanceId, final int taskPersistanceId, final int chargePersistanceId,
            final long chargePersistanceVersion) {

        // find the charge
        Story story = storyRepository.findByPersistanceId(storyPersistanceId);
       
    Errors errors = AgilePlanningObjectFactory.getErrors();
       
    // if the story is not found, return a global error
    if (story == null) {
      errors.reject("story.doesntExistsInDatabase");
      return errors;
    }


        for (Task task : story.getTasks()) {

            if (task.getPersistanceId() == taskPersistanceId) {

                for (Charge charge : task.getCharges()) {
View Full Code Here

     */
    private Story buildStory(final int projectPersistanceId, final String shortDescription, final String description,
            final double daysEstimated, final int businessValueId, final int riskLevelId) {

        // Build the object
        Story story = AgilePlanningObjectFactory.getStory();

        // find the project
        Project project = projectRepository.findByPersistanceId(projectPersistanceId);
        story.setProject(project);

        story.setShortDescription(shortDescription);
        story.setDescription(description);
        story.setDaysEstimated(daysEstimated);

        // find the riskLevel and business value
        BusinessValue businessValue = businessValueRepository.findById(businessValueId);
        story.setBusinessValue(businessValue);

        RiskLevel riskLevel = riskLevelRepository.findById(riskLevelId);
        story.setRiskLevel(riskLevel);

        return story;

    }
View Full Code Here

      Release release = new ReleaseImpl();
   
      // création de la liste de story
      Set<Story> stories = new HashSet<Story>();
     
      Story mockStory1 = mocksControl.createMock(Story.class);
      Story mockStory2 = mocksControl.createMock(Story.class);

      EasyMock.expect(mockStory1.warning()).andReturn(false);
      EasyMock.expect(mockStory2.warning()).andReturn(false);
     
      stories.add(mockStory1);
      stories.add(mockStory2);
       
        // set mock in replay mode
View Full Code Here

        iteration.setStories(new HashSet<Story>());

        Integer story1PersistanceId = new Integer(3);
        Integer story2PersistanceId = new Integer(4);

        Story story1 = new StoryImpl();
        story1.setPersistanceId(story1PersistanceId);
        story1.setShortDescription("scooby");
        Story story2 = new StoryImpl();
        story2.setPersistanceId(story2PersistanceId);
        story2.setShortDescription("doo");

        Set<Story> stories = new HashSet<Story>();
        stories.add(story1);
        stories.add(story2);
View Full Code Here

        Integer story1PersistanceId = new Integer(3);
        Integer story2PersistanceId = new Integer(4);

        // construction des stories
        Story story1 = new StoryImpl();
        story1.setPersistanceId(story1PersistanceId);
        story1.setShortDescription("scooby");
        Story story2 = new StoryImpl();
        story2.setPersistanceId(story2PersistanceId);
        story2.setShortDescription("doo");

        Set<Story> stories = new HashSet<Story>();
        stories.add(story1);
        stories.add(story2);
View Full Code Here

        iteration.setStories(new HashSet<Story>());

        Integer story1PersistanceId = new Integer(3);
        Integer story2PersistanceId = new Integer(4);

        Story story1 = new StoryImpl();
        story1.setPersistanceId(story1PersistanceId);
        story1.setShortDescription("scooby");
        Story story2 = new StoryImpl();
        story2.setPersistanceId(story2PersistanceId);
        story2.setShortDescription("doo");

        Set<Story> stories = new HashSet<Story>();
        stories.add(story1);
        stories.add(story2);
View Full Code Here

        iteration.setStories(new HashSet<Story>());

        Integer story1PersistanceId = new Integer(3);
        Integer story2PersistanceId = new Integer(4);

        Story story1 = new StoryImpl();
        story1.setPersistanceId(story1PersistanceId);
        story1.setShortDescription("scooby");
        Story story2 = new StoryImpl();
        story2.setPersistanceId(story2PersistanceId);
        story2.setShortDescription("doo");

        Set<Story> stories = new HashSet<Story>();
        stories.add(story1);
        stories.add(story2);
View Full Code Here

      Iteration iteration = new IterationImpl();
     
      iteration.setStories(new HashSet<Story>());
     
      // mock de story
      Story mockStory1 = mocksControl.createMock(Story.class);
      Story mockStory2 = mocksControl.createMock(Story.class);
     
      EasyMock.expect(mockStory1.daysCompleted()).andReturn(new Double(2));
      iteration.getStories().add(mockStory1);
      EasyMock.expect(mockStory2.daysCompleted()).andReturn(new Double(3));
      iteration.getStories().add(mockStory2);
  
       
        // set mock in replay mode
        mocksControl.replay();
View Full Code Here

TOP

Related Classes of net.sf.pmr.agilePlanning.domain.story.Story

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.