return vfs;
}
private EC2DescribeVolumes toVolumeFilterSet( EC2DescribeVolumes request, FilterSetType fst, String[] timeStrs )
{
EC2VolumeFilterSet vfs = new EC2VolumeFilterSet();
boolean timeFilter = false;
FilterType[] items = fst.getItem();
if (null != items)
{
// -> each filter can have one or more values associated with it
for( int j=0; j < items.length; j++ )
{
String filterName = items[j].getName();
ValueSetType vst = items[j].getValueSet();
ValueType[] valueItems = vst.getItem();
if (filterName.startsWith("tag:")) {
String key= filterName.split(":")[1];
for (ValueType valueItem : valueItems) {
EC2TagKeyValue tag = new EC2TagKeyValue();
tag.setKey(key);
tag.setValue(valueItem.getValue());
request.addResourceTag(tag);
}
} else {
EC2Filter oneFilter = new EC2Filter();
oneFilter.setName( filterName );
// -> is the filter one of the xsd:dateTime filters?
timeFilter = false;
for( int m=0; m < timeStrs.length; m++ ) {
timeFilter = filterName.equalsIgnoreCase( timeStrs[m] );
if (timeFilter) break;
}
for( int k=0; k < valueItems.length; k++ ) {
// -> time values are not encoded as regexes
if ( timeFilter )
oneFilter.addValue( valueItems[k].getValue());
else
oneFilter.addValueEncoded( valueItems[k].getValue());
}
vfs.addFilter( oneFilter );
}
}
request.setFilterSet(vfs);
}
return request;