Code Review
/
portal.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Tests Coverage up
[portal.git]
/
portal-BE
/
src
/
main
/
java
/
org
/
onap
/
portal
/
service
/
fn
/
FnUserService.java
diff --git
a/portal-BE/src/main/java/org/onap/portal/service/fn/FnUserService.java
b/portal-BE/src/main/java/org/onap/portal/service/fn/FnUserService.java
index
9187313
..
8c5806e
100644
(file)
--- a/
portal-BE/src/main/java/org/onap/portal/service/fn/FnUserService.java
+++ b/
portal-BE/src/main/java/org/onap/portal/service/fn/FnUserService.java
@@
-40,6
+40,7
@@
package org.onap.portal.service.fn;
package org.onap.portal.service.fn;
+import java.security.Principal;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
@@
-47,11
+48,15
@@
import java.util.stream.Collectors;
import org.onap.portal.dao.fn.FnUserDao;
import org.onap.portal.domain.db.fn.FnUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.onap.portal.dao.fn.FnUserDao;
import org.onap.portal.domain.db.fn.FnUser;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
@Service
@Service
+@EnableAspectJAutoProxy
+@Transactional
public class FnUserService implements UserDetailsService {
private FnUserDao fnUserDao;
public class FnUserService implements UserDetailsService {
private FnUserDao fnUserDao;
@@
-61,12
+66,12
@@
public class FnUserService implements UserDetailsService {
this.fnUserDao = fnUserDao;
}
this.fnUserDao = fnUserDao;
}
- public FnUser saveFnUser(FnUser fnUser) {
+ public FnUser saveFnUser(
final Principal principal, final
FnUser fnUser) {
return fnUserDao.save(fnUser);
}
@Override
return fnUserDao.save(fnUser);
}
@Override
- public FnUser loadUserByUsername(String username) throws UsernameNotFoundException {
+ public FnUser loadUserByUsername(
final
String username) throws UsernameNotFoundException {
Optional<FnUser> fnUser = fnUserDao.findByLoginId(username);
if (fnUser.isPresent()) {
return fnUser.get();
Optional<FnUser> fnUser = fnUserDao.findByLoginId(username);
if (fnUser.isPresent()) {
return fnUser.get();
@@
-75,28
+80,29
@@
public class FnUserService implements UserDetailsService {
}
}
}
}
- public Optional<FnUser> getUser(Long id) {
+ public Optional<FnUser> getUser(
final
Long id) {
return Optional.of(fnUserDao.getOne(id));
}
List<FnUser> getUserWithOrgUserId(final String orgUserIdValue){
return Optional.of(fnUserDao.getOne(id));
}
List<FnUser> getUserWithOrgUserId(final String orgUserIdValue){
- Optional<List<FnUser>> fnUsers = Optional.of(fnUserDao.findAll()
- .stream()
- .filter(fnUser -> orgUserIdValue.equals(fnUser.getOrgUserId()))
- .collect(Collectors.toList()));
- return fnUsers.orElse(new ArrayList<>());
+ return fnUserDao.getUserWithOrgUserId(orgUserIdValue).orElse(new ArrayList<>());
}
}
- List<FnUser> getUsersByOrgIds
NotificationsResult(
List<String> orgIds){
+ List<FnUser> getUsersByOrgIds
(final
List<String> orgIds){
String ids = "(" + orgIds.stream().map(s -> "'" + s + "'").collect(Collectors.joining()) + ")";
String ids = "(" + orgIds.stream().map(s -> "'" + s + "'").collect(Collectors.joining()) + ")";
- return fnUserDao.getUsersByOrg
UserId(i
ds).orElse(new ArrayList<>());
+ return fnUserDao.getUsersByOrg
Ids(orgI
ds).orElse(new ArrayList<>());
}
}
- List<FnUser> getUsersByOrgIdsNotificationsResult(String orgIds){
- return fnUserDao.getUsersByOrgUserId(orgIds).orElse(new ArrayList<>());
+
+ List<FnUser> getActiveUsers(){
+ return fnUserDao.getActiveUsers().orElse(new ArrayList<>());
+ }
+
+ public void deleteUser(final FnUser fnUser){
+ fnUserDao.delete(fnUser);
}
}
-
List<FnUser> etActiveUsers()
{
- return fnUserDao.
findAll().stream().filter(fnUser -> "Y".equals(fnUser.getActiveYn())).collect(Collectors.toList()
);
+
public boolean existById(final Long userId)
{
+ return fnUserDao.
existsById(userId
);
}
}
}
}