Search in sources :

Example 1 with ServiceLogRecord

use of org.qi4j.logging.log.records.ServiceLogRecord 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();
    }
}
Also used : EntityComposite(org.qi4j.api.entity.EntityComposite) CompositeLogRecord(org.qi4j.logging.log.records.CompositeLogRecord) EntityLogRecord(org.qi4j.logging.log.records.EntityLogRecord) EntityBuilder(org.qi4j.api.entity.EntityBuilder) ServiceLogRecord(org.qi4j.logging.log.records.ServiceLogRecord) ServiceComposite(org.qi4j.api.service.ServiceComposite)

Aggregations

EntityBuilder (org.qi4j.api.entity.EntityBuilder)1 EntityComposite (org.qi4j.api.entity.EntityComposite)1 ServiceComposite (org.qi4j.api.service.ServiceComposite)1 CompositeLogRecord (org.qi4j.logging.log.records.CompositeLogRecord)1 EntityLogRecord (org.qi4j.logging.log.records.EntityLogRecord)1 ServiceLogRecord (org.qi4j.logging.log.records.ServiceLogRecord)1