Verified Owner
Top Description Fields Constructors Methods
org.jabref.logic.importer.util

public Class GroupsParser

extends Object
Class Inheritance
Imports
java.io.IOException, java.nio.file.InvalidPathException, .Path, java.util.EnumSet, .List, org.jabref.logic.auxparser.DefaultAuxParser, org.jabref.logic.groups.GroupsFactory, org.jabref.logic.importer.ParseException, org.jabref.logic.l10n.Localization, org.jabref.logic.util.MetadataSerializationConfiguration, org.jabref.logic.util.strings.QuotedStringTokenizer, .StringUtil, org.jabref.model.database.BibDatabase, org.jabref.model.entry.field.Field, .FieldFactory, org.jabref.model.groups.AbstractGroup, .AutomaticDateGroup, .AutomaticEntryTypeGroup, .AutomaticKeywordGroup, .AutomaticPersonsGroup, .DateGranularity, .ExplicitGroup, .GroupHierarchyType, .GroupTreeNode, .KeywordGroup, .RegexKeywordGroup, .SearchGroup, .TexGroup, .WordKeywordGroup, org.jabref.model.metadata.MetaData, org.jabref.model.search.SearchFlags, org.jabref.model.util.FileUpdateMonitor, org.slf4j.Logger, .LoggerFactory

Converts string representation of groups to a parsed GroupTreeNode.

Field Summary

Modifier and TypeField and Description
private static final Logger
private static final String
SMART_GROUP_ID_FOR_MIGRATION

Deprecated Kept for backward compatibility during migration.
Identifier for SmartGroup (deprecated, replaced by ExplicitGroup).

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static void
private static void
addLegacyEntryKeys(QuotedStringTokenizer tok, ExplicitGroup group)

Called only when created fromString.

private static AbstractGroup
private static AbstractGroup
private static AbstractGroup
private static AbstractGroup
private static AbstractGroup
private static ExplicitGroup
explicitGroupFromString(String input, Character keywordSeparator)

public static AbstractGroup

Returns:

New instance of the encoded group.
fromString
(String
The result from the group's toString() method.
input
,
Character keywordSeparator, FileUpdateMonitor fileMonitor, MetaData metaData, String userAndHost)

Re-create a group instance from a textual representation.

public static GroupTreeNode
importGroups(List<String> orderedData, Character keywordSeparator, FileUpdateMonitor fileMonitor, MetaData metaData, String userAndHost)

private static KeywordGroup
keywordGroupFromString(String
The String representation obtained from KeywordGroup.toString()
input
,
Character keywordSeparator)

Parses s and recreates the KeywordGroup from it.

private static ExplicitGroup
private static AbstractGroup
searchGroupFromString(String
The String representation obtained from SearchGroup.toString(), or null if incompatible
input
)

Parses s and recreates the SearchGroup from it.

private static ExplicitGroup
smartGroupFromString(String input, Character keywordSeparator)

Migration method: Converts old SmartGroup serializations to ExplicitGroup.

private static AbstractGroup
texGroupFromString(String input, FileUpdateMonitor fileMonitor, MetaData metaData, String userAndHost)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

LOGGERback to summary
private static final Logger LOGGER
SMART_GROUP_ID_FOR_MIGRATIONback to summary
private static final String SMART_GROUP_ID_FOR_MIGRATION

Deprecated

Kept for backward compatibility during migration.

Identifier for SmartGroup (deprecated, replaced by ExplicitGroup).

Annotations
@Deprecated

Constructor Detail

GroupsParserback to summary
private GroupsParser()

Method Detail

addGroupDetailsback to summary
private static void addGroupDetails(QuotedStringTokenizer tokenizer, AbstractGroup group)
addLegacyEntryKeysback to summary
private static void addLegacyEntryKeys(QuotedStringTokenizer tok, ExplicitGroup group)

Called only when created fromString. JabRef used to store the entries of an explicit group in the serialization, e.g. ExplicitGroup:GroupName;0;Key1;Key2;; This method exists for backwards compatibility.

allEntriesGroupFromStringback to summary
private static AbstractGroup allEntriesGroupFromString(String input)
automaticDateGroupFromStringback to summary
private static AbstractGroup automaticDateGroupFromString(String input)
automaticEntryTypeGroupFromStringback to summary
private static AbstractGroup automaticEntryTypeGroupFromString(String input)
automaticKeywordGroupFromStringback to summary
private static AbstractGroup automaticKeywordGroupFromString(String input)
automaticPersonsGroupFromStringback to summary
private static AbstractGroup automaticPersonsGroupFromString(String input)
explicitGroupFromStringback to summary
private static ExplicitGroup explicitGroupFromString(String input, Character keywordSeparator) throws ParseException
fromStringback to summary
public static AbstractGroup fromString(String input, Character keywordSeparator, FileUpdateMonitor fileMonitor, MetaData metaData, String userAndHost) throws ParseException

Re-create a group instance from a textual representation.

Parameters
input:String

The result from the group's toString() method.

Returns:AbstractGroup

New instance of the encoded group.

Exceptions
ParseException:
If an error occurred and a group could not be created, e.g. due to a malformed regular expression.
importGroupsback to summary
public static GroupTreeNode importGroups(List<String> orderedData, Character keywordSeparator, FileUpdateMonitor fileMonitor, MetaData metaData, String userAndHost) throws ParseException
keywordGroupFromStringback to summary
private static KeywordGroup keywordGroupFromString(String input, Character keywordSeparator)

Parses s and recreates the KeywordGroup from it.

Parameters
input:String

The String representation obtained from KeywordGroup.toString()

legacyExplicitGroupFromStringback to summary
private static ExplicitGroup legacyExplicitGroupFromString(String input, Character keywordSeparator) throws ParseException
searchGroupFromStringback to summary
private static AbstractGroup searchGroupFromString(String input)

Parses s and recreates the SearchGroup from it.

Parameters
input:String

The String representation obtained from SearchGroup.toString(), or null if incompatible

smartGroupFromStringback to summary
private static ExplicitGroup smartGroupFromString(String input, Character keywordSeparator) throws ParseException

Migration method: Converts old SmartGroup serializations to ExplicitGroup. SmartGroup has been replaced by ExplicitGroup for the "Imported Entries" group Issue 14143.

texGroupFromStringback to summary
private static AbstractGroup texGroupFromString(String input, FileUpdateMonitor fileMonitor, MetaData metaData, String userAndHost) throws ParseException