private boolean loadUser() {
// Get the current user name (may be null)
final String whoami = GlobalContext.getGlobalContext().getIdManager().getCurrentUser();
// Try to load the user from persistence, if username was non-null
User currentUser = whoami != null ? PlatformAccess.getPlatform().getPersistenceProvider().getUser(whoami) : null;
// If no user was found (either in DB or simply because mct.user was unspecified) consider creating one.
if (currentUser == null) {
final String ADD_USER_PROP = "automatically.add.user";
final String DEFAULT_GROUP_PROP = "default.user.group";
if (Boolean.parseBoolean(System.getProperty(ADD_USER_PROP, MCTProperties.DEFAULT_MCT_PROPERTIES.getProperty(ADD_USER_PROP, "false")))) {
// Default to "testUser1" if no user name was ever specified
String userId = whoami != null ? whoami : bundle.getString("DEFAULT_USER"); //NOI18N
Platform platform = PlatformAccess.getPlatform();
// determine if the platform has been initialized
if (platform.getBootstrapComponents().isEmpty()) {
GlobalContext.getGlobalContext().switchUser(new User() {
@Override
public String getDisciplineId() {
return ""; //rather than null, we should return an empty string --Harleigh;Issue127
}