-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Export single corporate author to ms office xml (#2688)
* Export single corporate author to ms office xml #1497 * Add test files for corporate Authors export * Add changelog entry * Improved author handling in MS-Office Import/Export
- Loading branch information
1 parent
41decf4
commit 0c34fa4
Showing
13 changed files
with
244 additions
and
193 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
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
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,66 @@ | ||
package org.jabref.logic.msbib; | ||
|
||
import org.jabref.model.entry.Author; | ||
|
||
public class MsBibAuthor { | ||
|
||
private String firstName; | ||
private String middleName; | ||
private final Author author; | ||
private boolean isCorporate; | ||
|
||
public MsBibAuthor(Author author) { | ||
this.author = author; | ||
|
||
StringBuilder sb = new StringBuilder(); | ||
author.getFirst().ifPresent(firstNames -> { | ||
|
||
String[] names = firstNames.split(" "); | ||
for (int i = 1; i < names.length; i++) { | ||
sb.append(names[i]); | ||
sb.append(" "); | ||
} | ||
this.middleName = sb.toString().trim(); | ||
this.firstName = names[0]; | ||
}); | ||
|
||
} | ||
|
||
public MsBibAuthor(Author author, boolean isCorporate) { | ||
this(author); | ||
this.isCorporate = isCorporate; | ||
|
||
} | ||
|
||
public String getFirstName() { | ||
|
||
if (!"".equals(firstName)) { | ||
return firstName; | ||
} | ||
return author.getFirst().orElse(null); | ||
} | ||
|
||
public String getMiddleName() { | ||
if ("".equals(middleName)) { | ||
return null; | ||
} | ||
return middleName; | ||
} | ||
|
||
public String getLastName() { | ||
return author.getLast().orElse(null); | ||
} | ||
|
||
public String getFirstLast() { | ||
return author.getFirstLast(false); | ||
} | ||
|
||
public String getLastFirst() { | ||
return author.getLastFirst(false); | ||
} | ||
|
||
public boolean isCorporate() { | ||
return isCorporate; | ||
} | ||
|
||
} |
Oops, something went wrong.