-
Notifications
You must be signed in to change notification settings - Fork 461
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#23934 Including keys from tika 1.x that were missing in tika 2.x
- Loading branch information
nollymar
authored and
nollymar
committed
May 30, 2023
1 parent
d508c01
commit de70fba
Showing
4 changed files
with
80 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
dotCMS/src/main/java/com/dotcms/storage/model/ExtendedMetadataFields.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package com.dotcms.storage.model; | ||
|
||
import com.dotcms.util.CollectionsUtils; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.stream.Collectors; | ||
import java.util.stream.Stream; | ||
|
||
/** | ||
* Encapsulates a collection with keys generated by Tika. | ||
* It is used to translate keys from Tika 2.0 to the old ones (list with possible values). | ||
*/ | ||
public enum ExtendedMetadataFields { | ||
|
||
DC_CREATOR("dcCreator", CollectionsUtils.list("author, metaAuthor")), | ||
META_LAST_AUTHOR("metaLastAuthor", CollectionsUtils.list("lastAuthor")), | ||
DC_TITLE("dcTitle", CollectionsUtils.list("title")), | ||
DC_TERMS_CREATED("dctermsCreated", CollectionsUtils.list("date", "creationDate")), | ||
DC_TERMS_MODIFIED("dctermsModified", CollectionsUtils.list("lastModified", "modified")), | ||
|
||
META_SAVE_DATE("metaSaveDate", CollectionsUtils.list("lastSaveDate")), | ||
EXTENDED_PROPERTIES_APPLICATION("extendedPropertiesApplication", CollectionsUtils.list("applicationName")), | ||
META_CHARACTER_COUNT("metaCharacterCount", CollectionsUtils.list("characterCount")), | ||
EXTENDED_PROPERTIES_COMPANY("extendedPropertiesCompany", CollectionsUtils.list("company")), | ||
EXTENDED_PROPERTIES_TOTAL_TIME("extendedPropertiesTotalTime", CollectionsUtils.list("editTime")), | ||
META_KEYWORD("metaKeyword", CollectionsUtils.list("keywords", "dcSubject")), | ||
META_PAGE_COUNT("metaPageCount", CollectionsUtils.list("pageCount")), | ||
REVISION_NUMBER("cpRevision", CollectionsUtils.list("revisionNumber")), | ||
DC_SUBJECT("dcSubject", CollectionsUtils.list("subject", "cpSubject", "metaKeyword", "keywords")), | ||
EXTENDED_TEMPLATE("extendedPropertiesTemplate", CollectionsUtils.list("template")), | ||
WORD_COUNT("metaWordCount", CollectionsUtils.list("wordCount")), | ||
DC_IDENTIFIER("dcIdentifier", CollectionsUtils.list("identifier")), | ||
DC_PUBLISHER("dcPublisher", CollectionsUtils.list("publisher")); | ||
|
||
private final String key; | ||
private final List<String> possibleValues; | ||
|
||
ExtendedMetadataFields(String key, List<String> possibleValues) { | ||
this.key = key; | ||
this.possibleValues = possibleValues; | ||
} | ||
|
||
public String key() { | ||
return key; | ||
} | ||
|
||
public List<String> possibleValues() { | ||
return possibleValues; | ||
} | ||
|
||
public static Map<String, List<String>> keyMap() { | ||
return Stream.of(values()).collect( | ||
Collectors.toMap(ExtendedMetadataFields::key, ExtendedMetadataFields::possibleValues)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters