Search in sources :

Example 1 with SCMFileChangeFilters

use of net.nemerosa.ontrack.extension.scm.model.SCMFileChangeFilters in project ontrack by nemerosa.

the class SCMController method createChangeLogFileFilter.

/**
 * Adding a change log file filter
 */
@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).orElse(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());
    });
}
Also used : Project(net.nemerosa.ontrack.model.structure.Project) SCMFileChangeFilters(net.nemerosa.ontrack.extension.scm.model.SCMFileChangeFilters)

Aggregations

SCMFileChangeFilters (net.nemerosa.ontrack.extension.scm.model.SCMFileChangeFilters)1 Project (net.nemerosa.ontrack.model.structure.Project)1