enterprises.orbital.impl.evexmlapi.crp.ApiSecurityMember Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of eve-xml-api Show documentation
Show all versions of eve-xml-api Show documentation
Library to interact with EVE XML API servers
package enterprises.orbital.impl.evexmlapi.crp;
import java.util.HashSet;
import java.util.Set;
import enterprises.orbital.evexmlapi.crp.IMemberSecurity;
import enterprises.orbital.evexmlapi.crp.ISecurityRole;
import enterprises.orbital.evexmlapi.crp.ISecurityTitle;
public class ApiSecurityMember implements IMemberSecurity {
private long characterID;
private String name;
private final Set roles = new HashSet();
private final Set grantableRoles = new HashSet();
private final Set rolesAtHQ = new HashSet();
private final Set grantableRolesAtHQ = new HashSet();
private final Set rolesAtBase = new HashSet();
private final Set grantableRolesAtBase = new HashSet();
private final Set rolesAtOther = new HashSet();
private final Set grantableRolesAtOther = new HashSet();
private final Set titles = new HashSet();
@Override
public long getCharacterID() {
return characterID;
}
public void setCharacterID(long characterID) {
this.characterID = characterID;
}
@Override
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public void addSecurityRoleBag(SecurityRoleOrTitleBag securityRoleBag) {
String bagName = securityRoleBag.getName();
if (bagName.equals("roles"))
addSecurityRoles(roles, securityRoleBag);
else if (bagName.equals("grantableRoles"))
addSecurityRoles(grantableRoles, securityRoleBag);
else if (bagName.equals("rolesAtHQ"))
addSecurityRoles(rolesAtHQ, securityRoleBag);
else if (bagName.equals("grantableRolesAtHQ"))
addSecurityRoles(grantableRolesAtHQ, securityRoleBag);
else if (bagName.equals("rolesAtBase"))
addSecurityRoles(rolesAtBase, securityRoleBag);
else if (bagName.equals("grantableRolesAtBase"))
addSecurityRoles(grantableRolesAtBase, securityRoleBag);
else if (bagName.equals("rolesAtOther"))
addSecurityRoles(rolesAtOther, securityRoleBag);
else if (bagName.equals("grantableRolesAtOther"))
addSecurityRoles(grantableRolesAtOther, securityRoleBag);
else if (bagName.equals("titles"))
for (SecurityRoleOrTitle securityRoleOrTitle : securityRoleBag.getSecurityRoles())
titles.add(securityRoleOrTitle.getTitle());
else
throw new RuntimeException("Unknown roleOrTitleBag name");
}
private void addSecurityRoles(Set roleSet, SecurityRoleOrTitleBag securityRoleBag) {
for (SecurityRoleOrTitle securityRoleOrTitle : securityRoleBag.getSecurityRoles())
roleSet.add(securityRoleOrTitle.getRole());
}
@Override
public Set getRoles() {
return roles;
}
@Override
public Set getGrantableRoles() {
return grantableRoles;
}
@Override
public Set getRolesAtHQ() {
return rolesAtHQ;
}
@Override
public Set getGrantableRolesAtHQ() {
return grantableRolesAtHQ;
}
@Override
public Set getRolesAtBase() {
return rolesAtBase;
}
@Override
public Set getGrantableRolesAtBase() {
return grantableRolesAtBase;
}
@Override
public Set getRolesAtOther() {
return rolesAtOther;
}
@Override
public Set getGrantableRolesAtOther() {
return grantableRolesAtOther;
}
@Override
public Set getTitles() {
return titles;
}
}