ZEST-107 Fix JSONEntityState clone logic

The cloneStateIfGlobalStateLoaded() method of JSONEntityState is called
before any change is made to the entity state.

This method starts with the following check:

if( isStateNotCloned() )
{
    return;
}
// Do the clone

And the (private) isStateNotCloned() method returns:
status == EntityStatus.LOADED

IOW, the code says that it will clone state if status is loaded,
but does the opposite!

Rewriting the cloneStateIfGlobalStateLoaded() method,
as Tibor suggested, fixes the issue:

if( status != EntityState.LOADED )
{
    return;
}
// Do the clone

I removed the isStateNotCloned() method BTW as it was not used elsewhere
and the code is simpler without it.
1 file changed