Update story/feature information for all the projects one at a time

@param collector
490263
protected void updateStoryInformation(FeatureCollector collector) {
        long storyDataStart = System.currentTimeMillis();
        AtomicLong count = new AtomicLong();

        if (Objects.equals(collector.getMode(), JiraMode.Team)) {
            List<Scope> projects = new ArrayList<>(getScopeList(collector.getId()));
            projects.forEach(project -> {
                LOGGER.info("Collecting " + count.incrementAndGet() + " of " + projects.size() + " projects.");

                long lastCollection = System.currentTimeMillis();
                FeatureEpicResult featureEpicResult = jiraClient.getIssues(project);
                List<Feature> features = featureEpicResult.getFeatureList();
                saveFeatures(features, collector);
                updateFeaturesWithLatestEpics(featureEpicResult.getEpicList(), collector);
                log("Story Data Collected since " + LocalDateTime.ofInstant(Instant.ofEpochMilli(project.getLastCollected()), ZoneId.systemDefault()), storyDataStart, features.size());

                project.setLastCollected(lastCollection); //set it after everything is successfully done
                projectRepository.save(project);

            });
        } else {
            List<Team> boards = getBoardList(collector.getId());
            boards.forEach(board -> {
                LOGGER.info("Collecting " + count.incrementAndGet() + " of " + boards.size() + " boards.");
                long lastCollection = System.currentTimeMillis();
                FeatureEpicResult featureEpicResult = jiraClient.getIssues(board);
                List<Feature> features = featureEpicResult.getFeatureList();
                saveFeatures(features, collector);
                updateFeaturesWithLatestEpics(featureEpicResult.getEpicList(), collector);
                log("Story Data Collected since " + LocalDateTime.ofInstant(Instant.ofEpochMilli(board.getLastCollected()), ZoneId.systemDefault()), storyDataStart, features.size());

                board.setLastCollected(lastCollection); //set it after everything is successfully done
                teamRepository.save(board);
                FeatureBoard featureBoard = featureBoardRepository.findFeatureBoard(collector.getId(), board.getTeamId());
                if(featureBoard != null){
                     featureBoard.setLastUpdated(System.currentTimeMillis());
                     featureBoardRepository.save(featureBoard);
                }
            });
        }

    }
1069833
private void updateConduitSyncHandlerConnection(List<String> sourceList, SynchronousHandler handler) {
        if (sourceList.contains("message")) {
            logConduit.addSyncHandler(handler);
        } else {
            logConduit.removeSyncHandler(handler);
        }

        if (sourceList.contains("trace")) {
            traceConduit.addSyncHandler(handler);
        } else {
            traceConduit.removeSyncHandler(handler);
        }
    }
273841
public void setGenerator(Map<JsonGenerator.Feature, Boolean> generator) {
        if (CollectionUtils.isNotEmpty(generator)) {
            this.generator = generator;
        }
    }
408617
protected void update(List<TableInfo> tableInfos)
    {
        for (TableInfo tableInfo : tableInfos)
        {
            DBObject options = setCollectionProperties(tableInfo);
            DB db = mongo.getDB(databaseName);
            DBCollection collection = null;
            if (tableInfo.getLobColumnInfo().isEmpty())
            {
                if (!db.collectionExists(tableInfo.getTableName()))
                {
                    collection = db.createCollection(tableInfo.getTableName(), options);
                    KunderaCoreUtils.printQuery("Create collection: " + tableInfo.getTableName(), showQuery);
                }

                collection = collection != null ? collection : db.getCollection(tableInfo.getTableName());

                boolean isCappedCollection = isCappedCollection(tableInfo);
                if (!isCappedCollection)
                {
                    createIndexes(tableInfo, collection);
                }
            }
            else
            {
                checkMultipleLobs(tableInfo);
                if (!db.collectionExists(tableInfo.getTableName() + MongoDBUtils.FILES))
                {
                    coll = db.createCollection(tableInfo.getTableName() + MongoDBUtils.FILES, options);
                    createUniqueIndexGFS(coll, tableInfo.getIdColumnName());
                    KunderaCoreUtils.printQuery("Create collection: " + tableInfo.getTableName() + MongoDBUtils.FILES,
                            showQuery);
                }

                if (!db.collectionExists(tableInfo.getTableName() + MongoDBUtils.CHUNKS))
                {
                    db.createCollection(tableInfo.getTableName() + MongoDBUtils.CHUNKS, options);
                    KunderaCoreUtils.printQuery("Create collection: " + tableInfo.getTableName() + MongoDBUtils.CHUNKS,
                            showQuery);
                }
            }
        }
    }
548922
private void addNewRepos(List<ArtifactoryRepo> repos, List<ArtifactoryRepo> existingRepos, ArtifactoryCollector collector) {
        long start = System.currentTimeMillis();
        int count = 0;

        List<ArtifactoryRepo> newRepos = new ArrayList<>();
        for (ArtifactoryRepo repo : repos) {
            ArtifactoryRepo existing = null;
            if (!CollectionUtils.isEmpty(existingRepos) && (existingRepos.contains(repo))) {
                existing = existingRepos.get(existingRepos.indexOf(repo));
            }

            if (existing == null) {
                repo.setCollectorId(collector.getId());
                repo.setEnabled(false); // Do not enable for collection. Will be enabled later
                repo.setDescription(repo.getRepoName());
                newRepos.add(repo);
                count++;
            }
        }
        //save all in one shot
        if (!CollectionUtils.isEmpty(newRepos)) {
            artifactoryRepoRepository.save(newRepos);
        }
        log("New repos", start, count);
    }
1087934
function StoryUpdater (storyID, timestamp, screenshotCount) {
  var self = this
  if (!(self instanceof StoryUpdater)) return new StoryUpdater(storyID, timestamp, screenshotCount)

  self.storyID = storyID
  self.timestamp = timestamp
  self.screenshotCount = screenshotCount
}
1236249
private void updateBugCollection(Project findBugsProject, Reporter bugReporter, boolean incremental) {
        SortedBugCollection newBugCollection = bugReporter.getBugCollection();
        try {
            st.newPoint("getBugCollection");
            SortedBugCollection oldBugCollection = FindbugsPlugin.getBugCollection(project, monitor);

            st.newPoint("mergeBugCollections");
            SortedBugCollection resultCollection = mergeBugCollections(oldBugCollection, newBugCollection, incremental);
             resultCollection.getProject().setGuiCallback(new EclipseGuiCallback(project));
            resultCollection.setTimestamp(System.currentTimeMillis());

            // will store bugs in the default FB file + Eclipse project session
            // props
            st.newPoint("storeBugCollection");
            FindbugsPlugin.storeBugCollection(project, resultCollection, monitor);
        } catch (IOException e) {
            FindbugsPlugin.getDefault().logException(e, "Error performing SpotBugs results update");
        } catch (CoreException e) {
            FindbugsPlugin.getDefault().logException(e, "Error performing SpotBugs results update");
        }

        // will store bugs as markers in Eclipse workspace
        st.newPoint("createMarkers");
        MarkerUtil.createMarkers(javaProject, newBugCollection, resource, monitor);
    }
881082
@SuppressWarnings("PMD.AvoidDeeplyNestedIfStmts") // agreed, fixme
    private void clean(Collector collector) {
        Set<ObjectId> uniqueIDs = new HashSet<>();
        /*
          Logic: For each component, retrieve the collector item list of the type SCM.
          Store their IDs in a unique set ONLY if their collector IDs match with GitHub collectors ID.
         */
        for (com.capitalone.dashboard.model.Component comp : dbComponentRepository.findAll()) {
            if (!MapUtils.isEmpty(comp.getCollectorItems())) {
                List<CollectorItem> itemList = comp.getCollectorItems().get(CollectorType.SCM);
                if (itemList != null) {
                    itemList.stream().filter(ci -> ci != null && Objects.equals(ci.getCollectorId(), collector.getId())).map(BaseModel::getId).forEach(uniqueIDs::add);
                }
            }
        }
        /*
          Logic: Get all the collector items from the collector_item collection for this collector.
          If their id is in the unique set (above), keep them enabled; else, disable them.
         */
        List<GitHubRepo> repoList = new ArrayList<>();
        Set<ObjectId> gitID = new HashSet<>();
        gitID.add(collector.getId());
        gitHubRepoRepository.findByCollectorIdIn(gitID).stream().filter(Objects::nonNull).forEach(repo -> {
            if (repo.isPushed()) {return;}
            repo.setEnabled(uniqueIDs.contains(repo.getId()));
            repoList.add(repo);
        });
        gitHubRepoRepository.save(repoList);
    }
707890
private void updateAll(CmsClientSitemapEntry entry) {

        CmsSitemapTreeItem item = getTreeItem(entry.getId());
        if (item != null) {
            item.updateEntry(entry);
            item.updateSitePath(entry.getSitePath());
            for (CmsClientSitemapEntry child : entry.getSubEntries()) {
                updateAll(child);
            }
        }
    }
308454
private void doUpdateRW(final Collection<String> remove, final Collection<Document> add) throws IOException
   {
      // make sure a reader is available during long updates
      if (add.size() > handler.getBufferSize())
      {
         try
         {
            releaseMultiReader();
         }
         catch (IOException e)
         {
            // do not fail if an exception is thrown here
            LOG.warn("unable to prepare index reader " + "for queries during update", e);
         }
      }

      synchronized (updateMonitor)
      {
         //updateInProgress = true;
         indexUpdateMonitor.setUpdateInProgress(true, false);
      }
      boolean flush = false;
      try
      {
         long transactionId = nextTransactionId++;
         executeAndLog(new Start(transactionId));

         for (Iterator<String> it = remove.iterator(); it.hasNext();)
         {
            executeAndLog(new DeleteNode(transactionId, it.next()));
         }
         for (Iterator<Document> it = add.iterator(); it.hasNext();)
         {
            Document doc = it.next();
            if (doc != null)
            {
               executeAndLog(new AddNode(transactionId, doc));
               // commit volatile index if needed
               flush |= checkVolatileCommit();
            }
         }
         executeAndLog(new Commit(transactionId));

         // flush whole index when volatile index has been commited.
         if (flush)
         {
            // if we are going to flush, need to set persistent update
            synchronized (updateMonitor)
            {
               indexUpdateMonitor.setUpdateInProgress(true, true);
            }
            flush();
         }
      }
      finally
      {
         synchronized (updateMonitor)
         {
            //updateInProgress = false;

            indexUpdateMonitor.setUpdateInProgress(false, flush);
            updateMonitor.notifyAll();
            releaseMultiReader();
         }
      }
   }
550622
public void updateAll(Collection<TimelineEvent> events, TimelineUpdater timelineUpdater) {
        if (events != null && !events.isEmpty()) {
            for (TimelineEvent event : events) {
                update(event, timelineUpdater);
            }
        }
    }
1285824
public void updateTeamInformation() throws HygieiaException {
		// super.objClass = ScopeOwnerCollectorItem.class;
		String returnDate = getFeatureSettings().getDeltaCollectorItemStartDate();
		if (!StringUtils.isEmpty(getMaxChangeDate())) {
			returnDate = getMaxChangeDate();
		}
		returnDate = DateUtil.getChangeDateMinutePrior(returnDate,
				getFeatureSettings().getScheduledPriorMin());
		String queryName = getFeatureSettings().getTeamQuery();
		String query = getQuery(returnDate, queryName);
		updateObjectInformation(query);
	}
168696
private synchronized void myupdate(WSStats newStats, boolean keepOld, boolean recursiveUpdate) {
        if (newStats == null)
            return;

        StatsImpl newStats1 = (StatsImpl) newStats;
        // update the level and description of this collection
        this.instrumentationLevel = newStats1.getLevel();

        // update data
        updateMembers(newStats, keepOld);

        // update subcollections
        if (recursiveUpdate)
            updateSubcollection(newStats, keepOld, recursiveUpdate);
    }
1255279
void update(Object feature) throws LayerException {
		SimpleFeatureSource source = getFeatureSource();
		if (source instanceof SimpleFeatureStore) {
			SimpleFeatureStore store = (SimpleFeatureStore) source;
			String featureId = getFeatureModel().getId(feature);
			Filter filter = filterService.createFidFilter(new String[] { featureId });
			transactionSynchronization.synchTransaction(store);
			List<Name> names = new ArrayList<Name>();
			Map<String, Attribute> attrMap = getFeatureModel().getAttributes(feature);
			List<Object> values = new ArrayList<Object>();
			for (Map.Entry<String, Attribute> entry : attrMap.entrySet()) {
				String name = entry.getKey();
				names.add(store.getSchema().getDescriptor(name).getName());
				values.add(entry.getValue().getValue());
			}

			try {
				store.modifyFeatures(names.toArray(new Name[names.size()]), values.toArray(), filter);
				store.modifyFeatures(store.getSchema().getGeometryDescriptor().getName(), getFeatureModel()
						.getGeometry(feature), filter);
				log.debug("Updated feature {} in {}", featureId, getFeatureSourceName());
			} catch (IOException ioe) {
				featureModelUsable = false;
				throw new LayerException(ioe, ExceptionCode.LAYER_MODEL_IO_EXCEPTION);
			}
		} else {
			log.error("Don't know how to create or update " + getFeatureSourceName() + ", class "
					+ source.getClass().getName() + " does not implement SimpleFeatureStore");
			throw new LayerException(ExceptionCode.CREATE_OR_UPDATE_NOT_IMPLEMENTED, getFeatureSourceName(), source
					.getClass().getName());
		}
	}
1219621
private void update() {
                if (!uptodate) {
                        summary.clear();
                        distinctTraces.clear();
                        traces.clear();
                        addTraces(allTraces, false);
                        uptodate = true;
                }
        }
208796
private void addNewJobs(Set<BambooJob> jobs, List<BambooJob> existingJobs, BambooCollector collector) {
        long start = System.currentTimeMillis();
        int count = 0;

        List<BambooJob> newJobs = new ArrayList<>();
        for (BambooJob job : jobs) {
            BambooJob existing = null;
            if (!CollectionUtils.isEmpty(existingJobs) && (existingJobs.contains(job))) {
                existing = existingJobs.get(existingJobs.indexOf(job));
            }

            String niceName = getNiceName(job, collector);
            if (existing == null) {
                job.setCollectorId(collector.getId());
                job.setEnabled(false); // Do not enable for collection. Will be enabled when added to dashboard
                job.setDescription(job.getJobName());
                job.setLastUpdated(System.currentTimeMillis());
                if (StringUtils.isNotEmpty(niceName)) {
                    job.setNiceName(niceName);
                }
                newJobs.add(job);
                count++;
            } else if (StringUtils.isEmpty(existing.getNiceName()) && StringUtils.isNotEmpty(niceName)) {
                existing.setNiceName(niceName);
                bambooJobRepository.save(existing);
            }
        }
        //save all in one shot
        if (!CollectionUtils.isEmpty(newJobs)) {
            bambooJobRepository.save(newJobs);
        }
        log("New jobs", start, count);
    }
1118849
def update_project(config, task_presenter, results,
                   long_description, tutorial, watch): # pragma: no cover
    """"""
    if watch:
        res = _update_project_watch(config, task_presenter, results,
                                    long_description, tutorial)
    else:
        res = _update_project(config, task_presenter, results,
                              long_description, tutorial)
        click.echo(res)