public static void remove(JiraCustomFilter filter) { if (!FILTERS.ContainsKey(filter.Guid)) { return; } FILTERS.Remove(filter.Guid); save(); }
public static void add(JiraCustomFilter filter) { if (FILTERS.ContainsKey(filter.Guid)) { throw new Exception("Filter Exists"); } FILTERS[filter.Guid] = filter; save(); }
private static void loadReporter(ParameterStore store, Guid key, JiraCustomFilter f) { string reporterString = store.loadParameter(getParamKey(key, FILTER_REPORTER), UserType.UNDEFINED.ToString()); try { f.Reporter = (UserType)Enum.Parse(typeof(UserType), reporterString); } catch (Exception) { f.Reporter = UserType.UNDEFINED; } }
private static void loadAssignee(ParameterStore store, Guid key, JiraCustomFilter f) { string assigneeString = store.loadParameter(getParamKey(key, FILTER_ASSIGNEE), UserType.UNDEFINED.ToString()); try { f.Assignee = (UserType)Enum.Parse(typeof(UserType), assigneeString); } catch (Exception) { f.Assignee = UserType.UNDEFINED; } }
private static void storeStatuses(ParameterStore store, Guid key, JiraCustomFilter f) { int i = 0; store.storeParameter(getParamKey(key, FILTER_STATUSES_COUNT), f.Statuses.Count); foreach (JiraNamedEntity status in f.Statuses) { store.storeParameter(getParamKey(key, FILTER_STATUSES_ID + i), status.Id); store.storeParameter(getParamKey(key, FILTER_STATUSES_NAME + i), status.Name); ++i; } }
private static void loadProjects(ParameterStore store, Guid key, JiraCustomFilter f) { int count = store.loadParameter(getParamKey(key, FILTER_PROJECT_COUNT), 0); for (int i = 0; i < count; ++i) { int id = store.loadParameter(getParamKey(key, FILTER_PROJECT_ID + i), 0); string projectKey = store.loadParameter(getParamKey(key, FILTER_PROJECT_KEY + i), null); JiraProject proj = new JiraProject(id, projectKey, projectKey); f.Projects.Add(proj); } }
private static void storeIssueTypes(ParameterStore store, Guid key, JiraCustomFilter f) { int i = 0; store.storeParameter(getParamKey(key, FILTER_ISSUE_TYPE_COUNT), f.IssueTypes.Count); foreach (JiraNamedEntity issueType in f.IssueTypes) { store.storeParameter(getParamKey(key, FILTER_ISSUE_TYPE_ID + i), issueType.Id); store.storeParameter(getParamKey(key, FILTER_ISSUE_TYPE_NAME + i), issueType.Name); ++i; } }
private static void loadIssueTypes(ParameterStore store, Guid key, JiraCustomFilter f) { int count = store.loadParameter(getParamKey(key, FILTER_ISSUE_TYPE_COUNT), 0); for (int i = 0; i < count; ++i) { int id = store.loadParameter(getParamKey(key, FILTER_ISSUE_TYPE_ID + i), 0); string name = store.loadParameter(getParamKey(key, FILTER_ISSUE_TYPE_NAME + i), null); JiraNamedEntity issueType = new JiraNamedEntity(id, name, null); f.IssueTypes.Add(issueType); } }
private static void storeFixVersions(ParameterStore store, Guid key, JiraCustomFilter f) { int i = 0; store.storeParameter(getParamKey(key, FILTER_FIXFORVERSIONS_COUNT), f.FixForVersions.Count); foreach (JiraNamedEntity version in f.FixForVersions) { store.storeParameter(getParamKey(key, FILTER_FIXFORVERSIONS_ID + i), version.Id); store.storeParameter(getParamKey(key, FILTER_FIXFORVERSIONS_NAME + i), version.Name); ++i; } }
private static void loadFixVersions(ParameterStore store, Guid key, JiraCustomFilter f) { int count = store.loadParameter(getParamKey(key, FILTER_FIXFORVERSIONS_COUNT), 0); for (int i = 0; i < count; ++i) { int id = store.loadParameter(getParamKey(key, FILTER_FIXFORVERSIONS_ID + i), 0); string name = store.loadParameter(getParamKey(key, FILTER_FIXFORVERSIONS_NAME + i), null); JiraNamedEntity fixVersion = new JiraNamedEntity(id, name, null); f.FixForVersions.Add(fixVersion); } }
private static void storeComponents(ParameterStore store, Guid key, JiraCustomFilter f) { int i = 0; store.storeParameter(getParamKey(key, FILTER_COMPONENTS_COUNT), f.Components.Count); foreach (JiraNamedEntity comp in f.Components) { store.storeParameter(getParamKey(key, FILTER_COMPONENTS_ID + i), comp.Id); store.storeParameter(getParamKey(key, FILTER_COMPONENTS_NAME + i), comp.Name); ++i; } }
private static void loadComponents(ParameterStore store, Guid key, JiraCustomFilter f) { int count = store.loadParameter(getParamKey(key, FILTER_COMPONENTS_COUNT), 0); for (int i = 0; i < count; ++i) { int id = store.loadParameter(getParamKey(key, FILTER_COMPONENTS_ID + i), 0); string name = store.loadParameter(getParamKey(key, FILTER_COMPONENTS_NAME + i), null); JiraNamedEntity comp = new JiraNamedEntity(id, name, null); f.Components.Add(comp); } }
private static void storePriorities(ParameterStore store, Guid key, JiraCustomFilter f) { int i = 0; store.storeParameter(getParamKey(key, FILTER_PRIORITIES_COUNT), f.Priorities.Count); foreach (JiraNamedEntity priority in f.Priorities) { store.storeParameter(getParamKey(key, FILTER_PRIORITIES_ID + i), priority.Id); store.storeParameter(getParamKey(key, FILTER_PRIORITIES_NAME + i), priority.Name); ++i; } }
private static void loadResolutions(ParameterStore store, Guid key, JiraCustomFilter f) { int count = store.loadParameter(getParamKey(key, FILTER_RESOLUTIONS_COUNT), 0); for (int i = 0; i < count; ++i) { int id = store.loadParameter(getParamKey(key, FILTER_RESOLUTIONS_ID + i), 0); string name = store.loadParameter(getParamKey(key, FILTER_RESOLUTIONS_NAME + i), null); JiraNamedEntity resolution = new JiraNamedEntity(id, name, null); f.Resolutions.Add(resolution); } }
private static void loadStatuses(ParameterStore store, Guid key, JiraCustomFilter f) { int count = store.loadParameter(getParamKey(key, FILTER_STATUSES_COUNT), 0); for (int i = 0; i < count; ++i) { int id = store.loadParameter(getParamKey(key, FILTER_STATUSES_ID + i), 0); string name = store.loadParameter(getParamKey(key, FILTER_STATUSES_NAME + i), null); JiraNamedEntity status = new JiraNamedEntity(id, name, null); f.Statuses.Add(status); } }
private static void storeResolutions(ParameterStore store, Guid key, JiraCustomFilter f) { int i = 0; store.storeParameter(getParamKey(key, FILTER_RESOLUTIONS_COUNT), f.Resolutions.Count); foreach (JiraNamedEntity resolution in f.Resolutions) { store.storeParameter(getParamKey(key, FILTER_RESOLUTIONS_ID + i), resolution.Id); store.storeParameter(getParamKey(key, FILTER_RESOLUTIONS_NAME + i), resolution.Name); ++i; } }
private static void storeProjects(ParameterStore store, Guid key, JiraCustomFilter f) { store.storeParameter(getParamKey(key, FILTER_PROJECT_COUNT), f.Projects.Count); int i = 0; foreach (JiraProject project in f.Projects) { store.storeParameter(getParamKey(key, FILTER_PROJECT_ID + i), project.Id); store.storeParameter(getParamKey(key, FILTER_PROJECT_KEY + i), project.Key); ++i; } }
private static void loadPriorities(ParameterStore store, Guid key, JiraCustomFilter f) { int count = store.loadParameter(getParamKey(key, FILTER_PRIORITIES_COUNT), 0); for (int i = 0; i < count; ++i) { int id = store.loadParameter(getParamKey(key, FILTER_PRIORITIES_ID + i), 0); string name = store.loadParameter(getParamKey(key, FILTER_PRIORITIES_NAME + i), null); JiraNamedEntity priority = new JiraNamedEntity(id, name, null); f.Priorities.Add(priority); } }
public static void load() { FILTERS.Clear(); var store = ParameterStoreManager.Instance.getStoreFor(ParameterStoreManager.StoreType.SETTINGS); var filtersCount = store.loadParameter(FILTER_COUNT, 0); var servers = JiraServerModel.Instance.getAllServers(); for (int i = 0; i < filtersCount; ++i) { var filterGuidStr = store.loadParameter(FILTER_GUID + i, null); var filterGuid = new Guid(filterGuidStr); var filterServerGuidStr = store.loadParameter(getParamKey(filterGuid, FILTER_SERVER_GUID + filterGuidStr), null); var serverGuid = new Guid(filterServerGuidStr); var server = servers.FirstOrDefault(s => s.GUID.Equals(serverGuid)); if (server == null) { continue; } var filter = new JiraCustomFilter(server, filterGuid) { Name = store.loadParameter(getParamKey(filterGuid, FILTER_NAME + filterGuidStr), CUSTOM_FILTER_DEFAULT_NAME) }; loadProjects(store, filterGuid, filter); loadIssueTypes(store, filterGuid, filter); loadFixVersions(store, filterGuid, filter); loadAffectsVersions(store, filterGuid, filter); loadComponents(store, filterGuid, filter); loadReporter(store, filterGuid, filter); loadAssignee(store, filterGuid, filter); loadStatuses(store, filterGuid, filter); loadResolutions(store, filterGuid, filter); loadPriorities(store, filterGuid, filter); FILTERS[filterGuid] = filter; } }
private static void storeReporter(ParameterStore store, Guid key, JiraCustomFilter f) { store.storeParameter(getParamKey(key, FILTER_REPORTER), f.Reporter.ToString()); }
public void updateModelWithCustomFilter(JiraIssueListModel model, JiraServer server, JiraCustomFilter filter) { List <JiraIssue> issues = facade.getCustomFilterIssues(server, filter, model.Issues.Count, GlobalSettings.JiraIssuesBatch); lock (this) { model.addIssues(issues); } }
public void rebuildModelWithCustomFilter(JiraIssueListModel model, JiraServer server, JiraCustomFilter filter) { List <JiraIssue> issues = facade.getCustomFilterIssues(server, filter, 0, GlobalSettings.JiraIssuesBatch); lock (this) { model.clear(false); model.addIssues(issues); } }
private static void storeAssignee(ParameterStore store, Guid key, JiraCustomFilter f) { store.storeParameter(getParamKey(key, FILTER_ASSIGNEE), f.Assignee.ToString()); }