use of org.talend.components.netsuite.client.model.CustomRecordTypeInfo 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.CustomRecordTypeInfo in project components by Talend.
the class DefaultCustomMetaDataSource method getCustomFieldsImpl.
/**
* Get custom field descriptors for a given record type.
*
* @param recordTypeInfo record type info
* @return custom field descriptors as map
* @throws NetSuiteException if an error occurs during obtaining of customization data
*/
protected Map<String, CustomFieldDesc> getCustomFieldsImpl(RecordTypeInfo recordTypeInfo) throws NetSuiteException {
RecordTypeDesc recordType = recordTypeInfo.getRecordType();
Map<String, CustomFieldDesc> fieldDescMap;
if (recordTypeInfo instanceof CustomRecordTypeInfo) {
fieldDescMap = customRecordCustomFieldMap.get(recordTypeInfo.getName());
if (fieldDescMap == null) {
retrieveCustomRecordCustomFields((CustomRecordTypeInfo) recordTypeInfo);
fieldDescMap = customRecordCustomFieldMap.get(recordTypeInfo.getName());
}
} else {
fieldDescMap = recordCustomFieldMap.get(recordType.getType());
if (fieldDescMap == null) {
retrieveCustomFields(recordType);
fieldDescMap = recordCustomFieldMap.get(recordType.getType());
}
}
return fieldDescMap;
}
Aggregations