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 public void deleteUserIdMappers(long userId) throws SystemException {
031 userIdMapperPersistence.removeByUserId(userId);
032 }
033
034 public UserIdMapper getUserIdMapper(long userId, String type)
035 throws PortalException, SystemException {
036
037 return userIdMapperPersistence.findByU_T(userId, type);
038 }
039
040 public UserIdMapper getUserIdMapperByExternalUserId(
041 String type, String externalUserId)
042 throws PortalException, SystemException {
043
044 return userIdMapperPersistence.findByT_E(type, externalUserId);
045 }
046
047 public List<UserIdMapper> getUserIdMappers(long userId)
048 throws SystemException {
049
050 return userIdMapperPersistence.findByUserId(userId);
051 }
052
053 public UserIdMapper updateUserIdMapper(
054 long userId, String type, String description, String externalUserId)
055 throws SystemException {
056
057 UserIdMapper userIdMapper = userIdMapperPersistence.fetchByU_T(
058 userId, type);
059
060 if (userIdMapper == null) {
061 long userIdMapperId = counterLocalService.increment();
062
063 userIdMapper = userIdMapperPersistence.create(userIdMapperId);
064 }
065
066 userIdMapper.setUserId(userId);
067 userIdMapper.setType(type);
068 userIdMapper.setDescription(description);
069 userIdMapper.setExternalUserId(externalUserId);
070
071 userIdMapperPersistence.update(userIdMapper, false);
072
073 return userIdMapper;
074 }
075
076 }