use of com.netsuite.webservices.platform.core.SearchRecord 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;
}
use of com.netsuite.webservices.platform.core.SearchRecord in project tdi-studio-se by Talend.
the class NetsuiteManagement_CXF method initialize.
public void initialize(String searchentity, String savedSearchId) throws SecurityException, NoSuchMethodException, SOAPException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException {
this.entityClass = TalendComponentGenerator.getEntityClass(searchentity);
this.searchClass = TalendComponentGenerator.getSearchClass(searchentity);
this.searchBasicClass = TalendComponentGenerator.getSearchBasicClass(searchentity);
this.searchAdvancedClass = TalendComponentGenerator.getSearchAdvancedClass(searchentity);
this.customCriteria = new SearchCustomField[1];
// if type is customRecord
if (this.searchClass == null) {
this.searchClass = CustomRecordSearch.class;
searchentity = CustomRecord.class.getName();
this.searchAdvancedClass = CustomRecordSearchAdvanced.class;
this.searchBasicClass = TalendComponentGenerator.getSearchBasicClass(searchentity);
}
// search class not found or supported
if (this.searchClass == null) {
throw new IllegalArgumentException("SearchClass not found - " + searchentity);
}
// get a search class instance
Constructor<?> constructor = this.searchClass.getConstructor(new Class[0]);
this.search = ((SearchRecord) constructor.newInstance(new Object[0]));
// get a advanced search class instance and set SaveSearchId into it
this.searchAdvanced = null;
if ((savedSearchId != null) && (savedSearchId.length() > 0)) {
constructor = this.searchAdvancedClass.getConstructor(new Class[0]);
this.searchAdvanced = ((SearchRecord) constructor.newInstance(new Object[0]));
Method setSavedSearchIdMethod = findMethod(this.searchAdvancedClass, "setSavedSearchId");
Object[] args = { savedSearchId };
setSavedSearchIdMethod.invoke(this.searchAdvanced, args);
}
// search class is itemSearch, it's special
if (this.searchClass.getSimpleName().equals("ItemSearch")) {
this.isItemSearch = true;
}
// basic search class not found or supported
if (this.searchBasicClass == null) {
throw new IllegalArgumentException("SearchBasicClass not found-" + searchentity);
}
// get a basic search class instance
constructor = this.searchBasicClass.getConstructor(null);
this.searchBasic = ((SearchRecord) constructor.newInstance(new Object[0]));
}
Aggregations