private static String makeId ( CSLItemData item , CSLDateParser dateParser ) { if ( item . getAuthor ( ) == null || item . getAuthor ( ) . length == 0 ) { //there's no author information, return original ID return item . getId ( ) ; } //get author's name CSLName firstAuthor = item . getAuthor ( ) [ 0 ] ; String a = firstAuthor . getFamily ( ) ; if ( a == null || a . isEmpty ( ) ) { a = firstAuthor . getGiven ( ) ; if ( a == null || a . isEmpty ( ) ) { a = firstAuthor . getLiteral ( ) ; if ( a == null || a . isEmpty ( ) ) { //author could not be found, return original ID return item . getId ( ) ; } } } a = StringHelper . sanitize ( a ) ; //try to get year int year = getYear ( item . getIssued ( ) , dateParser ) ; if ( year < 0 ) { year = getYear ( item . getContainer ( ) , dateParser ) ; if ( year < 0 ) { year = getYear ( item . getOriginalDate ( ) , dateParser ) ; if ( year < 0 ) { year = getYear ( item . getEventDate ( ) , dateParser ) ; if ( year < 0 ) { year = getYear ( item . getSubmitted ( ) , dateParser ) ; } } } } //append year to author if ( year >= 0 ) { a = a + year ; } return a ; }
Generates a human - readable ID for an item