private Resource toResource(DependencyInfo dependency, String stackName,
                              String version, String dependentService,
                              String dependentComponent, Set<String> requestedIds) {

    Resource resource = new ResourceImpl(Resource.Type.StackServiceComponentDependency);

    setResourceProperty(resource, SERVICE_NAME_ID, dependency.getServiceName(), requestedIds);
    setResourceProperty(resource, COMPONENT_NAME_ID, dependency.getComponentName(), requestedIds);
    setResourceProperty(resource, STACK_NAME_ID, stackName, requestedIds);
    setResourceProperty(resource, STACK_VERSION_ID, version, requestedIds);
    setResourceProperty(resource, DEPENDENT_SERVICE_NAME_ID, dependentService, requestedIds);
    setResourceProperty(resource, DEPENDENT_COMPONENT_NAME_ID, dependentComponent, requestedIds);
    setResourceProperty(resource, SCOPE_ID, dependency.getScope(), requestedIds);
    setResourceProperty(resource, TYPE_ID, dependency.getType(), requestedIds);

    AutoDeployInfo autoDeployInfo = dependency.getAutoDeploy();
    if (autoDeployInfo != null) {
      setResourceProperty(resource, AUTO_DEPLOY_ENABLED_ID,
          autoDeployInfo.isEnabled(), requestedIds);

      if (autoDeployInfo.getCoLocate() != null) {
        setResourceProperty(resource, AUTO_DEPLOY_LOCATION_ID,
            autoDeployInfo.getCoLocate(), requestedIds);
      }
    }
    List<DependencyConditionInfo> dependencyConditionsInfo = dependency.getDependencyConditions();
    if(dependencyConditionsInfo != null){
      setResourceProperty(resource, CONDITIONS_ID,
        dependencyConditionsInfo, requestedIds);
    }
    return resource;
  }
Create a resource instance with dependency information.

@param dependency          dependency name
@param stackName           stack name
@param version             stack version
@param dependentService    dependent service
@param dependentComponent  dependent component
@param requestedIds        requested id's

@return a new Resource instance for the dependency
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackDependencyResourceProvider.java