Package com.sequenceiq.cloudbreak.converter

Source Code of com.sequenceiq.cloudbreak.converter.CloudbreakEventConverter

package com.sequenceiq.cloudbreak.converter;

import java.util.Date;

import org.springframework.stereotype.Component;

import com.sequenceiq.cloudbreak.controller.json.CloudbreakEventsJson;
import com.sequenceiq.cloudbreak.domain.CloudbreakEvent;

@Component
public class CloudbreakEventConverter extends AbstractConverter<CloudbreakEventsJson, CloudbreakEvent> {

    @Override
    public CloudbreakEventsJson convert(CloudbreakEvent entity) {
        CloudbreakEventsJson json = new CloudbreakEventsJson();
        json.setAccount(entity.getAccount());
        json.setBlueprintId(entity.getBlueprintId());
        json.setBlueprintName(entity.getBlueprintName());
        json.setCloud(entity.getCloud());
        json.setEventMessage(entity.getEventMessage());
        json.setEventType(entity.getEventType());
        json.setEventTimestamp(entity.getEventTimestamp().getTime());
        json.setRegion(entity.getRegion());
        json.setVmType(entity.getVmType());
        json.setOwner(entity.getOwner());
        return json;
    }

    @Override
    public CloudbreakEvent convert(CloudbreakEventsJson json) {
        CloudbreakEvent entity = new CloudbreakEvent();
        entity.setAccount(json.getAccount());
        entity.setBlueprintId(json.getBlueprintId());
        entity.setBlueprintName(json.getBlueprintName());
        entity.setCloud(json.getCloud());
        entity.setEventMessage(json.getEventMessage());
        entity.setEventType(json.getEventType());
        entity.setEventTimestamp(new Date(json.getEventTimestamp()));
        entity.setRegion(json.getRegion());
        entity.setVmType(json.getVmType());
        entity.setOwner(json.getOwner());
        return entity;
    }
}
TOP

Related Classes of com.sequenceiq.cloudbreak.converter.CloudbreakEventConverter

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.