There are two lessons in here for each of us:
1. It's not about you - too often we interpret commercial decisions from a personal perspective. We project our own rationale on the reasons for a decision, and believe that the ramifications for us were intended. For instance, Jake didn't get a cookie and that must be because I don't want to give him what he wants. In the workplace, decisions are rarely made which deliberately cause harm or discomfort. Sometimes the implications simply weren't envisaged or there was a greater good in taking a particular course of action. We all get our toes trodden on sometimes - it's seldom deliberate. When this happens to you, take a moment to get past your emotional reaction and to put yourself in the decision-maker's shoes. Why might they have done this? Is it possible there is something at play you are not aware of? "Seek first to understand, then be understood," as Covey would say.
2. No-one can make you feel happy or sad - or anything in between. Only you have control over your emotions. That's right, you can select them, just like you might select a gear in a car. It's not easy mind you. In fact, some situations are so emotionally charged it's very difficult to exercise this control. With practice though you can choose the right emotional state to deal with a situation. For instance, some people get into a decline when the weather is bad. This is odd since they have no control over the weather and it really doesn't mean it. So instead of bringing your own personal raincloud into the office, you could opt to be cheerful. You could decide not to let the weather dictate what kind of day you want to have. At the other end of the spectrum, psychiatrist and Holocaust survivor, Viktor Frankl calls this the last of human freedoms - "Between stimulus and response there is a space. In that space is our power to choose our response. In our response lies our growth and our freedom."
I guess a third lesson might be that to keep a child happy, you just need a large supply of cookies. But that's probably not a great solution.