@Transactional
  @Override
  public void putInstanceData(String key, String value) {
    checkInstance();

    ViewInstanceEntity updateInstance =
        viewRegistry.getViewInstanceEntity(viewInstanceEntity.getViewName(), viewInstanceEntity.getInstanceName());

    if (updateInstance != null) {
      updateInstance.putInstanceData(key, value);

      try {
        viewRegistry.updateViewInstance(updateInstance);
      } catch (SystemException e) {
        String msg = "Caught exception updating the view instance.";
        LOG.error(msg, e);
        throw new IllegalStateException(msg, e);
      } catch (ValidationException e) {
        throw new IllegalArgumentException(e.getMessage());
      }
    }
  }
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