use of org.wso2.carbon.apimgt.rest.api.publisher.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;
}
use of org.wso2.carbon.apimgt.rest.api.publisher.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;
}
Aggregations