made Resource::stateId() protected and improved some doc comments