function listAllDomains (request, response, appData)
{
    var dataObjArr = [], i, identityDomains, identityDomainsLen, apiDomains,
        apiDomainsLen, domainList = [], tempDomainMap = {},
        tempDomainIdToIdxMap = {};
    dataObjArr.push({type : identity, request: request, appData: appData});
    dataObjArr.push({type : apiServer, request: request, appData: appData});
    async.map(dataObjArr, getAllDomainAsync, function(error, domainData) {
        if (domainData[0].error && domainData[1].error) {
            commonUtils.handleJSONResponse(domainData[0].error, response, null);
            return;
        }
        identityDomains = commonUtils.getValueByJsonPath(domainData,
                "0;data", [], false);
        identityDomainsLen = identityDomains.length;
        apiDomains = commonUtils.getValueByJsonPath(domainData,
                "1;data;domains", [], false);
        apiDomainsLen = apiDomains.length;
        var allDomains = [];
        for (i = 0; i < apiDomainsLen; i++) {
            var apiDomainFQN = commonUtils.getValueByJsonPath(apiDomains[i],
                    "fq_name", [], false).join(":");
            var apiDomainId =
                commonUtils.getValueByJsonPath(apiDomains[i],
                                               "uuid", null);
            apiDomains[i]["display_name"] = apiDomainFQN;
            allDomains.push(apiDomains[i]);
            tempDomainIdToIdxMap[apiDomainId] = allDomains.length - 1;
            tempDomainMap[apiDomainFQN] = apiDomains[i];
        }

        for (i = 0; i < identityDomainsLen; i++) {
            var identityDomainFQN = commonUtils.getValueByJsonPath(
                    identityDomains[i], "fq_name", [], false).join(":");
            var identityDomainId =
                commonUtils.getValueByJsonPath(identityDomains[i], "uuid", null);
            var idx = tempDomainIdToIdxMap[identityDomainId];
            if (null != idx) {
                /* Exists in API Server, so take display_name from keystone */
                allDomains[idx]["display_name"] = identityDomainFQN;
            } else {
                if (null == tempDomainMap[identityDomainFQN]) {
                    identityDomains[i]["display_name"] = identityDomainFQN;
                    allDomains.push(identityDomains[i]);
                }
            }
        }

        commonUtils.handleJSONResponse(null, response,
                {domains: allDomains});
    });
}
/**
 * @listAllDomains
 * public function
 * 1. URL /api/tenants/config/all-domains
 * 2. Gets list of domains for the user from identity and api server
 */
@listAllDomains
public function
1. URL /api/tenants/config/all-domains
2. Gets list of domains for the user from identity and api server
@listAllDomains public function 1 . URL / api / tenants / config / all - domains 2 . Gets list of domains for the user from identity and api server
function listAllDomains (request, response, appData)
{
    var dataObjArr = [], i, identityDomains, identityDomainsLen, apiDomains,
        apiDomainsLen, domainList = [], tempDomainMap = {},
        tempDomainIdToIdxMap = {};
    dataObjArr.push({type : identity, request: request, appData: appData});
    dataObjArr.push({type : apiServer, request: request, appData: appData});
    async.map(dataObjArr, getAllDomainAsync, function(error, domainData) {
        if (domainData[0].error && domainData[1].error) {
            commonUtils.handleJSONResponse(domainData[0].error, response, null);
            return;
        }
        identityDomains = commonUtils.getValueByJsonPath(domainData,
                "0;data", [], false);
        identityDomainsLen = identityDomains.length;
        apiDomains = commonUtils.getValueByJsonPath(domainData,
                "1;data;domains", [], false);
        apiDomainsLen = apiDomains.length;
        var allDomains = [];
        for (i = 0; i < apiDomainsLen; i++) {
            var apiDomainFQN = commonUtils.getValueByJsonPath(apiDomains[i],
                    "fq_name", [], false).join(":");
            var apiDomainId =
                commonUtils.getValueByJsonPath(apiDomains[i],
                                               "uuid", null);
            apiDomains[i]["display_name"] = apiDomainFQN;
            allDomains.push(apiDomains[i]);
            tempDomainIdToIdxMap[apiDomainId] = allDomains.length - 1;
            tempDomainMap[apiDomainFQN] = apiDomains[i];
        }
        for (i = 0; i < identityDomainsLen; i++) {
            var identityDomainFQN = commonUtils.getValueByJsonPath(
                    identityDomains[i], "fq_name", [], false).join(":");
            var identityDomainId =
                commonUtils.getValueByJsonPath(identityDomains[i], "uuid", null);
            var idx = tempDomainIdToIdxMap[identityDomainId];
            if (null != idx) {
                allDomains[idx]["display_name"] = identityDomainFQN;
            } else {
                if (null == tempDomainMap[identityDomainFQN]) {
                    identityDomains[i]["display_name"] = identityDomainFQN;
                    allDomains.push(identityDomains[i]);
                }
            }
        }
        commonUtils.handleJSONResponse(null, response,
                {domains: allDomains});
    });
}
function listAllDomains ( request , response , appData ) { var dataObjArr = [ ] , i , identityDomains , identityDomainsLen , apiDomains , apiDomainsLen , domainList = [ ] , tempDomainMap = { } , tempDomainIdToIdxMap = { } ; dataObjArr . push ( { type : identity , request : request , appData : appData } ) ; dataObjArr . push ( { type : apiServer , request : request , appData : appData } ) ; async . map ( dataObjArr , getAllDomainAsync , function ( error , domainData ) { if ( domainData [ 0 ] . error && domainData [ 1 ] . error ) { commonUtils . handleJSONResponse ( domainData [ 0 ] . error , response , null ) ; return ; } identityDomains = commonUtils . getValueByJsonPath ( domainData , "0;data" , [ ] , false ) ; identityDomainsLen = identityDomains . length ; apiDomains = commonUtils . getValueByJsonPath ( domainData , "1;data;domains" , [ ] , false ) ; apiDomainsLen = apiDomains . length ; var allDomains = [ ] ; for ( i = 0 ; i < apiDomainsLen ; i ++ ) { var apiDomainFQN = commonUtils . getValueByJsonPath ( apiDomains [ i ] , "fq_name" , [ ] , false ) . join ( ":" ) ; var apiDomainId = commonUtils . getValueByJsonPath ( apiDomains [ i ] , "uuid" , null ) ; apiDomains [ i ] [ "display_name" ] = apiDomainFQN ; allDomains . push ( apiDomains [ i ] ) ; tempDomainIdToIdxMap [ apiDomainId ] = allDomains . length - 1 ; tempDomainMap [ apiDomainFQN ] = apiDomains [ i ] ; } for ( i = 0 ; i < identityDomainsLen ; i ++ ) { var identityDomainFQN = commonUtils . getValueByJsonPath ( identityDomains [ i ] , "fq_name" , [ ] , false ) . join ( ":" ) ; var identityDomainId = commonUtils . getValueByJsonPath ( identityDomains [ i ] , "uuid" , null ) ; var idx = tempDomainIdToIdxMap [ identityDomainId ] ; if ( null != idx ) { allDomains [ idx ] [ "display_name" ] = identityDomainFQN ; } else { if ( null == tempDomainMap [ identityDomainFQN ] ) { identityDomains [ i ] [ "display_name" ] = identityDomainFQN ; allDomains . push ( identityDomains [ i ] ) ; } } } commonUtils . handleJSONResponse ( null , response , { domains : allDomains } ) ; } ) ; }
@listAllDomains
 public function
 1.
@listAllDomains public function 1 .
/* Exists in API Server, so take display_name from keystone */