Search in sources :

Example 1 with ChallengeSetDTO

use of org.wso2.carbon.identity.rest.api.server.challenge.v1.dto.ChallengeSetDTO in project identity-api-server by wso2.

the class ServerChallengeService method getChallengeSetDTO.

private ChallengeSetDTO getChallengeSetDTO(String questionSetId, List<ChallengeQuestion> questions) {
    ChallengeSetDTO challenge = new ChallengeSetDTO();
    challenge.setQuestionSetId(questionSetId);
    List<ChallengeQuestionDTO> questionDTOs = questions.stream().map(new ChallengeQuestionToExternal()).collect(Collectors.toList());
    challenge.setQuestions(questionDTOs);
    return challenge;
}
Also used : ChallengeSetDTO(org.wso2.carbon.identity.rest.api.server.challenge.v1.dto.ChallengeSetDTO) ChallengeQuestionToExternal(org.wso2.carbon.identity.rest.api.server.challenge.v1.core.functions.ChallengeQuestionToExternal) ChallengeQuestionDTO(org.wso2.carbon.identity.rest.api.server.challenge.v1.dto.ChallengeQuestionDTO)

Example 2 with ChallengeSetDTO

use of org.wso2.carbon.identity.rest.api.server.challenge.v1.dto.ChallengeSetDTO in project identity-api-server by wso2.

the class ServerChallengeService method buildChallengeQuestionSets.

private ChallengeQuestion[] buildChallengeQuestionSets(List<ChallengeSetDTO> challengeSets) {
    List<ChallengeQuestion> questions = new ArrayList<>();
    for (ChallengeSetDTO challengeSet : challengeSets) {
        String setId = challengeSet.getQuestionSetId();
        questions = buildChallengeQuestions(challengeSet.getQuestions(), setId);
    }
    return questions.toArray(new ChallengeQuestion[0]);
}
Also used : ChallengeSetDTO(org.wso2.carbon.identity.rest.api.server.challenge.v1.dto.ChallengeSetDTO) ArrayList(java.util.ArrayList) ChallengeQuestion(org.wso2.carbon.identity.recovery.model.ChallengeQuestion)

Aggregations

ChallengeSetDTO (org.wso2.carbon.identity.rest.api.server.challenge.v1.dto.ChallengeSetDTO)2 ArrayList (java.util.ArrayList)1 ChallengeQuestion (org.wso2.carbon.identity.recovery.model.ChallengeQuestion)1 ChallengeQuestionToExternal (org.wso2.carbon.identity.rest.api.server.challenge.v1.core.functions.ChallengeQuestionToExternal)1 ChallengeQuestionDTO (org.wso2.carbon.identity.rest.api.server.challenge.v1.dto.ChallengeQuestionDTO)1