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

The following examples show how to use com.google.api.server.spi.response.InternalServerErrorException. 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: TechnologyRecommendationServiceImpl.java    From tech-gallery with Apache License 2.0 6 votes vote down vote up
@Override
public Response deleteRecommendById(Long recommendId, User user)
    throws BadRequestException, NotFoundException, InternalServerErrorException {
  final TechnologyRecommendation recommendation =
      technologyRecommendationDAO.findById(recommendId);
  final TechGalleryUser techUser = userService.getUserByEmail(user.getEmail());

  validateDeletion(recommendId, recommendation, user, techUser);

  recommendation.setActive(false);
  technologyRecommendationDAO.update(recommendation);
  technologyService.removeRecomendationCounter(recommendation.getTechnology().get(),
      recommendation.getScore());

  UserProfileServiceImpl.getInstance().handleRecommendationChanges(recommendation);
  return techRecTransformer.transformTo(recommendation);
}
 
Example #2
Source File: SkillServiceImpl.java    From tech-gallery with Apache License 2.0 6 votes vote down vote up
@Override
public Skill addOrUpdateSkill(Skill skill, User user)
    throws InternalServerErrorException, BadRequestException, NotFoundException {

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

  validateInputs(skill, user);

  Technology technology = skill.getTechnology().get();
  TechGalleryUser techUser = userService.getUserByGoogleId(user.getUserId());
  Skill skillEntity = skillDao.findByUserAndTechnology(techUser, technology);

  // if there is a skillEntity, it is needed to inactivate it and create a new
  // one
  inactivateSkill(skillEntity);

  final Skill newSkill = addNewSkill(skill, techUser, technology);

  UserProfileServiceImpl.getInstance().handleSkillChanges(newSkill);
  return newSkill;
}
 
Example #3
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 #4
Source File: TechnologyRecommendationServiceImpl.java    From tech-gallery with Apache License 2.0 6 votes vote down vote up
@Override
public List<Response> getRecommendations(String technologyId, User user)
    throws BadRequestException, InternalServerErrorException {
  Technology technology;
  try {
    technology = technologyService.getTechnologyById(technologyId, user);
  } catch (final NotFoundException e) {
    return null;
  }
  final List<TechnologyRecommendation> recommendations =
      technologyRecommendationDAO.findAllActivesByTechnology(technology);
  final List<Response> recommendationTOs = new ArrayList<Response>();
  for (final TechnologyRecommendation recommendation : recommendations) {
    recommendationTOs.add(techRecTransformer.transformTo(recommendation));
  }
  return recommendationTOs;

}
 
Example #5
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 #6
Source File: EndorsementServiceImpl.java    From tech-gallery with Apache License 2.0 6 votes vote down vote up
private List<EndorsementsGroupedByEndorsedTransient> transformGroupedUserMapIntoList(
    Map<TechGalleryUser, List<TechGalleryUser>> mapUsersGrouped, String techId)
        throws BadRequestException, NotFoundException, InternalServerErrorException,
        OAuthRequestException {
  final List<EndorsementsGroupedByEndorsedTransient> groupedList =
      new ArrayList<EndorsementsGroupedByEndorsedTransient>();

  for (final Map.Entry<TechGalleryUser, List<TechGalleryUser>> entry : mapUsersGrouped
      .entrySet()) {
    final EndorsementsGroupedByEndorsedTransient grouped =
        new EndorsementsGroupedByEndorsedTransient();
    grouped.setEndorsed(entry.getKey());
    final Skill response = skillService.getUserSkill(techId, entry.getKey());
    if (response != null) {
      grouped.setEndorsedSkill(response.getValue());
    } else {
      grouped.setEndorsedSkill(0);
    }
    grouped.setEndorsers(entry.getValue());
    groupedList.add(grouped);
  }
  return groupedList;
}
 
Example #7
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 #8
Source File: CachingDiscoveryProvider.java    From endpoints-java with Apache License 2.0 6 votes vote down vote up
@Override
public DirectoryList getDirectory(final String root) throws InternalServerErrorException {
  try {
    return directoryByRoot.get(root, new Callable<DirectoryList>() {
      @Override
      public DirectoryList call() throws Exception {
        return delegate.getDirectory(root);
      }
    });
  } catch (ExecutionException | UncheckedExecutionException e) {
    // Cast here so we can maintain specific errors for documentation in throws clauses.
    if (e.getCause() instanceof InternalServerErrorException) {
      throw (InternalServerErrorException) e.getCause();
    } else {
      logger.atSevere().withCause(e.getCause()).log("Could not generate or cache directory");
      throw new InternalServerErrorException("Internal Server Error", e.getCause());
    }
  }
}
 
Example #9
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 #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: ProxyingDiscoveryProvider.java    From endpoints-java with Apache License 2.0 5 votes vote down vote up
private String getApiConfigStringWithRoot(ImmutableList<ApiConfig> configs, final String root)
    throws InternalServerErrorException, ApiConfigException {
  Map<ApiKey, String> configMap = configWriter.writeConfig(rewriteConfigsWithRoot(configs, root));
  if (configMap.size() != 1) {
    logger.atSevere().log("config generation yielded more than one API");
    throw new InternalServerErrorException("Internal Server Error");
  }
  return Iterables.getFirst(configMap.values(), null);
}
 
Example #12
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 #13
Source File: ProxyingDiscoveryProvider.java    From endpoints-java with Apache License 2.0 5 votes vote down vote up
@Override
public RpcDescription getRpcDocument(String root, String name, String version)
    throws NotFoundException, InternalServerErrorException {
  try {
    return discovery.apis()
        .generateRpc(new com.google.api.services.discovery.model.ApiConfig().setConfig(
            getApiConfigStringWithRoot(getApiConfigs(name, version), root))).execute();
  } catch (IOException | ApiConfigException e) {
    logger.atSevere().withCause(e).log("Could not generate or cache discovery doc");
    throw new InternalServerErrorException("Internal Server Error", e);
  }
}
 
Example #14
Source File: CachingDiscoveryProviderTest.java    From endpoints-java with Apache License 2.0 5 votes vote down vote up
@Test
public void getRestDocument_internalServerError() throws Exception {
  CachingDiscoveryProvider provider = createNonExpiringProvider();
  when(delegate.getRestDocument(ROOT, NAME, VERSION))
      .thenThrow(new InternalServerErrorException(""));

  try {
    provider.getRestDocument(ROOT, NAME, VERSION);
    fail("expected InternalServerErrorException");
  } catch (InternalServerErrorException e) {
    // expected
  }
}
 
Example #15
Source File: ProxyingDiscoveryProvider.java    From endpoints-java with Apache License 2.0 5 votes vote down vote up
@Override
public DirectoryList getDirectory(String root) throws InternalServerErrorException {
  try {
    Map<ApiKey, String> configStrings =
        configWriter.writeConfig(rewriteConfigsWithRoot(getAllApiConfigs(), root));
    ApiConfigs configs = new ApiConfigs();
    configs.setConfigs(Lists.newArrayList(configStrings.values()));
    return discovery.apis().generateDirectory(configs).execute();
  } catch (IOException | ApiConfigException e) {
    logger.atSevere().withCause(e).log("Could not generate or cache directory");
    throw new InternalServerErrorException("Internal Server Error", e);
  }
}
 
Example #16
Source File: CachingDiscoveryProvider.java    From endpoints-java with Apache License 2.0 5 votes vote down vote up
@Override
public RpcDescription getRpcDocument(final String root, final String name, final String version)
    throws NotFoundException, InternalServerErrorException {
  return getDiscoveryDoc(rpcDocuments, root, name, version, new Callable<RpcDescription>() {
    @Override
    public RpcDescription call() throws NotFoundException, InternalServerErrorException {
      return delegate.getRpcDocument(root, name, version);
    }
  });
}
 
Example #17
Source File: UserEndpoint.java    From tech-gallery with Apache License 2.0 5 votes vote down vote up
@ApiMethod(name = "saveUserPreference", path = "users/savePreference", httpMethod = "post")
public TechGalleryUser saveUserPreference(
        @Named("postGooglePlusPreference") Boolean postGooglePlusPreference, User user)
        throws NotFoundException, BadRequestException, InternalServerErrorException, IOException,
        OAuthRequestException {
    return service.saveUserPreference(postGooglePlusPreference, user);
}
 
Example #18
Source File: ProxyingDiscoveryService.java    From endpoints-java with Apache License 2.0 5 votes vote down vote up
@VisibleForTesting
static String getActualRoot(HttpServletRequest request)
    throws InternalServerErrorException {
  String uri = request.getRequestURI();
  int index = uri.indexOf("discovery/v1/apis");
  if (index == -1) {
    logger.atSevere()
        .log("Could not compute discovery root from url: %s", request.getRequestURI());
    throw new InternalServerErrorException("Internal Server Error");
  }
  StringBuffer url = request.getRequestURL();
  return url.substring(0, url.length() - (uri.length() - index));
}
 
Example #19
Source File: ProxyingDiscoveryServiceTest.java    From endpoints-java with Apache License 2.0 5 votes vote down vote up
@Test
public void getRestDocument_uninitialized() throws Exception {
  try {
    ProxyingDiscoveryService discoveryService = createDiscoveryService(false);
    discoveryService.getRestDocument(null /* request */, null /* name */, null /* verson */);
    fail("expected InternalServerErrorException");
  } catch (InternalServerErrorException e) {
    // expected
  }
}
 
Example #20
Source File: ProxyingDiscoveryServiceTest.java    From endpoints-java with Apache License 2.0 5 votes vote down vote up
@Test
public void getApiList_uninitialized() throws Exception {
  try {
    ProxyingDiscoveryService discoveryService = createDiscoveryService(false);
    discoveryService.getApiList(null /* request */);
    fail("expected InternalServerErrorException");
  } catch (InternalServerErrorException e) {
    // expected
  }
}
 
Example #21
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 #22
Source File: ProxyingDiscoveryServiceTest.java    From endpoints-java with Apache License 2.0 5 votes vote down vote up
@Test
public void getActualRoot_badRoot() throws Exception {
  try {
    ProxyingDiscoveryService.getActualRoot(createRequest("badroot"));
    fail("expected InternalServerErrorException");
  } catch (InternalServerErrorException e) {
    // expected
  }
}
 
Example #23
Source File: ProxyingDiscoveryProviderTest.java    From endpoints-java with Apache License 2.0 5 votes vote down vote up
@Test
public void getRestDocument_internalServerError() throws Exception {
  when(restRequest.execute()).thenThrow(new IOException());

  try {
    provider.getRestDocument(REWRITTEN_ROOT, NAME, V1);
    fail("expected InternalServerErrorException");
  } catch (InternalServerErrorException e) {
    // expected
  }
}
 
Example #24
Source File: UserServiceTGImpl.java    From tech-gallery with Apache License 2.0 5 votes vote down vote up
@Override
public TechGalleryUser saveUserPreference(Boolean postGooglePlusPreference, User user)
    throws NotFoundException, BadRequestException, InternalServerErrorException, IOException, OAuthRequestException {

  validateUser(user);

  TechGalleryUser techUser = userDao.findByEmail(user.getEmail());
  if (postGooglePlusPreference != null) {
    techUser.setPostGooglePlusPreference(postGooglePlusPreference);
    userDao.update(techUser);
  }
  return techUser;
}
 
Example #25
Source File: TechnologyServiceImpl.java    From tech-gallery with Apache License 2.0 5 votes vote down vote up
private void verifyTechnologyFollowedByUser(User user, List<Technology> filteredList)
        throws NotFoundException, BadRequestException, InternalServerErrorException {
    TechGalleryUser techUser = userService.getUserByGoogleId(user.getUserId());
    if (techUser != null && techUser.getFollowedTechnologyIds() != null && !techUser.getFollowedTechnologyIds().isEmpty()) {
        for (Technology technology : filteredList) {
            if (techUser.getFollowedTechnologyIds().contains(technology.getId())) {
                technology.setFollowedByUser(true);
            }
        }
    }
}
 
Example #26
Source File: UserServiceTGImpl.java    From tech-gallery with Apache License 2.0 5 votes vote down vote up
/**
 * This method should be executed whenever a user logs in It check whether the
 * user exists on TG's datastore and create them, if not. It also checks if
 * the user's email has been changed and update it, in case it was changed.
 *
 * @param user
 *          A Google AppEngine API user
 * @return A response with the user data as it is on TG 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.
 * @throws OAuthRequestException
 *           in case of authentication problem
 * @throws IOException
 *           in case of a IO exception
 */
@Override
public TechGalleryUser handleLogin(Integer timezoneOffset, final User user, HttpServletRequest req)
    throws NotFoundException, BadRequestException, InternalServerErrorException, IOException,
    OAuthRequestException {
  authorize(user);
  String userEmail = user.getEmail();
  String header = req.getHeader("Authorization");
  String accesstoken = header.substring(header.indexOf(' ')).trim(); // "Bearer
                                                                     // ".length

  GoogleCredential credential = new GoogleCredential().setAccessToken(accesstoken);
  Plus plus = new Plus.Builder(new NetHttpTransport(), new JacksonFactory(), credential)
      .setApplicationName(i18n.t("Tech Gallery")).build();
  Person person = plus.people().get("me").execute();
  TechGalleryUser tgUser = userDao.findByGoogleId(user.getUserId());
  // Couldn't find by googleID. Try email
  if (tgUser == null) {
    tgUser = userDao.findByEmail(userEmail);
  }
  // Ok, we couldn't find it. Create it.
  if (tgUser == null) {
    tgUser = new TechGalleryUser();
  }
  updateUserInformation(user, person, tgUser);
  tgUser.setTimezoneOffset(timezoneOffset);
  addUser(tgUser);
  log.info("User " + tgUser.getName() + " added/updated");
  return tgUser;
}
 
Example #27
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 #28
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 #29
Source File: TechnologyServiceImpl.java    From tech-gallery with Apache License 2.0 5 votes vote down vote up
@Override
public void audit(String technologyId, User user)
        throws NotFoundException, BadRequestException, InternalServerErrorException {
    Technology technology = getTechnologyById(technologyId, user);
    technology.setLastActivity(new Date());
    technology.setLastActivityUser(user.getEmail());
    technologyDAO.update(technology);
}
 
Example #30
Source File: SkillServiceImpl.java    From tech-gallery with Apache License 2.0 5 votes vote down vote up
@Override
public String importUserSkill(UserSkillTO userSkills, User user)
    throws InternalServerErrorException, BadRequestException {
  String email = userSkills.getEmail();
  TechGalleryUser techGalleryUser;
  try {
    techGalleryUser = userService.getUserSyncedWithProvider(email.split("@")[0]);
    for (String techSkill : userSkills.getTechSkill()) {
      String[] splitedTechSkill = techSkill.split(";");
      Technology technology = recoverTechnologyById(splitedTechSkill[0]);
      if (technology != null) {
        Skill skillEntity = skillDao.findByUserAndTechnology(techGalleryUser, technology);
        if (skillEntity != null) {
          log.warning("Inactivating skill: " + skillEntity.getId());
          skillEntity.setInactivatedDate(new Date());
          skillEntity.setActive(Boolean.FALSE);
          skillDao.update(skillEntity);
        }
        Skill skill = new Skill();
        skill.setValue(Integer.parseInt(splitedTechSkill[1]));
        Skill newSkill = addNewSkill(skill, techGalleryUser, technology);
        UserProfileServiceImpl.getInstance().handleSkillChanges(newSkill);
      }
    }
  } catch (NotFoundException e) {
    log.log(Level.INFO,
        "User " + userSkills.getEmail() + " not found during import. Row ignored.", e);
  }
  return null;
}