Ejemplo n.º 1
0
        public void LoadBIELsAndTheirABIEs(ICctsRepository repository)
        {
            foreach (IBieLibrary biel in repository.GetBieLibraries())
            {
                if (BIELs.ContainsKey(biel.Name))
                {
                    BIELs.Clear();
                    throw new CacheException("The wizard encountered two BIE libraries having identical names. Please make sure that all BIE libraries within the model have unique names before proceeding with the wizard.");
                }

                BIELs.Add(biel.Name, new cBIELibrary(biel.Name, biel.Id));

                foreach (IAbie abie in biel.Abies)
                {
                    if (BIELs[biel.Name].ABIEs.ContainsKey(abie.Name))
                    {
                        BIELs[biel.Name].ABIEs.Clear();
                        throw new CacheException("The wizard encountered two ABIEs within one BIE library having identical names. Please make sure that all ABIEs within each BIE library have unique names before proceeding with the wizard.");
                    }

                    BIELs[biel.Name].ABIEs.Add(abie.Name, new cABIE(abie.Name, abie.Id, abie.BasedOn.Id));
                }
            }

            if (BIELs.Count == 0)
            {
                throw new CacheException("The repository did not contain any BIE libraries. Please make sure at least one BIE library is present before proceeding with the wizard.");
            }
        }
Ejemplo n.º 2
0
 public void EmptyCache()
 {
     CCLs.Clear();
     CDTLs.Clear();
     BDTLs.Clear();
     BIELs.Clear();
 }
Ejemplo n.º 3
0
        public bool PathIsValid(int typeOfPath, string[] path)
        {
            switch (typeOfPath)
            {
            case CacheConstants.PATH_BCCs:
            {
                if ((path.Length > 0) && !(CCLs.ContainsKey(path[0])))
                {
                    return(false);
                }

                if ((path.Length > 1) && !(CCLs[path[0]].ACCs.ContainsKey(path[1])))
                {
                    return(false);
                }

                if ((path.Length > 2) && !(CCLs[path[0]].ACCs[path[1]].BCCs.ContainsKey(path[2])))
                {
                    return(false);
                }

                if ((path.Length > 3) && !(CCLs[path[0]].ACCs[path[1]].BCCs[path[2]].BBIEs.ContainsKey(path[3])))
                {
                    return(false);
                }

                if (path.Length > 4)
                {
                    int countMatchingBDTs = 0;

                    foreach (cBDT bdt in CCLs[path[0]].ACCs[path[1]].BCCs[path[2]].BBIEs[path[3]].BDTs)
                    {
                        if (bdt.Name.Equals(path[4]))
                        {
                            countMatchingBDTs++;
                        }
                    }

                    if (countMatchingBDTs < 1)
                    {
                        return(false);
                    }
                }
            }
            break;

            case CacheConstants.PATH_ASCCs:
            {
                if ((path.Length > 0) && !(CCLs.ContainsKey(path[0])))
                {
                    return(false);
                }

                if ((path.Length > 1) && !(CCLs[path[0]].ACCs.ContainsKey(path[1])))
                {
                    return(false);
                }

                if ((path.Length > 2) && !(CCLs[path[0]].ACCs[path[1]].ASCCs.ContainsKey(path[2])))
                {
                    return(false);
                }
            }
            break;

            case CacheConstants.PATH_BDTLs:
            {
                if ((path.Length > 0) && !(BDTLs.ContainsKey(path[0])))
                {
                    return(false);
                }
            }
            break;

            case CacheConstants.PATH_BIELs:
            {
                if ((path.Length > 0) && !(BIELs.ContainsKey(path[0])))
                {
                    return(false);
                }
            }
            break;

            case CacheConstants.PATH_CDTs:
            {
                if ((path.Length > 0) && !(CDTLs.ContainsKey(path[0])))
                {
                    return(false);
                }

                if ((path.Length > 1) && !(CDTLs[path[0]].CDTs.ContainsKey(path[1])))
                {
                    return(false);
                }

                if ((path.Length > 2) && !(CDTLs[path[0]].CDTs[path[1]].SUPs.ContainsKey(path[2])))
                {
                    return(false);
                }
            }
            break;
            }

            return(true);
        }