com.google.api.server.spi.response.NotFoundException Java Examples

The following examples show how to use com.google.api.server.spi.response.NotFoundException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CachingDiscoveryProvider.java    From endpoints-java with Apache License 2.0 6 votes vote down vote up
private <T> T getDiscoveryDoc(Cache<ApiKey, T> cache, String root, String name, String version,
    Callable<T> loader) throws NotFoundException, InternalServerErrorException {
  ApiKey key = new ApiKey(name, version, root);
  try {
    return cache.get(key, loader);
  } catch (ExecutionException | UncheckedExecutionException e) {
    // Cast here so we can maintain specific errors for documentation in throws clauses.
    if (e.getCause() instanceof NotFoundException) {
      throw (NotFoundException) e.getCause();
    } else if (e.getCause() instanceof InternalServerErrorException) {
      throw (InternalServerErrorException) e.getCause();
    } else {
      logger.atSevere().withCause(e.getCause()).log("Could not generate or cache discovery doc");
      throw new InternalServerErrorException("Internal Server Error", e.getCause());
    }
  }
}
 
Example #2
Source File: WaxEndpoint.java    From endpoints-java with Apache License 2.0 6 votes vote down vote up
/**
 * Responds with the {@link WaxDataItem} resource requested.
 *
 * @throws NotFoundException if the session doesn't exist or has no {@link WaxDataItem} with the
 *         requested id
 */
@ApiMethod(
    name = "items.get",
    path = "sessions/{sessionId}/items/{itemId}")
public WaxDataItem get(@Named("sessionId") String sessionId, @Named("itemId") String itemId)
    throws NotFoundException {
  try {
    WaxDataItem item = store.get(sessionId, itemId);
    if (item != null) {
      return item;
    }
    throw new NotFoundException("Invalid itemId: " + itemId);
  } catch (InvalidSessionException e) {
    throw new NotFoundException(e.getMessage());
  }
}
 
Example #3
Source File: TechnologyLinkServiceImpl.java    From tech-gallery with Apache License 2.0 6 votes vote down vote up
@Override
public Response getLinksByTech(String techId, User user) throws InternalServerErrorException,
    BadRequestException, NotFoundException, OAuthRequestException {

  final Technology technology = techService.getTechnologyById(techId, user);

  validateUser(user);
  validateTechnology(technology);

  final List<TechnologyLink> linksByTech =
      technologyLinkDao.findAllByTechnology(technology);
  final TechnologyLinksTO response = new TechnologyLinksTO();
  response.setLinks(linksByTech);

  return response;
}
 
Example #4
Source File: TechnologyLinkServiceImpl.java    From tech-gallery with Apache License 2.0 6 votes vote down vote up
@Override
public TechnologyLink addLink(TechnologyLink link, User user)
    throws InternalServerErrorException, BadRequestException, NotFoundException {
  log.info("Starting creating Technology Link.");

  final Technology technology = link.getTechnology().get();

  validateUser(user);
  validateLink(link);
  validateTechnology(technology);

  final TechGalleryUser techUser = userService.getUserByGoogleId(user.getUserId());
  final TechnologyLink newLink = addNewLink(link, techUser, technology);

  // TODO: Adicionar contador de links na tecnologia
  // techService.addLinksCounter(technology);
  techService.audit(technology.getId(), user);

  followTechnology(technology, techUser);

  return newLink;
}
 
Example #5
Source File: ProjectServiceImpl.java    From tech-gallery with Apache License 2.0 6 votes vote down vote up
@Override
public Project addOrUpdateProject(Project project, User user)
        throws InternalServerErrorException, BadRequestException, NotFoundException {

    log.info("Starting creating or updating project");

    validateInputs(project, user);

    final Project newProject;

    if (projectDao.findById(project.getId()) != null) {
        projectDao.update(project);
        newProject = project;
    } else {
        newProject = addNewProject(project);
    }

    return newProject;
}
 
Example #6
Source File: SkillServiceImpl.java    From tech-gallery with Apache License 2.0 6 votes vote down vote up
@Override
public Skill getUserSkill(String techId, TechGalleryUser user) throws BadRequestException,
    OAuthRequestException, NotFoundException, InternalServerErrorException {
  // User can't be null
  if (user == null) {
    throw new OAuthRequestException(i18n.t("Null user reference!"));
  }

  // Technology can't be null
  final Technology technology = techService.getTechnologyById(techId, null);
  if (technology == null) {
    throw new NotFoundException(i18n.t("Technology do not exists!"));
  }
  final Skill userSkill = skillDao.findByUserAndTechnology(user, technology);
  if (userSkill == null) {
    return null;
  } else {
    return userSkill;
  }
}
 
Example #7
Source File: TechnologyRecommendationCommentServiceImpl.java    From tech-gallery with Apache License 2.0 6 votes vote down vote up
@Override
public TechnologyRecommendation addRecommendationComment(TechnologyRecommendation recommendation,
    TechnologyComment comment, Technology technology, User user)
        throws BadRequestException, InternalServerErrorException, NotFoundException {

  if (!isValidComment(comment)) {
    throw new BadRequestException(ValidationMessageEnums.COMMENT_CANNOT_BLANK.message());
  }
  Key<Technology> techKey = Key.create(Technology.class, technology.getId());
  comment.setTechnology(Ref.create(techKey));
  comment = comService.addComment(comment, user);
  recommendation.setComment(Ref.create(comment));
  recommendation.setTimestamp(new Date());
  recommendation.setTechnology(Ref.create(techKey));
  recommendation = recService.addRecommendation(recommendation, user);
  technologyService.audit(technology.getId(), user);

  return recommendation;
}
 
Example #8
Source File: EndorsementServiceImpl.java    From tech-gallery with Apache License 2.0 6 votes vote down vote up
/**
 * GET for getting one endorsement.
 *
 * @throws InternalServerErrorException in case something goes wrong
 * @throws OAuthRequestException in case of authentication problem
 * @throws NotFoundException in case the information are not founded
 * @throws BadRequestException in case a request with problem were made.
 */
@Override
public Response getEndorsementsByTech(String techId, User user)
    throws InternalServerErrorException, BadRequestException, NotFoundException,
    OAuthRequestException {
  final List<Endorsement> endorsementsByTech = endorsementDao.findAllActivesByTechnology(techId);
  final List<EndorsementsGroupedByEndorsedTransient> grouped =
      groupEndorsementByEndorsed(endorsementsByTech, techId);
  final Technology technology = techService.getTechnologyById(techId, user);

  techService.updateEdorsedsCounter(technology, grouped.size());

  groupUsersWithSkill(grouped, technology);

  Collections.sort(grouped, new EndorsementsGroupedByEndorsedTransient());
  final ShowEndorsementsResponse response = new ShowEndorsementsResponse();
  response.setEndorsements(grouped);
  return response;
}
 
Example #9
Source File: TechnologyCommentServiceImpl.java    From tech-gallery with Apache License 2.0 6 votes vote down vote up
@Override
public TechnologyComment addComment(TechnologyComment comment, User user)
    throws InternalServerErrorException, BadRequestException, NotFoundException {
  log.info("Starting creating Technology Comment.");

  final Technology technology = comment.getTechnology().get();

  validateUser(user);
  validateComment(comment);
  validateTechnology(technology);

  final TechGalleryUser techUser = userService.getUserByGoogleId(user.getUserId());
  final TechnologyComment newComment = addNewComment(comment, techUser, technology);
  techService.addCommentariesCounter(technology);
  techService.audit(technology.getId(), user);

  followTechnology(technology, techUser);

  UserProfileServiceImpl.getInstance().handleCommentChanges(newComment);
  return newComment;
}
 
Example #10
Source File: UserServiceTGImpl.java    From tech-gallery with Apache License 2.0 6 votes vote down vote up
/**
 * Checks if user exists on provider, syncs with tech gallery's datastore. If
 * user exists, adds to TG's datastore (if not there). Returns the user.
 *
 * @param userLogin
 *          userLogin
 * @return the user saved on the datastore
 * @throws InternalServerErrorException
 *           in case something goes wrong
 * @throws NotFoundException
 *           in case the information are not founded
 * @throws BadRequestException
 *           in case a request with problem were made.
 * @return user sinchronized in provider.
 */
@Override
public TechGalleryUser getUserSyncedWithProvider(final String userLogin)
    throws NotFoundException, InternalServerErrorException, BadRequestException {
  TechGalleryUser tgUser = null;
  TechGalleryUser userResp = getUserFromProvider(userLogin);
  tgUser = userDao.findByEmail(getUserFromProvider(userLogin).getEmail());
  if (tgUser == null) {
    tgUser = new TechGalleryUser();
    tgUser.setEmail(userResp.getEmail());
    tgUser.setName(userResp.getName());
    tgUser = addUser(tgUser);
    // Key<TechGalleryUser> key = userDao.add(tgUser);
    // tgUser.setId(key.getId());
  }
  return tgUser;
}
 
Example #11
Source File: TechnologyCommentServiceImpl.java    From tech-gallery with Apache License 2.0 6 votes vote down vote up
@Override
public Response getCommentsByTech(String techId, User user) throws InternalServerErrorException,
    BadRequestException, NotFoundException, OAuthRequestException {

  final Technology technology = techService.getTechnologyById(techId, user);

  validateUser(user);
  validateTechnology(technology);

  final List<TechnologyComment> commentsByTech =
      technologyCommentDao.findAllActivesByTechnology(technology);
  final TechnologyCommentsTO response = new TechnologyCommentsTO();
  response.setComments(commentsByTech);
  /*
   * for (TechnologyComment comment : response.getComments()) { setCommentRecommendation(comment);
   * }
   */
  return response;
}
 
Example #12
Source File: TechnologyServiceImpl.java    From tech-gallery with Apache License 2.0 6 votes vote down vote up
/**
 * GET for getting all technologies.
 *
 * @throws NotFoundException .
 */
@Override
public Response getTechnologies(User user)
        throws InternalServerErrorException, NotFoundException, BadRequestException {
    List<Technology> techEntities = technologyDAO.findAllActives();
    // if list is null, return a not found exception
    if (techEntities == null || techEntities.isEmpty()) {
        return new TechnologiesResponse();
    } else {
        verifyTechnologyFollowedByUser(user, techEntities);
        TechnologiesResponse response = new TechnologiesResponse();
        Technology.sortTechnologiesDefault(techEntities);
        response.setTechnologies(techEntities);
        return response;
    }
}
 
Example #13
Source File: TechnologyFollowersServiceImpl.java    From tech-gallery with Apache License 2.0 6 votes vote down vote up
@Override
@Transactional
public Technology followTechnology(String technologyId, TechGalleryUser techUser)
    throws BadRequestException, NotFoundException, InternalServerErrorException {

  Technology technology = techService.getTechnologyById(technologyId, null);
  TechnologyFollowers technologyFollowers = followersDao.findById(technology.getId());

  if (technologyFollowers == null
      || !technologyFollowers.getFollowers().contains(Ref.create(techUser))) {
    technologyFollowers = follow(technologyFollowers, techUser, technology);
  } else if (technologyFollowers != null
      && technologyFollowers.getFollowers().contains(Ref.create(techUser))) {
    technologyFollowers = unfollow(technologyFollowers, techUser, technology);
  }
  update(technologyFollowers);
  userService.updateUser(techUser);

  return technology;
}
 
Example #14
Source File: TechnologyRecommendationCommentServiceImpl.java    From tech-gallery with Apache License 2.0 5 votes vote down vote up
@Override
public void deleteCommentAndRecommendationById(Long recommendationId, Long commentId, User user)
    throws InternalServerErrorException, BadRequestException, NotFoundException,
    OAuthRequestException {
  comService.deleteComment(commentId, user);
  recService.deleteRecommendById(recommendationId, user);
}
 
Example #15
Source File: ProjectServiceImpl.java    From tech-gallery with Apache License 2.0 5 votes vote down vote up
/**
 * Validate inputs of SkillResponse.
 *
 * @param project inputs to be validate
 * @param user    info about user from google
 * @throws BadRequestException          for the validations.
 * @throws InternalServerErrorException in case something goes wrong
 * @throws NotFoundException            in case the information are not founded
 */
private void validateInputs(Project project, User user)
        throws BadRequestException, NotFoundException, InternalServerErrorException {

    log.info("Validating inputs of skill");

    if (user == null || user.getUserId() == null || user.getUserId().isEmpty()) {
        throw new BadRequestException(ValidationMessageEnums.USER_GOOGLE_ENDPOINT_NULL.message());
    }

    if (project == null || project.getName() == null) {
        throw new BadRequestException(ValidationMessageEnums.NAME_CANNOT_BLANK.message());
    }
}
 
Example #16
Source File: TechnologyCommentServiceImpl.java    From tech-gallery with Apache License 2.0 5 votes vote down vote up
/**
 * Validate comment of TechnologyCommentTO.
 *
 * @param comment inputs to be validate
 * @throws BadRequestException in case a request with problem were made.
 * @throws InternalServerErrorException in case something goes wrong
 * @throws NotFoundException in case the information are not founded
 */
private void validateDeletion(Long commentId, User user)
    throws BadRequestException, NotFoundException, InternalServerErrorException {

  log.info("Validating the deletion");

  validateComment(commentId);
  validateUser(user);

  final TechnologyComment comment = technologyCommentDao.findById(commentId);
  final TechGalleryUser techUser = userService.getUserByGoogleId(user.getUserId());
  if (!comment.getAuthor().get().equals(techUser)) {
    throw new BadRequestException(ValidationMessageEnums.COMMENT_AUTHOR_ERROR.message());
  }
}
 
Example #17
Source File: UserServiceTGImpl.java    From tech-gallery with Apache License 2.0 5 votes vote down vote up
/**
 * Gets a TechGalleryUser by id.
 *
 * @param id
 *          the user's id
 * @throws NotFoundException
 *           if the user is not found
 */
@Override
public TechGalleryUser getUser(final Long id) throws NotFoundException {
  TechGalleryUser userEntity = userDao.findById(id);
  // if user is null, return a not found exception
  if (userEntity == null) {
    throw new NotFoundException(i18n.t("No user was found."));
  } else {
    return userEntity;
  }
}
 
Example #18
Source File: UserServiceTGImpl.java    From tech-gallery with Apache License 2.0 5 votes vote down vote up
@Override
public TechGalleryUser validateUser(User user)
    throws BadRequestException, NotFoundException, InternalServerErrorException {

  if (user == null || user.getUserId() == null || user.getUserId().isEmpty()) {
    throw new BadRequestException(ValidationMessageEnums.USER_GOOGLE_ENDPOINT_NULL.message());
  }

  final TechGalleryUser techUser = getUserByGoogleId(user.getUserId());
  if (techUser == null) {
    throw new NotFoundException(ValidationMessageEnums.USER_NOT_EXIST.message());
  }
  return techUser;
}
 
Example #19
Source File: LocalDiscoveryProviderTest.java    From endpoints-java with Apache License 2.0 5 votes vote down vote up
@Test
public void getRpcDocument() {
  try {
    provider.getRpcDocument(ROOT, NAME, VERSION);
    fail("expected NotFoundException");
  } catch (NotFoundException expected) {
    // expected
  }
}
 
Example #20
Source File: RecommendationServiceImpl.java    From tech-gallery with Apache License 2.0 5 votes vote down vote up
@Override
public List<String> getRecommendations(User user)
    throws NotFoundException, BadRequestException, InternalServerErrorException {
  validateUser(user);
  final List<RecommendationEnums> enumValues = Arrays.asList(RecommendationEnums.values());
  final List<String> recommendations = new ArrayList<>();
  for (final RecommendationEnums enumEntry : enumValues) {
    recommendations.add(enumEntry.message());
  }
  return recommendations;
}
 
Example #21
Source File: TechnologyLinkServiceImpl.java    From tech-gallery with Apache License 2.0 5 votes vote down vote up
/**
 * @throws BadRequestException in case a request with problem were made.
 * @throws NotFoundException in case the information are not founded
 */
private void validateTechnology(Technology technology)
    throws BadRequestException, NotFoundException {
  log.info("Validating the technology");
  if (technology == null) {
    throw new NotFoundException(ValidationMessageEnums.TECHNOLOGY_NOT_EXIST.message());
  }
}
 
Example #22
Source File: TechnologyLinkServiceImpl.java    From tech-gallery with Apache License 2.0 5 votes vote down vote up
/**
 * @throws NotFoundException in case the information are not founded
 * @throws BadRequestException in case a request with problem were made.
 */
private void validateLink(Long linkId) throws BadRequestException, NotFoundException {

  log.info("Validating the link");

  if (linkId == null) {
    throw new BadRequestException(ValidationMessageEnums.LINK_ID_CANNOT_BLANK.message());
  }

  final TechnologyLink link = technologyLinkDao.findById(linkId);
  if (link == null) {
    throw new NotFoundException(ValidationMessageEnums.LINK_NOT_EXIST.message());
  }
}
 
Example #23
Source File: UserServiceTGImpl.java    From tech-gallery with Apache License 2.0 5 votes vote down vote up
/**
 * GET Calls the provider API passing a login to obtain a list of users
 * information.
 *
 * @param userLogin
 *          to search on provider by name or login
 *
 * @throws NotFoundException
 *           in case the user is not found on provider
 * @throws BadRequestException
 *           in case of JSON or URL error
 * @throws InternalServerErrorException
 *           if any IO exceptions occur
 */
@SuppressWarnings("unchecked")
@Override
public List<UserResponse> getUsersByPartialLogin(String userLogin)
    throws NotFoundException, BadRequestException, InternalServerErrorException {
  String userLoginFormatted = userLogin + "*";
  List<UserResponse> techUsers = (List<UserResponse>) syncCache.get(userLoginFormatted);
  if (techUsers == null) {
    techUsers = new ArrayList<>();
    Map<String, Object> map = peopleApiConnect(userLoginFormatted, PEOPLE_ENDPOINT_SEARCH);
    ArrayList<?> peopleApiResponse = (ArrayList<?>) map.get("data");
    for (int index = 0; index < peopleApiResponse.size(); index++) {
      ArrayList<?> peopleApiUser = (ArrayList<?>) peopleApiResponse.get(index);
      final String peopleNameLowerCase = peopleApiUser.get(INDEX_PEOPLE_API_NAME).toString().toLowerCase();
      final String peopleLoginLowerCase = peopleApiUser.get(INDEX_PEOPLE_API_LOGIN).toString().toLowerCase();
      if (peopleNameLowerCase.contains(userLogin.toLowerCase())
          || peopleLoginLowerCase.contains(userLogin.toLowerCase())) {

        TechGalleryUser foundUser = userDao
            .findByEmail((String) peopleApiUser.get(INDEX_PEOPLE_API_LOGIN) + EMAIL_DOMAIN);
        UserResponse tgUser = new UserResponse();
        if (foundUser != null) {
          tgUser.setEmail(foundUser.getEmail().split("@")[0]);
          tgUser.setName(foundUser.getName());
          tgUser.setPhoto(foundUser.getPhoto());
        } else {
          tgUser.setEmail((String) peopleApiUser.get(INDEX_PEOPLE_API_LOGIN));
          tgUser.setName((String) peopleApiUser.get(INDEX_PEOPLE_API_NAME));
          tgUser.setPhoto(null);
        }
        techUsers.add(tgUser);
      }
    }
    syncCache.put(userLoginFormatted, techUsers, memCacheTimeExpliration);
  }
  return techUsers;
}
 
Example #24
Source File: UserServiceTGImpl.java    From tech-gallery with Apache License 2.0 5 votes vote down vote up
/**
 * GET Calls the provider API passing a login to obtain user information.
 *
 * @param userLogin
 *          the user login to pass to the provider API
 * @throws NotFoundException
 *           in case the user is not found on provider
 * @throws BadRequestException
 *           in case of JSON or URL error
 * @throws InternalServerErrorException
 *           if any IO exceptions occur
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public TechGalleryUser getUserFromProvider(final String userLogin)
    throws NotFoundException, BadRequestException, InternalServerErrorException {

  TechGalleryUser tgUser = new TechGalleryUser();
  Map<String, Object> providerResponse = peopleApiConnect(userLogin, PEOPLE_ENDPOINT_PROFILE);
  HashMap<String, Object> userData = (LinkedHashMap) providerResponse.get("personal_info");
  tgUser.setEmail((String) userData.get("email"));
  tgUser.setName((String) userData.get("name"));
  return tgUser;
}
 
Example #25
Source File: SkillServiceImpl.java    From tech-gallery with Apache License 2.0 5 votes vote down vote up
/**
 * Validate inputs of SkillResponse.
 *
 * @param skill inputs to be validate
 * @param user info about user from google
 *
 * @throws BadRequestException for the validations.
 * @throws InternalServerErrorException in case something goes wrong
 * @throws NotFoundException in case the information are not founded
 */
private void validateInputs(Skill skill, User user)
    throws BadRequestException, NotFoundException, InternalServerErrorException {

  log.info("Validating inputs of skill");

  if (user == null || user.getUserId() == null || user.getUserId().isEmpty()) {
    throw new BadRequestException(ValidationMessageEnums.USER_GOOGLE_ENDPOINT_NULL.message());
  }

  final TechGalleryUser techUser = userService.getUserByGoogleId(user.getUserId());
  if (techUser == null) {
    throw new BadRequestException(ValidationMessageEnums.USER_NOT_EXIST.message());
  }

  if (skill == null) {
    throw new BadRequestException(ValidationMessageEnums.SKILL_CANNOT_BLANK.message());
  }

  if (skill.getValue() == null || skill.getValue() < 0 || skill.getValue() > 5) {
    throw new BadRequestException(ValidationMessageEnums.SKILL_RANGE.message());
  }

  if (skill.getTechnology() == null) {
    throw new BadRequestException(ValidationMessageEnums.TECHNOLOGY_ID_CANNOT_BLANK.message());
  }

}
 
Example #26
Source File: TechnologyLinkServiceImpl.java    From tech-gallery with Apache License 2.0 5 votes vote down vote up
@Override
public TechnologyLink deleteLink(Long linkId, User user)
    throws InternalServerErrorException, BadRequestException, NotFoundException,
    OAuthRequestException {

  validateDeletion(linkId, user);

  final TechnologyLink link = technologyLinkDao.findById(linkId);
  technologyLinkDao.delete(link);

  // TODO: Atualiza contador de links na tecnologia quando tivermos
  // techService.removeLinksCounter(link.getTechnology().get());

  return link;
}
 
Example #27
Source File: TechnologyRecommendationServiceImpl.java    From tech-gallery with Apache License 2.0 5 votes vote down vote up
@Override
public TechnologyRecommendation addRecommendation(TechnologyRecommendation recommendation,
    User user) throws BadRequestException {
  try {
    final TechGalleryUser tgUser = userService.getUserByEmail(user.getEmail());
    recommendation.setRecommender(Ref.create(tgUser));
    return addNewRecommendation(recommendation, tgUser);
  } catch (final NotFoundException e) {
    throw new BadRequestException(ValidationMessageEnums.USER_NOT_EXIST.message());
  }
}
 
Example #28
Source File: TechnologyLinkServiceImpl.java    From tech-gallery with Apache License 2.0 5 votes vote down vote up
/**
 * Validate the user logged in.
 *
 * @param user info about user from google
 *
 * @throws BadRequestException in case a request with problem were made.
 * @throws InternalServerErrorException in case something goes wrong
 * @throws NotFoundException in case the information are not founded
 */
private void validateUser(User user)
    throws BadRequestException, NotFoundException, InternalServerErrorException {

  log.info("Validating user to link");

  if (user == null || user.getUserId() == null || user.getUserId().isEmpty()) {
    throw new BadRequestException(ValidationMessageEnums.USER_GOOGLE_ENDPOINT_NULL.message());
  }

  final TechGalleryUser techUser = userService.getUserByGoogleId(user.getUserId());
  if (techUser == null) {
    throw new NotFoundException(ValidationMessageEnums.USER_NOT_EXIST.message());
  }
}
 
Example #29
Source File: TechnologyCommentServiceImpl.java    From tech-gallery with Apache License 2.0 5 votes vote down vote up
@Override
public TechnologyComment deleteComment(Long commentId, User user)
    throws InternalServerErrorException, BadRequestException, NotFoundException,
    OAuthRequestException {

  validateDeletion(commentId, user);

  final TechnologyComment comment = technologyCommentDao.findById(commentId);
  comment.setActive(false);
  technologyCommentDao.update(comment);
  techService.removeCommentariesCounter(comment.getTechnology().get());

  UserProfileServiceImpl.getInstance().handleCommentChanges(comment);
  return comment;
}
 
Example #30
Source File: TechnologyCommentServiceImpl.java    From tech-gallery with Apache License 2.0 5 votes vote down vote up
/**
 * Validate comment of TechnologyCommentTO.
 *
 * @param comment id to be validate
 *
 * @throws NotFoundException in case the information are not founded
 * @throws BadRequestException in case a request with problem were made.
 */
private void validateComment(Long commentId) throws BadRequestException, NotFoundException {

  log.info("Validating the comment");

  if (commentId == null) {
    throw new BadRequestException(ValidationMessageEnums.COMMENT_ID_CANNOT_BLANK.message());
  }

  final TechnologyComment comment = technologyCommentDao.findById(commentId);
  if (comment == null) {
    throw new NotFoundException(ValidationMessageEnums.COMMENT_NOT_EXIST.message());
  }
}