use of org.qi4j.api.service.ServiceComposite 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();
}
}
use of org.qi4j.api.service.ServiceComposite in project qi4j-sdk by Qi4j.
the class DebuggingServiceMixin method createDebugRecord.
private void createDebugRecord(UnitOfWork uow, Composite composite, String message, List<Serializable> params) {
if (composite instanceof ServiceComposite) {
EntityBuilder<ServiceDebugRecordEntity> builder = uow.newEntityBuilder(ServiceDebugRecordEntity.class);
ServiceDebugRecordEntity state = builder.instance();
setStandardStuff(composite, message, state, params);
state.source().set(((ServiceComposite) composite).identity().get());
ServiceDebugRecordEntity slr = builder.newInstance();
} else if (composite instanceof EntityComposite) {
EntityBuilder<EntityDebugRecordEntity> builder = uow.newEntityBuilder(EntityDebugRecordEntity.class);
EntityDebugRecordEntity state = builder.instance();
setStandardStuff(composite, message, state, params);
state.source().set((EntityComposite) composite);
EntityDebugRecordEntity elr = builder.newInstance();
} else {
EntityBuilder<CompositeDebugRecordEntity> builder = uow.newEntityBuilder(CompositeDebugRecordEntity.class);
CompositeDebugRecordEntity state = builder.instance();
setStandardStuff(composite, message, state, params);
state.source().set(composite);
CompositeDebugRecordEntity clr = builder.newInstance();
}
}
use of org.qi4j.api.service.ServiceComposite in project qi4j-sdk by Qi4j.
the class LoggingServiceMixin method createLogRecord.
private void createLogRecord(UnitOfWork uow, LogType type, Composite composite, String category, String message, List<Serializable> params) {
if (composite instanceof ServiceComposite) {
EntityBuilder<ServiceLogRecord> builder = uow.newEntityBuilder(ServiceLogRecord.class);
ServiceLogRecord state = builder.instance();
setStandardStuff(type, composite, category, message, state, params);
state.source().set(((ServiceComposite) composite).identity().get());
ServiceLogRecord slr = builder.newInstance();
} else if (composite instanceof EntityComposite) {
EntityBuilder<EntityLogRecord> builder = uow.newEntityBuilder(EntityLogRecord.class);
EntityLogRecord state = builder.instance();
setStandardStuff(type, composite, category, message, state, params);
state.source().set((EntityComposite) composite);
EntityLogRecord elr = builder.newInstance();
} else {
EntityBuilder<CompositeLogRecord> builder = uow.newEntityBuilder(CompositeLogRecord.class);
CompositeLogRecord state = builder.instance();
setStandardStuff(type, composite, category, message, state, params);
state.source().set(composite);
CompositeLogRecord clr = builder.newInstance();
}
}
Aggregations