/** * Update keywords according to values of special fields * * @param nc indicates the undo named compound. May be null */ public static void syncKeywordsFromSpecialFields(BibtexEntry be, NamedCompound nc) { SpecialFieldsUtils.exportFieldToKeywords(Priority.getInstance(), be, nc); SpecialFieldsUtils.exportFieldToKeywords(Rank.getInstance(), be, nc); SpecialFieldsUtils.exportFieldToKeywords(Relevance.getInstance(), be, nc); SpecialFieldsUtils.exportFieldToKeywords(Quality.getInstance(), be, nc); SpecialFieldsUtils.exportFieldToKeywords(ReadStatus.getInstance(), be, nc); SpecialFieldsUtils.exportFieldToKeywords(Printed.getInstance(), be, nc); }
/** * updates field values according to keywords * * @param ce indicates the undo named compound. May be null */ public static void syncSpecialFieldsFromKeywords(BibtexEntry be, NamedCompound ce) { if (be.getField("keywords") == null) { return; } ArrayList<String> keywordList = Util.getSeparatedKeywords(be.getField("keywords")); SpecialFieldsUtils.importKeywordsForField(keywordList, Priority.getInstance(), be, ce); SpecialFieldsUtils.importKeywordsForField(keywordList, Rank.getInstance(), be, ce); SpecialFieldsUtils.importKeywordsForField(keywordList, Quality.getInstance(), be, ce); SpecialFieldsUtils.importKeywordsForField(keywordList, Relevance.getInstance(), be, ce); SpecialFieldsUtils.importKeywordsForField(keywordList, ReadStatus.getInstance(), be, ce); SpecialFieldsUtils.importKeywordsForField(keywordList, Printed.getInstance(), be, ce); }
/** * @param fieldName the fieldName * @return an instance of that field. The returned object is a singleton. null is returned if * fieldName does not indicate a special field */ public static SpecialField getSpecialFieldInstanceFromFieldName(String fieldName) { if (fieldName.equals(SpecialFieldsUtils.FIELDNAME_PRIORITY)) { return Priority.getInstance(); } else if (fieldName.equals(SpecialFieldsUtils.FIELDNAME_QUALITY)) { return Quality.getInstance(); } else if (fieldName.equals(SpecialFieldsUtils.FIELDNAME_RANKING)) { return Rank.getInstance(); } else if (fieldName.equals(SpecialFieldsUtils.FIELDNAME_RELEVANCE)) { return Relevance.getInstance(); } else if (fieldName.equals(SpecialFieldsUtils.FIELDNAME_READ)) { return ReadStatus.getInstance(); } else if (fieldName.equals(SpecialFieldsUtils.FIELDNAME_PRINTED)) { return Printed.getInstance(); } else { return null; } }