/** * Returns {@link AliasedRIMType}s for the given qualified name. * * @param name * qualified name of a {@link RIMType} with optional aliases, separated by underscores * @return aliased registry object types, never <code>null</code> and contains at least a single entry * @throws IllegalArgumentException * if the input name does not refer to a known {@link RIMType} */ public static List<AliasedRIMType> valueOf( QName name ) throws IllegalArgumentException { List<AliasedRIMType> values = null; String[] tokens = split( name.getLocalPart(), "_" ); if ( tokens.length > 1 ) { String unaliasedName = tokens [0]; values = new ArrayList<AliasedRIMType>( tokens.length - 1 ); for ( int i = 1; i < tokens.length; i++ ) { String alias = tokens[i]; values.add( new AliasedRIMType( unaliasedName, alias ) ); } } else { String unaliasedName = name.getLocalPart(); values = Collections.singletonList( new AliasedRIMType( unaliasedName, unaliasedName ) ); } return values; }
public Table getTable( AliasedRIMType queryType ) { return aliasToTable.get( queryType.getAlias() ); }
for ( QName queryTypeName : queryTypeNames ) { try { List<AliasedRIMType> aliasedTypes = AliasedRIMType.valueOf( queryTypeName ); for ( AliasedRIMType aliasedType : aliasedTypes ) { if ( aliasToType.keySet().contains( aliasedType.getAlias() ) ) { String msg = "Each queried type must have a unique alias. However, alias '" + aliasedType.getAlias() + "' is used multiple times in the query."; throw new MetadataStoreException( msg ); aliasToType.put( aliasedType.getAlias(), aliasedType ); Table table = SlotMapper.getTable( queriedType.getType() ); if ( table == null ) { String msg = "Unsupported query type name " + queriedType + "."; aliasToTableAlias.put( queriedType.getAlias(), tableAlias ); aliasToTable.put( queriedType.getAlias(), table );
List<AliasedRIMType> aliasedTypes = AliasedRIMType.valueOf( recordTypeNames[0] ); if ( aliasedTypes.get( 0 ).getType() == AdhocQuery ) { return getAdhocQueries( idList ); table = SlotMapper.getTable( aliasedTypes.get( 0 ).getType() ); } catch ( Throwable t ) { String msg = "Specified type name '" + recordTypeNames[0]
List<AliasedRIMType> returnTypes = AliasedRIMType.valueOf( returnTypeNames[0] ); if ( returnTypes.size() != 1 ) { String msg = "Selecting of multiple return types is not supported."; rt = aliasToType.get( returnType.getAlias() ); if ( rt == null ) { for ( AliasedRIMType candidate : aliasToType.values() ) { if ( candidate.getType() == returnType.getType() ) { LOG.warn( "Relying on imprecise match for return type." ); rt = candidate;
public String getTableAlias( AliasedRIMType queryType ) { return aliasToTableAlias.get( queryType.getAlias() ); }