Search in sources :

Example 6 with AssignationDto

use of org.collectiveone.modules.assignations.dto.AssignationDto in project CollectiveOneWebapp by CollectiveOne.

the class AssignationService method getAssignationsOfSubinitiatives.

@Transactional
public GetResult<List<AssignationDto>> getAssignationsOfSubinitiatives(UUID initiativeId, UUID evaluatorAppUserId, PageRequest page) {
    /* add assignations of of this initiative */
    List<Assignation> assignationsOfSubinitiative = assignationRepository.findByAlsoInInitiatives_Id(initiativeId, page);
    List<AssignationDto> assignationsDto = new ArrayList<AssignationDto>();
    for (Assignation assignation : assignationsOfSubinitiative) {
        assignationsDto.add(getAssignationDto(assignation.getId(), evaluatorAppUserId, false).getData());
    }
    return new GetResult<List<AssignationDto>>("success", "assignations retrieved", assignationsDto);
}
Also used : AssignationDto(org.collectiveone.modules.assignations.dto.AssignationDto) GetResult(org.collectiveone.common.dto.GetResult) ArrayList(java.util.ArrayList) PeerReviewedAssignation(org.collectiveone.modules.assignations.evaluationlogic.PeerReviewedAssignation) Transactional(javax.transaction.Transactional)

Example 7 with AssignationDto

use of org.collectiveone.modules.assignations.dto.AssignationDto in project CollectiveOneWebapp by CollectiveOne.

the class AssignationService method getAssignationsOfInitiative.

@Transactional
public GetResult<List<AssignationDto>> getAssignationsOfInitiative(UUID initiativeId, UUID evaluatorAppUserId, PageRequest page) {
    /* add assignations of of this initiative */
    List<Assignation> assignations = assignationRepository.findByInitiativeId(initiativeId, page);
    List<AssignationDto> assignationsDto = new ArrayList<AssignationDto>();
    for (Assignation assignation : assignations) {
        assignationsDto.add(getAssignationDto(assignation.getId(), evaluatorAppUserId, false).getData());
    }
    return new GetResult<List<AssignationDto>>("success", "assignations retrieved", assignationsDto);
}
Also used : AssignationDto(org.collectiveone.modules.assignations.dto.AssignationDto) GetResult(org.collectiveone.common.dto.GetResult) ArrayList(java.util.ArrayList) PeerReviewedAssignation(org.collectiveone.modules.assignations.evaluationlogic.PeerReviewedAssignation) Transactional(javax.transaction.Transactional)

Aggregations

AssignationDto (org.collectiveone.modules.assignations.dto.AssignationDto)7 GetResult (org.collectiveone.common.dto.GetResult)5 Transactional (javax.transaction.Transactional)4 PeerReviewedAssignation (org.collectiveone.modules.assignations.evaluationlogic.PeerReviewedAssignation)4 ArrayList (java.util.ArrayList)2 UUID (java.util.UUID)2 PageRequest (org.springframework.data.domain.PageRequest)2 Sort (org.springframework.data.domain.Sort)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 EvaluationDto (org.collectiveone.modules.assignations.dto.EvaluationDto)1 ReceiverDto (org.collectiveone.modules.assignations.dto.ReceiverDto)1