示例#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);
 }