Provides list of files related to the change.
@param gerritQueryHandler the query handler, responsible for the queries to gerrit.
@param changeId the Gerrit change id.
@return list of files from the change, null in case of errors
9302
public static List<String> getFilesByChange(GerritQueryHandler gerritQueryHandler, String changeId) {
        try {
            List<JSONObject> jsonList = gerritQueryHandler.queryFiles("change:" + changeId);
            for (JSONObject json : jsonList) {
                if (json.has("type") && "stats".equalsIgnoreCase(json.getString("type"))) {
                    continue;
                }
                if (json.has("currentPatchSet")) {
                    JSONObject currentPatchSet = json.getJSONObject("currentPatchSet");
                    if (currentPatchSet.has("files")) {
                        JSONArray changedFiles = currentPatchSet.optJSONArray("files");
                        int numberOfFiles = changedFiles.size();

                        if (numberOfFiles > 0) {
                            List<String> files = new ArrayList<String>(numberOfFiles);
                            for (int i = 0; i < changedFiles.size(); i++) {
                                JSONObject file = changedFiles.getJSONObject(i);
                                files.add(file.getString("file"));
                            }
                            return files;
                        }
                    }

                    break;
                }
            }
        } catch (IOException e) {
            logger.error("IOException occurred. ", e);
        } catch (GerritQueryException e) {
            logger.error("Bad query. ", e);
        }
        return null;
    }
818448
@NonNull
    public ListenerToken addDocumentChangeListener(
        @NonNull String id,
        @NonNull DocumentChangeListener listener) {
        return addDocumentChangeListener(id, null, listener);
    }
258629
public function changeRecordListing(Request $request, $contenttype, $contentid)
    {
        // We have to handle three cases here:
        // - $contenttype and $contentid given: get changelog entries for *one* content item
        // - only $contenttype given: get changelog entries for all items of that type
        // - neither given: get all changelog entries

        $page = $request->get('page');
        $pagination = $this->getPagination($page);
        $queryOptions = $this->getQueryOptions($pagination);

        if (empty($contenttype)) {
            // Case 1: No content type given, show from *all* items. This is easy:
            $data = [
                'title'   => Trans::__('logs.change-log.contenttypes.all'),
                'entries' => $this->changeLogRepository()->getChangeLog($queryOptions),
                'count'   => $this->changeLogRepository()->count(),
                'content' => null,
            ];
        } else {
            $contenttype = $this->getContentType($contenttype);
            $data = $this->manager()->getListingData($contenttype, $contentid, $queryOptions);
        }

        $context = [
            'contenttype' => $contenttype,
            'entry'       => null,
            'entries'     => $data['entries'],
            'content'     => $data['content'],
            'title'       => $data['title'],
            'currentpage' => $pagination['page'],
            'pagecount'   => $pagination['limit'] ? ceil($data['count'] / $pagination['limit']) : null,
        ];

        return $this->render('@bolt/changelog/changelog_record_all.twig', $context);
    }
848292
@RequestMapping(value = "changelog/{uuid}/issues", method = RequestMethod.GET)
    public SVNChangeLogIssues changeLogIssues(@PathVariable String uuid) {
        // Gets the change log
        SVNChangeLog changeLog = getChangeLog(uuid);
        // Cached?
        SVNChangeLogIssues issues = changeLog.getIssues();
        if (issues != null) {
            return issues;
        }
        // Loads the issues
        issues = changeLogService.getChangeLogIssues(changeLog);
        // Stores in cache
        logCache.put(uuid, changeLog.withIssues(issues));
        // OK
        return issues;
    }
74295
@RequestMapping(value = "changeLog/fileFilter/{projectId}/{name}/delete", method = RequestMethod.DELETE)
    public Ack deleteChangeLogFileFilter(@PathVariable ID projectId, @PathVariable String name) {
        securityService.checkProjectFunction(projectId.get(), ProjectConfig.class);
        securityService.asAdmin(() ->
                        entityDataService.withData(
                                structureService.getProject(projectId),
                                SCMFileChangeFilters.class.getName(),
                                SCMFileChangeFilters.class,
                                (SCMFileChangeFilters filters) -> filters.remove(name)
                        )
        );
        return Ack.OK;
    }
942719
public ChangesHolder getChanges(final Set<String> removedNodes, final Set<String> addedNodes)
   {
      if (handler != null)
      {
         Iterator<NodeData> addedStates = new Iterator<NodeData>()
         {
            private final Iterator<String> iter = addedNodes.iterator();

            public boolean hasNext()
            {
               return iter.hasNext();
            }

            public NodeData next()
            {

               // cycle till find a next or meet the end of set
               do
               {
                  String id = iter.next();
                  try
                  {
                     ItemData item = itemMgr.getItemData(id);
                     if (item != null)
                     {
                        if (item.isNode())
                        {
                           if (!indexingTree.isExcluded(item))
                           {
                              return (NodeData)item;
                           }
                        }
                        else
                        {
                           LOG.warn("Node not found, but property " + id + ", " + item.getQPath().getAsString()
                              + " found. ");
                        }
                     }
                     else
                     {
                        LOG.warn("Unable to index node with id " + id + ", node does not exist.");
                     }

                  }
                  catch (RepositoryException e)
                  {
                     LOG.error("Can't read next node data " + id, e);
                  }
               }
               while (iter.hasNext()); // get next if error or node not found

               return null; // we met the end of iterator set
            }

            public void remove()
            {
               throw new UnsupportedOperationException();
            }
         };

         Iterator<String> removedIds = new Iterator<String>()
         {
            private final Iterator<String> iter = removedNodes.iterator();

            public boolean hasNext()
            {
               return iter.hasNext();
            }

            public String next()
            {
               return nextNodeId();
            }

            public String nextNodeId() throws NoSuchElementException
            {
               return iter.next();
            }

            public void remove()
            {
               throw new UnsupportedOperationException();

            }
         };

         if (removedNodes.size() > 0 || addedNodes.size() > 0)
         {
            return handler.getChanges(removedIds, addedStates);
         }
      }
      return null;
   }
1153904
@RequestMapping(value = "changelog/export", method = RequestMethod.GET)
    public ResponseEntity<String> changeLog(IssueChangeLogExportRequest request) {
        // Gets the change log
        SVNChangeLog changeLog = changeLogService.changeLog(request);
        // Gets the issue service
        ConfiguredIssueService configuredIssueService = changeLog.getRepository().getConfiguredIssueService();
        if (configuredIssueService == null) {
            return new ResponseEntity<>(
                    "The branch is not configured for issues",
                    HttpStatus.NO_CONTENT
            );
        }
        // Gets the issue change log
        SVNChangeLogIssues changeLogIssues = changeLogService.getChangeLogIssues(changeLog);
        // List of issues
        List<Issue> issues = changeLogIssues.getList().stream()
                .map(SCMChangeLogIssue::getIssue)
                .collect(Collectors.toList());
        // Exports the change log using the given format
        ExportedIssues exportedChangeLogIssues = configuredIssueService.getIssueServiceExtension()
                .exportIssues(
                        configuredIssueService.getIssueServiceConfiguration(),
                        issues,
                        request
                );
        // Content type
        HttpHeaders responseHeaders = new HttpHeaders();
        responseHeaders.set("Content-Type", exportedChangeLogIssues.getFormat());
        // Body and headers
        return new ResponseEntity<>(exportedChangeLogIssues.getContent(), responseHeaders, HttpStatus.OK);
    }
1102792
public synchronized ChangedFile reserve() {
        if (fileList.isEmpty() || shutdown) {
            return null;
        }

        String key = fileList.keySet().iterator().next();
        ChangedFile changedFile = fileList.remove(key);
        reservedFiles.put(key, changedFile);
        incrementVersion();
        fireChangedEventAsync();
        return changedFile;
    }
1113350
public void addChangelogFile(File changelogFile) throws IOException, ChangelogParseException {
		new ChangelogHandler(this.format.getHeader()).addChangeLog(changelogFile);
	}
1327178
function(object, data, changeRecord, except) {
            data.handlers.forEach(function(hdata) {
                var acceptList = hdata.observed.get(object).acceptList;
                // If except is defined, Notifier.performChange has been
                // called, with except as the type.
                // All the handlers that accepts that type are skipped.
                if ((typeof except !== "string"
                        || inArray(acceptList, except) === -1)
                        && inArray(acceptList, changeRecord.type) > -1)
                    hdata.changeRecords.push(changeRecord);
            });
        }
588331
@SuppressWarnings("WeakerAccess")
    public void addChangeListener(@NonNull ControllerChangeListener changeListener) {
        if (!changeListeners.contains(changeListener)) {
            changeListeners.add(changeListener);
        }
    }
881947
@Override
    protected ChangeSet getFilteredChangeSet(ChangeSet changeSet) {
        changeSet = super.getFilteredChangeSet(changeSet);
        if (changeSet != null && !changeSet.isEmpty() && xmlFlatteningEnabled && reindexItemsOnComponentUpdates) {
            List<String> createdFiles = changeSet.getCreatedFiles();
            List<String> updatedFiles = changeSet.getUpdatedFiles();
            List<String> deletedFiles = changeSet.getDeletedFiles();
            List<String> newUpdatedFiles = new ArrayList<>(updatedFiles);

            if (CollectionUtils.isNotEmpty(createdFiles)) {
                for (String path : createdFiles) {
                    if (isComponent(path)) {
                        addItemsThatIncludeComponentToUpdatedFiles(path, createdFiles, newUpdatedFiles, deletedFiles);
                    }
                }
            }

            if (CollectionUtils.isNotEmpty(updatedFiles)) {
                for (String path : updatedFiles) {
                    if (isComponent(path)) {
                        addItemsThatIncludeComponentToUpdatedFiles(path, createdFiles, newUpdatedFiles, deletedFiles);
                    }
                }
            }


            if (CollectionUtils.isNotEmpty(deletedFiles)) {
                for (String path : deletedFiles) {
                    if (isComponent(path)) {
                        addItemsThatIncludeComponentToUpdatedFiles(path, createdFiles, newUpdatedFiles, deletedFiles);
                    }
                }
            }

            return new ChangeSet(createdFiles, newUpdatedFiles, deletedFiles);
        } else {
            return changeSet;
        }
    }
4658
public ChangesetInfo get(long id)
	{
		SingleElementHandler<ChangesetInfo> handler = new SingleElementHandler<>();
		String query = CHANGESET + "/" + id + "?include_discussion=true";
		try
		{
			osm.makeAuthenticatedRequest(query, null, new ChangesetParser(handler));
		}
		catch(OsmNotFoundException e)
		{
			return null;
		}
		return handler.get();
	}
112528
protected Set<String> getChangedDotFiles() {
		Set<String> generatedFiles = getGeneratedFiles();

		// If there is no status file to compare against or no files are
		// generated then skip image generation
		if (generatedFiles == null || generatedFiles.isEmpty()) {
			return null;
		}

		// Check if images for generated dot files are missing or outdated
		Set<String> changedDotFiles = new HashSet<String>();
		for (String generatedFile : generatedFiles) {
			if (generatedFile.endsWith(".dot")) {
				File dotFile = new File(getProject().getBasedir(),
						generatedFile);
				File imageFile = new File(getProject().getBasedir(),
						generatedFile + ".png");
				if (!imageFile.exists()
						|| imageFile.lastModified() < dotFile.lastModified()) {
					changedDotFiles.add(generatedFile);
				}
			}
		}

		// Print info of result
		if (changedDotFiles.size() == 1) {
			String fileName = changedDotFiles.iterator().next();
			if (fileName.startsWith(project.getBasedir().getAbsolutePath())) {
				fileName = fileName.substring(project.getBasedir()
						.getAbsolutePath().length() + 1);
			}
			final String message = MessageFormat.format(
					"\"{0}\" has been changed", fileName);
			getLog().info(message);
		} else if (changedDotFiles.size() > 1) {
			final String message = MessageFormat.format(
					"{0} dot files have been changed", changedDotFiles.size());
			getLog().info(message);
		} else {
			getLog().info(
					"Everything is up to date - no image generation is needed");
		}
		return changedDotFiles;
	}
468010
function _enqueueChangeRecord(object, changeRecord) {
        var notifier = Object.getNotifier(object),
            changeType = changeRecord.type,
            activeChanges = activeChangesMap.get(notifier),
            changeObservers = changeObserversMap.get(notifier);

        for (var i = 0, l = changeObservers.length; i < l; i++) {
            var observerRecord = changeObservers[i],
                acceptList = observerRecord.accept;
            if (_shouldDeliverToObserver(activeChanges, acceptList, changeType)) {
                var observer = observerRecord.callback,
                    pendingChangeRecords = [];
                if (!pendingChangesMap.has(observer))  {
                    pendingChangesMap.set(observer, pendingChangeRecords);
                } else {
                    pendingChangeRecords = pendingChangesMap.get(observer);
                }
                pendingChangeRecords.push(changeRecord);
            }
        }
        setUpChangesDelivery();
    }
704695
@RequestMapping(value = "changeLog/fileFilter/{projectId}/create", method = RequestMethod.POST)
    public Resource<SCMFileChangeFilter> createChangeLogFileFilter(@PathVariable ID projectId, @RequestBody SCMFileChangeFilter filter) {
        securityService.checkProjectFunction(projectId.get(), ProjectConfig.class);
        return securityService.asAdmin(() -> {
            // Loads the project
            Project project = structureService.getProject(projectId);
            // Gets the store
            SCMFileChangeFilters config = entityDataService.retrieve(
                    project,
                    SCMFileChangeFilters.class.getName(),
                    SCMFileChangeFilters.class
            );
            if (config == null) config = SCMFileChangeFilters.create();
            // Updates the store
            config = config.save(filter);
            // Saves the store back
            entityDataService.store(project, SCMFileChangeFilters.class.getName(), config);
            // OK
            return getChangeLogFileFilter(projectId, filter.getName());
        });
    }
1249930
public final ConfigChanges deleted(String schemaName, Collection<String> instanceIds) {
        ConfigChanges changes = new ConfigChanges();
        for (String instanceId : instanceIds) {
            BeanId id = BeanId.create(instanceId, schemaName);
            Optional<Bean> before = beanManager.getEager(id);
            if (!before.isPresent()) {
                throw Events.CFG304_BEAN_DOESNT_EXIST(id);
            }
            Bean bean = before.get();
            schemaManager.setSchema(Arrays.asList(bean));
            changes.add(ConfigChange.deleted(bean));
        }
        return changes;
    }