Package org.jboss.seam.rest.example.tasks.entity

Examples of org.jboss.seam.rest.example.tasks.entity.Category


        return taskCollectionSubresource;
    }

    @PUT
    public void putCategory(@PathParam("category") String categoryName) {
        Category category = new Category(categoryName);
        em.persist(category);
    }
View Full Code Here


     */
    @POST
    @Path("/task")
    public Response createTask(JaxbTaskWrapper incommingTask, @PathParam("category") String categoryName,
            @Context UriInfo uriInfo) {
        Category category = loadCategory(categoryName);

        Task task = new Task();
        task.setCategory(category);
        task.setCreated(new Date());
        task.setUpdated(task.getCreated()); // set update date to creation date
View Full Code Here

    @POST
    @Path("/move")
    public void move(@PathParam("taskId") long taskId, @QueryParam("category") String newCategoryName, @Context UriInfo uriInfo) {
        Task task = loadTask(taskId, uriInfo);
        Category newCategory = (Category) em.createNamedQuery("categoryByName").setParameter("category", newCategoryName)
                .getSingleResult();
        Category oldCategory = task.getCategory();

        oldCategory.getTasks().remove(task);
        newCategory.getTasks().add(task);
        task.setCategory(newCategory);
        task.setUpdated(new Date());
    }
View Full Code Here

    public void feedDatabase() {
        log.info("Running database import.");

        // School
        Category school = createCategory("School");
        addTask(school, "Build the Turing machine");
        addTask(school, "Finish the RESTEasy-Seam integration example");
        addTask(school, "Learn new vocab for English conversations");
        addTask(school, "Prepare a presentation for webdesign seminar");
        addTask(school, "Print study materials", true);
        em.persist(school);

        // Work
        Category work = createCategory("Work");
        addTask(work, "Pick up meal tickets");

        // Buy
        em.persist(work);
        Category buy = createCategory("Buy");
        addTask(buy, "Buy milk");
        addTask(buy, "Buy an infinite tape");
        addTask(buy, "Order books");
        addTask(buy, "Buy a turtle", true);
        addTask(buy, "Buy new shoes", true);
        addTask(buy, "Order camera", true);
        em.persist(buy);

        // Other stuff
        Category other_stuff = createCategory("Other Stuff");
        addTask(other_stuff, "Learn to fly", true);
        addTask(other_stuff, "Visit grandma");
        addTask(other_stuff, "Extend passport");
        addTask(other_stuff, "Get a haircut");
        addTask(other_stuff, "Pay bills", true);
View Full Code Here

        addTask(other_stuff, "Tidy up", true);
        em.persist(other_stuff);
    }

    private Category createCategory(String name) {
        Category c = new Category(name);
        c.setTasks(new LinkedList<Task>());
        return c;
    }
View Full Code Here

TOP

Related Classes of org.jboss.seam.rest.example.tasks.entity.Category

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.