]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/UserNature.java
3713fdc79142b561bd960663f4dc0ec66d3b9322
1 package org
.argeo
.security
;
3 import java
.io
.Serializable
;
6 import org
.argeo
.ArgeoException
;
8 public class UserNature
implements Serializable
{
9 private static final long serialVersionUID
= 1L;
13 public String
getType() {
17 return getClass().getName();
20 public void setType(String type
) {
24 public final static void updateUserNaturesWithCheck(
25 List
<UserNature
> userNatures
, List
<UserNature
> userNaturesData
) {
26 if (userNatures
.size() != userNaturesData
.size())
27 throw new ArgeoException(
28 "It is forbidden to add or remove user natures via this method");
29 for (int i
= 0; i
< userNatures
.size(); i
++) {
30 String type
= userNatures
.get(i
).getType();
31 boolean found
= false;
32 for (int j
= 0; j
< userNatures
.size(); j
++) {
33 String newType
= userNaturesData
.get(j
).getType();
34 if (type
.equals(newType
))
38 throw new ArgeoException(
39 "Could not find a user nature of type " + type
);
42 for (int i
= 0; i
< userNatures
.size(); i
++) {
43 userNatures
.set(i
, userNaturesData
.get(i
));