Search in sources :

Example 1 with StructuredEventEntity

use of com.sequenceiq.cloudbreak.domain.StructuredEventEntity in project cloudbreak by hortonworks.

the class StructuredEventToStructuredEventEntityConverter method convert.

@Override
public StructuredEventEntity convert(StructuredEvent source) {
    try {
        OperationDetails operationDetails = source.getOperation();
        StructuredEventEntity structuredEventEntity = new StructuredEventEntity();
        structuredEventEntity.setEventType(operationDetails.getEventType());
        structuredEventEntity.setResourceType(operationDetails.getResourceType());
        structuredEventEntity.setResourceId(operationDetails.getResourceId());
        structuredEventEntity.setTimestamp(operationDetails.getTimestamp());
        structuredEventEntity.setAccount(operationDetails.getAccount());
        structuredEventEntity.setUserId(operationDetails.getUserId());
        structuredEventEntity.setStructuredEventJson(new Json(source));
        return structuredEventEntity;
    } catch (JsonProcessingException e) {
        // TODO What should we do in case of json processing error
        return null;
    }
}
Also used : OperationDetails(com.sequenceiq.cloudbreak.structuredevent.event.OperationDetails) StructuredEventEntity(com.sequenceiq.cloudbreak.domain.StructuredEventEntity) Json(com.sequenceiq.cloudbreak.domain.json.Json) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException)

Example 2 with StructuredEventEntity

use of com.sequenceiq.cloudbreak.domain.StructuredEventEntity in project cloudbreak by hortonworks.

the class StructuredEventDBService method storeStructuredEvent.

@Override
public void storeStructuredEvent(StructuredEvent structuredEvent) {
    StructuredEventEntity structuredEventEntityEntity = conversionService.convert(structuredEvent, StructuredEventEntity.class);
    structuredEventRepository.save(structuredEventEntityEntity);
}
Also used : StructuredEventEntity(com.sequenceiq.cloudbreak.domain.StructuredEventEntity)

Aggregations

StructuredEventEntity (com.sequenceiq.cloudbreak.domain.StructuredEventEntity)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 Json (com.sequenceiq.cloudbreak.domain.json.Json)1 OperationDetails (com.sequenceiq.cloudbreak.structuredevent.event.OperationDetails)1