001
014
015 package com.liferay.portal.service.impl;
016
017 import com.liferay.portal.kernel.exception.PortalException;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.model.UserIdMapper;
020 import com.liferay.portal.service.base.UserIdMapperLocalServiceBaseImpl;
021
022 import java.util.List;
023
024
027 public class UserIdMapperLocalServiceImpl
028 extends UserIdMapperLocalServiceBaseImpl {
029
030 @Override
031 public void deleteUserIdMappers(long userId) throws SystemException {
032 userIdMapperPersistence.removeByUserId(userId);
033 }
034
035 @Override
036 public UserIdMapper getUserIdMapper(long userId, String type)
037 throws PortalException, SystemException {
038
039 return userIdMapperPersistence.findByU_T(userId, type);
040 }
041
042 @Override
043 public UserIdMapper getUserIdMapperByExternalUserId(
044 String type, String externalUserId)
045 throws PortalException, SystemException {
046
047 return userIdMapperPersistence.findByT_E(type, externalUserId);
048 }
049
050 @Override
051 public List<UserIdMapper> getUserIdMappers(long userId)
052 throws SystemException {
053
054 return userIdMapperPersistence.findByUserId(userId);
055 }
056
057 @Override
058 public UserIdMapper updateUserIdMapper(
059 long userId, String type, String description, String externalUserId)
060 throws SystemException {
061
062 UserIdMapper userIdMapper = userIdMapperPersistence.fetchByU_T(
063 userId, type);
064
065 if (userIdMapper == null) {
066 long userIdMapperId = counterLocalService.increment();
067
068 userIdMapper = userIdMapperPersistence.create(userIdMapperId);
069 }
070
071 userIdMapper.setUserId(userId);
072 userIdMapper.setType(type);
073 userIdMapper.setDescription(description);
074 userIdMapper.setExternalUserId(externalUserId);
075
076 userIdMapperPersistence.update(userIdMapper, false);
077
078 return userIdMapper;
079 }
080
081 }