Search in sources :

Example 1 with SearchFieldOperatorTypeDesc

use of org.talend.components.netsuite.client.model.search.SearchFieldOperatorTypeDesc in project components by Talend.

the class BasicMetaData method bindSearchFieldOperatorTypes.

/**
 * Bind search operator type descriptors.
 *
 * @param searchFieldOperatorTypes search operator type descriptors to be registered and bound
 */
protected void bindSearchFieldOperatorTypes(Collection<SearchFieldOperatorTypeDesc> searchFieldOperatorTypes) {
    Collection<SearchFieldOperatorTypeDesc> searchFieldOperatorTypeList = new ArrayList<>();
    for (SearchFieldOperatorTypeDesc operatorTypeDesc : searchFieldOperatorTypes) {
        searchFieldOperatorTypeList.add(operatorTypeDesc);
    }
    searchFieldOperatorTypeList.add(// Boolean (Synthetic)
    new SearchFieldOperatorTypeDesc(SearchFieldOperatorType.BOOLEAN, SearchFieldOperatorType.SearchBooleanFieldOperator.class, null, null));
    for (SearchFieldOperatorTypeDesc info : searchFieldOperatorTypeList) {
        searchFieldOperatorTypeMap.put(info.getOperatorType(), info);
    }
}
Also used : ArrayList(java.util.ArrayList) SearchFieldOperatorTypeDesc(org.talend.components.netsuite.client.model.search.SearchFieldOperatorTypeDesc)

Example 2 with SearchFieldOperatorTypeDesc

use of org.talend.components.netsuite.client.model.search.SearchFieldOperatorTypeDesc in project components by Talend.

the class BasicMetaData method getSearchFieldOperator.

/**
 * Get search field operator for given search field type and operator name.
 *
 * @see SearchFieldOperatorType
 * @see SearchFieldOperatorName
 *
 * @param fieldType search field type
 * @param operatorName operator name
 * @return search field operator
 */
public Object getSearchFieldOperator(SearchFieldType fieldType, String operatorName) {
    SearchFieldOperatorName operatorQName = new SearchFieldOperatorName(operatorName);
    SearchFieldOperatorType operatorType = SearchFieldType.getOperatorType(fieldType);
    if (operatorType != null) {
        SearchFieldOperatorTypeDesc def = searchFieldOperatorTypeMap.get(operatorType);
        return def.getOperator(operatorName);
    }
    for (SearchFieldOperatorTypeDesc def : searchFieldOperatorTypeMap.values()) {
        if (def.hasOperator(operatorQName)) {
            return def.getOperator(operatorName);
        }
    }
    throw new IllegalArgumentException("Unknown search field operator: " + fieldType + ", " + operatorName);
}
Also used : SearchFieldOperatorName(org.talend.components.netsuite.client.model.search.SearchFieldOperatorName) SearchFieldOperatorTypeDesc(org.talend.components.netsuite.client.model.search.SearchFieldOperatorTypeDesc) SearchFieldOperatorType(org.talend.components.netsuite.client.model.search.SearchFieldOperatorType)

Aggregations

SearchFieldOperatorTypeDesc (org.talend.components.netsuite.client.model.search.SearchFieldOperatorTypeDesc)2 ArrayList (java.util.ArrayList)1 SearchFieldOperatorName (org.talend.components.netsuite.client.model.search.SearchFieldOperatorName)1 SearchFieldOperatorType (org.talend.components.netsuite.client.model.search.SearchFieldOperatorType)1