Package gettasky.util

Source Code of gettasky.util.Tasks

package gettasky.util;

import gettasky.domain.Task;
import gettasky.storage.StorageFactory;
import gettasky.storage.TaskStorage;

/**
* Utility methods for tasks.
*/
public class Tasks
{
    /**
     * If there are no tasks in the database, populate it with some hard-coded tasks.
     */
    public static void populateIfEmpty()
    {
        TaskStorage taskStorage = StorageFactory.getTaskStorage();
       
        if (taskStorage.isEmpty())
        {
            taskStorage.save(new Task("Buy some milk", Task.Priority.Medium, new String[] {"errand"}));
            taskStorage.save(new Task("Grow a beard", Task.Priority.Low, null));
            taskStorage.save(new Task("Check the post box", Task.Priority.High, new String[] {"errand", "weekly"}));
            taskStorage.save(new Task("Play tennis", Task.Priority.Low, new String[] {"exercise"}, true));
            taskStorage.save(new Task("Buy a cello bow", Task.Priority.Medium, new String[] {"online"}));         
        }
    }
}
TOP

Related Classes of gettasky.util.Tasks

TOP
Copyright © 2018 www.massapi.com. 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.