@Override public Key createKey(String name) { Key key = new Key(); key.setEntityId(name); return key; }
@Override public Key createKey(String name, String comment, Map<String, Triplet<String, Boolean, Boolean>> translations) { Key key = new Key(); key.setEntityId(name); key.setComment(comment); for (Map.Entry<String, Triplet<String, Boolean, Boolean>> entry : translations.entrySet()) { key.addTranslation(entry.getKey(), entry.getValue().getValue0(), entry.getValue().getValue1(), entry.getValue().getValue2()); } return key; } }
@Override public Key createKey(String name, String comment, boolean outdated) { Key key = new Key(); key.setEntityId(name); key.setComment(comment); key.setOutdated(outdated); return key; }
/** * Returns a sub aggregate key with just the default translation. * * @param defaultLocale source locale * @return Key */ public Key subKey(String defaultLocale) { Key subKey = new Key(); subKey.setComment(description); subKey.setOutdated(outdated); subKey.setEntityId(entityId); Map<String, Translation> subTranslations = new HashMap<String, Translation>(); addTranslation(subTranslations, subKey, defaultLocale); subKey.setTranslations(subTranslations); return subKey; }
/** * Returns a sub aggregate key with only two translations. * * @param sourceLocale source locale * @param targetLocale target locale * @return Key */ public Key subKey(String sourceLocale, String targetLocale) { Key subKey = new Key(); subKey.setComment(description); subKey.setOutdated(outdated); subKey.setEntityId(entityId); Map<String, Translation> subTranslations = new HashMap<String, Translation>(); addTranslation(subTranslations, subKey, sourceLocale); addTranslation(subTranslations, subKey, targetLocale); subKey.setTranslations(subTranslations); return subKey; }