}
if(isCaching() && modifiedRoleMappings!=null && modifiedRoleMappings.containsKey(roleName)) return null;
RoleMappingDAOType rmDAOFacade = RoleMappingDAOType.getInstance(ptc);
RoleMappingDAO roleMappingDAO = rmDAOFacade.findByInstanceIdAndRoleName(new Long(getInstanceId()), roleName);
if ( roleMappingDAO.size() < 1 ) return null;
RoleMapping making;
if(roleMappingDAO.size()==1){
making = rmDAOFacade.createRoleMapping(roleMappingDAO); //(RoleMapping)GlobalContext.deserialize(roleMappingDAO.getValue(), RoleMapping.class);
}else{
making = RoleMapping.create();
making.setName(roleName);
int i = roleMappingDAO.size();
do{
//RoleMapping mapping = (RoleMapping)GlobalContext.deserialize(roleMappingDAO.getValue(), RoleMapping.class);
RoleMapping mapping = rmDAOFacade.createRoleMapping(roleMappingDAO);
making.replaceCurrentRoleMapping(mapping);
if(making.getCursor() == 0){
making.setDispatchingOption(mapping.getDispatchingOption());
making.setDispatchingParameters(mapping.getDispatchingParameters());
}
if ((--i)>0) making.moveToAdd();
}while(roleMappingDAO.next());
}
making.beforeFirst();
if(isCaching()){