Package name.pehl.karaka.server.activity.entity

Examples of name.pehl.karaka.server.activity.entity.Activity


    @Path("/{id}/stop")
    public Response stopActivity(@PathParam("id") String id)
    {
        try
        {
            Activity activity = repository.get(id);
            if (activity.getStatus() == STOPPED)
            {
                return Response.status(NOT_MODIFIED).build();
            }
            else
            {
                activity.stop();
                Activity savedActivity = repository.save(activity);
                name.pehl.karaka.shared.model.Activity clientActivity = activityConverter.toModel(savedActivity);
                return Response.ok(clientActivity).build();
            }
        }
        catch (com.googlecode.objectify.NotFoundException e)
View Full Code Here


    @Path("/{id}")
    public Response deleteActivity(@PathParam("id") String id)
    {
        try
        {
            Activity activity = repository.get(id);
            repository.delete(activity);
            return Response.noContent().build();
        }
        catch (com.googlecode.objectify.NotFoundException e)
        {
View Full Code Here

     * @throws EntityNotFoundException
     * @throws IllegalStateException   if more thaan one activity is {@link Status#RUNNING}.
     */
    public Activity findRunningActivity()
    {
        Activity activity = null;
        List<Activity> activities = query().filter("status =", Status.RUNNING).list();
        if (!activities.isEmpty())
        {
            if (activities.size() > 1)
            {
View Full Code Here

    public Iterable<Activity> start(final Activity activity)
    {
        if (activity != null)
        {
            Set<Activity> saveMe = new HashSet<Activity>();
            Activity runningActivity = findRunningActivity();
            if (runningActivity != null && !runningActivity.equals(activity))
            {
                runningActivity.stop();
                saveMe.add(runningActivity);
            }
            // same day --> resume, init otherwise
            if (activity.isToday())
            {
                activity.resume();
                saveMe.add(activity);
            }
            else
            {
                Activity copy = activity.copy();
                copy.start();
                saveMe.add(copy);
            }
            return saveAll(saveMe);
        }
        return Collections.emptySet();
View Full Code Here

    public Iterable<Activity> tick(final Activity activity)
    {
        if (activity != null)
        {
            Set<Activity> saveMe = new HashSet<Activity>();
            Activity runningActivity = findRunningActivity();
            if (runningActivity != null && !runningActivity.equals(activity))
            {
                runningActivity.stop();
                saveMe.add(runningActivity);
            }
            if (activity.getStatus() == STOPPED)
            {
                activity.start();
View Full Code Here

TOP

Related Classes of name.pehl.karaka.server.activity.entity.Activity

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.