use of org.dashbuilder.dataset.def.DataColumnDef in project kie-wb-common by kiegroup.
the class ContributorsManager method buildDataSet.
@Override
public DataSet buildDataSet(Map<String, String> params) {
final DataSetBuilder dsBuilder = DataSetFactory.newDataSetBuilder();
for (final DataColumnDef columnDef : dataSetdef.getColumns()) {
dsBuilder.column(columnDef.getId(), columnDef.getColumnType());
}
final Collection<OrganizationalUnit> orgUnitList = organizationalUnitService.getOrganizationalUnits();
for (final OrganizationalUnit orgUnit : orgUnitList) {
final String org = orgUnit.getName();
final Collection<WorkspaceProject> projects = projectService.getAllWorkspaceProjects(orgUnit);
if (projects.isEmpty()) {
// org
dsBuilder.row(// org
org, // repo
null, // project
null, // author
null, // message
"Empty organizational unit", // date
null);
} else {
for (final WorkspaceProject project : projects) {
final String repoAlias = project.getRepository().getAlias();
final String projectName = project.getName();
org.uberfire.backend.vfs.Path rootPath = project.getRootPath();
final Path projectRoot = Paths.convert(rootPath);
final List<VersionRecord> recordList = recordService.loadVersionRecords(projectRoot);
if (recordList.isEmpty()) {
// org
dsBuilder.row(// org
org, // repo
repoAlias, // project
null, // author
null, // mesage
"Empty project", // date
null);
} else {
for (VersionRecord record : recordList) {
String alias = record.author();
String author = authorMappings.getProperty(alias);
author = author == null ? alias : author;
String msg = record.comment();
Date date = record.date();
dsBuilder.row(org, repoAlias, projectName, author, msg, date);
}
}
}
}
}
DataSet dataSet = dsBuilder.buildDataSet();
dataSet.setUUID(GIT_CONTRIB);
return dataSet;
}
Aggregations