public class RoleUnitName
extends java.lang.Object
implements java.io.Serializable
A RoleUnit name consists of a module name, the separator (currently
"::" without the quotes
), and a local role or organization
unit name. Its full form has the format "
moduleName::localName
" (without the
quotes).
From the version 1.2 the class can have zero or more parameters (and as such,
it can represent both a RoleUnit name and a parametric role
or organization unit itself). Each parameter is composed of its
name
and its value
.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
SEPARATOR
The string separator of a module name and a local name.
|
Modifier | Constructor and Description |
---|---|
protected |
RoleUnitName()
Creates new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
afterUnmarshal(javax.xml.bind.Unmarshaller unmarshaller,
java.lang.Object parent) |
void |
beforeUnmarshal(javax.xml.bind.Unmarshaller unmarshaller,
java.lang.Object parent) |
boolean |
equals(java.lang.Object object) |
java.lang.String |
getLocalName()
Returns the local name of this role or organization unit, i.e.
|
java.lang.String |
getModuleName()
Returns the module name of this role or organization unit.
|
java.lang.String |
getName()
Returns the simple name (i.e.
|
java.lang.String |
getNameWithParameters()
Returns the full name (i.e.
|
java.lang.String |
getParameter(java.lang.String name)
Returns the value of a parameter identified by given
name or
null if the parameter with such name does not exist for this role
or organization unit. |
java.util.Set<java.lang.String> |
getParameterNames()
Returns a set of parameter names present in this RoleUnitName.
|
java.util.List<RoleUnitParameter> |
getParameters()
Returns a collection of parameters.
|
java.util.Map<java.lang.String,java.lang.String> |
getParametersMap()
Returns a map of parameter names and values of this RoleUnitName
.
|
int |
hashCode() |
boolean |
isSubRole(RoleUnitName other)
Returns true if this role is a sub-role of the other role, i.e.
|
boolean |
matches(java.util.Collection<RoleUnitName> others)
Returns true if this role matches at least one of the other roles.
|
static boolean |
matches(java.util.Collection<RoleUnitName> roles1,
java.util.Collection<RoleUnitName> roles2)
Returns true if at least one role in
roles1 matches at least one
role in roles2 . |
boolean |
matches(RoleUnitName other)
Returns true if this role matches the other role, i.e.
|
static java.util.Set<RoleUnitName> |
removeSubRoles(java.util.Collection<RoleUnitName> roles)
Returns a set of RoleUnitNames with all sub-roles removed.
|
java.lang.String |
toString() |
static RoleUnitName |
valueOf(java.lang.String fullName)
Constructs a RoleUnit name using given raw string.
|
static RoleUnitName |
valueOf(java.lang.String name,
java.util.Collection<RoleUnitParameter> parameters)
Constructs a RoleUnit name using the full name of a role or an
organization unit (i.e.
|
static RoleUnitName |
valueOf(java.lang.String name,
RoleUnitParameter... parameters)
Constructs a RoleUnit name using the full name of a role or an
organization unit (i.e.
|
static RoleUnitName |
valueOf(java.lang.String moduleName,
java.lang.String localName,
java.util.Collection<RoleUnitParameter> parameters)
Constructs a RoleUnit name using the module name and the local
name of a role or an organization unit.
|
static RoleUnitName |
valueOf(java.lang.String moduleName,
java.lang.String localName,
RoleUnitParameter... parameters)
Constructs a RoleUnit name using the module name and the local
name of a role or an organization unit.
|
RoleUnitName |
withParameterNames(java.util.Collection<java.lang.String> paramNames)
Returns this role unit name rebased using the specified parameter names.
|
public static final java.lang.String SEPARATOR
public static RoleUnitName valueOf(java.lang.String fullName)
fullName
- a raw string that can contain either simple RoleUnit
name (a module name, the separator, and a local name) or
RoleUnit name together with all the parameters it hasjava.lang.NullPointerException
- if fullName
is nulljava.lang.IllegalArgumentException
- if fullName
has an invalid formatpublic static RoleUnitName valueOf(java.lang.String name, RoleUnitParameter... parameters)
parameters
.name
- a full name of a role or an organization unitparameters
- an array of parameters of a role or an organization unitjava.lang.NullPointerException
- if name
is null or any parameter in parameters
is nulljava.lang.IllegalArgumentException
- if name
has an invalid format or any parameter in
parameters
is invalid or there are duplicate
parameterspublic static RoleUnitName valueOf(java.lang.String name, java.util.Collection<RoleUnitParameter> parameters)
parameters
.name
- a full name of a role or an organization unitparameters
- a collection of parameters of a role or an organization unitjava.lang.NullPointerException
- if name
is null or parameters
or any
parameter in parameters
is nulljava.lang.IllegalArgumentException
- if name
has an invalid format or any parameter in
parameters
is invalid or there are duplicate
parameterspublic static RoleUnitName valueOf(java.lang.String moduleName, java.lang.String localName, RoleUnitParameter... parameters)
parameters
.moduleName
- a name of a module that contains a role or an organization
unitlocalName
- a local name of a role or an organization unitparameters
- an array of parameters of a role or an organization unitjava.lang.NullPointerException
- if moduleName
or localName
or any of parameters
is nulljava.lang.IllegalArgumentException
- if name
has an invalid format or any parameter in
parameters
is invalid or there are duplicate
parameterspublic static RoleUnitName valueOf(java.lang.String moduleName, java.lang.String localName, java.util.Collection<RoleUnitParameter> parameters)
parameters
.moduleName
- a name of a module that contains a role or an organization
unitlocalName
- a local name of a role or an organization unitparameters
- an array of parameters of a role or an organization unitjava.lang.NullPointerException
- if moduleName
or localName
or any of parameters
is nulljava.lang.IllegalArgumentException
- if name
has an invalid format or any parameter in
parameters
is invalid or there are duplicate
parameterspublic RoleUnitName withParameterNames(java.util.Collection<java.lang.String> paramNames)
paramNames
- java.lang.NullPointerException
- if the paramNames
is null or any of its elements is
nullpublic java.lang.String getName()
public java.lang.String getNameWithParameters()
public java.lang.String getModuleName()
public java.lang.String getLocalName()
public java.util.Map<java.lang.String,java.lang.String> getParametersMap()
public java.util.List<RoleUnitParameter> getParameters()
public java.util.Set<java.lang.String> getParameterNames()
public java.lang.String getParameter(java.lang.String name)
name
or
null
if the parameter with such name does not exist for this role
or organization unit.name
- a name of a parametername
or
null
if the parameter with such name does not exist for
this role or organization unitpublic boolean matches(RoleUnitName other)
other
- java.lang.NullPointerException
- if other
is nullpublic boolean matches(java.util.Collection<RoleUnitName> others)
others
- java.lang.NullPointerException
- if others
or any role in others
is nullpublic boolean isSubRole(RoleUnitName other)
other
- java.lang.NullPointerException
- if other
is nullpublic static boolean matches(java.util.Collection<RoleUnitName> roles1, java.util.Collection<RoleUnitName> roles2)
roles1
matches at least one
role in roles2
.roles1
- roles2
- roles1
matches at least one
role in roles2
java.lang.NullPointerException
- if roles1
or roles2
or any role in roles1
or in roles2
is nullpublic static java.util.Set<RoleUnitName> removeSubRoles(java.util.Collection<RoleUnitName> roles)
roles
- public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public void beforeUnmarshal(javax.xml.bind.Unmarshaller unmarshaller, java.lang.Object parent)
public void afterUnmarshal(javax.xml.bind.Unmarshaller unmarshaller, java.lang.Object parent)
Copyright © 2007-2020 Whitestein Technologies. All Rights Reserved.