@Override public SchemaBranch load(Key key) throws Exception { SchemaBranch schemaBranch; Key otherKey; if (key.getSchemaBranchKey() != null) { schemaBranch = schemaBranchFetcher.getSchemaBranch(key.getSchemaBranchKey()); otherKey = Key.of(schemaBranch.getId()); schemaBranchNameToIdMap.put(key.getSchemaBranchKey(), schemaBranch.getId()); } else if (key.getId() != null) { schemaBranch = schemaBranchFetcher.getSchemaBranch(key.getId()); otherKey = Key.of(new SchemaBranchKey(schemaBranch.getName(), schemaBranch.getSchemaMetadataName())); schemaBranchNameToIdMap.put(otherKey.schemaBranchKey, schemaBranch.getId()); } else { throw new IllegalArgumentException("Given argument is not valid: " + key); } loadingCache.put(otherKey, schemaBranch); return schemaBranch; } });
@Override public SchemaBranch load(Key key) throws Exception { SchemaBranch schemaBranch; Key otherKey; if (key.getSchemaBranchKey() != null) { schemaBranch = schemaBranchFetcher.getSchemaBranch(key.getSchemaBranchKey()); otherKey = Key.of(schemaBranch.getId()); schemaBranchNameToIdMap.put(key.getSchemaBranchKey(), schemaBranch.getId()); } else if (key.getId() != null) { schemaBranch = schemaBranchFetcher.getSchemaBranch(key.getId()); otherKey = Key.of(new SchemaBranchKey(schemaBranch.getName(), schemaBranch.getSchemaMetadataName())); schemaBranchNameToIdMap.put(otherKey.schemaBranchKey, schemaBranch.getId()); } else { throw new IllegalArgumentException("Given argument is not valid: " + key); } loadingCache.put(otherKey, schemaBranch); return schemaBranch; } });