Search in sources :

Example 1 with Developer

use of com.viadee.sonarQuest.entities.Developer in project sonarQuest by viadee.

the class DeveloperController method getDeveloperByID.

/**
 * Get a Developer by Id
 *
 * @param id
 * @return
 */
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public DeveloperDto getDeveloperByID(@PathVariable(value = "id") Long id) {
    Developer developer = this.developerRepository.findById(id);
    DeveloperDto developerDto = null;
    if (developer != null) {
        developerDto = this.toDeveloperDto(developer);
    }
    return developerDto;
}
Also used : Developer(com.viadee.sonarQuest.entities.Developer) DeveloperDto(com.viadee.sonarQuest.dtos.DeveloperDto)

Example 2 with Developer

use of com.viadee.sonarQuest.entities.Developer in project sonarQuest by viadee.

the class DeveloperController method deleteDeveloper.

@CrossOrigin
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
public void deleteDeveloper(@PathVariable(value = "id") Long id) {
    Developer developer = developerRepository.findById(id);
    developerService.deleteDeveloper(developer);
}
Also used : Developer(com.viadee.sonarQuest.entities.Developer)

Example 3 with Developer

use of com.viadee.sonarQuest.entities.Developer in project sonarQuest by viadee.

the class DeveloperController method updateDeveloper.

@CrossOrigin
@RequestMapping(value = "/{id}", method = RequestMethod.PUT)
public DeveloperDto updateDeveloper(@PathVariable(value = "id") Long id, @RequestBody DeveloperDto developerDto) {
    Developer developer = developerRepository.findById(id);
    if (developer != null) {
        developer.setGold((developerDto.getGold()));
        developer.setXp(developerDto.getXp());
        developer.setLevel(this.levelService.getLevelByDeveloperXp(developer.getXp()));
        developer.setPicture(developerDto.getPicture());
        developer.setAboutMe(developerDto.getAboutMe());
        developer.setAvatarClass(developerDto.getAvatarClass());
        developer.setAvatarRace(developerDto.getAvatarRace());
        developer.setArtefacts(developerDto.getArtefacts());
        developer = this.developerRepository.save(developer);
    }
    return this.toDeveloperDto(developer);
}
Also used : Developer(com.viadee.sonarQuest.entities.Developer)

Example 4 with Developer

use of com.viadee.sonarQuest.entities.Developer in project sonarQuest by viadee.

the class WorldController method getCurrentWorld.

@CrossOrigin
@RequestMapping(value = "/developer/{developer_id}", method = RequestMethod.GET)
public WorldDto getCurrentWorld(@PathVariable(value = "developer_id") Long developer_id) {
    Developer d = this.developerRepository.findById(developer_id);
    World w = this.worldService.getCurrentWorld(d);
    return toWorldDto(w);
}
Also used : Developer(com.viadee.sonarQuest.entities.Developer) World(com.viadee.sonarQuest.entities.World)

Example 5 with Developer

use of com.viadee.sonarQuest.entities.Developer in project sonarQuest by viadee.

the class AdventureService method addDeveloperToAdventure.

/**
 * Add a developer to adventure
 * @param adventureId
 * @param developerId
 * @return adventure
 */
public Adventure addDeveloperToAdventure(long adventureId, long developerId) {
    Adventure adventure = adventureRepository.findOne(adventureId);
    final Developer developer = developerRepository.findOne(developerId);
    if (adventure != null && developer != null) {
        final List<Developer> developerList = adventure.getDevelopers();
        if (!developerList.contains(developer)) {
            developerList.add(developer);
        }
        adventure.setDevelopers(developerList);
        adventure = adventureRepository.save(adventure);
    }
    return adventure;
}
Also used : Adventure(com.viadee.sonarQuest.entities.Adventure) Developer(com.viadee.sonarQuest.entities.Developer)

Aggregations

Developer (com.viadee.sonarQuest.entities.Developer)21 World (com.viadee.sonarQuest.entities.World)7 Adventure (com.viadee.sonarQuest.entities.Adventure)6 Participation (com.viadee.sonarQuest.entities.Participation)5 Quest (com.viadee.sonarQuest.entities.Quest)5 Test (org.junit.Test)4 ArrayList (java.util.ArrayList)3 List (java.util.List)3 DeveloperDto (com.viadee.sonarQuest.dtos.DeveloperDto)2 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)2 SkillType (com.viadee.sonarQuest.constants.SkillType)1 Level (com.viadee.sonarQuest.entities.Level)1 Skill (com.viadee.sonarQuest.entities.Skill)1 Task (com.viadee.sonarQuest.entities.Task)1 DeveloperGratification (com.viadee.sonarQuest.interfaces.DeveloperGratification)1 DeveloperRepository (com.viadee.sonarQuest.repositories.DeveloperRepository)1 Collectors (java.util.stream.Collectors)1 Autowired (org.springframework.beans.factory.annotation.Autowired)1 Service (org.springframework.stereotype.Service)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1