use of org.talend.components.netsuite.client.model.BasicRecordType in project components by Talend.
the class DefaultCustomMetaDataSource method retrieveCustomFields.
/**
* Retrieve custom fields for a given record type.
*
* @param recordType record type
* @throws NetSuiteException if an error occurs during retrieving of customization data
*/
protected void retrieveCustomFields(RecordTypeDesc recordType) throws NetSuiteException {
retrieveCustomFields();
Map<String, CustomFieldDesc> fieldDescMap = new HashMap<>();
for (BasicRecordType customizationType : fieldCustomizationTypes) {
List<?> customFieldList = customFieldMap.get(customizationType);
Map<String, CustomFieldDesc> customFieldDescMap = createCustomFieldDescMap(clientService, recordType, customizationType, customFieldList);
fieldDescMap.putAll(customFieldDescMap);
}
recordCustomFieldMap.put(recordType.getType(), fieldDescMap);
}
use of org.talend.components.netsuite.client.model.BasicRecordType in project components by Talend.
the class SearchQuery method toNativeQuery.
/**
* Finalize building of search query and get built NetSuite's search record object.
*
* @return
* @throws NetSuiteException if an error occurs during updating of search record
*/
public SearchT toNativeQuery() throws NetSuiteException {
initSearch();
BasicRecordType basicRecordType = BasicRecordType.getByType(searchRecordTypeDesc.getType());
if (BasicRecordType.TRANSACTION == basicRecordType) {
SearchFieldAdapter<?> fieldAdapter = metaDataSource.getBasicMetaData().getSearchFieldAdapter(SearchFieldType.SELECT);
Object searchTypeField = fieldAdapter.populate("List.anyOf", Arrays.asList(recordTypeInfo.getRecordType().getType()));
setProperty(searchBasic, "type", searchTypeField);
} else if (BasicRecordType.CUSTOM_RECORD == basicRecordType) {
CustomRecordTypeInfo customRecordTypeInfo = (CustomRecordTypeInfo) recordTypeInfo;
NsRef customizationRef = customRecordTypeInfo.getCustomizationRef();
Object recType = metaDataSource.getBasicMetaData().createInstance(RefType.CUSTOMIZATION_REF.getTypeName());
setProperty(recType, "scriptId", customizationRef.getScriptId());
setProperty(recType, "internalId", customizationRef.getInternalId());
setProperty(searchBasic, "recType", recType);
}
// Set custom fields
if (!customFieldList.isEmpty()) {
Object customFieldListWrapper = metaDataSource.getBasicMetaData().createInstance("SearchCustomFieldList");
List<Object> customFields = (List<Object>) getProperty(customFieldListWrapper, "customField");
for (Object customField : customFieldList) {
customFields.add(customField);
}
setProperty(searchBasic, "customFieldList", customFieldListWrapper);
}
SearchT searchRecord;
if (searchRecordTypeDesc.getSearchClass() != null) {
setProperty(search, "basic", searchBasic);
searchRecord = search;
if (searchAdvanced != null) {
setProperty(searchAdvanced, "condition", search);
searchRecord = searchAdvanced;
}
} else {
searchRecord = searchBasic;
}
return searchRecord;
}
use of org.talend.components.netsuite.client.model.BasicRecordType in project components by Talend.
the class DefaultCustomMetaDataSource method retrieveCustomRecordTypes.
/**
* Retrieve custom record types from NetSuite web service.
*
* @see #customRecordTypeMap
*
* @throws NetSuiteException if an error occurs during retrieving of customization data
*/
protected void retrieveCustomRecordTypes() throws NetSuiteException {
if (customRecordTypesLoaded) {
return;
}
List<NsRef> customTypes = new ArrayList<>();
List<NsRef> customRecordTypes = customMetaDataRetriever.retrieveCustomizationIds(BasicRecordType.CUSTOM_RECORD_TYPE);
customTypes.addAll(customRecordTypes);
List<NsRef> customTransactionTypes = customMetaDataRetriever.retrieveCustomizationIds(BasicRecordType.CUSTOM_TRANSACTION_TYPE);
customTypes.addAll(customTransactionTypes);
for (NsRef customizationRef : customTypes) {
String recordType = customizationRef.getType();
RecordTypeDesc recordTypeDesc = null;
BasicRecordType basicRecordType = BasicRecordType.getByType(recordType);
if (basicRecordType != null) {
recordTypeDesc = clientService.getBasicMetaData().getRecordType(toInitialUpper(basicRecordType.getSearchType()));
}
CustomRecordTypeInfo customRecordTypeInfo = new CustomRecordTypeInfo(customizationRef.getScriptId(), recordTypeDesc, customizationRef);
customRecordTypeMap.put(customRecordTypeInfo.getName(), customRecordTypeInfo);
}
customRecordTypesLoaded = true;
}
use of org.talend.components.netsuite.client.model.BasicRecordType in project components by Talend.
the class DefaultCustomMetaDataSource method retrieveCustomFields.
/**
* Retrieve custom fields for standard record types from NetSuite web service.
*
* @throws NetSuiteException if an error occurs during retrieving of customization data
*/
protected void retrieveCustomFields() throws NetSuiteException {
if (customFieldsLoaded) {
return;
}
Map<BasicRecordType, List<NsRef>> fieldCustomizationRefs = new HashMap<>(32);
for (BasicRecordType customizationType : fieldCustomizationTypes) {
List<NsRef> customizationRefs = customMetaDataRetriever.retrieveCustomizationIds(customizationType);
fieldCustomizationRefs.put(customizationType, customizationRefs);
}
for (BasicRecordType customizationType : fieldCustomizationTypes) {
List<NsRef> customizationRefs = fieldCustomizationRefs.get(customizationType);
List<?> fieldCustomizationList = customMetaDataRetriever.retrieveCustomizations(customizationRefs);
customFieldMap.put(customizationType, fieldCustomizationList);
}
customFieldsLoaded = true;
}
Aggregations