@Override
  public BlueprintEntity toEntity() {

    BlueprintEntity entity = new BlueprintEntity();
    entity.setBlueprintName(name);
    if (security != null) {
      if (security.getType() != null) {
        entity.setSecurityType(security.getType());
      }
      if (security.getDescriptorReference() != null) {
        entity.setSecurityDescriptorReference(security.getDescriptorReference());
      }
    }

    //todo: not using stackDAO so stackEntity.id is not set
    //todo: this is now being set in BlueprintDAO
    StackEntity stackEntity = new StackEntity();
    stackEntity.setStackName(stack.getName());
    stackEntity.setStackVersion(stack.getVersion());
    entity.setStack(stackEntity);

    createHostGroupEntities(entity);
    createBlueprintConfigEntities(entity);
    createBlueprintSettingEntities(entity);

    return entity;
  }
Get host groups which contain a component for the given service.

@param service   service name

@return collection of host groups which contain a component of the specified service
ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImpl.java