|
| 1 | +/** |
| 2 | + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. |
| 3 | + * |
| 4 | + * This software is licensed under the GNU General Public License v3 or later. |
| 5 | + * |
| 6 | + * It is free software: you can redistribute it and/or modify |
| 7 | + * it under the terms of the GNU General Public License as published by |
| 8 | + * the Free Software Foundation, either version 3 of the License, or any later version. |
| 9 | + * This program is distributed in the hope that it will be useful, |
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | + * GNU General Public License for more details. |
| 13 | + * |
| 14 | + * You should have received a copy of the GNU General Public License |
| 15 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | + * |
| 17 | + */ |
| 18 | +package com.cloud.vm; |
| 19 | + |
| 20 | +import java.util.Date; |
| 21 | + |
| 22 | +import javax.persistence.Column; |
| 23 | +import javax.persistence.Entity; |
| 24 | +import javax.persistence.Id; |
| 25 | +import javax.persistence.Table; |
| 26 | +import javax.persistence.Temporal; |
| 27 | +import javax.persistence.TemporalType; |
| 28 | + |
| 29 | +import com.cloud.utils.db.GenericDao; |
| 30 | + |
| 31 | +@Entity |
| 32 | +@Table(name="op_it_work") |
| 33 | +public class ItWorkVO { |
| 34 | + enum Type { |
| 35 | + Start; |
| 36 | + } |
| 37 | + |
| 38 | + enum State { |
| 39 | + Working, |
| 40 | + Cancelling, |
| 41 | + } |
| 42 | + |
| 43 | + @Id |
| 44 | + @Column(name="id") |
| 45 | + String id; |
| 46 | + |
| 47 | + @Column(name=GenericDao.CREATED_COLUMN) |
| 48 | + Date created; |
| 49 | + |
| 50 | + @Column(name="mgmt_server_id") |
| 51 | + long managementServerId; |
| 52 | + |
| 53 | + @Column(name="type") |
| 54 | + Type type; |
| 55 | + |
| 56 | + @Column(name="thread") |
| 57 | + String threadName; |
| 58 | + |
| 59 | + @Column(name="state") |
| 60 | + State state; |
| 61 | + |
| 62 | + @Column(name="cancel_taken") |
| 63 | + @Temporal(value=TemporalType.TIMESTAMP) |
| 64 | + Date taken; |
| 65 | + |
| 66 | + protected ItWorkVO() { |
| 67 | + } |
| 68 | + |
| 69 | + protected ItWorkVO(String id, long managementServerId, Type type) { |
| 70 | + this.id = id; |
| 71 | + this.managementServerId = managementServerId; |
| 72 | + this.type = type; |
| 73 | + this.threadName = Thread.currentThread().getName(); |
| 74 | + } |
| 75 | + |
| 76 | + public String getId() { |
| 77 | + return id; |
| 78 | + } |
| 79 | + |
| 80 | + public Date getCreated() { |
| 81 | + return created; |
| 82 | + } |
| 83 | + |
| 84 | + public long getManagementServerId() { |
| 85 | + return managementServerId; |
| 86 | + } |
| 87 | + |
| 88 | + public Type getType() { |
| 89 | + return type; |
| 90 | + } |
| 91 | + |
| 92 | + public String getThreadName() { |
| 93 | + return threadName; |
| 94 | + } |
| 95 | + |
| 96 | + public State getState() { |
| 97 | + return state; |
| 98 | + } |
| 99 | + |
| 100 | + public void setState(State state) { |
| 101 | + this.state = state; |
| 102 | + } |
| 103 | + |
| 104 | + public Date getTaken() { |
| 105 | + return taken; |
| 106 | + } |
| 107 | +} |
0 commit comments