Search in sources :

Example 1 with CommenterInfoDTO

use of org.wso2.carbon.apimgt.rest.api.store.v1.dto.CommenterInfoDTO in project carbon-apimgt by wso2.

the class CommentMappingUtil method fromCommentToDTOWithUserInfo.

/**
 * Converts a Comment object into corresponding REST API CommentDTO object with User Info.
 *
 * @param comment comment object
 * @return CommentDTO
 */
public static CommentDTO fromCommentToDTOWithUserInfo(Comment comment, Map<String, Map<String, String>> userClaimsMap) throws APIManagementException {
    CommentDTO commentDTO = fromCommentToDTO(comment);
    if (userClaimsMap.get(comment.getUser()) != null) {
        Map userClaims = userClaimsMap.get(comment.getUser());
        CommenterInfoDTO commenterInfoDTO = new CommenterInfoDTO();
        commenterInfoDTO.setFullName((String) userClaims.get(APIConstants.FULL_NAME));
        commenterInfoDTO.setFirstName((String) userClaims.get(APIConstants.FIRST_NAME));
        commenterInfoDTO.setLastName((String) userClaims.get(APIConstants.LAST_NAME));
        commentDTO.setCommenterInfo(commenterInfoDTO);
    }
    return commentDTO;
}
Also used : CommenterInfoDTO(org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.CommenterInfoDTO) CommentDTO(org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.CommentDTO) HashMap(java.util.HashMap) Map(java.util.Map)

Example 2 with CommenterInfoDTO

use of org.wso2.carbon.apimgt.rest.api.store.v1.dto.CommenterInfoDTO in project carbon-apimgt by wso2.

the class CommentMappingUtil method fromCommentToDTOWithUserInfo.

/**
 * Converts a Comment object into corresponding REST API CommentDTO object with User Info
 *
 * @param comment comment object
 * @return CommentDTO
 */
public static CommentDTO fromCommentToDTOWithUserInfo(Comment comment, Map<String, Map<String, String>> userClaimsMap) throws APIManagementException {
    CommentDTO commentDTO = fromCommentToDTO(comment);
    if (userClaimsMap.get(comment.getUser()) != null) {
        Map userClaims = userClaimsMap.get(comment.getUser());
        CommenterInfoDTO commenterInfoDTO = new CommenterInfoDTO();
        commenterInfoDTO.setFullName((String) userClaims.get(APIConstants.FULL_NAME));
        commenterInfoDTO.setFirstName((String) userClaims.get(APIConstants.FIRST_NAME));
        commenterInfoDTO.setLastName((String) userClaims.get(APIConstants.LAST_NAME));
        commentDTO.setCommenterInfo(commenterInfoDTO);
    }
    return commentDTO;
}
Also used : CommenterInfoDTO(org.wso2.carbon.apimgt.rest.api.store.v1.dto.CommenterInfoDTO) CommentDTO(org.wso2.carbon.apimgt.rest.api.store.v1.dto.CommentDTO) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

HashMap (java.util.HashMap)2 Map (java.util.Map)2 CommentDTO (org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.CommentDTO)1 CommenterInfoDTO (org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.CommenterInfoDTO)1 CommentDTO (org.wso2.carbon.apimgt.rest.api.store.v1.dto.CommentDTO)1 CommenterInfoDTO (org.wso2.carbon.apimgt.rest.api.store.v1.dto.CommenterInfoDTO)1