예제 #1
0
 @Override
 public Answer updateSystemsByUser(User user, List<UserSystem> newGroups) {
   Answer a = new Answer(new MessageEvent(MessageEventEnum.DATA_OPERATION_OK));
   AnswerList an = this.readByUser(user.getLogin());
   if (an.isCodeEquals(MessageEventEnum.DATA_OPERATION_OK.getCode())) {
     List<UserSystem> oldGroups = an.getDataList();
     // delete if don't exist in new
     for (UserSystem old : oldGroups) {
       if (!newGroups.contains(old)) {
         Answer del = userSystemDAO.remove(old);
         if (!del.isCodeEquals(MessageEventEnum.DATA_OPERATION_OK.getCode())) {
           a = del;
         }
       }
     }
     // insert if don't exist in old
     for (UserSystem group : newGroups) {
       if (!oldGroups.contains(group)) {
         Answer add = userSystemDAO.create(group);
         if (!add.isCodeEquals(MessageEventEnum.DATA_OPERATION_OK.getCode())) {
           a = add;
         }
       }
     }
   }
   return a;
 }
예제 #2
0
 @Override
 public Answer remove(UserSystem sys) {
   return userSystemDAO.remove(sys);
 }
예제 #3
0
 @Override
 public Answer create(UserSystem sys) {
   return userSystemDAO.create(sys);
 }
예제 #4
0
 @Override
 public AnswerList<UserSystem> readByUser(String login) {
   return userSystemDAO.readByUser(login);
 }
예제 #5
0
 @Override
 public void deleteUserSystem(UserSystem userSystem) throws CerberusException {
   userSystemDAO.deleteUserSystem(userSystem);
 }
예제 #6
0
 @Override
 public void insertUserSystem(UserSystem useSystem) throws CerberusException {
   userSystemDAO.insertUserSystem(useSystem);
 }
예제 #7
0
 @Override
 public List<UserSystem> findUserSystemBySystem(String system) throws CerberusException {
   return userSystemDAO.findUserSystemBySystem(system);
 }
예제 #8
0
 @Override
 public List<UserSystem> findUserSystemByUser(String login) throws CerberusException {
   return userSystemDAO.findUserSystemByUser(login);
 }
예제 #9
0
 @Override
 public List<UserSystem> findallUser() throws CerberusException {
   return userSystemDAO.findallUser();
 }
예제 #10
0
 @Override
 public UserSystem findUserSystemByKey(String login, String system) throws CerberusException {
   return userSystemDAO.findUserSystemByKey(login, system);
 }