Check image id format before executing operations

DB2 will raise 'CLI0109E String data right truncation' error if
the given query parameter is longer than the column definition.
As a result, user will run into 500 instead of 404 error though
the malformed id is not existed in DB.
This fix will add image id format checking before executing real
operations.

Closes-Bug: #1263684

Change-Id: I1ab3e38724014032d9290e7dde3f8b6d23b6df6c
Merge "Check image id format before executing operations"