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

         }
       
         // recherche de chaque story
         for (Integer id : storyPersistanceIds) {

           Story story = storyRepository.findByPersistanceId(id);
          
           // et ajout à la liste des story.
           release.getStories().add(story);
       
         }
View Full Code Here

         }
       
         // recherche de chaque story
         for (Integer id : storyPersistanceIds) {

           Story story = storyRepository.findByPersistanceId(id);
          
           // et ajout à la liste des story.
           release.getStories().remove(story);
       
         }
View Full Code Here

         iteration.setPersistanceVersion(iterationPersistanceVersion);

         // recherche de chaque story
         for (Integer id : storyPersistanceIds) {
       
           Story story = storyRepository.findByPersistanceId(id);

           if (story != null) {
             // ajout au set de story de l'iteration
             iteration.getStories().add(story);
           }
View Full Code Here

         iteration.setPersistanceVersion(iterationPersistanceVersion);

         // recherche de chaque story
         for (Integer id : storyPersistanceIds) {
       
           Story story = storyRepository.findByPersistanceId(id);

           if (story != null) {
             // ajout au set de story de l'iteration
             iteration.getStories().remove(story);
           }
View Full Code Here

    public void testAdd() {

        // Comment tester la construction � l'aide de la factory ??
        // et la construction de l'objet
       
        Story story = new StoryImpl();
       
        BusinessValue businessValue = new BusinessValueImpl();
        businessValue.setId(1);
       
        RiskLevel riskLevel = new RiskLevelImpl();
        riskLevel.setId(2);

        story.setPersistanceId(1);
        story.setBusinessValue(businessValue);
        story.setRiskLevel(riskLevel);
       
        Project project = new ProjectImpl();
        project.setPersistanceId(5);
        story.setProject(project);
       
        story.setShortDescription("titi");
        story.setDescription("toto");
        story.setDaysEstimated(2);
       
        MockCore.startBlock();
       
        // recherche bu basicProject
        mockProjectRepository.expectFindByPersistanceId(story.getProject().getPersistanceId(), project);
       
        // recherche des business value et risk level
        mockBusinessValueRepository.expectFindById(story.getBusinessValue().getId(), businessValue);
       
        mockRiskLevelRepository.expectFindById(story.getRiskLevel().getId(), riskLevel);
       
      
        MockCore.endBlock();
       
        // validation
        mockStoryValidator.acceptValidate(new Ignore(), errors);

        // ajout
        mockStoryRepository.acceptAddOrUpdate_Story(new Ignore());
       
        storyService.add(story.getProject().getPersistanceId(), story.getShortDescription(), story.getDescription(), story.getDaysEstimated(), story.getBusinessValue().getId(), story.getRiskLevel().getId());

        // V�rifie les appels
        MockCore.verify();

    }
View Full Code Here

        // TODO comment tester unitairement la construction de l'objet à l'aide de la factory ???
       
        // Comment tester la construction à l'aide de la factory ??
        // et la construction de l'objet
       
        Story story = new StoryImpl();
       
        BusinessValue businessValue = new BusinessValueImpl();
        businessValue.setId(1);
       
        RiskLevel riskLevel = new RiskLevelImpl();
        riskLevel.setId(2);

        story.setPersistanceId(1);
        story.setBusinessValue(businessValue);
        story.setRiskLevel(riskLevel);
       
        Project project = new ProjectImpl();
        project.setPersistanceId(5);
        story.setProject(project);
       
        story.setShortDescription("titi");
        story.setDescription("toto");
        story.setDaysEstimated(2);
       
        MockCore.startBlock();
       
        // recherche bu basicProject
        mockProjectRepository.expectFindByPersistanceId(story.getProject().getPersistanceId(), project);
       
        // recherche des business value et risk level
        mockBusinessValueRepository.expectFindById(story.getBusinessValue().getId(), businessValue);
       
        mockRiskLevelRepository.expectFindById(story.getRiskLevel().getId(), riskLevel);
      
        MockCore.endBlock();

        // validation
        errors.reject("code");
        mockStoryValidator.expectValidate(new Ignore(), errors);

        Errors errorsFromService = storyService.add(story.getProject().getPersistanceId(), story.getShortDescription(), story.getDescription(), story.getDaysEstimated(), story.getBusinessValue().getId(), story.getRiskLevel().getId());

        // V�rifie les appels
        MockCore.verify();
       
        // les erreurs sont retourn�es
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.