building or structure, including a building or structure owned or controlled by the commonwealth or a political subdivision thereof, (a) which is existing, or (b) for which an approved building permit was issued before December 1, 2004, shall be protected throughout with an adequate system of automatic sprinklers, in accordance with the state building code.