Skip to content
Snippets Groups Projects
Commit 7e1babdb authored by Adrian Damian's avatar Adrian Damian
Browse files

Added the core authorization classes - code review changes

parent 48adcd6d
No related branches found
No related tags found
No related merge requests found
...@@ -96,6 +96,10 @@ public class GroupProperty ...@@ -96,6 +96,10 @@ public class GroupProperty
{ {
throw new IllegalArgumentException("Null key"); throw new IllegalArgumentException("Null key");
} }
if(value == null)
{
throw new IllegalArgumentException("Null value");
}
this.key = key; this.key = key;
this.value = value; this.value = value;
this.readOnly = readOnly; this.readOnly = readOnly;
...@@ -176,14 +180,7 @@ public class GroupProperty ...@@ -176,14 +180,7 @@ public class GroupProperty
{ {
return false; return false;
} }
if (value == null) if (!value.equals(other.value))
{
if (other.value != null)
{
return false;
}
}
else if (!value.equals(other.value))
{ {
return false; return false;
} }
......
...@@ -52,6 +52,10 @@ public class User<T extends Principal> ...@@ -52,6 +52,10 @@ public class User<T extends Principal>
public User(final T userID) public User(final T userID)
{ {
if(userID == null)
{
throw new IllegalArgumentException("null userID");
}
this.userID = userID; this.userID = userID;
} }
...@@ -100,14 +104,7 @@ public class User<T extends Principal> ...@@ -100,14 +104,7 @@ public class User<T extends Principal>
return false; return false;
} }
User<?> other = (User<?>) obj; User<?> other = (User<?>) obj;
if (userID == null) if (!userID.equals(other.userID))
{
if (other.userID != null)
{
return false;
}
}
else if (!userID.equals(other.userID))
{ {
return false; return false;
} }
......
...@@ -44,15 +44,38 @@ public class UserDetails ...@@ -44,15 +44,38 @@ public class UserDetails
private String city; private String city;
private String country; private String country;
public PersonalTitle title;
public String telephone;
public String fax;
public String province;
public String postalCode;
public UserDetails(String firstName, String lastName, String email, public UserDetails(String firstName, String lastName, String email,
String address, String institute, String city, String country) String address, String institute, String city, String country)
{ {
if (firstName == null)
{
throw new IllegalArgumentException("null firstName");
}
if (lastName == null)
{
throw new IllegalArgumentException("null lastName");
}
if (email == null)
{
throw new IllegalArgumentException("null email");
}
if (address == null)
{
throw new IllegalArgumentException("null address");
}
if (institute == null)
{
throw new IllegalArgumentException("null institute");
}
if (city == null)
{
throw new IllegalArgumentException("null city");
}
if (country == null)
{
throw new IllegalArgumentException("null country");
}
this.firstName = firstName; this.firstName = firstName;
this.lastName = lastName; this.lastName = lastName;
this.email = email; this.email = email;
...@@ -97,11 +120,6 @@ public class UserDetails ...@@ -97,11 +120,6 @@ public class UserDetails
return country; return country;
} }
public String getFax()
{
return fax;
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
...@@ -112,19 +130,13 @@ public class UserDetails ...@@ -112,19 +130,13 @@ public class UserDetails
{ {
final int prime = 31; final int prime = 31;
int result = 1; int result = 1;
result = prime * result result = prime * result + address.hashCode();
+ ((address == null) ? 0 : address.hashCode()); result = prime * result + city.hashCode();
result = prime * result + ((city == null) ? 0 : city.hashCode()); result = prime * result + country.hashCode();
result = prime * result result = prime * result + email.hashCode();
+ ((country == null) ? 0 : country.hashCode()); result = prime * result + firstName.hashCode();
result = prime * result result = prime * result + institute.hashCode();
+ ((email == null) ? 0 : email.hashCode()); result = prime * result + lastName.hashCode();
result = prime * result
+ ((firstName == null) ? 0 : firstName.hashCode());
result = prime * result
+ ((institute == null) ? 0 : institute.hashCode());
result = prime * result
+ ((lastName == null) ? 0 : lastName.hashCode());
return result; return result;
} }
...@@ -149,128 +161,31 @@ public class UserDetails ...@@ -149,128 +161,31 @@ public class UserDetails
return false; return false;
} }
UserDetails other = (UserDetails) obj; UserDetails other = (UserDetails) obj;
if (address == null) if (!firstName.equals(other.firstName))
{
if (other.address != null)
{
return false;
}
}
else if (!address.equals(other.address))
{
return false;
}
if (city == null)
{
if (other.city != null)
{
return false;
}
}
else if (!city.equals(other.city))
{ {
return false; return false;
} }
if (country == null) if (!lastName.equals(other.lastName))
{
if (other.country != null)
{
return false;
}
}
else if (!country.equals(other.country))
{
return false;
}
if (email == null)
{
if (other.email != null)
{
return false;
}
}
else if (!email.equals(other.email))
{ {
return false; return false;
} }
if (fax == null) if (!email.equals(other.email))
{
if (other.fax != null)
{
return false;
}
}
else if (!fax.equals(other.fax))
{ {
return false; return false;
} }
if (firstName == null) if (!institute.equals(other.institute))
{
if (other.firstName != null)
{
return false;
}
}
else if (!firstName.equals(other.firstName))
{ {
return false; return false;
} }
if (institute == null) if (!address.equals(other.address))
{
if (other.institute != null)
{
return false;
}
}
else if (!institute.equals(other.institute))
{ {
return false; return false;
} }
if (lastName == null) if (!city.equals(other.city))
{
if (other.lastName != null)
{
return false;
}
}
else if (!lastName.equals(other.lastName))
{
return false;
}
if (postalCode == null)
{
if (other.postalCode != null)
{
return false;
}
}
else if (!postalCode.equals(other.postalCode))
{
return false;
}
if (province == null)
{
if (other.province != null)
{
return false;
}
}
else if (!province.equals(other.province))
{
return false;
}
if (telephone == null)
{
if (other.telephone != null)
{
return false;
}
}
else if (!telephone.equals(other.telephone))
{ {
return false; return false;
} }
if (title != other.title) if (!country.equals(other.country))
{ {
return false; return false;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment