Пример #1
0
 /// <summary>
 /// This is the constructor normaly used to instanciate a fully fledged obj
 /// </summary>
 /// <param name="component">SqComponent from the SQ API response</param>
 public FilComponent(SqComponent component) : base(component)
 {
     if (Qualifier != SqQualifier.FILE)
     {
         throw new ArgumentException("Illegal Argument for Qualifier: \"" + component.qualifier + "\"");
     }
 }
Пример #2
0
 /// <summary>
 /// This is the constructor normaly used to instanciate a fully fledged obj
 /// </summary>
 /// <param name="component">SqComponent from the SQ API response</param>
 protected TreeComponent(SqComponent component)
 {
     ID        = component.id;
     Key       = component.key;
     Name      = component.name.Split('/').Last();
     Path      = component.path;
     Qualifier = QualifierForString(component.qualifier);
     Metrics   = TransformToTreeMetrics(component.measures);
 }
Пример #3
0
 /// <summary>
 /// This is the constructor normaly used to instanciate a fully fledged obj
 /// </summary>
 /// <param name="component">SqComponent from the SQ API response</param>
 public DirComponent(SqComponent component) : base(component)
 {
     if (Qualifier != SqQualifier.DIRECTORY &&
         Qualifier != SqQualifier.PROJECT &&
         Qualifier != SqQualifier.SUB_PROJECT)
     {
         throw new ArgumentException("Illegal Argument for Qualifier: \"" + component.qualifier + "\"");
     }
 }
Пример #4
0
 /// <summary>
 /// This is the constructor normaly used to instanciate a fully fledged obj
 /// </summary>
 /// <param name="component">SqComponent from the SQ API response</param>
 public ProjectComponent(SqComponent component) : base(component)
 {
     if (component.qualifier == "TRK")
     {
         Qualifier = SqQualifier.PROJECT;
         // path ist IMMER "" (empty)
         Path = "";
     }
     else
     {
         throw new ArgumentException("Illegal Argument for Qualifier: \"" + component.qualifier + "\"");
     }
 }
Пример #5
0
    private DirComponent GetDirectoryTreeComponent()
    {
        SqComponent sqComponent = new SqComponent();

        sqComponent.id        = "id";
        sqComponent.key       = "key";
        sqComponent.name      = "name";
        sqComponent.qualifier = "DIR";
        sqComponent.path      = "path";
        sqComponent.language  = "language";

        sqComponent.measures = new List <Measure>();

        return(new DirComponent(sqComponent));
    }
Пример #6
0
    private FilComponent GetDocumentTreeComponent()
    {
        SqComponent sqComponent = new SqComponent();

        sqComponent.id        = "id";
        sqComponent.key       = "key";
        sqComponent.name      = "name";
        sqComponent.qualifier = "FIL";
        sqComponent.path      = "path";
        sqComponent.language  = "language";

        sqComponent.measures = new List <Measure>();

        return(new FilComponent(sqComponent));
    }
Пример #7
0
        /// <summary>
        /// Returns the correct object representation for the specific
        /// SqComponent based on the qualifier. These qualifier come from the SQ API.
        /// </summary>
        /// <param name="component">SqComponent for which a TreeComponent is needed</param>
        /// <returns>TreeComponent for the SqComponent based on the qualifier</returns>
        private TreeComponent GetTreeComponent(SqComponent component)
        {
            // Tests (UTS) and Sub-Projects (BRC) are not welcome in the tree
            // The Project Component (TRK) will not be created by this and is in the BaseComponent
            switch (component.qualifier)
            {
            case "BRC": return(null);

            case "DIR": return(new DirComponent(component));

            case "FIL": return(new FilComponent(component));

            case "TRK": return(null);

            case "UTS": return(null);

            default: throw new ArgumentException("Unknown Qualifier: \"" + component.qualifier + "\"");
            }
        }
Пример #8
0
        /// <summary>
        /// Constructs the component tree of the baseComponent and a list of components.
        /// </summary>
        /// <param name="baseComponent">Project Infos & Metrics</param>
        /// <param name="components">List of Components</param>
        /// <returns>Root of ComponentTree</returns>
        public ProjectComponent BuildProjectTree(SqComponent baseComponent,
                                                 List <SqComponent> components)
        {
            if (baseComponent == null || components == null)
            {
                return(null);
            }

            project = new ProjectComponent(baseComponent);

            lock (project)
            {
                foreach (SqComponent c in components)
                {
                    string[] s = c.path.Split('/');
                    project.InsertComponentAt(s, GetTreeComponent(c));
                }
            }
            return(project);
        }
Пример #9
0
 /// <summary>
 /// This is the constructor normaly used to instanciate a fully fledged obj
 /// </summary>
 /// <param name="component">SqComponent from the SQ API response</param>
 protected TreeLeafComponent(SqComponent component) : base(component)
 {
     Language = component.language;
 }