use of org.qi4j.logging.trace.records.ServiceTraceRecordEntity in project qi4j-sdk by Qi4j.
the class TraceServiceMixin method createTraceRecord.
private void createTraceRecord(UnitOfWork uow, Class compositeType, Composite object, Method method, Object[] args, long entryTime, long durationNano, Throwable exception) {
if (object instanceof EntityComposite) {
EntityComposite entity = (EntityComposite) object;
String identity = entity.identity().get();
EntityComposite source = (EntityComposite) uow.get((Class<?>) first(Qi4j.FUNCTION_DESCRIPTOR_FOR.map(entity).types()), identity);
EntityBuilder<EntityTraceRecordEntity> builder = uow.newEntityBuilder(EntityTraceRecordEntity.class);
EntityTraceRecordEntity state = builder.instance();
setStandardStuff(compositeType, method, args, entryTime, durationNano, state, exception);
state.source().set(source);
// Record is created.
EntityTraceRecordEntity etr = builder.newInstance();
} else if (object instanceof ServiceComposite) {
ServiceComposite service = (ServiceComposite) object;
EntityBuilder<ServiceTraceRecordEntity> builder = uow.newEntityBuilder(ServiceTraceRecordEntity.class);
ServiceTraceRecordEntity state = builder.instance();
setStandardStuff(compositeType, method, args, entryTime, durationNano, state, exception);
state.source().set(service.toString());
// Record is created.
ServiceTraceRecordEntity str = builder.newInstance();
} else {
EntityBuilder<CompositeTraceRecordEntity> builder = uow.newEntityBuilder(CompositeTraceRecordEntity.class);
CompositeTraceRecordEntity state = builder.instance();
state.source().set(object);
setStandardStuff(compositeType, method, args, entryTime, durationNano, state, exception);
// Record is created.
CompositeTraceRecordEntity ctr = builder.newInstance();
}
}
Aggregations