com.abiquo.server.core.task.JobExtendedDto 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;
@XmlRootElement(name = "jobextended")
@XmlType(propOrder = {"progress", "errorCause", "guestInitialPassword"})
public class JobExtendedDto extends JobDto
{
private static final long serialVersionUID = 4902190084295941044L;
private static final String TYPE = "application/vnd.abiquo.jobextended";
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;
/** Include the error description for a FAILED job */
private String errorCause;
/** Include the progress for a STARTED job */
private Integer progress;
/**
* Password generated for the guest during the deploy process.
*
* This attribute will only appear if the deploy process generated a random password for the
* guest and the user that requests the job is the owner of the virtual machine
*/
private String guestInitialPassword;
public JobExtendedDto()
{
}
public JobExtendedDto(final JobDto job)
{
setId(job.getId());
setParentTaskId(job.getParentTaskId());
setType(job.getType());
setDescription(job.getDescription());
setState(job.getState());
setRollbackState(job.getRollbackState());
setTimestamp(job.getTimestamp());
}
public String getErrorCause()
{
return errorCause;
}
public Integer getProgress()
{
return progress;
}
public void setErrorCause(final String errorCause)
{
this.errorCause = errorCause;
}
public void setProgress(final Integer progress)
{
this.progress = progress;
}
public String getGuestInitialPassword()
{
return guestInitialPassword;
}
public void setGuestInitialPassword(final String guestInitialPassword)
{
this.guestInitialPassword = guestInitialPassword;
}
@Override
public String getBaseMediaType()
{
return MEDIA_TYPE;
}
@Override
public String getMediaType()
{
return MEDIA_TYPE_JSON;
}
}