class EmrClusterDefinitionDaoHelper {

    public EmrClusterDefinitionEntity getEmrClusterDefinitionEntity(EmrClusterDefinitionKey emrClusterDefinitionKey) throws ObjectNotFoundException
    {
        EmrClusterDefinitionEntity emrClusterDefinitionEntity = null;

        // Try to retrieve the relative namespace entity.
        NamespaceEntity namespaceEntity = namespaceDao.getNamespaceByCd(emrClusterDefinitionKey.getNamespace());

        // If namespace entity exists, try to retrieve EMR cluster definition entity by namespace entity and EMR cluster definition name.
        if (namespaceEntity != null)
        {
            emrClusterDefinitionEntity =
                emrClusterDefinitionDao.getEmrClusterDefinitionByNamespaceAndName(namespaceEntity, emrClusterDefinitionKey.getEmrClusterDefinitionName());
        }

        // Throw an exception if EMR cluster definition entity does not exist.
        if (emrClusterDefinitionEntity == null)
        {
            throw new ObjectNotFoundException(String
                .format("EMR cluster definition with name \"%s\" doesn't exist for namespace \"%s\".", emrClusterDefinitionKey.getEmrClusterDefinitionName(),
                    emrClusterDefinitionKey.getNamespace()));
        }

        return emrClusterDefinitionEntity;
    }

}