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