public void SyncAll(GetChildrenFromJiraDelegate delegateGetChildren) { // Create missing items, update existing items Dictionary <IResource, bool> mapLiving = new Dictionary <IResource, bool>(); // Hash-set for the items that are still alive in JIRA foreach (TJira itemJira in delegateGetChildren(_server.GetSignInToken())) { TResourceObject itemLocal = FindByJiraId(itemJira.id); if (itemLocal == null) { itemLocal = CreateNewResource(itemJira); } else { itemLocal.Undelete(); } itemLocal.Async = false; ((ISyncableTo <TJira>)itemLocal).Sync(itemJira); mapLiving[itemLocal.Resource] = true; } // Mark those projects no more in JIRA as deleted foreach (TResourceObject componentLocal in GetList()) { if (!mapLiving.ContainsKey(componentLocal.Resource)) { componentLocal.Delete(); } } }
public void SyncComponents() { // Create missing items, update existing items Dictionary <IResource, bool> mapLiving = new Dictionary <IResource, bool>(); // Hash-set for the items that are still alive in JIRA foreach (RemoteComponent componentJira in Server.Service.getComponents(Server.GetSignInToken(), Key)) { JiraComponent componentLocal = FindComponentByJiraId(componentJira.id); if (componentLocal == null) { componentLocal = CreateComponent(componentJira); } else { componentLocal.Undelete(); } componentLocal.Async = false; componentLocal.Sync(componentJira); mapLiving[componentLocal.Resource] = true; } // Mark those projects no more in JIRA as deleted foreach (JiraComponent componentLocal in Components) { if (!mapLiving.ContainsKey(componentLocal.Resource)) { componentLocal.Delete(); } } }