WIP: страницы для правил #62
@ -7,9 +7,9 @@ package ru.ulstu.extractor.branch.model;
|
|||||||
|
|
||||||
import org.hibernate.annotations.Fetch;
|
import org.hibernate.annotations.Fetch;
|
||||||
import org.hibernate.annotations.FetchMode;
|
import org.hibernate.annotations.FetchMode;
|
||||||
|
import ru.ulstu.extractor.commit.model.Commit;
|
||||||
import ru.ulstu.extractor.core.BaseEntity;
|
import ru.ulstu.extractor.core.BaseEntity;
|
||||||
import ru.ulstu.extractor.gitrepository.model.GitRepository;
|
import ru.ulstu.extractor.gitrepository.model.GitRepository;
|
||||||
import ru.ulstu.extractor.model.Commit;
|
|
||||||
|
|
||||||
import javax.persistence.CascadeType;
|
import javax.persistence.CascadeType;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
@ -11,12 +11,13 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import ru.ulstu.extractor.branch.model.Branch;
|
import ru.ulstu.extractor.branch.model.Branch;
|
||||||
import ru.ulstu.extractor.branch.repository.BranchRepository;
|
import ru.ulstu.extractor.branch.repository.BranchRepository;
|
||||||
|
import ru.ulstu.extractor.commit.model.Commit;
|
||||||
import ru.ulstu.extractor.commit.service.CommitService;
|
import ru.ulstu.extractor.commit.service.CommitService;
|
||||||
import ru.ulstu.extractor.core.BaseEntity;
|
import ru.ulstu.extractor.core.BaseEntity;
|
||||||
import ru.ulstu.extractor.gitrepository.model.GitRepository;
|
import ru.ulstu.extractor.gitrepository.model.GitRepository;
|
||||||
import ru.ulstu.extractor.model.Commit;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@ -55,6 +56,10 @@ public class BranchService {
|
|||||||
return branchRepository.findByGitRepositoryAndName(gitRepository, branchName);
|
return branchRepository.findByGitRepositoryAndName(gitRepository, branchName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Optional<Branch> findByBranchId(Integer branchId) {
|
||||||
|
return branchRepository.findById(branchId);
|
||||||
|
}
|
||||||
|
|
||||||
public List<Branch> findAll() {
|
public List<Branch> findAll() {
|
||||||
return branchRepository.findAll();
|
return branchRepository.findAll();
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* You may use, distribute and modify this code, please write to: romanov73@gmail.com.
|
* You may use, distribute and modify this code, please write to: romanov73@gmail.com.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package ru.ulstu.extractor.model;
|
package ru.ulstu.extractor.commit.model;
|
||||||
|
|
||||||
import org.hibernate.annotations.Fetch;
|
import org.hibernate.annotations.Fetch;
|
||||||
import org.hibernate.annotations.FetchMode;
|
import org.hibernate.annotations.FetchMode;
|
||||||
|
@ -10,12 +10,12 @@ import org.springframework.data.domain.Pageable;
|
|||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
|
import ru.ulstu.extractor.commit.model.Commit;
|
||||||
import ru.ulstu.extractor.commit.model.CommitAuthorStatistic;
|
import ru.ulstu.extractor.commit.model.CommitAuthorStatistic;
|
||||||
import ru.ulstu.extractor.commit.model.CommitEntityStatistic;
|
import ru.ulstu.extractor.commit.model.CommitEntityStatistic;
|
||||||
import ru.ulstu.extractor.commit.model.CommitTimeStatistic;
|
import ru.ulstu.extractor.commit.model.CommitTimeStatistic;
|
||||||
import ru.ulstu.extractor.commit.model.CommitUrlStatistic;
|
import ru.ulstu.extractor.commit.model.CommitUrlStatistic;
|
||||||
import ru.ulstu.extractor.gitrepository.model.GitRepository;
|
import ru.ulstu.extractor.gitrepository.model.GitRepository;
|
||||||
import ru.ulstu.extractor.model.Commit;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -8,8 +8,8 @@ package ru.ulstu.extractor.commit.service;
|
|||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import ru.ulstu.extractor.author.service.AuthorService;
|
import ru.ulstu.extractor.author.service.AuthorService;
|
||||||
|
import ru.ulstu.extractor.commit.model.Commit;
|
||||||
import ru.ulstu.extractor.commit.repository.CommitRepository;
|
import ru.ulstu.extractor.commit.repository.CommitRepository;
|
||||||
import ru.ulstu.extractor.model.Commit;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
@ -8,7 +8,7 @@ import javax.persistence.Version;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
@MappedSuperclass
|
@MappedSuperclass
|
||||||
public abstract class BaseEntity implements Serializable, Comparable {
|
public abstract class BaseEntity implements Serializable, Comparable<BaseEntity> {
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.TABLE)
|
@GeneratedValue(strategy = GenerationType.TABLE)
|
||||||
private Integer id;
|
private Integer id;
|
||||||
@ -49,10 +49,10 @@ public abstract class BaseEntity implements Serializable, Comparable {
|
|||||||
}
|
}
|
||||||
BaseEntity other = (BaseEntity) obj;
|
BaseEntity other = (BaseEntity) obj;
|
||||||
if (id == null) {
|
if (id == null) {
|
||||||
if (other.id != null) {
|
if (other.getId() != null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (!id.equals(other.id)) {
|
} else if (!id.equals(other.getId())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -75,8 +75,8 @@ public abstract class BaseEntity implements Serializable, Comparable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(Object o) {
|
public int compareTo(BaseEntity o) {
|
||||||
return id != null ? id.compareTo(((BaseEntity) o).getId()) : -1;
|
return id != null ? id.compareTo(o.getId()) : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reset() {
|
public void reset() {
|
||||||
|
@ -13,6 +13,7 @@ public class Route {
|
|||||||
public static final String DELETE_INDEXED_REPOSITORY = "deleteRepository";
|
public static final String DELETE_INDEXED_REPOSITORY = "deleteRepository";
|
||||||
public static final String LIST_REPOSITORY_BRANCHES = "listBranches";
|
public static final String LIST_REPOSITORY_BRANCHES = "listBranches";
|
||||||
public static final String DELETE_BRANCH = "deleteBranch";
|
public static final String DELETE_BRANCH = "deleteBranch";
|
||||||
|
public static final String REINDEX_BRANCH = "reindexBranch";
|
||||||
public static final String INDEXING_NEW_REPOSITORY = "indexNewRepository";
|
public static final String INDEXING_NEW_REPOSITORY = "indexNewRepository";
|
||||||
public static final String FILTER_COMMITS = "filterCommits";
|
public static final String FILTER_COMMITS = "filterCommits";
|
||||||
public static final String STATISTIC = "statistic";
|
public static final String STATISTIC = "statistic";
|
||||||
|
@ -11,10 +11,10 @@ import org.springframework.ui.Model;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import ru.ulstu.extractor.commit.model.Commit;
|
||||||
import ru.ulstu.extractor.core.OffsetablePageRequest;
|
import ru.ulstu.extractor.core.OffsetablePageRequest;
|
||||||
import ru.ulstu.extractor.gitrepository.model.FilterForm;
|
import ru.ulstu.extractor.gitrepository.model.FilterForm;
|
||||||
import ru.ulstu.extractor.gitrepository.service.FilteringService;
|
import ru.ulstu.extractor.gitrepository.service.FilteringService;
|
||||||
import ru.ulstu.extractor.model.Commit;
|
|
||||||
import springfox.documentation.annotations.ApiIgnore;
|
import springfox.documentation.annotations.ApiIgnore;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -14,8 +14,10 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||||
import ru.ulstu.extractor.branch.model.Branch;
|
import ru.ulstu.extractor.branch.model.Branch;
|
||||||
|
import ru.ulstu.extractor.branch.service.BranchService;
|
||||||
import ru.ulstu.extractor.gitrepository.model.FilterForm;
|
import ru.ulstu.extractor.gitrepository.model.FilterForm;
|
||||||
import ru.ulstu.extractor.gitrepository.model.RepoForm;
|
import ru.ulstu.extractor.gitrepository.model.RepoForm;
|
||||||
import ru.ulstu.extractor.gitrepository.service.GitRepositoryService;
|
import ru.ulstu.extractor.gitrepository.service.GitRepositoryService;
|
||||||
@ -27,6 +29,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import static ru.ulstu.extractor.core.Route.FILTER_COMMITS;
|
import static ru.ulstu.extractor.core.Route.FILTER_COMMITS;
|
||||||
import static ru.ulstu.extractor.core.Route.INDEXING_NEW_REPOSITORY;
|
import static ru.ulstu.extractor.core.Route.INDEXING_NEW_REPOSITORY;
|
||||||
|
import static ru.ulstu.extractor.core.Route.REINDEX_BRANCH;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@ApiIgnore
|
@ApiIgnore
|
||||||
@ -34,11 +37,14 @@ public class GitIndexingController {
|
|||||||
private final static Logger LOG = LoggerFactory.getLogger(GitIndexingController.class);
|
private final static Logger LOG = LoggerFactory.getLogger(GitIndexingController.class);
|
||||||
private final GitRepositoryService gitRepositoryService;
|
private final GitRepositoryService gitRepositoryService;
|
||||||
private final IndexService indexService;
|
private final IndexService indexService;
|
||||||
|
private final BranchService branchService;
|
||||||
|
|
||||||
public GitIndexingController(GitRepositoryService gitRepositoryService,
|
public GitIndexingController(GitRepositoryService gitRepositoryService,
|
||||||
IndexService indexService) {
|
IndexService indexService,
|
||||||
|
BranchService branchService) {
|
||||||
this.gitRepositoryService = gitRepositoryService;
|
this.gitRepositoryService = gitRepositoryService;
|
||||||
this.indexService = indexService;
|
this.indexService = indexService;
|
||||||
|
this.branchService = branchService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(INDEXING_NEW_REPOSITORY)
|
@GetMapping(INDEXING_NEW_REPOSITORY)
|
||||||
@ -76,4 +82,21 @@ public class GitIndexingController {
|
|||||||
return "redirect:/" + FILTER_COMMITS;
|
return "redirect:/" + FILTER_COMMITS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping(REINDEX_BRANCH)
|
||||||
|
public String reindexBranch(Model model,
|
||||||
|
RedirectAttributes redirectAttributes,
|
||||||
|
@RequestParam Integer branchId) {
|
||||||
|
try {
|
||||||
|
indexService.index(branchId);
|
||||||
|
} catch (IOException | GitAPIException ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
model.addAttribute("error", ex.getMessage());
|
||||||
|
return INDEXING_NEW_REPOSITORY;
|
||||||
|
}
|
||||||
|
Branch branch = branchService.findByBranchId(branchId).orElseThrow(() -> new RuntimeException("Ветка не найдена по id"));
|
||||||
|
redirectAttributes.addAttribute("repositoryUrl", branch.getGitRepository().getUrl());
|
||||||
|
redirectAttributes.addAttribute("branchName", branch.getName());
|
||||||
|
return "redirect:/" + FILTER_COMMITS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,9 +12,9 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import ru.ulstu.extractor.commit.model.Commit;
|
||||||
import ru.ulstu.extractor.gitrepository.service.GitRepositoryService;
|
import ru.ulstu.extractor.gitrepository.service.GitRepositoryService;
|
||||||
import ru.ulstu.extractor.gitrepository.service.IndexService;
|
import ru.ulstu.extractor.gitrepository.service.IndexService;
|
||||||
import ru.ulstu.extractor.model.Commit;
|
|
||||||
import ru.ulstu.extractor.util.HttpUtils;
|
import ru.ulstu.extractor.util.HttpUtils;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
package ru.ulstu.extractor.gitrepository.model;
|
package ru.ulstu.extractor.gitrepository.model;
|
||||||
|
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import ru.ulstu.extractor.model.Commit;
|
import ru.ulstu.extractor.commit.model.Commit;
|
||||||
|
|
||||||
public class FilterForm {
|
public class FilterForm {
|
||||||
private String filter;
|
private String filter;
|
||||||
|
@ -10,9 +10,9 @@ import org.springframework.data.domain.Page;
|
|||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import ru.ulstu.extractor.author.repository.AuthorRepository;
|
import ru.ulstu.extractor.author.repository.AuthorRepository;
|
||||||
|
import ru.ulstu.extractor.commit.model.Commit;
|
||||||
import ru.ulstu.extractor.commit.repository.CommitRepository;
|
import ru.ulstu.extractor.commit.repository.CommitRepository;
|
||||||
import ru.ulstu.extractor.gitrepository.repository.GitRepositoryRepository;
|
import ru.ulstu.extractor.gitrepository.repository.GitRepositoryRepository;
|
||||||
import ru.ulstu.extractor.model.Commit;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -20,6 +20,7 @@ import org.springframework.data.domain.Pageable;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import ru.ulstu.extractor.author.model.Author;
|
import ru.ulstu.extractor.author.model.Author;
|
||||||
import ru.ulstu.extractor.branch.model.Branch;
|
import ru.ulstu.extractor.branch.model.Branch;
|
||||||
|
import ru.ulstu.extractor.commit.model.Commit;
|
||||||
import ru.ulstu.extractor.gitrepository.model.FileChange;
|
import ru.ulstu.extractor.gitrepository.model.FileChange;
|
||||||
import ru.ulstu.extractor.gitrepository.model.GitRepository;
|
import ru.ulstu.extractor.gitrepository.model.GitRepository;
|
||||||
import ru.ulstu.extractor.gitrepository.model.LineChange;
|
import ru.ulstu.extractor.gitrepository.model.LineChange;
|
||||||
@ -28,7 +29,6 @@ import ru.ulstu.extractor.heuristic.model.BusinessLogicUnit;
|
|||||||
import ru.ulstu.extractor.heuristic.model.EntityUnit;
|
import ru.ulstu.extractor.heuristic.model.EntityUnit;
|
||||||
import ru.ulstu.extractor.heuristic.model.ResourceUnit;
|
import ru.ulstu.extractor.heuristic.model.ResourceUnit;
|
||||||
import ru.ulstu.extractor.heuristic.service.StructuralUnitService;
|
import ru.ulstu.extractor.heuristic.service.StructuralUnitService;
|
||||||
import ru.ulstu.extractor.model.Commit;
|
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -12,9 +12,9 @@ import org.slf4j.LoggerFactory;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import ru.ulstu.extractor.branch.model.Branch;
|
import ru.ulstu.extractor.branch.model.Branch;
|
||||||
import ru.ulstu.extractor.branch.service.BranchService;
|
import ru.ulstu.extractor.branch.service.BranchService;
|
||||||
|
import ru.ulstu.extractor.commit.model.Commit;
|
||||||
import ru.ulstu.extractor.gitrepository.model.GitRepository;
|
import ru.ulstu.extractor.gitrepository.model.GitRepository;
|
||||||
import ru.ulstu.extractor.gitrepository.repository.GitRepositoryRepository;
|
import ru.ulstu.extractor.gitrepository.repository.GitRepositoryRepository;
|
||||||
import ru.ulstu.extractor.model.Commit;
|
|
||||||
import ru.ulstu.extractor.ts.creator.AbstractTimeSeriesCreator;
|
import ru.ulstu.extractor.ts.creator.AbstractTimeSeriesCreator;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -40,6 +40,11 @@ public class IndexService {
|
|||||||
this.timeSeriesCreators = timeSeriesCreators;
|
this.timeSeriesCreators = timeSeriesCreators;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void index(@NotNull Integer branchId) throws GitAPIException, IOException {
|
||||||
|
Branch branch = branchService.findByBranchId(branchId).orElseThrow(() -> new RuntimeException("Ветка репозитория не найдена по id"));
|
||||||
|
index(branch.getGitRepository().getUrl(), branch.getName());
|
||||||
|
}
|
||||||
|
|
||||||
public void index(@NotNull String repositoryUrl, @NotNull String branchName) throws GitAPIException, IOException {
|
public void index(@NotNull String repositoryUrl, @NotNull String branchName) throws GitAPIException, IOException {
|
||||||
GitRepository gitRepository = gitRepositoryRepository.findByUrl(repositoryUrl);
|
GitRepository gitRepository = gitRepositoryRepository.findByUrl(repositoryUrl);
|
||||||
if (gitRepository == null) {
|
if (gitRepository == null) {
|
||||||
|
@ -4,6 +4,7 @@ import org.springframework.stereotype.Component;
|
|||||||
import ru.ulstu.extractor.author.model.Author;
|
import ru.ulstu.extractor.author.model.Author;
|
||||||
import ru.ulstu.extractor.author.service.AuthorService;
|
import ru.ulstu.extractor.author.service.AuthorService;
|
||||||
import ru.ulstu.extractor.branch.service.BranchService;
|
import ru.ulstu.extractor.branch.service.BranchService;
|
||||||
|
import ru.ulstu.extractor.commit.model.Commit;
|
||||||
import ru.ulstu.extractor.commit.service.CommitService;
|
import ru.ulstu.extractor.commit.service.CommitService;
|
||||||
import ru.ulstu.extractor.gitrepository.model.GitRepository;
|
import ru.ulstu.extractor.gitrepository.model.GitRepository;
|
||||||
import ru.ulstu.extractor.gitrepository.service.GitRepositoryService;
|
import ru.ulstu.extractor.gitrepository.service.GitRepositoryService;
|
||||||
@ -45,7 +46,7 @@ public class AuthorTS extends AbstractTimeSeriesCreator {
|
|||||||
List<TimeSeries> timeSeriesResult = new ArrayList<>();
|
List<TimeSeries> timeSeriesResult = new ArrayList<>();
|
||||||
List<Author> authors = authorService.findAll();
|
List<Author> authors = authorService.findAll();
|
||||||
GitRepository gitRepository = gitRepositoryService.findById(repositoryId);
|
GitRepository gitRepository = gitRepositoryService.findById(repositoryId);
|
||||||
List<ru.ulstu.extractor.model.Commit> commits = new ArrayList<>(commitService.findByRepositoryIdAndName(repositoryId, branchName));
|
List<Commit> commits = new ArrayList<>(commitService.findByRepositoryIdAndName(repositoryId, branchName));
|
||||||
for (Author author : authors) {
|
for (Author author : authors) {
|
||||||
TimeSeries timeSeries = new TimeSeries(
|
TimeSeries timeSeries = new TimeSeries(
|
||||||
String.format("%s %s %s %s",
|
String.format("%s %s %s %s",
|
||||||
@ -55,7 +56,7 @@ public class AuthorTS extends AbstractTimeSeriesCreator {
|
|||||||
getTimeSeriesType().getDescription()),
|
getTimeSeriesType().getDescription()),
|
||||||
branchService.findByRepositoryAndName(gitRepository, branchName),
|
branchService.findByRepositoryAndName(gitRepository, branchName),
|
||||||
getTimeSeriesType());
|
getTimeSeriesType());
|
||||||
for (ru.ulstu.extractor.model.Commit commit : commits) {
|
for (Commit commit : commits) {
|
||||||
if (commit.getAuthor().equals(author)) {
|
if (commit.getAuthor().equals(author)) {
|
||||||
timeSeries.getValues().add(new TimeSeriesValue(commit.getDate(), 1.0));
|
timeSeries.getValues().add(new TimeSeriesValue(commit.getDate(), 1.0));
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package ru.ulstu.extractor.ts.creator;
|
|||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import ru.ulstu.extractor.branch.service.BranchService;
|
import ru.ulstu.extractor.branch.service.BranchService;
|
||||||
|
import ru.ulstu.extractor.commit.model.Commit;
|
||||||
import ru.ulstu.extractor.commit.service.CommitService;
|
import ru.ulstu.extractor.commit.service.CommitService;
|
||||||
import ru.ulstu.extractor.gitrepository.model.FileChange;
|
import ru.ulstu.extractor.gitrepository.model.FileChange;
|
||||||
import ru.ulstu.extractor.gitrepository.model.GitRepository;
|
import ru.ulstu.extractor.gitrepository.model.GitRepository;
|
||||||
@ -61,9 +62,9 @@ public class EntityTS extends AbstractTimeSeriesCreator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Double findEntity(Integer repositoryId, String branchName) {
|
public Double findEntity(Integer repositoryId, String branchName) {
|
||||||
List<ru.ulstu.extractor.model.Commit> commits = new ArrayList<>(commitService.findByRepositoryIdAndName(repositoryId, branchName));
|
List<Commit> commits = new ArrayList<>(commitService.findByRepositoryIdAndName(repositoryId, branchName));
|
||||||
double value = 0;
|
double value = 0;
|
||||||
for (ru.ulstu.extractor.model.Commit commit : commits) {
|
for (Commit commit : commits) {
|
||||||
for (FileChange fileChange : commit.getFileChanges()) {
|
for (FileChange fileChange : commit.getFileChanges()) {
|
||||||
if ((fileChange.getContainsEntity() != null) && (fileChange.getContainsEntity())) {
|
if ((fileChange.getContainsEntity() != null) && (fileChange.getContainsEntity())) {
|
||||||
value = value + 1;
|
value = value + 1;
|
||||||
|
@ -2,11 +2,11 @@ package ru.ulstu.extractor.ts.creator;
|
|||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import ru.ulstu.extractor.branch.service.BranchService;
|
import ru.ulstu.extractor.branch.service.BranchService;
|
||||||
|
import ru.ulstu.extractor.commit.model.Commit;
|
||||||
import ru.ulstu.extractor.commit.service.CommitService;
|
import ru.ulstu.extractor.commit.service.CommitService;
|
||||||
import ru.ulstu.extractor.gitrepository.model.FileChange;
|
import ru.ulstu.extractor.gitrepository.model.FileChange;
|
||||||
import ru.ulstu.extractor.gitrepository.model.GitRepository;
|
import ru.ulstu.extractor.gitrepository.model.GitRepository;
|
||||||
import ru.ulstu.extractor.gitrepository.service.GitRepositoryService;
|
import ru.ulstu.extractor.gitrepository.service.GitRepositoryService;
|
||||||
import ru.ulstu.extractor.model.Commit;
|
|
||||||
import ru.ulstu.extractor.ts.model.TimeSeries;
|
import ru.ulstu.extractor.ts.model.TimeSeries;
|
||||||
import ru.ulstu.extractor.ts.model.TimeSeriesType;
|
import ru.ulstu.extractor.ts.model.TimeSeriesType;
|
||||||
import ru.ulstu.extractor.ts.model.TimeSeriesValue;
|
import ru.ulstu.extractor.ts.model.TimeSeriesValue;
|
||||||
|
@ -12,7 +12,6 @@ import org.springframework.stereotype.Service;
|
|||||||
import ru.ulstu.extractor.branch.model.Branch;
|
import ru.ulstu.extractor.branch.model.Branch;
|
||||||
import ru.ulstu.extractor.http.HttpService;
|
import ru.ulstu.extractor.http.HttpService;
|
||||||
import ru.ulstu.extractor.http.JsonTimeSeries;
|
import ru.ulstu.extractor.http.JsonTimeSeries;
|
||||||
import ru.ulstu.extractor.http.SmoothingTimeSeries;
|
|
||||||
import ru.ulstu.extractor.ts.model.TimeSeries;
|
import ru.ulstu.extractor.ts.model.TimeSeries;
|
||||||
import ru.ulstu.extractor.ts.model.TimeSeriesType;
|
import ru.ulstu.extractor.ts.model.TimeSeriesType;
|
||||||
import ru.ulstu.extractor.ts.model.TimeSeriesValue;
|
import ru.ulstu.extractor.ts.model.TimeSeriesValue;
|
||||||
@ -115,9 +114,9 @@ public class TimeSeriesService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Double getLastTimeSeriesTendency(TimeSeries ts) {
|
public Double getLastTimeSeriesTendency(TimeSeries ts) {
|
||||||
JSONObject response = httpService.post(TIME_SERIES_TENDENCY_URL, new JSONObject(new SmoothingTimeSeries(ts)));
|
//JSONObject response = httpService.post(TIME_SERIES_TENDENCY_URL, new JSONObject(new SmoothingTimeSeries(ts)));
|
||||||
LOG.debug("Успешно отправлен на сервис сглаживания");
|
LOG.debug("Успешно отправлен на сервис сглаживания");
|
||||||
response.get("timeSeries");
|
//response.get("timeSeries");
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,10 @@
|
|||||||
th:text="${branch.name}"/>
|
th:text="${branch.name}"/>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
<a role="button" class="btn btn-primary" title="Повторить индексацию ветки"
|
||||||
|
th:href="@{'reindexBranch?branchId=' + ${branch.id}}">
|
||||||
|
<i class="fa fa-repeat" aria-hidden="true"></i>
|
||||||
|
</a>
|
||||||
<a role="button" class="btn btn-danger"
|
<a role="button" class="btn btn-danger"
|
||||||
th:href="@{'deleteBranch?id=' + ${branch.id} + '&repositoryId='+${repository.id}}"
|
th:href="@{'deleteBranch?id=' + ${branch.id} + '&repositoryId='+${repository.id}}"
|
||||||
onclick="return confirm('Удалить ветку?')">
|
onclick="return confirm('Удалить ветку?')">
|
||||||
|
Loading…
Reference in New Issue
Block a user