public class AttivioPrincipal extends Object implements Principal, Serializable, Comparable<AttivioPrincipal>, Cloneable
Modifier and Type | Class and Description |
---|---|
static class |
AttivioPrincipal.PrincipalType
Contains the possible principal types.
|
Modifier and Type | Field and Description |
---|---|
static String |
ANONYMOUS
Constant to signify anonymous (realm or user).
|
static AttivioPrincipal |
ANONYMOUS_USER
Represents the anonymous user (whose realm ID, principal ID, and principal name are
ANONYMOUS ). |
static String |
ANONYMOUS_USER_GUID
The GUID of the anonymous user.
|
protected UUID |
correlationId
correlation id if set
|
static String |
FIELD_PRINCIPAL_ID
The name of the field that stores the principal ID.
|
static String |
FIELD_PRINCIPAL_NAME
The name of the field that stores the principal name.
|
static String |
FIELD_REALM_ID
The name of the field that stores the security realm ID.
|
protected Set<AttivioGroupMembership> |
groupMemberships
Any group memberships of this principal.
|
static String |
PARAMETER_PRINCIPAL_ID
The CGI parameter or query request property for the principal ID.
|
static String |
PARAMETER_PRINCIPAL_NAME
The CGI parameter or query request property for the principal name.
|
static String |
PARAMETER_REALM_ID
The CGI parameter or query request property for the realm ID.
|
static String |
PRIN_NAME_UNKNOWN
The constant for the 'unknown' principal name.
|
protected String |
principalId
The principal ID.
|
protected String |
principalName
The principal name.
|
protected AttivioPrincipal.PrincipalType |
principalType
The principal type.
|
protected BaseTypesMap<String,Object> |
properties
Any additional properties.
|
protected String |
realmId
The security realm ID.
|
protected Set<AttivioRole> |
roles
Optional roles used by the Security Client API authorization.
|
Modifier | Constructor and Description |
---|---|
protected |
AttivioPrincipal()
The default constructor.
|
|
AttivioPrincipal(AttivioPrincipalKey principalKey,
String principalName,
AttivioPrincipal.PrincipalType principalType)
Constructs an Attivio principal from a principal key, name, and type.
|
|
AttivioPrincipal(String realmId,
String principalId,
String principalName,
AttivioPrincipal.PrincipalType principalType)
Creates an Attivio principal object from a realm ID, a principal ID, a principal name, and a principal type.
|
Modifier and Type | Method and Description |
---|---|
void |
addGroupMembership(AttivioGroupMembership groupMembership)
Adds a group membership to the set of this principal's group memberships.
|
void |
addRole(AttivioRole role)
Add a role to the principal.
|
AttivioPrincipal |
clone() |
int |
compareTo(AttivioPrincipal other)
{inheritDoc}
|
boolean |
equals(Object obj)
{inheritDoc}
|
static AttivioPrincipal |
fromPrincipalString(String principalString)
Creates an attivio principal from a principal string in the form of realmId:principalId:principalName
|
UUID |
getCorrelationId()
Get the correlation ID used to tie different instances of the same document sent in back to their original source.
|
Set<AttivioGroupMembership> |
getGroupMemberships() |
String |
getName() |
String |
getPassword() |
String |
getPrincipalId() |
AttivioPrincipalKey |
getPrincipalKey() |
String |
getPrincipalName() |
String |
getPrincipalString() |
AttivioPrincipal.PrincipalType |
getPrincipalType() |
BaseTypesMap<String,Object> |
getProperties() |
Object |
getProperty(String propName) |
String |
getRealmId() |
Set<AttivioRole> |
getRoles() |
Set<AttivioRole> |
getRoles(Enum<?> enumRole)
Return all
AttivioRole objects that have the same name as the given Enum . |
Set<AttivioRole> |
getRoles(String roleName)
Return all
AttivioRole objects that have the given role name. |
int |
hashCode()
{inheritDoc}
|
boolean |
hasRole(Enum<?> enumRole)
Equivalent to hasRule(enumRole, AttivioRole.SUBGROUP_ANY);
|
boolean |
hasRole(Enum<?> enumRole,
String subgroup) |
boolean |
hasRole(String role)
Equivalent to hasRule(role , AttivioRole.SUBGROUP_ANY);
|
boolean |
hasRole(String roleName,
String subgroup) |
boolean |
isAnonymous() |
static boolean |
isAnonymous(AttivioPrincipalKey prinKey) |
static boolean |
isAnonymous(String realmId,
String principalId) |
boolean |
isGroup() |
boolean |
isUser() |
boolean |
removeGroupMembership(AttivioGroupMembership groupMembership)
Removes a group membership from the set of this principal's group memberships.
|
void |
setCorrelationId(UUID correlationId)
Set the correlation id
|
void |
setGroupMemberships(Set<AttivioGroupMembership> groupMemberships)
Sets the group memberships for this principal.
|
void |
setPassword(String password)
Set a password with this principal
|
void |
setPrincipalId(String principalId)
Sets the principal ID.
|
void |
setPrincipalName(String principalName)
Sets the principal name.
|
void |
setPrincipalType(AttivioPrincipal.PrincipalType principalType)
Set the principal type
|
void |
setProperty(String propName,
Object propValue)
Sets a property on the principal.
|
void |
setRealmId(String realmId)
Sets the realm ID.
|
void |
setRoles(Set<AttivioRole> roles)
Set roles for this principal.
|
String |
toString()
{inheritDoc}
|
public static final String PRIN_NAME_UNKNOWN
public static final String ANONYMOUS
public static final AttivioPrincipal ANONYMOUS_USER
ANONYMOUS
).public static final String ANONYMOUS_USER_GUID
public static final String FIELD_REALM_ID
public static final String FIELD_PRINCIPAL_ID
public static final String FIELD_PRINCIPAL_NAME
public static final String PARAMETER_REALM_ID
public static final String PARAMETER_PRINCIPAL_ID
public static final String PARAMETER_PRINCIPAL_NAME
protected String realmId
protected String principalId
protected String principalName
protected AttivioPrincipal.PrincipalType principalType
protected Set<AttivioRole> roles
protected Set<AttivioGroupMembership> groupMemberships
protected UUID correlationId
protected BaseTypesMap<String,Object> properties
protected AttivioPrincipal()
public AttivioPrincipal(String realmId, String principalId, String principalName, AttivioPrincipal.PrincipalType principalType)
realmId
- the security realm ID; may not be null or emptyprincipalId
- the principal ID; may not be null or emptyprincipalName
- the principal name; may be null or emptyprincipalType
- the principal type; may not be null or emptypublic AttivioPrincipal(AttivioPrincipalKey principalKey, String principalName, AttivioPrincipal.PrincipalType principalType)
principalKey
- the principal key; may not be nullprincipalName
- the principal name; may be null or emptyprincipalType
- the principal type; may not be null or emptypublic void setRealmId(String realmId)
realmId
- the realm IDpublic String getRealmId()
public void setPrincipalId(String principalId)
principalId
- the principal IDpublic String getPrincipalId()
public AttivioPrincipalKey getPrincipalKey()
public String getPrincipalString()
public static AttivioPrincipal fromPrincipalString(String principalString)
principalString
- public String getName()
public void setPrincipalName(String principalName)
principalName
- the principal namepublic String getPrincipalName()
public AttivioPrincipal.PrincipalType getPrincipalType()
public void setPrincipalType(AttivioPrincipal.PrincipalType principalType)
principalType
- public boolean isAnonymous()
public static boolean isAnonymous(String realmId, String principalId)
realmId
- the realm IDprincipalId
- the principal IDpublic static boolean isAnonymous(AttivioPrincipalKey prinKey)
prinKey
- the principal keypublic boolean isUser()
public boolean isGroup()
public Set<AttivioRole> getRoles()
public Set<AttivioRole> getRoles(String roleName)
AttivioRole
objects that have the given role name.roleName
- the role name to matchpublic boolean hasRole(String roleName, String subgroup)
roleName
- role namesubgroup
- subgroup id,resource id, or AttivioRole.SUBGROUP_ANY
public boolean hasRole(Enum<?> enumRole, String subgroup)
enumRole
- enum used for rolessubgroup
- subgroup ID, resource ID, or AttivioRole.SUBGROUP_ANY
public boolean hasRole(Enum<?> enumRole)
enumRole
- enum used for rolespublic boolean hasRole(String role)
role
- role namepublic Set<AttivioRole> getRoles(Enum<?> enumRole)
AttivioRole
objects that have the same name as the given Enum
.enumRole
- enum used for rolespublic void addRole(AttivioRole role)
public void setRoles(Set<AttivioRole> roles)
roles
- the roles to setpublic Set<AttivioGroupMembership> getGroupMemberships()
public void setGroupMemberships(Set<AttivioGroupMembership> groupMemberships)
groupMemberships
- the group membershipspublic void addGroupMembership(AttivioGroupMembership groupMembership)
groupMembership
- the group membership to addpublic boolean removeGroupMembership(AttivioGroupMembership groupMembership)
groupMembership
- the group membership to removepublic UUID getCorrelationId()
public void setCorrelationId(UUID correlationId)
correlationId
- public void setProperty(String propName, Object propValue)
propName
- the property namepropValue
- the property valuepublic void setPassword(String password)
password
- public String getPassword()
public Object getProperty(String propName)
propName
- the name of the propertypublic BaseTypesMap<String,Object> getProperties()
public int hashCode()
public boolean equals(Object obj)
public String toString()
public int compareTo(AttivioPrincipal other)
compareTo
in interface Comparable<AttivioPrincipal>
public AttivioPrincipal clone()
Copyright © 2018 Attivio, Inc. All Rights Reserved.
PATENT NOTICE: Attivio, Inc. Software Related Patents. With respect to the Attivio software product(s) being used, the following patents apply: Querying Joined Data Within A Search Engine Index: United States Patent No.(s): 8,073,840. Ordered Processing of Groups of Messages: U.S. Patent No.(s) 8,495,656. Signal processing approach to sentiment analysis for entities in documents: U.S. Patent No.(s) 8,725,494. Other U.S. and International Patents Pending.