use of wooteco.prolog.report.domain.ablity.Ability in project prolog by woowacourse.
the class AbilityService method deleteAbility.
@Transactional
public void deleteAbility(Long memberId, Long abilityId) {
Ability ability = findAbilityByIdAndMemberId(abilityId, memberId);
abilityRepository.delete(ability);
}
use of wooteco.prolog.report.domain.ablity.Ability in project prolog by woowacourse.
the class AbilityService method extractChildAbility.
private Ability extractChildAbility(Member member, List<Ability> abilities, String name, String description, String color, Long parentId) {
Ability parentAbility = findAbilityById(parentId);
Ability childAbility = Ability.child(name, description, color, parentAbility, member);
childAbility.validateDuplicateName(abilities);
childAbility.validateColorWithParent(abilities, parentAbility);
return childAbility;
}
use of wooteco.prolog.report.domain.ablity.Ability in project prolog by woowacourse.
the class AbilityService method addDefaultAbilities.
@Transactional
public void addDefaultAbilities(Long memberId, String template) {
Member member = memberService.findById(memberId);
List<DefaultAbility> defaultAbilities = findDefaultAbilitiesByTemplate(template);
Map<DefaultAbility, Ability> parentAbilities = new HashMap<>();
for (DefaultAbility defaultAbility : defaultAbilities) {
if (defaultAbility.isParent()) {
Ability parentAbility = mapToParentAbility(member, defaultAbility);
parentAbilities.put(defaultAbility, parentAbility);
} else {
Ability parentAbility = parentAbilities.get(defaultAbility.getParent());
mapToChildAbility(member, defaultAbility, parentAbility);
}
}
}
Aggregations