use of com.helger.pd.indexer.storage.PDStoredMLName in project phoss-directory by phax.
the class PDCommonUI method getUIFilteredNames.
@Nonnull
public static ICommonsList<PDStoredMLName> getUIFilteredNames(@Nonnull final ICommonsList<PDStoredMLName> aNames, @Nonnull final Locale aDisplayLocale) {
final String sDisplayLanguage = LocaleHelper.getValidLanguageCode(aDisplayLocale.getLanguage());
ICommonsList<PDStoredMLName> ret = CommonsArrayList.createFiltered(aNames, x -> x.hasLanguageCode(sDisplayLanguage));
if (ret.isEmpty()) {
// Filter matched no entry - take all names
ret = aNames.getClone();
}
return ret;
}
use of com.helger.pd.indexer.storage.PDStoredMLName in project phoss-directory by phax.
the class ExportAllManager method queryAllContainedBusinessCardsAsCSV.
public static void queryAllContainedBusinessCardsAsCSV(@Nonnull final EQueryMode eQueryMode, @Nonnull @WillNotClose final CSVWriter aCSVWriter) throws IOException {
_unify(aCSVWriter);
final Query aQuery = eQueryMode.getEffectiveQuery(new MatchAllDocsQuery());
aCSVWriter.writeNext("Participant ID", "Names (per-row)", "Country code", "Geo info", "Identifier schemes", "Identifier values", "Websites", "Contact type", "Contact name", "Contact phone", "Contact email", "Additional info", "Registration date", "Document types");
final Consumer<? super PDStoredBusinessEntity> aConsumer = aEntity -> {
aCSVWriter.writeNext(aEntity.getParticipantID().getURIEncoded(), StringHelper.getImplodedMapped("\n", aEntity.names(), PDStoredMLName::getNameAndLanguageCode), aEntity.getCountryCode(), aEntity.getGeoInfo(), StringHelper.getImplodedMapped("\n", aEntity.identifiers(), PDStoredIdentifier::getScheme), StringHelper.getImplodedMapped("\n", aEntity.identifiers(), PDStoredIdentifier::getValue), StringHelper.getImploded("\n", aEntity.websiteURIs()), StringHelper.getImplodedMapped("\n", aEntity.contacts(), PDStoredContact::getType), StringHelper.getImplodedMapped("\n", aEntity.contacts(), PDStoredContact::getName), StringHelper.getImplodedMapped("\n", aEntity.contacts(), PDStoredContact::getPhone), StringHelper.getImplodedMapped("\n", aEntity.contacts(), PDStoredContact::getEmail), aEntity.getAdditionalInformation(), aEntity.getRegistrationDate() == null ? "" : aEntity.getRegistrationDate().toString(), StringHelper.getImplodedMapped("\n", aEntity.documentTypeIDs(), IDocumentTypeIdentifier::getURIEncoded));
};
PDMetaManager.getStorageMgr().searchAllDocuments(aQuery, -1, aConsumer);
aCSVWriter.flush();
}
use of com.helger.pd.indexer.storage.PDStoredMLName in project phoss-directory by phax.
the class ExportAllManager method queryAllContainedBusinessCardsAsExcel.
@Nonnull
public static WorkbookCreationHelper queryAllContainedBusinessCardsAsExcel(@Nonnull final EQueryMode eQueryMode, final boolean bIncludeDocTypes) throws IOException {
final Query aQuery = eQueryMode.getEffectiveQuery(new MatchAllDocsQuery());
final ExcelStyle ES_DATE = new ExcelStyle().setDataFormat("yyyy-mm-dd");
final ExcelStyle ES_WRAP = new ExcelStyle().setWrapText(true);
@WillNotClose final WorkbookCreationHelper aWBCH = new WorkbookCreationHelper(EExcelVersion.XLSX);
aWBCH.createNewSheet();
aWBCH.addRow();
aWBCH.addCell("Participant ID");
aWBCH.addCell("Names (per-row)");
aWBCH.addCell("Country code");
aWBCH.addCell("Geo info");
aWBCH.addCell("Identifier schemes");
aWBCH.addCell("Identifier values");
aWBCH.addCell("Websites");
aWBCH.addCell("Contact type");
aWBCH.addCell("Contact name");
aWBCH.addCell("Contact phone");
aWBCH.addCell("Contact email");
aWBCH.addCell("Additional info");
aWBCH.addCell("Registration date");
if (bIncludeDocTypes)
aWBCH.addCell("Document types");
final Consumer<? super PDStoredBusinessEntity> aConsumer = aEntity -> {
aWBCH.addRow();
aWBCH.addCell(aEntity.getParticipantID().getURIEncoded());
aWBCH.addCell(StringHelper.getImplodedMapped("\n", aEntity.names(), PDStoredMLName::getNameAndLanguageCode));
aWBCH.addCellStyle(ES_WRAP);
aWBCH.addCell(aEntity.getCountryCode());
aWBCH.addCell(aEntity.getGeoInfo());
aWBCH.addCellStyle(ES_WRAP);
aWBCH.addCell(StringHelper.getImplodedMapped("\n", aEntity.identifiers(), PDStoredIdentifier::getScheme));
aWBCH.addCellStyle(ES_WRAP);
aWBCH.addCell(StringHelper.getImplodedMapped("\n", aEntity.identifiers(), PDStoredIdentifier::getValue));
aWBCH.addCellStyle(ES_WRAP);
aWBCH.addCell(StringHelper.getImploded("\n", aEntity.websiteURIs()));
aWBCH.addCellStyle(ES_WRAP);
aWBCH.addCell(StringHelper.getImplodedMapped("\n", aEntity.contacts(), PDStoredContact::getType));
aWBCH.addCellStyle(ES_WRAP);
aWBCH.addCell(StringHelper.getImplodedMapped("\n", aEntity.contacts(), PDStoredContact::getName));
aWBCH.addCellStyle(ES_WRAP);
aWBCH.addCell(StringHelper.getImplodedMapped("\n", aEntity.contacts(), PDStoredContact::getPhone));
aWBCH.addCellStyle(ES_WRAP);
aWBCH.addCell(StringHelper.getImplodedMapped("\n", aEntity.contacts(), PDStoredContact::getEmail));
aWBCH.addCellStyle(ES_WRAP);
aWBCH.addCell(aEntity.getAdditionalInformation());
aWBCH.addCellStyle(ES_WRAP);
aWBCH.addCell(aEntity.getRegistrationDate());
aWBCH.addCellStyle(ES_DATE);
if (bIncludeDocTypes) {
aWBCH.addCell(StringHelper.getImplodedMapped("\n", aEntity.documentTypeIDs(), IDocumentTypeIdentifier::getURIEncoded));
aWBCH.addCellStyle(ES_WRAP);
}
};
// Query all and group by participant ID
PDMetaManager.getStorageMgr().searchAllDocuments(aQuery, -1, aConsumer);
aWBCH.autoSizeAllColumns();
aWBCH.autoFilterAllColumns();
return aWBCH;
}
Aggregations