Search in sources :

Example 1 with RecordType

use of com.netsuite.webservices.test.platform.core.types.RecordType in project components by Talend.

the class NetSuiteMockTestBase method createCustomFieldCustomizationRefs.

protected Map<String, NsRef> createCustomFieldCustomizationRefs(Map<String, CustomFieldSpec<RecordType, CustomizationFieldType>> customFieldSpecs) throws Exception {
    Map<String, NsRef> map = new HashMap<>();
    for (CustomFieldSpec<RecordType, CustomizationFieldType> spec : customFieldSpecs.values()) {
        NsRef ref = new NsRef(RefType.CUSTOMIZATION_REF);
        ref.setScriptId(spec.getScriptId());
        ref.setInternalId(spec.getInternalId());
        ref.setType(spec.getRecordType().value());
        map.put(ref.getScriptId(), ref);
    }
    return map;
}
Also used : CustomizationFieldType(com.netsuite.webservices.test.setup.customization.types.CustomizationFieldType) RecordType(com.netsuite.webservices.test.platform.core.types.RecordType) CustomRecordType(com.netsuite.webservices.test.setup.customization.CustomRecordType) HashMap(java.util.HashMap) NsRef(org.talend.components.netsuite.client.NsRef)

Example 2 with RecordType

use of com.netsuite.webservices.test.platform.core.types.RecordType in project components by Talend.

the class NetSuiteMockTestBase method createCustomFieldTypes.

protected Map<String, CustomFieldType> createCustomFieldTypes(Map<String, CustomFieldSpec<RecordType, CustomizationFieldType>> customFieldSpecs) throws Exception {
    Map<String, CustomFieldType> customFieldTypeMap = new HashMap<>();
    for (CustomFieldSpec<RecordType, CustomizationFieldType> spec : customFieldSpecs.values()) {
        CustomFieldType fieldRecord = (CustomFieldType) spec.getFieldTypeClass().newInstance();
        Beans.setProperty(fieldRecord, "internalId", spec.getInternalId());
        fieldRecord.setScriptId(spec.getScriptId());
        fieldRecord.setFieldType(spec.getFieldType());
        if (spec.getAppliesTo() != null) {
            for (String appliesTo : spec.getAppliesTo()) {
                Beans.setProperty(fieldRecord, appliesTo, Boolean.TRUE);
            }
        }
        customFieldTypeMap.put(fieldRecord.getScriptId(), fieldRecord);
    }
    return customFieldTypeMap;
}
Also used : CustomizationFieldType(com.netsuite.webservices.test.setup.customization.types.CustomizationFieldType) RecordType(com.netsuite.webservices.test.platform.core.types.RecordType) CustomRecordType(com.netsuite.webservices.test.setup.customization.CustomRecordType) HashMap(java.util.HashMap) CustomFieldType(com.netsuite.webservices.test.setup.customization.CustomFieldType)

Aggregations

RecordType (com.netsuite.webservices.test.platform.core.types.RecordType)2 CustomRecordType (com.netsuite.webservices.test.setup.customization.CustomRecordType)2 CustomizationFieldType (com.netsuite.webservices.test.setup.customization.types.CustomizationFieldType)2 HashMap (java.util.HashMap)2 CustomFieldType (com.netsuite.webservices.test.setup.customization.CustomFieldType)1 NsRef (org.talend.components.netsuite.client.NsRef)1