protected < T > List < T > getResources ( final String prefix , final String attribute , final ResourceType resourceType , final Class < T > type , @ Nullable final String locationUUID ) throws FlexiantException { SearchFilter sf = new SearchFilter ( ) ; FilterCondition fc = new FilterCondition ( ) ; fc . setCondition ( Condition . STARTS_WITH ) ; fc . setField ( attribute ) ; fc . getValue ( ) . add ( prefix ) ; sf . getFilterConditions ( ) . add ( fc ) ; if ( locationUUID != null ) { FilterCondition fcLocation = new FilterCondition ( ) ; fcLocation . setCondition ( Condition . IS_EQUAL_TO ) ; fcLocation . setField ( "vdcUUID" ) ; fcLocation . getValue ( ) . add ( locationUUID ) ; sf . getFilterConditions ( ) . add ( fcLocation ) ; } try { //noinspection unchecked return ( List < T > ) this . getService ( ) . listResources ( sf , null , resourceType ) . getList ( ) ; } catch ( ExtilityException e ) { throw new FlexiantException ( String . format ( "Error while retrieving resource with prefix %s on attribute %s of resourceType %s" , prefix , attribute , resourceType ) , e ) ; } }
Retrieves a list of resources matching the given prefix on the given attribute which are of the given type .