Pharmacy_09_03_18
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.bestray.healthcareemr.ServiceImpl;
import com.bestray.healthcarecommonutil.exception.DataAccessException;
import com.bestray.healthcarecommonutil.exception.HealthCareException;
import com.bestray.healthcarecommonutil.exception.ProcessingException;
import com.bestray.healthcarecommonutil.vo.TAccount;
import com.bestray.healthcarecommonutil.vo.TAccountDepartment;
import com.bestray.healthcarecommonutil.vo.TAccountRole;
import com.bestray.healthcarecommonutil.vo.TRolePermission;
import com.bestray.healthcareemr.Dao.UserAccountDeptDao;
import com.bestray.healthcareemr.Dao.UserAccountRoleDao;
import com.bestray.healthcareemr.Dao.UserRolePermissionDao;
import com.bestray.healthcareemr.Dao.UserAccountDao;
import com.bestray.healthcareemr.Service.LoginService;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
// TODO: Auto-generated Javadoc
/**
* The Class LoginServiceImpl.
*
* @author user3
*/
@Service
public class LoginServiceImpl implements LoginService{
/** The user setup dao. */
@Autowired
private UserAccountDao userAccountDao;
@Autowired
private UserAccountRoleDao userAccountRoleDao;
@Autowired
private UserRolePermissionDao userRolePermissionDao;
@Autowired
private UserAccountDeptDao userAccountDeptDao;
/**
* Instantiates a new login service impl.
*
* @param logindao the logindao
* @param userAccountDao the user setup dao
*/
/*public LoginServiceImpl(UserAccountDao userAccountDao,UserAccountRoleDao userAccountRoleDao,
UserRolePermissionDao userRolePermissionDao,UserAccountDeptDao userAccountDeptDao) {
this.userAccountDao = userAccountDao;
this.userAccountRoleDao = userAccountRoleDao;
this.userRolePermissionDao = userRolePermissionDao;
this.userAccountDeptDao = userAccountDeptDao;
}*/
/* (non-Javadoc)
* @see com.bestray.healthcareemr.Service.LoginService#authorize(com.bestray.healthcareemr.Vo.TAccount)
*/
@Transactional(readOnly=true)
@Override
public TAccount authorize(TAccount account)throws ProcessingException {
try{
return userAccountDao.authorize(account);
}catch(DataAccessException e){
throw new ProcessingException();
}
}
/* (non-Javadoc)
* @see com.bestray.healthcareemr.Service.LoginService#getPermissionForUser(com.bestray.healthcareemr.Vo.TAccount)
*/
@Transactional(readOnly = true)
@Override
public List<String> getPermissionForUser(TAccount useraccount)throws ProcessingException {
try{
List<TAccountRole> accrole = userAccountRoleDao.getAccountRole(useraccount);
List<TRolePermission> rolepermissions = new ArrayList<TRolePermission>();
List<TRolePermission> permissionslist = new ArrayList<TRolePermission>();
List<String> permissions = new ArrayList<String>();
for(TAccountRole role : accrole){
rolepermissions = userRolePermissionDao.getRolePermission(role.getRoleId());
for(TRolePermission permission:rolepermissions){
permissionslist.add(permission);
}
}
Set<TRolePermission> dupli = new HashSet<TRolePermission>(permissionslist);
for(TRolePermission s:dupli){
String str = s.getPermissionId().getPermissionName();
permissions.add(str);
}
return permissions;
}catch (DataAccessException ex) {
Logger.getLogger(LoginServiceImpl.class.getName()).log(Level.SEVERE, null, ex);
throw new ProcessingException();
}catch(Exception e){
Logger.getLogger(LoginServiceImpl.class.getName()).log(Level.SEVERE, null, e);
throw new HealthCareException("Error in Fetching Permission List...");
}
}
/* (non-Javadoc)
* @see com.bestray.healthcareemr.Service.LoginService#getDepartments(com.bestray.healthcareemr.Vo.TAccount)
*/
@Transactional(readOnly = true)
@Override
public List<TAccountDepartment> getDepartments(TAccount useraccount) throws ProcessingException {
try{
return userAccountDeptDao.getDepartments(useraccount);
}catch(DataAccessException e){
throw new ProcessingException();
}
}
}
|
Revision |
Author |
Commited |
Message |
1
|
girijabapi
|
Fri 27 Jul, 2018 07:30:57 +0000 |
|