Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mytime
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Narendar Vakiti
mytime
Commits
d11c5abe
Commit
d11c5abe
authored
May 21, 2019
by
Vijay Akula
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed the hard coded values of employee roles in employeeservice
parent
49d725f8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
14 deletions
+40
-14
EmployeeService.java
...n/java/com/nisum/myteam/service/impl/EmployeeService.java
+16
-14
RoleConstant.java
...n/java/com/nisum/myteam/utils/constants/RoleConstant.java
+24
-0
No files found.
src/main/java/com/nisum/myteam/service/impl/EmployeeService.java
View file @
d11c5abe
...
@@ -8,6 +8,7 @@ import com.nisum.myteam.repository.EmployeeRepo;
...
@@ -8,6 +8,7 @@ import com.nisum.myteam.repository.EmployeeRepo;
import
com.nisum.myteam.service.*
;
import
com.nisum.myteam.service.*
;
import
com.nisum.myteam.utils.MyTeamUtils
;
import
com.nisum.myteam.utils.MyTeamUtils
;
import
com.nisum.myteam.utils.constants.ApplicationRole
;
import
com.nisum.myteam.utils.constants.ApplicationRole
;
import
com.nisum.myteam.utils.constants.RoleConstant
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -173,17 +174,29 @@ public class EmployeeService implements IEmployeeService {
...
@@ -173,17 +174,29 @@ public class EmployeeService implements IEmployeeService {
return
employee
;
return
employee
;
}
}
@Override
public
List
<
Employee
>
getAllEmployees
()
{
return
employeeRepo
.
findAll
();
}
@Override
@Override
public
Employee
getEmployeeByEmaillId
(
String
emailId
)
{
public
Employee
getEmployeeByEmaillId
(
String
emailId
)
{
return
employeeRepo
.
findByEmailId
(
emailId
);
return
employeeRepo
.
findByEmailId
(
emailId
);
}
}
@Override
public
List
<
Employee
>
getEmployeesByEmpStatusAndShift
(
String
empStatus
,
String
shift
)
{
return
employeeRepo
.
findByEmpStatusAndShiftLikeOrderByEmployeeIdDesc
(
empStatus
,
shift
);
}
public
List
<
Employee
>
getManagers
()
throws
MyTeamException
{
public
List
<
Employee
>
getManagers
()
throws
MyTeamException
{
List
<
Employee
>
activeEmpsList
=
getActiveEmployees
();
List
<
Employee
>
activeEmpsList
=
getActiveEmployees
();
List
<
Employee
>
managers
=
activeEmpsList
.
stream
()
List
<
Employee
>
managers
=
activeEmpsList
.
stream
()
.
filter
(
e
->
(
"Director"
.
equalsIgnoreCase
(
e
.
getRole
())
.
filter
(
employee
->
(
RoleConstant
.
DIRECTOR
.
getRoleName
().
equalsIgnoreCase
(
employee
.
getRole
())
||
"Delivery Manager"
.
equalsIgnoreCase
(
e
.
getRole
())
||
"Manager"
.
equalsIgnoreCase
(
e
.
getRole
())
||
RoleConstant
.
DELIVERY_MANAGER
.
getRoleName
().
equalsIgnoreCase
(
employee
.
getRole
())
||
"HR Manager"
.
equalsIgnoreCase
(
e
.
getRole
())
||
"Lead"
.
equalsIgnoreCase
(
e
.
getRole
())))
||
RoleConstant
.
MANAGER
.
getRoleName
().
equalsIgnoreCase
(
employee
.
getRole
())
||
RoleConstant
.
HR_MANAGER
.
getRoleName
().
equalsIgnoreCase
(
employee
.
getRole
())
||
RoleConstant
.
LEAD
.
getRoleName
().
equalsIgnoreCase
(
employee
.
getRole
())))
.
sorted
(
Comparator
.
comparing
(
Employee:
:
getEmployeeName
)).
collect
(
Collectors
.
toList
());
.
sorted
(
Comparator
.
comparing
(
Employee:
:
getEmployeeName
)).
collect
(
Collectors
.
toList
());
return
managers
;
return
managers
;
}
}
...
@@ -250,7 +263,6 @@ public class EmployeeService implements IEmployeeService {
...
@@ -250,7 +263,6 @@ public class EmployeeService implements IEmployeeService {
return
getDeliveryManagerMap
(
domain
.
getDeliveryManagers
());
return
getDeliveryManagerMap
(
domain
.
getDeliveryManagers
());
}
}
@Override
@Override
public
List
<
HashMap
<
String
,
String
>>
getDeliveryManagerMap
(
List
deliveryManagerIdsList
)
{
public
List
<
HashMap
<
String
,
String
>>
getDeliveryManagerMap
(
List
deliveryManagerIdsList
)
{
List
<
HashMap
<
String
,
String
>>
employeeList
=
new
ArrayList
<>();
List
<
HashMap
<
String
,
String
>>
employeeList
=
new
ArrayList
<>();
...
@@ -312,15 +324,5 @@ public class EmployeeService implements IEmployeeService {
...
@@ -312,15 +324,5 @@ public class EmployeeService implements IEmployeeService {
}
}
@Override
public
List
<
Employee
>
getAllEmployees
()
{
return
employeeRepo
.
findAll
();
}
@Override
public
List
<
Employee
>
getEmployeesByEmpStatusAndShift
(
String
empStatus
,
String
shift
)
{
return
employeeRepo
.
findByEmpStatusAndShiftLikeOrderByEmployeeIdDesc
(
empStatus
,
shift
);
}
}
}
src/main/java/com/nisum/myteam/utils/constants/RoleConstant.java
0 → 100644
View file @
d11c5abe
package
com
.
nisum
.
myteam
.
utils
.
constants
;
public
enum
RoleConstant
{
DIRECTOR
(
""
,
"Director"
),
DELIVERY_MANAGER
(
""
,
"Delivery Manager"
),
MANAGER
(
""
,
"Manager"
),
HR_MANAGER
(
""
,
"HR Manager"
),
LEAD
(
""
,
"Lead"
);
private
String
roleId
;
private
String
roleName
;
private
RoleConstant
(
String
roleId
,
String
roleName
)
{
this
.
roleId
=
roleId
;
this
.
roleName
=
roleName
;
}
public
String
getRoleId
()
{
return
this
.
roleId
;
}
public
String
getRoleName
()
{
return
this
.
roleName
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment