package org.zstack.header.host;

import org.zstack.header.message.NeedReplyMessage;

/**
 * Created by david on 9/12/16.
 */
public class AddHostMsg extends NeedReplyMessage implements AddHostMessage {
    private String name;
    private String description;
    private String managementIp;
    private String clusterUuid;
    private String accountUuid;
    private String resourceUuid;

    public AddHostMsg() {
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    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 getClusterUuid() {
        return clusterUuid;
    }

    public void setClusterUuid(String clusterUuid) {
        this.clusterUuid = clusterUuid;
    }

    public String getAccountUuid() {
        return accountUuid;
    }

    public void setAccountUuid(String accountUuid) {
        this.accountUuid = accountUuid;
    }

    public String getResourceUuid() {
        return resourceUuid;
    }

    public void setResourceUuid(String resourceUuid) {
        this.resourceUuid = resourceUuid;
    }

    public static AddHostMsg valueOf(final APIAddHostMsg msg) {
        AddHostMsg amsg = new AddHostMsg();

        amsg.setAccountUuid(msg.getSession().getAccountUuid());
        amsg.setName(msg.getName());
        amsg.setClusterUuid(msg.getClusterUuid());
        amsg.setDescription(msg.getDescription());
        amsg.setManagementIp(msg.getManagementIp());
        amsg.setResourceUuid(msg.getResourceUuid());
        return amsg;
    }

    public APIAddHostMsg toAPIMsg() {
        final String name = this.getName();
        APIAddHostMsg msg = new APIAddHostMsg() {
            @Override
            public String getName() {
                return name;
            }
        };

        msg.setName(name);
        msg.setClusterUuid(msg.getClusterUuid());
        msg.setDescription(msg.getDescription());
        msg.setManagementIp(msg.getManagementIp());
        msg.setResourceUuid(msg.getResourceUuid());
        return msg;
    }
}

@@ -1866,512 +1866,7 @@
    %7D
-%0A%0A    public APIAddHostMsg toAPIMsg() %7B%0A        final String name = this.getName();%0A        APIAddHostMsg msg = new APIAddHostMsg() %7B%0A            @Override%0A            public String getName() %7B%0A                return name;%0A            %7D%0A        %7D;%0A%0A        msg.setName(name);%0A        msg.setClusterUuid(msg.getClusterUuid());%0A        msg.setDescription(msg.getDescription());%0A        msg.setManagementIp(msg.getManagementIp());%0A        msg.setResourceUuid(msg.getResourceUuid());%0A        return msg;%0A    %7D
 %0A%7D%0A

Remove unused code