package org.ovirt.engine.core.searchbackend;

import org.ovirt.engine.core.common.businessentities.StoragePoolStatus;
import org.ovirt.engine.core.common.businessentities.StorageType;

public class StoragePoolFieldAutoCompleter extends BaseConditionFieldAutoCompleter {
    public StoragePoolFieldAutoCompleter() {
        // Building the basic vervs Dict
        mVerbs.add("NAME");
        mVerbs.add("DESCRIPTION");
        mVerbs.add("TYPE");
        mVerbs.add("STATUS");
        mVerbs.add("COMMENT");

        // Building the autoCompletion Dict
        buildCompletions();
        // Building the types dict
        getTypeDictionary().put("NAME", String.class);
        getTypeDictionary().put("DESCRIPTION", String.class);
        getTypeDictionary().put("COMMENT", String.class);
        getTypeDictionary().put("TYPE", StorageType.class);
        getTypeDictionary().put("STATUS", StoragePoolStatus.class);

        // building the ColumnName Dict
        columnNameDict.put("NAME", "name");
        columnNameDict.put("DESCRIPTION", "description");
        columnNameDict.put("COMMENT", "free_text_comment");
        columnNameDict.put("TYPE", "storage_pool_type");
        columnNameDict.put("STATUS", "status");

        // Building the validation dict
        buildBasicValidationTable();
    }

    @Override
    public IAutoCompleter getFieldRelationshipAutoCompleter(String fieldName) {
        return StringConditionRelationAutoCompleter.INSTANCE;
    }

    @Override
    public IConditionValueAutoCompleter getFieldValueAutoCompleter(String fieldName) {
        IConditionValueAutoCompleter retval = null;
        if ("STATUS".equals(fieldName)) {
            retval = new EnumValueAutoCompleter(StoragePoolStatus.class);
        }
        else if ("TYPE".equals(fieldName)) {
            retval = new EnumValueAutoCompleter(StorageType.class);
        } else {
        }
        return retval;
    }
}

@@ -114,74 +114,8 @@
 tus;
-%0Aimport org.ovirt.engine.core.common.businessentities.StorageType;
 %0A%0Apu
@@ -366,20 +366,21 @@
 bs.add(%22
-TYPE
+LOCAL
 %22);%0A    
@@ -756,26 +756,23 @@
 ut(%22
-TYPE%22, StorageType
+LOCAL%22, Boolean
 .cla
@@ -1079,33 +1079,25 @@
 ut(%22
-TYPE%22, %22storage_pool_type
+LOCAL%22, %22is_local
 %22);%0A
@@ -1693,12 +1693,13 @@
 f (%22
-TYPE
+LOCAL
 %22.eq
@@ -1734,36 +1734,35 @@
    retval = new 
-Enum
+Bit
 ValueAutoComplet
@@ -1768,44 +1768,10 @@
 ter(
-StorageType.class);%0A        %7D else %7B
+);
 %0A   

Allow searching data center with local property