private void checkInstance() {
    if (viewInstanceEntity == null) {
      throw new IllegalStateException("No instance is associated with the context.");
    }
  }
Construct a view context from the given view entity.

@param viewEntity    the view entity
@param viewRegistry  the view registry
ambari-server/src/main/java/org/apache/ambari/server/view/ViewContextImpl.java