Package com.salas.bb.service

Examples of com.salas.bb.service.ServicePreferences


     */
    private static boolean isServiceAccountPresent(GlobalModel model)
    {
        String success = ServicePreferences.SYNC_STATUS_SUCCESS;

        ServicePreferences prefs = model.getServicePreferences();

        // If account info is added and any synchronization was successful
        // we report that the account is present and can be used for restoration
        boolean actInfoEntered = prefs.isAccountInformationEntered();
        boolean successfulSync = success.equals(prefs.getLastSyncInStatus()) ||
                                 success.equals(prefs.getLastSyncOutStatus());

        return actInfoEntered && successfulSync;
    }
View Full Code Here


    /**
     * Initializes main properties of the service account.
     */
    private void initializeServiceAccount()
    {
        ServicePreferences sp = model.getServicePreferences();
        sp.setRegDate(new Date());
        sp.setEmail(installationSettings.getServiceAccountEmail());
        sp.setPassword(installationSettings.getServiceAccountPassword());

// Since we copy everything from the installation model to the working model in
// OpenDBInBackground.run(), we don't need this any more
//        Preferences prefs = Application.getUserPreferences();
//        prefs.putLong(ServicePreferences.KEY_REG_DATE, System.currentTimeMillis());
View Full Code Here

     * Initializes and starts connection checker.
     */
    private void startConnectionChecker()
    {
        GlobalModel model = GlobalController.SINGLETON.getModel();
        ServicePreferences prefs = model.getServicePreferences();

        String version = globalAppLauncher.getApplicationDescription().getVersion();
        long installationId = getInstallationId();
        int runs = getInstallationRuns();
        String accountEmail = prefs.getEmail();
        String accountPassword = prefs.getPassword();

        ConnectionChecker connectionChecker = new ConnectionChecker(
            version, installationId, runs, accountEmail, accountPassword, connectionState);
        connectionChecker.start();
    }
View Full Code Here

     */
    private String prepareText()
    {
        String result;

        ServicePreferences servicePreferences = GlobalModel.SINGLETON.getServicePreferences();
        String regStatus;
        String regName = Constants.EMPTY_STRING;
        String regEmail = Constants.EMPTY_STRING;

        boolean registered = servicePreferences.isAccountInformationEntered();
        if (registered)
        {
            regStatus = Strings.message("aboutdialog.registered");
            regName = servicePreferences.getFullName();
            regEmail = servicePreferences.getEmail();
        } else
        {
            regStatus = Strings.message("aboutdialog.unregistered");
        }

View Full Code Here

     */
    public void actionPerformed(ActionEvent e)
    {
        final SendFeedbackDialog dlg = getDialog();

        ServicePreferences servicePreferences = GlobalModel.SINGLETON.getServicePreferences();

        dlg.open(servicePreferences.getFullName(), servicePreferences.getEmail());
        if (!dlg.hasBeenCanceled())
        {
            String name = dlg.getFullName();
            String email = dlg.getEmail();
            int forumId = dlg.getForumId();
View Full Code Here

     *                          this model object.
     */
    public GlobalModel(ScoresCalculator scoresCalculator, boolean full)
    {
        userPreferences = new UserPreferences();
        servicePreferences = new ServicePreferences();
        starzPreferences = new StarzPreferences();
        globalRenderingSettings = new FeedRenderingSettings();
        globalRenderingSettings.setParent(new DefaultFRS());

        if (full)
View Full Code Here

        SyncOut syncOut = new SyncOut(model);
        if (syncOut.isSyncTime())
        {
            GuidesSet set = model.getGuidesSet();
            ServicePreferences servicePreferences = model.getServicePreferences();

            int feedsCount = set.countFeeds();
            int lastSyncOutFeedsCount = servicePreferences.getLastSyncOutFeedsCount();
            boolean synchronizedBefore = servicePreferences.getLastSyncOutDate() != null;

            boolean doSync = feedsCount > 0 || synchronizedBefore;
            if (doSync && isSuspiciousDifference(feedsCount, lastSyncOutFeedsCount))
            {
                String message;
View Full Code Here

    public void testGetLastSuccessfulSyncDate_NoDate()
    {
        assertNull(DatabaseRecoverer.getLastSuccessfulSyncDate((GlobalModel)null));
        assertNull(DatabaseRecoverer.getLastSuccessfulSyncDate((ServicePreferences)null));

        ServicePreferences prefs = new ServicePreferences();
        prefs.setLastSyncOutDate(null);
        prefs.setLastSyncInDate(null);
        prefs.setEmail(null);
        assertNull("Account info isn't entered.",
            DatabaseRecoverer.getLastSuccessfulSyncDate(prefs));

        prefs.setEmail("1");
        prefs.setPassword("2");
        assertTrue(prefs.isAccountInformationEntered());
        assertNull("Statuses and dates aren't set",
            DatabaseRecoverer.getLastSuccessfulSyncDate(prefs));

        prefs.setLastSyncInStatus(null);
        prefs.setLastSyncOutStatus(null);
        prefs.setLastSyncInDate(new Date());
        prefs.setLastSyncOutDate(new Date());
        assertNull("Success status isn't set.",
            DatabaseRecoverer.getLastSuccessfulSyncDate(prefs));

        prefs.setLastSyncInStatus(ServicePreferences.SYNC_STATUS_FAILURE);
        prefs.setLastSyncOutStatus(ServicePreferences.SYNC_STATUS_FAILURE);
        assertNull("Success statuses aren't set.",
            DatabaseRecoverer.getLastSuccessfulSyncDate(prefs));
    }
View Full Code Here

            DatabaseRecoverer.getLastSuccessfulSyncDate(prefs));
    }

    public void testGetLastSuccessfulSyncDate_NoAccount()
    {
        ServicePreferences prefs = new ServicePreferences();
        prefs.setLastSyncOutDate(new Date());
        prefs.setLastSyncInDate(new Date());
        prefs.setLastSyncInStatus(ServicePreferences.SYNC_STATUS_SUCCESS);
        prefs.setLastSyncOutStatus(ServicePreferences.SYNC_STATUS_SUCCESS);
        prefs.setEmail(null);
        assertNull("Account info isn't entered.",
            DatabaseRecoverer.getLastSuccessfulSyncDate(prefs));
    }
View Full Code Here

    public void testGetLastSuccessfulSyncDate_In()
    {
        Date inDate = new Date(1);
        Date outDate = new Date(2);

        ServicePreferences prefs = new ServicePreferences();
        prefs.setEmail("1");
        prefs.setPassword("2");
        prefs.setLastSyncInDate(inDate);
        prefs.setLastSyncInStatus(ServicePreferences.SYNC_STATUS_SUCCESS);
        assertTrue(inDate == DatabaseRecoverer.getLastSuccessfulSyncDate(prefs));

        prefs.setLastSyncOutDate(outDate);
        assertTrue(inDate == DatabaseRecoverer.getLastSuccessfulSyncDate(prefs));

        prefs.setLastSyncOutDate(null);
        prefs.setLastSyncOutStatus(ServicePreferences.SYNC_STATUS_SUCCESS);
        assertTrue(inDate == DatabaseRecoverer.getLastSuccessfulSyncDate(prefs));
    }
View Full Code Here

TOP

Related Classes of com.salas.bb.service.ServicePreferences

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.