SqlView extends BaseIdentifiableObject implements Cacheable, MetadataObject { public static Map<String, String> getCriteria( Set<String> params ) { Map<String, String> map = new HashMap<>(); if ( params != null ) { for ( String param : params ) { if ( param != null && param.split( CRITERIA_SEP ).length == 2 ) { String[] criteria = param.split( CRITERIA_SEP ); String filter = criteria[0]; String value = criteria[1]; map.put( filter, value ); } } } return map; } SqlView();  SqlView( String name, String sqlQuery, SqlViewType type ); String getViewName(); static Map<String, String> getCriteria( Set<String> params ); static Set<String> getInvalidQueryParams( Set<String> params ); static boolean isValidQueryParam( String param ); static Set<String> getInvalidQueryValues( Collection<String> values ); static boolean isValidQueryValue( String value ); static String getProtectedTablesRegex(); static String getIllegalKeywordsRegex(); boolean isQuery(); boolean isView(); boolean isMaterializedView(); @JsonProperty @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) @PropertyRange( min = 2 ) String getDescription(); void setDescription( String description ); @JsonProperty @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) String getSqlQuery(); void setSqlQuery( String sqlQuery ); @JsonProperty @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) SqlViewType getType(); void setType( SqlViewType type ); @JsonProperty @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) @Override CacheStrategy getCacheStrategy(); void setCacheStrategy( CacheStrategy cacheStrategy ); static final String PREFIX_VIEWNAME; static final Set<String> PROTECTED_TABLES; static final Set<String> ILLEGAL_KEYWORDS; static final String CURRENT_USER_ID_VARIABLE; static final String CURRENT_USERNAME_VARIABLE; static final Set<String> STANDARD_VARIABLES; }
@Test public void testGetCriteria() { Set<String> params = Sets.newHashSet( "type:NUMBER", "aggregationType:AVERAGE" ); Map<String, String> expected = ImmutableMap.of( "type", "NUMBER", "aggregationType", "AVERAGE" ); assertEquals( expected, SqlView.getCriteria( params ) ); }