public class RoleUnitName extends Object implements 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 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,
Object parent) |
void |
beforeUnmarshal(javax.xml.bind.Unmarshaller unmarshaller,
Object parent) |
boolean |
equals(Object object) |
String |
getLocalName()
Returns the local name of this role or organization unit, i.e.
|
String |
getModuleName()
Returns the module name of this role or organization unit.
|
String |
getName()
Returns the simple name (i.e.
|
String |
getNameWithParameters()
Returns the full name (i.e.
|
String |
getParameter(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. |
Set<String> |
getParameterNames()
Returns a set of parameter names present in this RoleUnitName.
|
List<RoleUnitParameter> |
getParameters()
Returns a collection of parameters.
|
Map<String,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(Collection<RoleUnitName> others)
Returns true if this role matches at least one of the other roles.
|
static boolean |
matches(Collection<RoleUnitName> roles1,
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 Set<RoleUnitName> |
removeSubRoles(Collection<RoleUnitName> roles)
Returns a set of RoleUnitNames with all sub-roles removed.
|
String |
toString() |
static RoleUnitName |
valueOf(String fullName)
Constructs a RoleUnit name using given raw string.
|
static RoleUnitName |
valueOf(String name,
Collection<RoleUnitParameter> parameters)
Constructs a RoleUnit name using the full name of a role or an
organization unit (i.e.
|
static RoleUnitName |
valueOf(String name,
RoleUnitParameter... parameters)
Constructs a RoleUnit name using the full name of a role or an
organization unit (i.e.
|
static RoleUnitName |
valueOf(String moduleName,
String localName,
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(String moduleName,
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(Collection<String> paramNames)
Returns this role unit name rebased using the specified parameter names.
|
public static final String SEPARATOR
public static RoleUnitName valueOf(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 hasNullPointerException
- if fullName
is nullIllegalArgumentException
- if fullName
has an invalid formatpublic static RoleUnitName valueOf(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 unitNullPointerException
- if name
is null or any parameter in parameters
is nullIllegalArgumentException
- if name
has an invalid format or any parameter in
parameters
is invalid or there are duplicate
parameterspublic static RoleUnitName valueOf(String name, 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 unitNullPointerException
- if name
is null or parameters
or any
parameter in parameters
is nullIllegalArgumentException
- if name
has an invalid format or any parameter in
parameters
is invalid or there are duplicate
parameterspublic static RoleUnitName valueOf(String moduleName, 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 unitNullPointerException
- if moduleName
or localName
or any of parameters
is nullIllegalArgumentException
- if name
has an invalid format or any parameter in
parameters
is invalid or there are duplicate
parameterspublic static RoleUnitName valueOf(String moduleName, String localName, 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 unitNullPointerException
- if moduleName
or localName
or any of parameters
is nullIllegalArgumentException
- if name
has an invalid format or any parameter in
parameters
is invalid or there are duplicate
parameterspublic RoleUnitName withParameterNames(Collection<String> paramNames)
paramNames
- NullPointerException
- if the paramNames
is null or any of its elements is
nullpublic String getName()
public String getNameWithParameters()
public String getModuleName()
public String getLocalName()
public Map<String,String> getParametersMap()
public List<RoleUnitParameter> getParameters()
public Set<String> getParameterNames()
public String getParameter(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
- NullPointerException
- if other
is nullpublic boolean matches(Collection<RoleUnitName> others)
others
- NullPointerException
- if others
or any role in others
is nullpublic boolean isSubRole(RoleUnitName other)
other
- NullPointerException
- if other
is nullpublic static boolean matches(Collection<RoleUnitName> roles1, Collection<RoleUnitName> roles2)
roles1
matches at least one
role in roles2
.roles1
- roles2
- roles1
matches at least one
role in roles2
NullPointerException
- if roles1
or roles2
or any role in roles1
or in roles2
is nullpublic static Set<RoleUnitName> removeSubRoles(Collection<RoleUnitName> roles)
roles
- public void beforeUnmarshal(javax.xml.bind.Unmarshaller unmarshaller, Object parent)
public void afterUnmarshal(javax.xml.bind.Unmarshaller unmarshaller, Object parent)
Copyright © 2007-2020 Whitestein Technologies. All Rights Reserved.