use of net.geoprism.registry.excel.ListTypeExcelExporter.ListTypeExcelExporterSheet in project geoprism-registry by terraframe.
the class ListTypeShapefileExporter method writeDictionaryFile.
/**
* Writes an additional "data dictionary" / metadata excel spreadsheet to the
* directory, which is intended to be part of the final Shapfile. This is
* useful for downstream developers trying to make sense of the GIS data.
*
* See also: - https://github.com/terraframe/geoprism-registry/issues/628
*/
private void writeDictionaryFile(File directory) {
MdBusinessDAOIF mdBusiness = MdBusinessDAO.get(this.version.getMdBusinessOid());
List<? extends MdAttributeConcreteDAOIF> mdAttributes = mdBusiness.definesAttributesOrdered().stream().filter(mdAttribute -> this.version.isValid(mdAttribute)).collect(Collectors.toList());
mdAttributes = mdAttributes.stream().filter(mdAttribute -> !mdAttribute.definesAttribute().equals("invalid")).collect(Collectors.toList());
try {
File file = new File(directory, "metadata.xlsx");
FileOutputStream fos = new FileOutputStream(file);
ListTypeExcelExporter exporter = new ListTypeExcelExporter(this.version, mdBusiness, mdAttributes, new ListTypeExcelExporterSheet[] { ListTypeExcelExporterSheet.DICTIONARY, ListTypeExcelExporterSheet.METADATA }, criteria);
Workbook wb = exporter.createWorkbook();
wb.write(fos);
} catch (IOException e) {
throw new ProgrammingErrorException(e);
}
}
Aggregations