Adding api to get latest partition date for cube

Check should be done before the cast. Otherwise you get ClassCastException for cast