* Sets the invocation context user instance.
* @param user The user instance.
*/
protected void setUser(Instance user)
{
PrivilegeSet privilegeSet = null;
String sFragmentName = m_sFragmentName;
Instance partition = m_partition;
if (user != null)
{
Metaclass metaclass = user.getMetaclass();
PersistenceMapping mapping = metaclass.getPersistenceMapping();
Attribute attribute = null;
assert m_userClass.isUpcast(metaclass);
if (mapping != null)
{
attribute = mapping.getFragmentAttribute();
}
if (attribute == null)
{
attribute = metaclass.findAttribute("fragmentName");
}
if (attribute != null)
{
sFragmentName = (String)((attribute.isStatic()) ?
metaclass.getValue(attribute.getOrdinal()) :
user.getValue(attribute.getOrdinal()));
}
attribute = metaclass.findAttribute("partition");
if (attribute != null)
{
partition = (Instance)((attribute.isStatic()) ?
metaclass.getValue(attribute.getOrdinal()) :
user.getValue(attribute.getOrdinal()));
}
privilegeSet = (PrivilegeSet)user.getValue("privilegeSet");
}
if (privilegeSet == null)
{
privilegeSet = new PrivilegeSet(m_metadata.getPrimitivePrivilegeCount(), false);
}
m_user = user;
m_privilegeSet = privilegeSet;
m_sFragmentName = sFragmentName;