Package org.qi4j.spi.entity

Examples of org.qi4j.spi.entity.EntityState


    public void updateResponse( Response response )
    {
        if( entity != null )
        {
            EntityState state = spi.entityStateOf( entity );
            Date lastModified = new Date( state.lastModified() );
            Tag tag = new Tag( state.identity().identity() + "/" + state.version() );
            response.getEntity().setModificationDate( lastModified );
            response.getEntity().setTag( tag );
        }
    }
View Full Code Here


    {
        // Check command rules
        Date modificationDate = request.getConditions().getUnmodifiedSince();
        if( modificationDate != null )
        {
            EntityState state = spi.entityStateOf( entity );
            Date lastModified = new Date( ( state.lastModified() / 1000 ) * 1000 ); // Cut off milliseconds
            if( lastModified.after( modificationDate ) )
            {
                throw new ResourceException( Status.CLIENT_ERROR_CONFLICT );
            }
        }

        // Check query rules
        modificationDate = request.getConditions().getModifiedSince();
        if( modificationDate != null )
        {
            EntityState state = spi.entityStateOf( entity );
            Date lastModified = new Date( ( state.lastModified() / 1000 ) * 1000 ); // Cut off milliseconds
            if( !lastModified.after( modificationDate ) )
            {
                throw new ResourceException( Status.REDIRECTION_NOT_MODIFIED );
            }
        }
View Full Code Here

TOP

Related Classes of org.qi4j.spi.entity.EntityState

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.