Search in sources :

Example 1 with SearchRequest

use of com.netsuite.webservices.platform.messages.SearchRequest in project tdi-studio-se by Talend.

the class NetsuiteManagement_CXF method submitRequest.

public List<Record> submitRequest(boolean useRequestLevelAuth) throws Exception {
    if (useRequestLevelAuth) {
        initializeStub();
    }
    List<String> list = Arrays.asList(TalendComponentGenerator.transactionTypeList);
    if (list.contains(this.entityClass.getSimpleName())) {
        Method typeSetter = findMethod(this.searchBasicClass, "setType");
        SearchEnumMultiSelectField semsf = new SearchEnumMultiSelectField();
        semsf.getSearchValue().add(TalendComponentGenerator.toInitialLower(this.entityClass.getSimpleName()));
        semsf.setOperator(SearchEnumMultiSelectFieldOperator.ANY_OF);
        typeSetter.invoke(this.searchBasic, new Object[] { semsf });
    }
    if (this.hasCustomCriteria) {
        this.criteriaSetter = findMethod(this.searchBasicClass, "setCustomFieldList");
        SearchCustomFieldList scl = new SearchCustomFieldList();
        scl.getCustomField().addAll(Arrays.asList(this.customCriteria));
        this.criteriaSetter.invoke(this.searchBasic, new Object[] { scl });
    }
    Method basicSetter = findMethod(this.searchClass, "setBasic");
    basicSetter.invoke(this.search, new Object[] { this.searchBasic });
    SearchRecord s = this.search;
    if (this.searchAdvanced != null) {
        s = this.searchAdvanced;
        Method setCriteriaMethod = findMethod(this.searchAdvancedClass, "setCriteria");
        setCriteriaMethod.invoke(this.searchAdvanced, new Object[] { this.search });
    }
    SearchRequest searchRequest = new SearchRequest();
    searchRequest.setSearchRecord(s);
    this.searchResult = this._port.search(searchRequest).getSearchResult();
    if (this.searchResult.getStatus().isIsSuccess()) {
        this.searchId = this.searchResult.getSearchId();
        if (this.searchResult.getRecordList() != null) {
            return filterItemSearch();
        }
    }
    return null;
}
Also used : SearchRecord(com.netsuite.webservices.platform.core.SearchRecord) SearchRequest(com.netsuite.webservices.platform.messages.SearchRequest) SearchCustomFieldList(com.netsuite.webservices.platform.core.SearchCustomFieldList) Method(java.lang.reflect.Method) SearchEnumMultiSelectField(com.netsuite.webservices.platform.core.SearchEnumMultiSelectField)

Aggregations

SearchCustomFieldList (com.netsuite.webservices.platform.core.SearchCustomFieldList)1 SearchEnumMultiSelectField (com.netsuite.webservices.platform.core.SearchEnumMultiSelectField)1 SearchRecord (com.netsuite.webservices.platform.core.SearchRecord)1 SearchRequest (com.netsuite.webservices.platform.messages.SearchRequest)1 Method (java.lang.reflect.Method)1