class ProjectImportPortlet extends Sw360Portlet {

    void setNewImportSource(RemoteCredentials newCredentials, PortletSession session, JSONObject responseData, LoginState loginState) {

        String serverUrl = nullToEmpty(newCredentials.getServerUrl());

        if (serverUrl.isEmpty()) {
            loginState.logout();
            responseData.put(ProjectImportConstants.RESPONSE__STATUS,
                    ProjectImportConstants.RESPONSE__DB_URL_NOT_SET);
        } else {
            putRemoteCredentialsIntoSession(session, newCredentials);
            responseData.put(ProjectImportConstants.RESPONSE__STATUS,
                    ProjectImportConstants.RESPONSE__DB_CHANGED);
            responseData.put(ProjectImportConstants.RESPONSE__DB_URL, serverUrl);
            loginState.login(serverUrl);
        }
    }

}