private TopologyRequestEntity toEntity(BaseClusterRequest request) {
    TopologyRequestEntity entity = new TopologyRequestEntity();

    //todo: this isn't set for a scaling operation because we had intended to allow multiple
    //todo: bp's to be used to scale a cluster although this isn't currently supported by
    //todo: new topology infrastructure
    entity.setAction(request.getType().name());
    if (request.getBlueprint() != null) {
      entity.setBlueprintName(request.getBlueprint().getName());
    }

    entity.setClusterAttributes(attributesAsString(request.getConfiguration().getAttributes()));
    entity.setClusterId(request.getClusterId());
    entity.setClusterProperties(propertiesAsString(request.getConfiguration().getProperties()));
    entity.setDescription(request.getDescription());

    if (request.getProvisionAction() != null) {
      entity.setProvisionAction(request.getProvisionAction());
    }

    // host groups
    Collection<TopologyHostGroupEntity> hostGroupEntities = new ArrayList<>();
    for (HostGroupInfo groupInfo : request.getHostGroupInfo().values())  {
      hostGroupEntities.add(toEntity(groupInfo, entity));
    }
    entity.setTopologyHostGroupEntities(hostGroupEntities);

    return entity;
  }
Implementation which uses Ambari Database DAO and Entity objects for persistence
of topology related information.
ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedStateImpl.java