/** * {@inheritDoc} * * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (!(obj instanceof Role)) return false; Role other = (Role) obj; return name.equals(other.getName()) && organization.equals(other.getOrganization()); }
@Override public boolean equals(Object obj) { if (!(obj instanceof Role)) return false; Role other = (Role) obj; return name.equals(other.getName()) && organization.equals(other.getOrganization()); }
/** * Constructs a user with the specified username, password, provider and roles. * * @param username * the username * @param password * the password * @param organization * the organization * @param provider * the provider * @param manageable * whether the user is manageable * @param roles * the roles */ public JpaUser(String username, String password, JpaOrganization organization, String provider, boolean manageable, Set<JpaRole> roles) { this(username, password, organization, null, null, provider, manageable); for (Role role : roles) { if (role.getOrganization() == null || !organization.getId().equals(role.getOrganization().getId())) throw new IllegalArgumentException("Role " + role + " is not from the same organization!"); } this.roles = roles; }
/** * Constructs a user with the specified username, password, name, email, provider and roles. * * @param username * the username * @param password * the password * @param organization * the organization * @param name * the name * @param email * the email * @param provider * the provider * @param manageable * whether the user is manageable * @param roles * the roles */ public JpaUser(String username, String password, JpaOrganization organization, String name, String email, String provider, boolean manageable, Set<JpaRole> roles) { this(username, password, organization, name, email, provider, manageable); for (Role role : roles) { if (role.getOrganization() == null || !organization.getId().equals(role.getOrganization().getId())) throw new IllegalArgumentException("Role " + role + " is not from the same organization!"); } this.roles = roles; }
/** * Constructs a user with the specified username, name, email, login mechanism, last login date, organization and * roles. * * @param username * the username * @param name * the name * @param email * the email address * @param loginMechanism * the login mechanism * @param lastLogin * the last login date * @param organization * the organization * @param roles * the roles */ public JpaUserReference(String username, String name, String email, String loginMechanism, Date lastLogin, JpaOrganization organization, Set<JpaRole> roles) { this(username, name, email, loginMechanism, lastLogin, organization); for (Role role : roles) { if (role.getOrganization() == null || !organization.getId().equals(role.getOrganization().getId())) throw new IllegalArgumentException("Role " + role + " is not from the same organization!"); } this.roles = roles; }
this.roles = new HashSet<JaxbRole>(); for (Role role : roles) { if (role.getOrganization() == null || !organization.getId().equals(role.getOrganization().getId())) throw new IllegalArgumentException("Role " + role + " is not from the same organization!");
public static JaxbRole fromRole(Role role) { if (role instanceof JaxbRole) return (JaxbRole) role; JaxbOrganization org = JaxbOrganization.fromOrganization(role.getOrganization()); return new JaxbRole(role.getName(), org, role.getDescription(), role.getType()); }