try
{
beginTransaction(db);
SystemUser systemUser = SystemUserController.getController().getReadOnlySystemUserWithName(userName, db);
if(logger.isInfoEnabled())
t.printElapsedTime("systemUser AAA took:");
//setDebug(Level.DEBUG, "org.exolab.castor.jdo");
if(systemUser != null)
{
Collection<RoleVO> roleVOList = RoleController.getController().getRoleVOList(userName, db);
if(logger.isInfoEnabled())
t.printElapsedTime("getRoleVOList took:");
Iterator<RoleVO> roleVOListIterator = roleVOList.iterator();
while(roleVOListIterator.hasNext())
{
RoleVO roleVO = roleVOListIterator.next();
if(logger.isInfoEnabled())
logger.info("Adding role:" + roleVO.getRoleName());
InfoGlueRole infoGlueRole = new InfoGlueRole(roleVO.getRoleName(), roleVO.getRoleName(), roleVO.getDescription(), roleVO.getSource(), roleVO.getIsActive(), roleVO.getModifiedDateTime(), this);
roles.add(infoGlueRole);
}
Collection<GroupVO> groupVOList = GroupController.getController().getGroupVOList(userName, db);
if(logger.isInfoEnabled())
t.printElapsedTime("groupVOList took:");
Iterator<GroupVO> groupVOListIterator = groupVOList.iterator();
while(groupVOListIterator.hasNext())
{
GroupVO groupVO = groupVOListIterator.next();
if(logger.isInfoEnabled())
logger.info("Adding group:" + groupVO.getGroupName());
InfoGlueGroup infoGlueGroup = new InfoGlueGroup(groupVO.getGroupName(), groupVO.getGroupName(), groupVO.getDescription(), groupVO.getSource(), groupVO.getGroupType(), groupVO.getIsActive(), groupVO.getModifiedDateTime(), this);
groups.add(infoGlueGroup);
}
infogluePrincipal = new InfoGluePrincipal(userName, userName, systemUser.getFirstName(), systemUser.getLastName(), systemUser.getEmail(), systemUser.getSource(), systemUser.getIsActive(), systemUser.getModifiedDateTime(), roles, groups, new HashMap(), isAdministrator, this);
}
else
{
logger.warn("Could not find user with userName '" + userName + "' - fix your template logic.");
infogluePrincipal = null;
}
//setDebug(Level.ERROR, "org.exolab.castor.jdo");
commitTransaction(db);
}
catch (Exception e)
{
logger.info("An error occurred trying to get SystemUser for " + userName + ":" + e.getMessage());
rollbackTransaction(db);
throw new SystemException(e.getMessage());
}
}
else
{
SystemUser systemUser = SystemUserController.getController().getReadOnlySystemUserWithName(userName, transactionObject);
if(logger.isInfoEnabled())
t.printElapsedTime("systemUser BBB took:");
if(systemUser != null)
{
Collection<RoleVO> roleVOList = RoleController.getController().getRoleVOList(userName, transactionObject);
if(logger.isInfoEnabled())
t.printElapsedTime("getRoleVOList took:");
Iterator<RoleVO> roleVOListIterator = roleVOList.iterator();
while(roleVOListIterator.hasNext())
{
RoleVO roleVO = roleVOListIterator.next();
if(logger.isInfoEnabled())
logger.info("Adding role:" + roleVO.getRoleName());
InfoGlueRole infoGlueRole = new InfoGlueRole(roleVO.getRoleName(), roleVO.getRoleName(), roleVO.getDescription(), roleVO.getSource(), roleVO.getIsActive(), roleVO.getModifiedDateTime(), this);
roles.add(infoGlueRole);
}
Collection<GroupVO> groupVOList = GroupController.getController().getGroupVOList(userName, transactionObject);
if(logger.isInfoEnabled())
t.printElapsedTime("groupVOList took:");
Iterator<GroupVO> groupVOListIterator = groupVOList.iterator();
while(groupVOListIterator.hasNext())
{
GroupVO groupVO = (GroupVO)groupVOListIterator.next();
if(logger.isInfoEnabled())
logger.info("Adding group:" + groupVO.getGroupName());
InfoGlueGroup infoGlueGroup = new InfoGlueGroup(groupVO.getGroupName(), groupVO.getGroupName(), groupVO.getDescription(), groupVO.getSource(), groupVO.getGroupType(), groupVO.getIsActive(), groupVO.getModifiedDateTime(), this);
groups.add(infoGlueGroup);
}
infogluePrincipal = new InfoGluePrincipal(userName, userName, systemUser.getFirstName(), systemUser.getLastName(), systemUser.getEmail(), systemUser.getSource(), systemUser.getIsActive(), systemUser.getModifiedDateTime(), roles, groups, new HashMap(), isAdministrator, this);
}
else
{
logger.warn("Could not find user with userName '" + userName + "' - fix your template logic.");
infogluePrincipal = null;