if (! user.getId().equals( 0L ))
if ( user.getId().equals( 0L ))
    protected void checkManagedState( IObject obj )    {                Details currentDetails = CurrentDetails.createDetails();        Experimenter user = currentDetails.getOwner();        ExperimenterGroup group = currentDetails.getGroup();                if ( obj.getId() == null)            throw new ValidationException(                    "Id required on all detached instances.");        // Throws an exception if does not exist        IObject original = (IObject) hibernateOps.load(                     Utils.trueClass( obj.getClass() ),                     obj.getId() );                if ( obj == original )            return; // Early exit. Obj is in session.                Details oldDetails = original.getDetails();         Details updatedDetails = obj.getDetails();                // This happens if all fields of details are null.        if ( oldDetails == null )         {            if ( obj.getDetails() != null )            {                obj.setDetails( null );                if ( log.isDebugEnabled() )                {                    log.debug("Setting details on "+                            obj+" to null like original");                }            }        }        // Probably common since users don't worry about this information.        else if ( updatedDetails == null )        {            obj.setDetails( new Details( oldDetails ) );            if ( log.isDebugEnabled() )            {                log.debug("Setting details on "+                        obj+" to copy of original details.");            }                    // Now we have to make sure certain things do not happen:        } else {                        if ( ! idEqual(                     oldDetails.getOwner(),                     updatedDetails.getOwner() ))            {                                if (! user.getId().equals( 0L ))                {                    throw new SecurityViolation(String.format(                        "Owner id changed for %s", obj                         ));                }            }            if ( ! idEqual(                     oldDetails.getGroup(),                     updatedDetails.getGroup() ))            {                if (! user.getId().equals( 0L ))                {                    throw new SecurityViolation(String.format(                        "Group id changed for %s", obj                         ));                }            }                        if ( ! idEqual(                     oldDetails.getCreationEvent(),                     updatedDetails.getCreationEvent()))            {                if (! user.getId().equals( 0L ))                {                    throw new SecurityViolation(String.format(                        "Creation event changed for %s", obj                         ));                }            }                    }                if ( obj instanceof IMutable )        {            Integer version = ((IMutable) obj).getVersion();            if ( version == null || version.intValue() < 0 );//                throw new ValidationException(//                        "Version must properly be set on managed objects :\n"+//                        obj.toString()//                        );                //TODO        }                }