Methods Summary |
---|
public static final org.apache.lucene.gdata.data.GDataAccount | createAdminAccount()
GDataAccount retVal = new GDataAccount();
retVal.setName("administrator");
retVal.setPassword("password");
retVal.setRole(AccountRole.USERADMINISTRATOR);
retVal.setRole(AccountRole.FEEDAMINISTRATOR);
retVal.setRole(AccountRole.ENTRYAMINISTRATOR);
return retVal;
|
public boolean | equals(java.lang.Object o)
if(this.name == null)
return super.equals(o);
if(o == null)
return false;
if (this == o)
return true;
if (!(o instanceof GDataAccount))
return false;
GDataAccount toCompare = (GDataAccount) o;
if (this.name.equals(toCompare.name))
return true;
return false;
|
public java.net.URL | getAuthorLink()
return this.authorLink;
|
public java.lang.String | getAuthorMail()
return this.authorMail;
|
public java.lang.String | getAuthorname()
return this.authorname;
|
public java.lang.String | getName()
return this.name;
|
public java.lang.String | getPassword()
return this.password;
|
public java.util.Set | getRoles()
return this.roles;
|
public int | getRolesAsInt()
// 1 as the Userrole is always set
int bits = 1;
for (AccountRole role : this.roles) {
if (role == AccountRole.ENTRYAMINISTRATOR)
bits ^= 2;
else if (role == AccountRole.FEEDAMINISTRATOR)
bits ^= 4;
else if (role == AccountRole.USERADMINISTRATOR)
bits ^= 8;
}
return bits;
|
public int | hashCode()
if(this.name == null)
return super.hashCode();
int ret = 37;
ret = 9 * ret + this.name.hashCode();
return ret;
|
public static boolean | isInRole(int intRole, org.apache.lucene.gdata.data.GDataAccount$AccountRole role)checks whether the given integer matches the account role.
if(role == AccountRole.USER)
return (intRole&1)>0;
if (role == AccountRole.ENTRYAMINISTRATOR)
return (intRole&2) >0 ;
else if (role == AccountRole.FEEDAMINISTRATOR)
return (intRole&4) >0 ;
else if (role == AccountRole.USERADMINISTRATOR)
return (intRole&8) >0 ;
return false;
|
public boolean | isUserInRole(org.apache.lucene.gdata.data.GDataAccount$AccountRole role)
if (role == null)
return false;
return this.roles.contains(role);
|
public boolean | requiredValuesSet()Checks the requiered values for creating an account are set. Required
values are name and password the minimum length of
these values is 6.
return (this.name != null && this.password != null
&& this.name.length() > 5 && this.password.length() > 5);
|
public void | setAuthorLink(java.net.URL authorLink)
this.authorLink = authorLink;
|
public void | setAuthorMail(java.lang.String authorMail)
this.authorMail = authorMail;
|
public void | setAuthorname(java.lang.String authorname)
this.authorname = authorname;
|
public void | setName(java.lang.String name)
this.name = name;
|
public void | setPassword(java.lang.String password)
this.password = password;
|
public void | setRole(org.apache.lucene.gdata.data.GDataAccount$AccountRole role)Adds the given role to the role list
if (role == null)
return;
this.roles.add(role);
|
public void | setRolesAsInt(int i)Sets the roles from a int representation.
- The fist bit set indicates a {@link AccountRole#USER} - int value 1
- The second bit set indicates a {@link AccountRole#ENTRYAMINISTRATOR} -
int value 2
- The third bit set indicates a {@link AccountRole#FEEDAMINISTRATOR} -
int value 4
- The forth bit set indicates a {@link AccountRole#USERADMINISTRATOR} -
int value 8
This method will only set roles, will not remove roles! A combination of
roles is also possible e.g. the int value 6 combines
{@link AccountRole#ENTRYAMINISTRATOR} and
{@link AccountRole#FEEDAMINISTRATOR}.
if ((i & 2) > 0)
this.roles.add(AccountRole.ENTRYAMINISTRATOR);
if ((i & 4) > 0)
this.roles.add(AccountRole.FEEDAMINISTRATOR);
if ((i & 8) > 0)
this.roles.add(AccountRole.USERADMINISTRATOR);
|
public java.lang.String | toString()
StringBuilder builder = new StringBuilder("GdataAccount: ");
builder.append("name: ").append(this.name);
builder.append(" password: ").append((this.password!= null?" length: "+this.password.length():null));
builder.append(" author: ").append(this.authorname);
builder.append(" author email: ").append(this.authorMail);
builder.append(" author link: ").append(this.authorLink!=null?"":this.authorLink);
return builder.toString();
|