Package com.totalchange.jizz.web.shared.admin

Examples of com.totalchange.jizz.web.shared.admin.ServerSettings


    }

    private ServerSettings makeNewServerSettings() {
        logger.debug("Making up new default settings for a new install");

        ServerSettings settings = new ServerSettings();
        settings.setStationName("");
        settings.setStationLocale(Locale.getDefault().toLanguageTag());
        settings.setBroadcastSchedule("30 17 * * fri");
        settings.setStationUrl("");
        settings.setSmtpServerHost("");
        settings.setSmtpServerPort(-1);

        return settings;
    }
View Full Code Here


        logger.finer("Finished starting up InitJizzActivity");
    }

    @Override
    public void saveAndGetStarted() {
        ServerSettings settings = new ServerSettings();
        settings.setStationName(initJizzView.getStationName());
        settings.setStationLocale(initJizzView.getStationLocale());
        settings.setStationUrl(initJizzView.getStationUrl());

        CronDateUtil du = new CronDateUtil();
        settings.setBroadcastSchedule(du.parseDate(initJizzView
                .getBroadcastEnd()));

        String[] smtpServerBits = initJizzView.getSmtpServer().split(":");
        if (smtpServerBits.length >= 1) {
            settings.setSmtpServerHost(smtpServerBits[0]);
        }
        if (smtpServerBits.length >= 2) {
            try {
                settings.setSmtpServerPort(Integer.parseInt(smtpServerBits[1]));
            } catch (NumberFormatException nfEx) {
                errorHandler.argh(errorMessages
                        .invalidSmtpServerPort(smtpServerBits[1]));
                return;
            }
        } else {
            settings.setSmtpServerPort(-1);
        }

        SetSettingsAction action = new SetSettingsAction();
        action.setSettings(settings);
View Full Code Here

    @Override
    public GetSettingsResult execute(GetSettingsAction action,
            ExecutionContext context) throws DispatchException {
        logger.trace("Fetching server settings");
        ServerSettings settings;

        JizzStation station = jizzStationDao.getPrimaryStation();
        if (station == null) {
            settings = makeNewServerSettings();
        } else {
            settings = new ServerSettings();
            settings.setStationName(station.getName());
            settings.setStationLocale(station.getLocale());
            settings.setStationUrl(station.getUrl());
            settings.setBroadcastSchedule(station.getBroadcastSchedule());
            settings.setSmtpServerHost(station.getSmtpServerHost());
            settings.setSmtpServerPort(station.getSmtpServerPort());
        }

        GetSettingsResult result = new GetSettingsResult();
        result.setSettings(settings);
        logger.trace("Returning server settings {}", result);
View Full Code Here

    @Override
    public SetSettingsResult execute(SetSettingsAction action,
            ExecutionContext context) throws DispatchException {
        logger.trace("Saving server settings {}", action);

        ServerSettings settings = action.getSettings();
        JizzStation station = jizzStationDao.getPrimaryStation();

        boolean isNewInstall = false;
        if (station == null) {
            logger.debug("Creating new station");
            station = new JizzStation();
            station.setKey(UUID.randomUUID().toString());
            isNewInstall = true;
        }

        station.setName(settings.getStationName());
        station.setLocale(settings.getStationLocale());
        station.setUrl(settings.getStationUrl());
        station.setBroadcastSchedule(settings.getBroadcastSchedule());
        station.setSmtpServerHost(settings.getSmtpServerHost());
        station.setSmtpServerPort(settings.getSmtpServerPort());
        station = jizzStationDao.createOrUpdateStation(station);

        if (isNewInstall) {
            logger.info("New install - making current user an admin of this "
                    + "new station");
View Full Code Here

        mockJizzDjServices.addRole(mockDj, JizzDjRole.Roles.Administrator);

        replayAll();

        SetSettingsAction action = new SetSettingsAction();
        ServerSettings mockSettings = new ServerSettings();
        mockSettings.setStationName("Awesome Station");
        mockSettings.setStationUrl("http://awesome/");
        mockSettings.setBroadcastSchedule("30 0 * * * Mon");
        action.setSettings(mockSettings);

        setSettingsHandler.execute(action, null);

        verifyAll();
View Full Code Here

                .andReturn(mockStation);

        replayAll();

        SetSettingsAction action = new SetSettingsAction();
        ServerSettings mockSettings = new ServerSettings();
        mockSettings.setStationName("Awesome Station");
        mockSettings.setStationUrl("http://awesome/");
        mockSettings.setBroadcastSchedule("30 0 * * * Mon");
        action.setSettings(mockSettings);

        setSettingsHandler.execute(action, null);
        assertEquals(mockSettings.getStationName(), mockStation.getName());
        assertEquals(mockSettings.getStationUrl(), mockStation.getUrl());
        assertEquals(mockSettings.getBroadcastSchedule(),
                mockStation.getBroadcastSchedule());

        verifyAll();
    }
View Full Code Here

TOP

Related Classes of com.totalchange.jizz.web.shared.admin.ServerSettings

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.