Exemple #1
0
        public void load(Globals globals)
        {
            int count = ParameterSerializer.loadParameter(globals, SERVER_COUNT, -1);

            if (count != -1)
            {
                try
                {
                    for (int i = 1; i <= count; ++i)
                    {
                        string     guidStr = ParameterSerializer.loadParameter(globals, SERVER_GUID + i, null);
                        Guid       guid    = new Guid(guidStr);
                        string     sName   = ParameterSerializer.loadParameter(globals, SERVER_NAME + guidStr, null);
                        string     url     = ParameterSerializer.loadParameter(globals, SERVER_URL + guidStr, null);
                        JiraServer server  = new JiraServer(guid, sName, url, null, null);
                        server.UserName = CredentialsVault.Instance.getUserName(server);
                        server.Password = CredentialsVault.Instance.getPassword(server);
                        addServer(server);
                    }
                    changedSinceLoading = false;
                }
                catch (Exception e)
                {
                    Debug.WriteLine(e);
                }
            }
        }
Exemple #2
0
        public void load(Globals globals, string solutionName)
        {
            lock (this)
            {
                issues.Clear();

                solutionName = ParameterSerializer.getKeyFromSolutionName(solutionName);

                int count = ParameterSerializer.loadParameter(globals, RECENTLY_VIEWED_COUNT + solutionName, -1);
                if (count != -1)
                {
                    try
                    {
                        if (count > MAX_ITEMS)
                        {
                            count = MAX_ITEMS;
                        }

                        for (int i = 1; i <= count; ++i)
                        {
                            string guidStr            = ParameterSerializer.loadParameter(globals, RECENTLY_VIEWED_ISSUE_SERVER_GUID + solutionName + "_" + i, null);
                            Guid   guid               = new Guid(guidStr);
                            string key                = ParameterSerializer.loadParameter(globals, RECENTLY_VIEWED_ISSUE_KEY + solutionName + "_" + i, null);
                            RecentlyViewedIssue issue = new RecentlyViewedIssue(guid, key);
                            issues.Add(issue);
                        }
                    }
                    catch (Exception e)
                    {
                        Debug.WriteLine(e);
                    }
                }
                changedSinceLoading = false;
            }
        }
        private static void loadProjects(Globals globals, string solutionKey, Guid key, JiraCustomFilter f)
        {
            int count = ParameterSerializer.loadParameter(globals, getParamKey(solutionKey, key, FILTER_PROJECT_COUNT), 0);

            for (int i = 0; i < count; ++i)
            {
                int         id         = ParameterSerializer.loadParameter(globals, getParamKey(solutionKey, key, FILTER_PROJECT_ID + i), 0);
                string      projectKey = ParameterSerializer.loadParameter(globals, getParamKey(solutionKey, key, FILTER_PROJECT_KEY + i), null);
                JiraProject proj       = new JiraProject(id, projectKey, projectKey);
                f.Projects.Add(proj);
            }
        }
        private static void loadIssueTypes(Globals globals, string solutionKey, Guid key, JiraCustomFilter f)
        {
            int count = ParameterSerializer.loadParameter(globals, getParamKey(solutionKey, key, FILTER_ISSUE_TYPE_COUNT), 0);

            for (int i = 0; i < count; ++i)
            {
                int             id        = ParameterSerializer.loadParameter(globals, getParamKey(solutionKey, key, FILTER_ISSUE_TYPE_ID + i), 0);
                string          name      = ParameterSerializer.loadParameter(globals, getParamKey(solutionKey, key, FILTER_ISSUE_TYPE_NAME + i), null);
                JiraNamedEntity issueType = new JiraNamedEntity(id, name, null);
                f.IssueTypes.Add(issueType);
            }
        }
        private static void loadFixVersions(Globals globals, string solutionKey, Guid key, JiraCustomFilter f)
        {
            int count = ParameterSerializer.loadParameter(globals, getParamKey(solutionKey, key, FILTER_FIXFORVERSIONS_COUNT), 0);

            for (int i = 0; i < count; ++i)
            {
                int             id         = ParameterSerializer.loadParameter(globals, getParamKey(solutionKey, key, FILTER_FIXFORVERSIONS_ID + i), 0);
                string          name       = ParameterSerializer.loadParameter(globals, getParamKey(solutionKey, key, FILTER_FIXFORVERSIONS_NAME + i), null);
                JiraNamedEntity fixVersion = new JiraNamedEntity(id, name, null);
                f.FixForVersions.Add(fixVersion);
            }
        }
        private static void loadComponents(Globals globals, string solutionKey, Guid key, JiraCustomFilter f)
        {
            int count = ParameterSerializer.loadParameter(globals, getParamKey(solutionKey, key, FILTER_COMPONENTS_COUNT), 0);

            for (int i = 0; i < count; ++i)
            {
                int             id   = ParameterSerializer.loadParameter(globals, getParamKey(solutionKey, key, FILTER_COMPONENTS_ID + i), 0);
                string          name = ParameterSerializer.loadParameter(globals, getParamKey(solutionKey, key, FILTER_COMPONENTS_NAME + i), null);
                JiraNamedEntity comp = new JiraNamedEntity(id, name, null);
                f.Components.Add(comp);
            }
        }
        public static void load(Globals globals, string solutionName)
        {
            FILTERS.Clear();

            string solutionKey  = ParameterSerializer.getKeyFromSolutionName(solutionName);
            int    filtersCount = ParameterSerializer.loadParameter(globals, solutionKey + FILTER_COUNT, 0);
            ICollection <JiraServer> servers = JiraServerModel.Instance.getAllServers();

            for (int i = 0; i < filtersCount; ++i)
            {
                string     filterGuidStr       = ParameterSerializer.loadParameter(globals, solutionKey + FILTER_GUID + i, null);
                Guid       filterGuid          = new Guid(filterGuidStr);
                string     filterServerGuidStr = ParameterSerializer.loadParameter(globals, getParamKey(solutionKey, filterGuid, FILTER_SERVER_GUID + filterGuidStr), null);
                Guid       serverGuid          = new Guid(filterServerGuidStr);
                JiraServer server = null;
                foreach (JiraServer s in servers)
                {
                    if (!s.GUID.Equals(serverGuid))
                    {
                        continue;
                    }
                    server = s;
                    break;
                }
                if (server == null)
                {
                    continue;
                }

                JiraCustomFilter filter = new JiraCustomFilter(server);

                loadProjects(globals, solutionKey, filterGuid, filter);
                loadIssueTypes(globals, solutionKey, filterGuid, filter);
                loadFixVersions(globals, solutionKey, filterGuid, filter);
                loadAffectsVersions(globals, solutionKey, filterGuid, filter);
                loadComponents(globals, solutionKey, filterGuid, filter);

                FILTERS[filterGuid] = filter;
            }
        }