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();
}
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"));
}
}
Aggregations