Search in sources :

Example 1 with ISSN

use of org.jabref.model.entry.identifier.ISSN in project jabref by JabRef.

the class ISSNCleanup method cleanup.

@Override
public List<FieldChange> cleanup(BibEntry entry) {
    Optional<String> issnString = entry.getField(FieldName.ISSN);
    if (!issnString.isPresent()) {
        return Collections.emptyList();
    }
    ISSN issn = new ISSN(issnString.get());
    if (issn.isCanBeCleaned()) {
        String newValue = issn.getCleanedISSN();
        FieldChange change = new FieldChange(entry, FieldName.ISSN, issnString.get(), newValue);
        entry.setField(FieldName.ISSN, newValue);
        return Collections.singletonList(change);
    }
    return Collections.emptyList();
}
Also used : ISSN(org.jabref.model.entry.identifier.ISSN) FieldChange(org.jabref.model.FieldChange)

Example 2 with ISSN

use of org.jabref.model.entry.identifier.ISSN in project jabref by JabRef.

the class ISSNChecker method checkValue.

@Override
public Optional<String> checkValue(String value) {
    // Check that the ISSN is on the correct form
    String issnString = value.trim();
    ISSN issn = new ISSN(issnString);
    if (!issn.isValidFormat()) {
        return Optional.of(Localization.lang("incorrect format"));
    }
    if (issn.isValidChecksum()) {
        return Optional.empty();
    } else {
        return Optional.of(Localization.lang("incorrect control digit"));
    }
}
Also used : ISSN(org.jabref.model.entry.identifier.ISSN)

Aggregations

ISSN (org.jabref.model.entry.identifier.ISSN)2 FieldChange (org.jabref.model.FieldChange)1