Class UserBook
java.lang.Object
io.github.jbastgen.stemma.app.avatar.UserBook
The user mapping (feature 26): which identities (e-mail addresses and names) are one person. It changes only the display, never
a commit. The file is plain text, one line per fact,
kind TAB user-id TAB value: name (display name),
short, bot, email, alias (a name used when no e-mail matches). Later lines win over earlier ones,
so people who add to a shared file need no merge; lines that cannot be read are skipped and reported.-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a user with a new identifier.voidassign(UserBook.User u, String email, String name) Adds an e-mail address or a name to a user, taking it away from any other user (an identity belongs to one user).The name to show for an author: the user's display name, else the name as written.The key that makes two authors one person: the user id, else the e-mail address.intimportMailmap(String text) Takes the lines of a.mailmapover: the proper identity becomes a user, the old ones its identities.static UserBookReads the file; a missing file is an empty book.voidmerge(UserBook.User from, UserBook.User into) Moves everything offromtointo.static UserBookReads the file: lineskind TAB user TAB value.problems()The lines of the file that could not be read, with the reason.voidreindex()Rebuilds the lookup after the users were changed.voidRemoves a user.The user an author is: by e-mail address first, then by name.voidWrites the file completely and replaces the old one in one step.searchText(Author a) The text the filter searches: every name and address of the user, or the author as written.The mapping as a.mailmap: the first address of a user is the proper one.users()A copy of the list of users.
-
Field Details
-
EMPTY
-
-
Constructor Details
-
UserBook
public UserBook()
-
-
Method Details
-
users
A copy of the list of users. -
problems
The lines of the file that could not be read, with the reason. -
add
Adds a user with a new identifier. -
remove
Removes a user. -
assign
Adds an e-mail address or a name to a user, taking it away from any other user (an identity belongs to one user). -
merge
Moves everything offromtointo. -
reindex
public void reindex()Rebuilds the lookup after the users were changed. -
resolve
The user an author is: by e-mail address first, then by name. -
displayName
The name to show for an author: the user's display name, else the name as written. -
searchText
The text the filter searches: every name and address of the user, or the author as written. -
identity
The key that makes two authors one person: the user id, else the e-mail address. -
parse
Reads the file: lineskind TAB user TAB value. Lines that cannot be used are skipped and listed inproblems. -
load
Reads the file; a missing file is an empty book. -
save
Writes the file completely and replaces the old one in one step.- Throws:
IOException
-
importMailmap
Takes the lines of a.mailmapover: the proper identity becomes a user, the old ones its identities. @return lines read -
toMailmap
The mapping as a.mailmap: the first address of a user is the proper one.
-