All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.abiquo.server.core.task.JobDto Maven / Gradle / Ivy

/**
 * Copyright (C) 2008 Abiquo Holdings S.L.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.abiquo.server.core.task;

import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

import com.abiquo.model.transport.SingleResourceTransportDto;

@XmlRootElement(name = "job")
@XmlType(propOrder = {"id", "parentTaskId", "type", "description", "state", "rollbackState",
"creationTimestamp", "timestamp"})
public class JobDto extends SingleResourceTransportDto
{
    private static final long serialVersionUID = 3441968794948596375L;

    private static final String TYPE = "application/vnd.abiquo.job";

    public static final String MEDIA_TYPE = TYPE + "+" + JSON;

    public static final String SHORT_MEDIA_TYPE_JSON = MEDIA_TYPE;

    public static final String SHORT_MEDIA_TYPE_XML = TYPE + "+" + XML;

    public static final String MEDIA_TYPE_XML = TYPE + "+" + XML + VERSION_PARAM + API_VERSION;

    public static final String MEDIA_TYPE_JSON = MEDIA_TYPE + VERSION_PARAM + API_VERSION;

    /** Identifier of the job */
    private String id;

    /** Identifier of the parent task */
    private String parentTaskId;

    /** Type of the job */
    private JobType type;

    /** Description of the job */
    private String description;

    /** Current state of the job */
    private JobState state;

    /** Current rollback state of the job */
    private JobState rollbackState;

    /** Creation timestamp in standard UNIX timestamp */
    private Long creationTimestamp;

    /** Timestamp of the last update on the job in standard UNIX timestamp */
    private Long timestamp;

    public Long getCreationTimestamp()
    {
        return creationTimestamp;
    }

    public Long getTimestamp()
    {
        return timestamp;
    }

    public String getId()
    {
        return id;
    }

    public JobType getType()
    {
        return type;
    }

    public JobState getState()
    {
        return state;
    }

    public String getParentTaskId()
    {
        return parentTaskId;
    }

    public String getDescription()
    {
        return description;
    }

    public JobState getRollbackState()
    {
        return rollbackState;
    }

    public void setCreationTimestamp(final Long creationTimestamp)
    {
        this.creationTimestamp = creationTimestamp;
    }

    public void setDescription(final String description)
    {
        this.description = description;
    }

    public void setId(final String id)
    {
        this.id = id;
    }

    public void setParentTaskId(final String parentTaskId)
    {
        this.parentTaskId = parentTaskId;
    }

    public void setRollbackState(final JobState rollbackState)
    {
        this.rollbackState = rollbackState;
    }

    public void setState(final JobState state)
    {
        this.state = state;
    }

    public void setTimestamp(final Long timestamp)
    {
        this.timestamp = timestamp;
    }

    public void setType(final JobType type)
    {
        this.type = type;
    }

    @Override
    public String getBaseMediaType()
    {
        return MEDIA_TYPE;
    }

    @Override
    public String getMediaType()
    {
        return MEDIA_TYPE_JSON;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy