'In the modern world the stupid are cocksure while the intelligent are full of doubt' - Bertrand Russell.
When the attack happened they were nowhere near Gaza it seems. Why not I wonder isn't Hamas the single worst sworn enemy of Israel? Where were they instead and why? Accountability will follow, I hope.
As for knowing about a plan - its unclear still what was known so we're all speculating here. Just because the enemy is training or even publicly saying it has a plan - doesn't immediately mean its going to attack or has the capability. Hamas was quite smart in simulating this attack many times throughout the years to make sure Israel doesn't take it seriously. A lot of faith, way too much, was put on technology and the border barrier and both turned out to be completely useless.
Obviously the Israeli intelligence completely screwed up in interpreting the intelligence that was available. Hence why I said its inaccurate to say "Israel knew", this issue is much more complex for such simplistic remarks.