use of edu.stanford.muse.AddressBookManager.Contact in project epadd by ePADD.
the class IndexUtils method selectDocsByContact.
private static Set<Document> selectDocsByContact(AddressBook ab, Collection<EmailDocument> docs, Set<Contact> cset) {
if (cset == null)
return new LinkedHashSet<>();
Set<String> cnames = new LinkedHashSet<>();
Set<String> cemails = new LinkedHashSet<>();
for (Contact c : cset) {
cnames.addAll(c.getNames());
cemails.addAll(c.getEmails());
}
return selectDocsByContact(ab, docs, cnames, cemails);
}
use of edu.stanford.muse.AddressBookManager.Contact in project epadd by ePADD.
the class IndexUtils method computeDetailedFacetsForMessageBrowsing.
/**
* Compute facet list for message browsing screen.
*/
public static Map<String, Collection<DetailedFacetItem>> computeDetailedFacetsForMessageBrowsing(Collection<Document> docs, Archive archive) {
AddressBook addressBook = archive.addressBook;
Map<String, Collection<DetailedFacetItem>> facetMap = new LinkedHashMap<>();
if (addressBook != null) {
// people
Map<Contact, DetailedFacetItem> peopleMap = partitionDocsByPerson(docs, addressBook);
facetMap.put("correspondent", peopleMap.values());
// direction (sender: only one if anything with owner)
Map<String, DetailedFacetItem> directionMap = partitionDocsByDirection(docs, addressBook);
if (// this size can at max be 1 when there is at least one message sent from the owner
directionMap.size() > 0)
facetMap.put("sender", directionMap.values());
/*
--No longer need this code as restriction, reviewed etc. are handled by labels--
// flags -- provide them only if they have at least 2 types in these docs. if all docs have the same value for a particular flag, no point showing it.
Map<String, DetailedFacetItem> doNotTransferMap = partitionDocsByDoNotTransfer(docs);
if (doNotTransferMap.size() > 1)
facetMap.put("transfer", doNotTransferMap.values());
Map<String, DetailedFacetItem> transferWithRestrictionsMap = partitionDocsByTransferWithRestrictions(docs);
if (transferWithRestrictionsMap.size() > 1)
facetMap.put("restrictions", transferWithRestrictionsMap.values());
Map<String, DetailedFacetItem> reviewedMap = partitionDocsByReviewed(docs);
if (reviewedMap.size() > 1)
facetMap.put("reviewed", reviewedMap.values());
*/
// facet for restriction labels
Map<String, DetailedFacetItem> restrlabels = partitionDocsByLabelTypes(docs, archive, LabelManager.LabType.RESTRICTION);
facetMap.put("Restriction Labels", restrlabels.values());
// facet for general labels
Map<String, DetailedFacetItem> genlabels = partitionDocsByLabelTypes(docs, archive, LabelManager.LabType.GENERAL);
facetMap.put("General Labels", genlabels.values());
// facet for accession IDs- only in modes other than appraisal
if (!ModeConfig.isAppraisalMode()) {
Map<String, DetailedFacetItem> accIDs = partitionDocsByAccessionID(docs, archive);
facetMap.put("Accessions", accIDs.values());
}
Map<String, DetailedFacetItem> annotationPresenceMap = partitionDocsByAnnotationPresence(docs, archive);
facetMap.put("Annotations", annotationPresenceMap.values());
// attachments
if (!ModeConfig.isPublicMode()) {
Map<String, DetailedFacetItem> attachmentTypesMap = partitionDocsByAttachmentType(archive, docs);
facetMap.put("attachment type", attachmentTypesMap.values());
}
}
if (!ModeConfig.isPublicMode()) {
Map<String, DetailedFacetItem> folderNameMap = partitionDocsByFolder(docs);
if (folderNameMap.size() > 0)
facetMap.put("folders", folderNameMap.values());
}
// sort so that in each topic, the heaviest facets are first
for (String s : facetMap.keySet()) {
Collection<DetailedFacetItem> detailedFacets = facetMap.get(s);
List<DetailedFacetItem> list = new ArrayList<>(detailedFacets);
Collections.sort(list);
facetMap.put(s, list);
}
return facetMap;
}
Aggregations