Esempio n. 1
0
 @Override
 public void addRequiredAction(RequiredAction action) {
   for (UserRequiredActionEntity attr : user.getRequiredActions()) {
     if (attr.getAction().equals(action)) {
       return;
     }
   }
   UserRequiredActionEntity attr = new UserRequiredActionEntity();
   attr.setAction(action);
   attr.setUser(user);
   em.persist(attr);
   user.getRequiredActions().add(attr);
 }
Esempio n. 2
0
 @Override
 public Set<RequiredAction> getRequiredActions() {
   Set<RequiredAction> result = new HashSet<RequiredAction>();
   for (UserRequiredActionEntity attr : user.getRequiredActions()) {
     result.add(attr.getAction());
   }
   return result;
 }
Esempio n. 3
0
 @Override
 public void removeRequiredAction(RequiredAction action) {
   Iterator<UserRequiredActionEntity> it = user.getRequiredActions().iterator();
   while (it.hasNext()) {
     UserRequiredActionEntity attr = it.next();
     if (attr.getAction().equals(action)) {
       it.remove();
       em.remove(attr);
     }
   }
 }