Search in sources :

Example 1 with User

use of nl.tudelft.watchdog.core.ui.wizards.User in project watchdog by TestRoots.

the class UserRegistrationPage method makeRegistration.

protected void makeRegistration() {
    User user = new User();
    user.email = getEmailInput().getText();
    user.organization = getOrganizationInput().getText();
    user.mayContactUser = getMayContactUser();
    user.programmingExperience = getProgrammingExperience();
    user.operatingSystem = Platform.getOS();
    try {
        id = new JsonTransferer().registerNewUser(user);
    } catch (ServerCommunicationException exception) {
        successfulRegistration = false;
        messageTitle = "Problem creating new user!";
        messageBody = WordUtils.wrap(exception.getMessage(), 100, null, true);
        messageBody += "\nAre you connected to the internet, and is port 80 open?";
        messageBody += "\nPlease contact us via www.testroots.org. \nWe'll troubleshoot the issue!";
        return;
    }
    successfulRegistration = true;
    ((UserProjectRegistrationWizard) getWizard()).userid = id;
    messageTitle = "New user registered!";
    messageBody = "Your new user id is registered: ";
    Preferences preferences = Preferences.getInstance();
    preferences.setUserId(id);
    preferences.registerProjectId(WatchDogUtils.getWorkspaceName(), "");
    preferences.setProgrammingExperience(user.programmingExperience);
}
Also used : JsonTransferer(nl.tudelft.watchdog.core.logic.network.JsonTransferer) ServerCommunicationException(nl.tudelft.watchdog.core.logic.network.ServerCommunicationException) User(nl.tudelft.watchdog.core.ui.wizards.User) Preferences(nl.tudelft.watchdog.eclipse.ui.preferences.Preferences)

Example 2 with User

use of nl.tudelft.watchdog.core.ui.wizards.User in project watchdog by TestRoots.

the class StartupUIThread method makeSilentRegistration.

private void makeSilentRegistration() {
    String userId = "";
    if (preferences.getUserId() == null || preferences.getUserId().isEmpty()) {
        User user = new User();
        user.programmingExperience = "NA";
        try {
            userId = new JsonTransferer().registerNewUser(user);
        } catch (ServerCommunicationException exception) {
            WatchDogLogger.getInstance().logSevere(exception);
        }
        if (WatchDogUtils.isEmptyOrHasOnlyWhitespaces(userId)) {
            return;
        }
        preferences.setUserId(userId);
        preferences.registerProjectId(WatchDogUtils.getWorkspaceName(), "");
    }
    savePreferenceStoreIfNeeded();
    registerAnonymousProject(preferences.getUserId());
}
Also used : JsonTransferer(nl.tudelft.watchdog.core.logic.network.JsonTransferer) ServerCommunicationException(nl.tudelft.watchdog.core.logic.network.ServerCommunicationException) User(nl.tudelft.watchdog.core.ui.wizards.User)

Example 3 with User

use of nl.tudelft.watchdog.core.ui.wizards.User in project watchdog by TestRoots.

the class JsonConverterTestBase method testUserHasWatchDogVersion.

@Test
public void testUserHasWatchDogVersion() {
    String gsonRepresentation = WatchDogUtils.convertToJson(new User());
    boolean containsWDVersion = gsonRepresentation.contains("\"wdv\":\"" + WatchDogGlobals.CLIENT_VERSION + "\"");
    assertTrue(containsWDVersion);
}
Also used : User(nl.tudelft.watchdog.core.ui.wizards.User) Test(org.junit.Test)

Example 4 with User

use of nl.tudelft.watchdog.core.ui.wizards.User in project watchdog by TestRoots.

the class WatchDogStartUp method makeSilentRegistration.

private void makeSilentRegistration() {
    String userId = "";
    Preferences preferences = Preferences.getInstance();
    if (preferences.getUserId() == null || preferences.getUserId().isEmpty()) {
        User user = new User();
        user.programmingExperience = "NA";
        try {
            userId = new JsonTransferer().registerNewUser(user);
        } catch (ServerCommunicationException exception) {
            WatchDogLogger.getInstance().logSevere(exception);
        }
        if (WatchDogUtils.isEmptyOrHasOnlyWhitespaces(userId)) {
            return;
        }
        preferences.setUserId(userId);
        preferences.registerProjectId(WatchDogUtils.getProjectName(), "");
    }
    registerAnonymousProject(preferences.getUserId());
}
Also used : JsonTransferer(nl.tudelft.watchdog.core.logic.network.JsonTransferer) ServerCommunicationException(nl.tudelft.watchdog.core.logic.network.ServerCommunicationException) User(nl.tudelft.watchdog.core.ui.wizards.User) Preferences(nl.tudelft.watchdog.intellij.ui.preferences.Preferences)

Example 5 with User

use of nl.tudelft.watchdog.core.ui.wizards.User in project watchdog by TestRoots.

the class UserRegistrationStep method makeRegistration.

protected void makeRegistration() {
    User user = new User();
    user.email = getEmailInput().getText();
    user.organization = getOrganizationInput().getText();
    user.mayContactUser = getMayContactUser();
    user.programmingExperience = getProgrammingExperience();
    user.operatingSystem = System.getProperty("os.name");
    try {
        id = new JsonTransferer().registerNewUser(user);
    } catch (ServerCommunicationException exception) {
        successfulRegistration = false;
        messageTitle = "Problem creating new user!";
        messageBody = "<html>" + WordUtils.wrap(exception.getMessage(), 100, "<br>", true);
        messageBody += "<br>Are you connected to the internet, and is port 80 open?";
        messageBody += "<br>Please contact us via www.testroots.org. <br>We'll troubleshoot the issue!</html>";
        return;
    }
    successfulRegistration = true;
    ((UserProjectRegistrationWizard) getWizard()).userid = id;
    messageTitle = "New user registered!";
    messageBody = "Your new user id is registered: ";
    Preferences preferences = Preferences.getInstance();
    preferences.setUserId(id);
    preferences.registerProjectId(WatchDogUtils.getProjectName(), "");
    preferences.setProgrammingExperience(user.programmingExperience);
}
Also used : JsonTransferer(nl.tudelft.watchdog.core.logic.network.JsonTransferer) ServerCommunicationException(nl.tudelft.watchdog.core.logic.network.ServerCommunicationException) User(nl.tudelft.watchdog.core.ui.wizards.User) Preferences(nl.tudelft.watchdog.intellij.ui.preferences.Preferences)

Aggregations

User (nl.tudelft.watchdog.core.ui.wizards.User)5 JsonTransferer (nl.tudelft.watchdog.core.logic.network.JsonTransferer)4 ServerCommunicationException (nl.tudelft.watchdog.core.logic.network.ServerCommunicationException)4 Preferences (nl.tudelft.watchdog.intellij.ui.preferences.Preferences)2 Preferences (nl.tudelft.watchdog.eclipse.ui.preferences.Preferences)1 Test (org.junit.Test)1