1
19
20 package com.liferay.portal.service.impl;
21
22 import com.liferay.portal.PortalException;
23 import com.liferay.portal.SystemException;
24 import com.liferay.portal.model.UserIdMapper;
25 import com.liferay.portal.service.base.UserIdMapperLocalServiceBaseImpl;
26
27 import java.util.List;
28
29
36 public class UserIdMapperLocalServiceImpl
37 extends UserIdMapperLocalServiceBaseImpl {
38
39 public void deleteUserIdMappers(long userId) throws SystemException {
40 userIdMapperPersistence.removeByUserId(userId);
41 }
42
43 public UserIdMapper getUserIdMapper(long userId, String type)
44 throws PortalException, SystemException {
45
46 return userIdMapperPersistence.findByU_T(userId, type);
47 }
48
49 public UserIdMapper getUserIdMapperByExternalUserId(
50 String type, String externalUserId)
51 throws PortalException, SystemException {
52
53 return userIdMapperPersistence.findByT_E(type, externalUserId);
54 }
55
56 public List<UserIdMapper> getUserIdMappers(long userId)
57 throws SystemException {
58
59 return userIdMapperPersistence.findByUserId(userId);
60 }
61
62 public UserIdMapper updateUserIdMapper(
63 long userId, String type, String description, String externalUserId)
64 throws SystemException {
65
66 UserIdMapper userIdMapper = userIdMapperPersistence.fetchByU_T(
67 userId, type);
68
69 if (userIdMapper == null) {
70 long userIdMapperId = counterLocalService.increment();
71
72 userIdMapper = userIdMapperPersistence.create(userIdMapperId);
73 }
74
75 userIdMapper.setUserId(userId);
76 userIdMapper.setType(type);
77 userIdMapper.setDescription(description);
78 userIdMapper.setExternalUserId(externalUserId);
79
80 userIdMapperPersistence.update(userIdMapper, false);
81
82 return userIdMapper;
83 }
84
85 }