package org.zstack.header.console;

import org.zstack.header.managementnode.ManagementNodeVO;
import org.zstack.header.vo.ForeignKey;

import javax.persistence.*;
import java.sql.Timestamp;

/**
 * Created by xing5 on 2016/3/15.
 */
@Table
@Entity
public class ConsoleProxyAgentVO {
    @Id
    @Column
    @ForeignKey(parentEntityClass = ManagementNodeVO.class, onDeleteAction = ForeignKey.ReferenceOption.CASCADE)
    private String uuid;

    @Column
    private String description;

    @Column
    private String managementIp;

    @Column
    private String type;

    @Column
    @Enumerated(EnumType.STRING)
    private ConsoleProxyAgentStatus status;

    @Column
    @Enumerated(EnumType.STRING)
    private ConsoleProxyAgentState state;

    @Column
    private Timestamp createDate;

    @Column
    private Timestamp lastOpDate;

    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    public String getDescription() {
        return description;
    }

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

    public String getManagementIp() {
        return managementIp;
    }

    public void setManagementIp(String managementIp) {
        this.managementIp = managementIp;
    }

    public String getType() {
        return type;
    }

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

    public ConsoleProxyAgentStatus getStatus() {
        return status;
    }

    public void setStatus(ConsoleProxyAgentStatus status) {
        this.status = status;
    }

    public ConsoleProxyAgentState getState() {
        return state;
    }

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

    public Timestamp getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Timestamp createDate) {
        this.createDate = createDate;
    }

    public Timestamp getLastOpDate() {
        return lastOpDate;
    }

    public void setLastOpDate(Timestamp lastOpDate) {
        this.lastOpDate = lastOpDate;
    }
}

@@ -874,24 +874,109 @@
 tOpDate;%0D%0A%0D%0A
+    @PreUpdate%0D%0A    private void preUpdate() %7B%0D%0A        lastOpDate = null;%0D%0A    %7D%0D%0A%0D%0A
     public S

add PreUpdate callback to ConsoleProxyAgentVO