Search in sources :

Example 1 with CustomizationFieldType

use of com.netsuite.webservices.v2014_2.setup.customization.types.CustomizationFieldType in project components by Talend.

the class NetSuiteMockTestBase method createCustomFieldRefs.

protected Map<String, CustomFieldRef> createCustomFieldRefs(Map<String, CustomFieldSpec<RecordType, CustomizationFieldType>> customFieldSpecs) throws Exception {
    NetSuiteClientService<?> clientService = webServiceMockTestFixture.getClientService();
    Map<String, CustomFieldRef> map = new HashMap<>();
    for (CustomFieldSpec<RecordType, CustomizationFieldType> spec : customFieldSpecs.values()) {
        CustomFieldRef fieldRef = clientService.getBasicMetaData().createInstance(spec.getFieldRefType().getTypeName());
        fieldRef.setScriptId(spec.getScriptId());
        fieldRef.setInternalId(spec.getInternalId());
        BeanInfo beanInfo = Beans.getBeanInfo(fieldRef.getClass());
        PropertyInfo valuePropInfo = beanInfo.getProperty("value");
        Object value = composeValue(valuePropInfo.getWriteType());
        if (value != null) {
            Beans.setProperty(fieldRef, "value", value);
        }
        map.put(fieldRef.getScriptId(), fieldRef);
    }
    return map;
}
Also used : CustomizationFieldType(com.netsuite.webservices.v2014_2.setup.customization.types.CustomizationFieldType) RecordType(com.netsuite.webservices.v2014_2.platform.core.types.RecordType) HashMap(java.util.HashMap) BeanInfo(org.talend.components.netsuite.client.model.beans.BeanInfo) CustomFieldRef(com.netsuite.webservices.v2014_2.platform.core.CustomFieldRef) PropertyInfo(org.talend.components.netsuite.client.model.beans.PropertyInfo)

Example 2 with CustomizationFieldType

use of com.netsuite.webservices.v2014_2.setup.customization.types.CustomizationFieldType in project components by Talend.

the class NetSuiteMockTestBase method createCustomFieldCustomizationRefs.

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

Example 3 with CustomizationFieldType

use of com.netsuite.webservices.v2014_2.setup.customization.types.CustomizationFieldType 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());
        for (String appliesTo : spec.getAppliesTo()) {
            Beans.setProperty(fieldRecord, appliesTo, Boolean.TRUE);
        }
        customFieldTypeMap.put(fieldRecord.getScriptId(), fieldRecord);
    }
    return customFieldTypeMap;
}
Also used : CustomizationFieldType(com.netsuite.webservices.v2014_2.setup.customization.types.CustomizationFieldType) RecordType(com.netsuite.webservices.v2014_2.platform.core.types.RecordType) HashMap(java.util.HashMap) CustomFieldType(com.netsuite.webservices.v2014_2.setup.customization.CustomFieldType)

Example 4 with CustomizationFieldType

use of com.netsuite.webservices.v2014_2.setup.customization.types.CustomizationFieldType in project components by Talend.

the class NetSuiteMockTestBase method createCustomFieldCustomizationRefs.

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

Example 5 with CustomizationFieldType

use of com.netsuite.webservices.v2014_2.setup.customization.types.CustomizationFieldType 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());
        for (String appliesTo : spec.getAppliesTo()) {
            Beans.setProperty(fieldRecord, appliesTo, Boolean.TRUE);
        }
        customFieldTypeMap.put(fieldRecord.getScriptId(), fieldRecord);
    }
    return customFieldTypeMap;
}
Also used : CustomizationFieldType(com.netsuite.webservices.v2016_2.setup.customization.types.CustomizationFieldType) RecordType(com.netsuite.webservices.v2016_2.platform.core.types.RecordType) HashMap(java.util.HashMap) CustomFieldType(com.netsuite.webservices.v2016_2.setup.customization.CustomFieldType)

Aggregations

HashMap (java.util.HashMap)6 RecordType (com.netsuite.webservices.v2014_2.platform.core.types.RecordType)4 CustomizationFieldType (com.netsuite.webservices.v2014_2.setup.customization.types.CustomizationFieldType)3 CustomizationRef (com.netsuite.webservices.v2014_2.platform.core.CustomizationRef)2 CustomFieldType (com.netsuite.webservices.v2014_2.setup.customization.CustomFieldType)2 RecordType (com.netsuite.webservices.v2016_2.platform.core.types.RecordType)2 CustomizationFieldType (com.netsuite.webservices.v2016_2.setup.customization.types.CustomizationFieldType)2 NetSuitePortType (com.netsuite.webservices.v2014_2.platform.NetSuitePortType)1 BaseRef (com.netsuite.webservices.v2014_2.platform.core.BaseRef)1 CustomFieldRef (com.netsuite.webservices.v2014_2.platform.core.CustomFieldRef)1 CustomizationRefList (com.netsuite.webservices.v2014_2.platform.core.CustomizationRefList)1 CustomizationType (com.netsuite.webservices.v2014_2.platform.core.CustomizationType)1 GetCustomizationIdResult (com.netsuite.webservices.v2014_2.platform.core.GetCustomizationIdResult)1 GetCustomizationIdRequest (com.netsuite.webservices.v2014_2.platform.messages.GetCustomizationIdRequest)1 GetCustomizationIdResponse (com.netsuite.webservices.v2014_2.platform.messages.GetCustomizationIdResponse)1 GetListRequest (com.netsuite.webservices.v2014_2.platform.messages.GetListRequest)1 GetListResponse (com.netsuite.webservices.v2014_2.platform.messages.GetListResponse)1 ReadResponse (com.netsuite.webservices.v2014_2.platform.messages.ReadResponse)1 ReadResponseList (com.netsuite.webservices.v2014_2.platform.messages.ReadResponseList)1 CustomizationRef (com.netsuite.webservices.v2016_2.platform.core.CustomizationRef)1