function listAllProjects (request, response, appData)
{
    var dataObjArr = [], i, identityProj, identityProjLen, apiProj,
        apiProjLen, projList = [], tempProjMap = {},
        parentId = commonUtils.getValueByJsonPath(request,
                "query;domainId", null, false),
        tempProjIdToIdxMap = {};
    var tempProjFqnToIDMap = {};
    dataObjArr.push({type : identity, request: request,
        appData: appData, parentId: parentId});
    dataObjArr.push({type : apiServer, request: request,
        appData: appData, parentId: parentId});
    async.map(dataObjArr, getAllProjectAsync, function(error, projData) {
        if (projData[0].error && projData[1].error) {
            commonUtils.handleJSONResponse(projData[0].error, response, null);
            return;
        }
        identityProj = commonUtils.getValueByJsonPath(projData,
                "0;data;projects", [], false);
        identityProjLen = identityProj.length;
        apiProj = commonUtils.getValueByJsonPath(projData,
                "1;data;projects", [], false);
        apiProjLen = apiProj.length;
        var allProjects = [];
        for (var i = 0; i < apiProjLen; i++) {
            var apiProjFQN = commonUtils.getValueByJsonPath(apiProj[i],
                                                            "fq_name", null);
            var apiProjName = commonUtils.getValueByJsonPath(apiProjFQN, "1",
                                                             null);
            var apiProjID = commonUtils.getValueByJsonPath(apiProj[i], "uuid",
                                                           null);
            apiProj[i]["display_name"] = apiProjName;
            allProjects.push(apiProj[i]);
            tempProjIdToIdxMap[apiProjID] = allProjects.length - 1;
            tempProjFqnToIDMap[apiProjFQN.join(":")] = apiProjID;
        }

        for (i = 0; i < identityProjLen; i++) {
            var identityProjID = commonUtils.getValueByJsonPath(identityProj[i],
                                                                "uuid", null);
            var idx = tempProjIdToIdxMap[identityProjID];
            var identityProjFQN =
                commonUtils.getValueByJsonPath(identityProj[i], "fq_name",
                                               null);
            var identityProjName =
                commonUtils.getValueByJsonPath(identityProjFQN, "1", null);
            if (null != idx) {
                /* Exists in API Server, so take display_name from keystone */
                allProjects[idx]["display_name"] = identityProjName;
            } else {
                identityProj[i]["display_name"] = identityProjName;
                allProjects.push(identityProj[i]);
            }
            /* If fqn matches both in Api Server and keystone, but their UUID is
             * different, then the project was deleted and recreated and the
             * project entry had child, so it did not get cleaned up from API
             * Server yet
             */
            var apiID = tempProjFqnToIDMap[identityProjFQN.join(":")];
            if ((null != apiID) && (apiID != identityProjID)) {
                idx = tempProjIdToIdxMap[apiID];
                if (null != idx) {
                    allProjects[idx]["display_name"] = identityProjName +
                        ctrlGlobal.PROJECT_NOT_FOUND_IN_KEYSTONE;
                    allProjects[idx]["error_string"] =
                        ctrlGlobal.PROJECT_NOT_FOUND_IN_KEYSTONE;
                }
            }
        }
        commonUtils.handleJSONResponse(null, response, {projects: allProjects});
    });
}
/**
 * @listAllProjects
 * public function
 * 1. URL /api/tenants/config/all-projects
 * 2. Gets list of all projects from identity and api server
 * 3. Takes query param domain uuid and returns filtered projects
 */
@listAllProjects
public function
1. URL /api/tenants/config/all-projects
2. Gets list of all projects from identity and api server
3. Takes query param domain uuid and returns filtered projects
@listAllProjects public function 1 . URL / api / tenants / config / all - projects 2 . Gets list of all projects from identity and api server 3 . Takes query param domain uuid and returns filtered projects
function listAllProjects (request, response, appData)
{
    var dataObjArr = [], i, identityProj, identityProjLen, apiProj,
        apiProjLen, projList = [], tempProjMap = {},
        parentId = commonUtils.getValueByJsonPath(request,
                "query;domainId", null, false),
        tempProjIdToIdxMap = {};
    var tempProjFqnToIDMap = {};
    dataObjArr.push({type : identity, request: request,
        appData: appData, parentId: parentId});
    dataObjArr.push({type : apiServer, request: request,
        appData: appData, parentId: parentId});
    async.map(dataObjArr, getAllProjectAsync, function(error, projData) {
        if (projData[0].error && projData[1].error) {
            commonUtils.handleJSONResponse(projData[0].error, response, null);
            return;
        }
        identityProj = commonUtils.getValueByJsonPath(projData,
                "0;data;projects", [], false);
        identityProjLen = identityProj.length;
        apiProj = commonUtils.getValueByJsonPath(projData,
                "1;data;projects", [], false);
        apiProjLen = apiProj.length;
        var allProjects = [];
        for (var i = 0; i < apiProjLen; i++) {
            var apiProjFQN = commonUtils.getValueByJsonPath(apiProj[i],
                                                            "fq_name", null);
            var apiProjName = commonUtils.getValueByJsonPath(apiProjFQN, "1",
                                                             null);
            var apiProjID = commonUtils.getValueByJsonPath(apiProj[i], "uuid",
                                                           null);
            apiProj[i]["display_name"] = apiProjName;
            allProjects.push(apiProj[i]);
            tempProjIdToIdxMap[apiProjID] = allProjects.length - 1;
            tempProjFqnToIDMap[apiProjFQN.join(":")] = apiProjID;
        }
        for (i = 0; i < identityProjLen; i++) {
            var identityProjID = commonUtils.getValueByJsonPath(identityProj[i],
                                                                "uuid", null);
            var idx = tempProjIdToIdxMap[identityProjID];
            var identityProjFQN =
                commonUtils.getValueByJsonPath(identityProj[i], "fq_name",
                                               null);
            var identityProjName =
                commonUtils.getValueByJsonPath(identityProjFQN, "1", null);
            if (null != idx) {
                allProjects[idx]["display_name"] = identityProjName;
            } else {
                identityProj[i]["display_name"] = identityProjName;
                allProjects.push(identityProj[i]);
            }
            var apiID = tempProjFqnToIDMap[identityProjFQN.join(":")];
            if ((null != apiID) && (apiID != identityProjID)) {
                idx = tempProjIdToIdxMap[apiID];
                if (null != idx) {
                    allProjects[idx]["display_name"] = identityProjName +
                        ctrlGlobal.PROJECT_NOT_FOUND_IN_KEYSTONE;
                    allProjects[idx]["error_string"] =
                        ctrlGlobal.PROJECT_NOT_FOUND_IN_KEYSTONE;
                }
            }
        }
        commonUtils.handleJSONResponse(null, response, {projects: allProjects});
    });
}
function listAllProjects ( request , response , appData ) { var dataObjArr = [ ] , i , identityProj , identityProjLen , apiProj , apiProjLen , projList = [ ] , tempProjMap = { } , parentId = commonUtils . getValueByJsonPath ( request , "query;domainId" , null , false ) , tempProjIdToIdxMap = { } ; var tempProjFqnToIDMap = { } ; dataObjArr . push ( { type : identity , request : request , appData : appData , parentId : parentId } ) ; dataObjArr . push ( { type : apiServer , request : request , appData : appData , parentId : parentId } ) ; async . map ( dataObjArr , getAllProjectAsync , function ( error , projData ) { if ( projData [ 0 ] . error && projData [ 1 ] . error ) { commonUtils . handleJSONResponse ( projData [ 0 ] . error , response , null ) ; return ; } identityProj = commonUtils . getValueByJsonPath ( projData , "0;data;projects" , [ ] , false ) ; identityProjLen = identityProj . length ; apiProj = commonUtils . getValueByJsonPath ( projData , "1;data;projects" , [ ] , false ) ; apiProjLen = apiProj . length ; var allProjects = [ ] ; for ( var i = 0 ; i < apiProjLen ; i ++ ) { var apiProjFQN = commonUtils . getValueByJsonPath ( apiProj [ i ] , "fq_name" , null ) ; var apiProjName = commonUtils . getValueByJsonPath ( apiProjFQN , "1" , null ) ; var apiProjID = commonUtils . getValueByJsonPath ( apiProj [ i ] , "uuid" , null ) ; apiProj [ i ] [ "display_name" ] = apiProjName ; allProjects . push ( apiProj [ i ] ) ; tempProjIdToIdxMap [ apiProjID ] = allProjects . length - 1 ; tempProjFqnToIDMap [ apiProjFQN . join ( ":" ) ] = apiProjID ; } for ( i = 0 ; i < identityProjLen ; i ++ ) { var identityProjID = commonUtils . getValueByJsonPath ( identityProj [ i ] , "uuid" , null ) ; var idx = tempProjIdToIdxMap [ identityProjID ] ; var identityProjFQN = commonUtils . getValueByJsonPath ( identityProj [ i ] , "fq_name" , null ) ; var identityProjName = commonUtils . getValueByJsonPath ( identityProjFQN , "1" , null ) ; if ( null != idx ) { allProjects [ idx ] [ "display_name" ] = identityProjName ; } else { identityProj [ i ] [ "display_name" ] = identityProjName ; allProjects . push ( identityProj [ i ] ) ; } var apiID = tempProjFqnToIDMap [ identityProjFQN . join ( ":" ) ] ; if ( ( null != apiID ) && ( apiID != identityProjID ) ) { idx = tempProjIdToIdxMap [ apiID ] ; if ( null != idx ) { allProjects [ idx ] [ "display_name" ] = identityProjName + ctrlGlobal . PROJECT_NOT_FOUND_IN_KEYSTONE ; allProjects [ idx ] [ "error_string" ] = ctrlGlobal . PROJECT_NOT_FOUND_IN_KEYSTONE ; } } } commonUtils . handleJSONResponse ( null , response , { projects : allProjects } ) ; } ) ; }
@listAllProjects
 public function
 1.
@listAllProjects public function 1 .
/* Exists in API Server, so take display_name from keystone */ /* If fqn matches both in Api Server and keystone, but their UUID is
             * different, then the project was deleted and recreated and the
             * project entry had child, so it did not get cleaned up from API
             * Server yet
             */