@@ -260,6 +260,22 @@ public void possiblySendRabNotification(int reviewerId)
260260 }
261261 }
262262
263+ private TableInfo _mappingTable = null ;
264+
265+ private TableInfo getMappingTable ()
266+ {
267+ if (_mappingTable == null )
268+ {
269+ _mappingTable = QueryService .get ().getUserSchema (_user , _container , MccSchema .NAME ).getTable (MccSchema .TABLE_ANIMAL_MAPPING );
270+ }
271+
272+ return _mappingTable ;
273+ }
274+
275+ public @ Nullable String getMccAlias (String id ) {
276+ return new TableSelector (getMappingTable (), PageFlowUtil .set ("externalAlias" ), new SimpleFilter (FieldKey .fromString ("subjectname" ), id , CompareType .EQUAL ), null ).getObject (String .class );
277+ }
278+
263279 public int ensureMccAliasExists (Collection <String > rawIds , Map <Object , Object > existingAliases )
264280 {
265281 // NOTE: The incoming object can convert numeric IDs from strings to int, so manually convert:
@@ -273,7 +289,7 @@ public int ensureMccAliasExists(Collection<String> rawIds, Map<Object, Object> e
273289 SimpleFilter filter = new SimpleFilter (FieldKey .fromString ("subjectname" ), idMap .values (), CompareType .IN );
274290
275291 final Set <String > aliasesFound = new HashSet <>();
276- TableInfo ti = QueryService . get (). getUserSchema ( _user , _container , MccSchema . NAME ). getTable ( MccSchema . TABLE_ANIMAL_MAPPING );
292+ TableInfo ti = getMappingTable ( );
277293 new TableSelector (ti , PageFlowUtil .set ("subjectname" , "externalAlias" ), filter , null ).forEachResults (rs -> {
278294 aliasesFound .add (rs .getString (FieldKey .fromString ("subjectname" )));
279295 if (ciExistingAliases .containsKey (rs .getString (FieldKey .fromString ("subjectname" )))) {
0 commit comments