Package org.qi4j.library.eventsourcing.domain.api

Examples of org.qi4j.library.eventsourcing.domain.api.DomainEventValue


    public Object invoke( Object proxy, Method method, Object[] args ) throws Throwable
    {
        if (DomainEvents.currentEvent() == null)
        {
            // Create eventValue
            DomainEventValue eventValue = domainEventFactory.createEvent( entity, method.getName(), args );
            DomainEvents.setCurrentEvent( eventValue );
            try
            {
                return next.invoke( proxy, method, args );
            } finally
View Full Code Here


    @Override
    public DomainEventValue createEvent( EntityComposite entity, String name, Object[] args )
    {
        final UnitOfWork unitOfWork = uowf.currentUnitOfWork();

        DomainEventValue eventValue = next.createEvent( api.dereference( entity ), name, args );

        // Add eventValue to list in UoW
        UnitOfWorkEvents events = unitOfWork.metaInfo(UnitOfWorkEvents.class );
        if (events == null)
        {
View Full Code Here

        @Override
        public DomainEventValue createEvent( EntityComposite entity, String name, Object[] args )
        {
            ValueBuilder<DomainEventValue> builder = vbf.newValueBuilder( DomainEventValue.class );

            DomainEventValue prototype = builder.prototype();
            prototype.name().set( name );
            prototype.entityType().set( first(Qi4j.FUNCTION_DESCRIPTOR_FOR.map( entity ).types()).getName() );
            prototype.entityId().set( entity.identity().get() );

            // JSON-ify parameters
            JSONStringer json = new JSONStringer();
            try
            {
                JSONWriter params = json.object();
                for (int i = 0; i < args.length; i++)
                {
                    params.key( "param" + i );
                    if (args[i] == null)
                        params.value( JSONObject.NULL );
                    else
                        params.value( args[i] );
                }
                json.endObject();
            } catch (JSONException e)
            {
                throw new IllegalArgumentException( "Could not create eventValue", e );
            }

            prototype.parameters().set( json.toString() );

            DomainEventValue eventValue = builder.newInstance();

            return eventValue;
        }
View Full Code Here

        @Override
        public void playTransaction( UnitOfWorkDomainEventsValue unitOfWorkDomainValue )
                throws EventReplayException
        {
            UnitOfWork uow = uowf.newUnitOfWork( UsecaseBuilder.newUsecase( "Event replay" ) );
            DomainEventValue currentEventValue = null;
            try
            {
                for (DomainEventValue domainEventValue : unitOfWorkDomainValue.events().get())
                {
                    currentEventValue = domainEventValue;
View Full Code Here

TOP

Related Classes of org.qi4j.library.eventsourcing.domain.api.DomainEventValue

Copyright © 2018 www.massapicom. 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.