I have an Object which has OWD as private. We provide access to this object records via some sharing setting rule. Now, I want to provide a check box here. Once the check box is checked, all the sharing must be revoked for that records. And it should become private. Visible to Owner, sys admin and as per Role hierarchy.
You can't revoke sharing rule-generated sharing entries on individual records directly; those sharing entries are read-only. If you're using criteria-based sharing rules, you can include a check for this field; criteria-based sharing would then automatically remove entries once the box is checked. You will need this criteria in each sharing rule for this to be effective, of course. The only other means of removing sharing entirely is to change ownership to someone that isn't covered under sharing rules. You could also create Apex Sharing settings, where sharing would be managed by triggers, Visualforce pages, custom settings, etc. This is certainly a lot of effort, but would grant you more control over the sharing of the object.