public class

NetSuiteCloudConnector

extends Object
java.lang.Object
   ↳ org.mule.module.netsuite.NetSuiteCloudConnector
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

The NetSuite cloud connector facade, based on a NetSuiteClient

Summary

Constants
String SUITETALK_LIVE_ADDRESS
Fields
private String account SuiteTalk -NetSuite WebService - account id.
private NetSuiteClient<List<Object>, RuntimeException, Void> client The Netsuite client to use.
private String email The login email of both NetSuite UI and SuiteTalk
private String endpoint Service endpoint
    Supports:
  • Live: https://webservices.netsuite.com/services/NetSuitePort_2010_2
  • Sandbox: https://webservices.sandbox.netsuite.com/services/NetSuitePort_2010_2
Defaults to Live
private String password The login password of both the NetSuite UI and SuiteTalk
private String roleId The id of the role used to login in SuiteTalk, which determines the Processor privileges
Public Constructors
NetSuiteCloudConnector()
Public Methods
Date GetServerTime()
Answers the server time, resulting in more accurate and reliable sync'ing of data than using using local client time.
RecordRef addFile(Map<String, Object> attributes, Object content, String fileName, String folderId, RecordIdType folderIdType)
Creates a new file record.
WriteResponseList addList(RecordTypeEnum recordType, List<Map<String, Object>> records)
Used to add one or more records into the system
RecordRef addRecord(RecordTypeEnum recordType, Map<String, Object> attributes)
Creates a new record.
AsyncStatusResult asyncFindRecords(SearchRecordTypeEnum recordType, String expression)
Searches for all records that match the given filtering expression, asynchronously.
void attachRecord(RecordTypeEnum sourceRecordType, String sourceId, RecordIdType sourceIdType, RecordTypeEnum destinationRecordType, String destinationId, RecordIdType destinationIdType, RecordTypeEnum contanctRecordType, String contanctId, RecordIdType contanctIdType)
Attaches a source record - that is, the attachment - to another destination one, optionally specifying a contact for the attachment.
AsyncStatusResult checkAsyncStatus(String jobId)
Answers the status of an asynchronous Web services submission.
WriteResponseList deleteList(List<Map<String, Object>> records)
Used to delete one or more records in the system.
void deleteRecord(RecordTypeEnum recordType, String id, RecordIdType idType)
Deletes a record.
void detachRecord(RecordTypeEnum sourceRecordType, String sourceId, RecordIdType sourceIdType, RecordTypeEnum destinationRecordType, String destinationId, RecordIdType destinationIdType)
Detaches a source record - that is, the attachment - from a destination record.
Record findFirstRecord(SearchRecordTypeEnum recordType, String expression)
Answers the first records that match the given filtering expression.
Iterable<Record> findRecords(SearchRecordTypeEnum recordType, String expression)
Answers all records that match the given filtering expression.
String getAccount()
Record getAsyncFindFirstResult(String jobId)
Answers the the first result of an asynchronous asyncFind.
Iterable<Record> getAsyncFindResult(String jobId)
Answers the results of an asynchronous web services submission.
List<Object> getBudgetExchangeRates(String periodId, RecordIdType periodIdType, String fromSubsidiaryId, RecordIdType fromSubsidiaryIdType, String toSubsidiaryId, RecordIdType toSubsidiaryIdType)
Answers the list of budget exchange rates Example:
NetSuiteClient<List<Object>, RuntimeException, Void> getClient()
List<Object> getConsolidatedExchangeRates(String periodId, RecordIdType periodIdType, String fromSubsidiaryId, RecordIdType fromSubsidiaryIdType, String toSubsidiaryId, RecordIdType toSubsidiaryIdType)
Answers the list of consolidated exchange rates Example:
List<Object> getCustomizationIds(GetCustomizationTypeEnum type, boolean includeInactives)
Answers the ids of available customizations for a given record type.
List<Object> getDeletedRecords(RecordTypeEnum type, String whenExpression, Date date1, Date date2, SearchDateFieldOperatorEnum operator)
Answers a list of deleted records of a given record type that match a given date expression.
String getEmail()
String getEndpoint()
List<Object> getItemAvailabilities(RecordTypeEnum recordType, String id, RecordIdType idType, Date ifModifiedSince)
Answers the availability for a given record reference.
String getPassword()
Object getRecord(RecordTypeEnum recordType, String id, RecordIdType idType)
Answers a record given its id Example:
List<Object> getRecords(RecordTypeEnum type)
Answers all the record of a given type Example:
String getRoleId()
List<Object> getSavedSearch(RecordTypeEnum type)
Retrieves a list of existing saved searches for the given record type.
void init()
Record initialize(InitializeTypeEnum type, RecordTypeEnum recordType, String id, RecordIdType idType)
Populates fields on transaction line items with values from a related record, in a similar way empty text boxes are prepopulated within the Netsuite UI Example:
Iterable<Record> savedFindRecords(SearchRecordTypeEnum recordType, String searchId)
Answers all records of a given type for a saved search, given its search id.
void setAccount(String account)
void setClient(NetSuiteClient<?, ?, ?> client)
void setEmail(String email)
void setEndpoint(String endpoint)
void setPassword(String password)
void setRoleId(String roleId)
void updateInviteeStatus(String eventId, RecordIdType eventIdType, CalendarEventAttendeeResponseEnum status)
Sets a new invitation status for a given event.
WriteResponseList updateList(RecordTypeEnum recordType, List<Map<String, Object>> records)
Used to update one or more existing records in the system by providing new values for the fields to be updated for each record.
void updateRecord(RecordTypeEnum recordType, String id, RecordIdType idType, Map<String, Object> attributes)
Updates an existing record.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

private static final String SUITETALK_LIVE_ADDRESS

Constant Value: "https://webservices.netsuite.com/services/NetSuitePort_2010_2"

Fields

private String account

SuiteTalk -NetSuite WebService - account id. It looks like TSTDRVXXXXXX

private NetSuiteClient<List<Object>, RuntimeException, Void> client

The Netsuite client to use. Mainly for mocking purposes

private String email

The login email of both NetSuite UI and SuiteTalk

private String endpoint

Service endpoint

    Supports:
  • Live: https://webservices.netsuite.com/services/NetSuitePort_2010_2
  • Sandbox: https://webservices.sandbox.netsuite.com/services/NetSuitePort_2010_2
Defaults to Live

private String password

The login password of both the NetSuite UI and SuiteTalk

private String roleId

The id of the role used to login in SuiteTalk, which determines the Processor privileges

Public Constructors

public NetSuiteCloudConnector ()

Public Methods

public Date GetServerTime ()

Answers the server time, resulting in more accurate and reliable sync'ing of data than using using local client time. Example:

Returns
  • the server time, as a Date

public RecordRef addFile (Map<String, Object> attributes, Object content, String fileName, String folderId, RecordIdType folderIdType)

Creates a new file record. This Processor is similar to addRecord, but is customized for simplifying local content passing.

Parameters
attributes The additional file attributes
content The content of the file record to add. It can be of type String, byte array, File or InputStream. If it is an input stream, this Processors also closes it.
fileName The name of the remote file
folderId The id of the folder record where to add this file
folderIdType The id type of the folder record
Returns
  • the RecordRef of the new record
Throws
IOException

public WriteResponseList addList (RecordTypeEnum recordType, List<Map<String, Object>> records)

Used to add one or more records into the system

Parameters
recordType The type of record to add
records The records with their attributes, as a string-object map
Returns
Throws
Exception

public RecordRef addRecord (RecordTypeEnum recordType, Map<String, Object> attributes)

Creates a new record. Example:

Parameters
recordType The type of record to add
attributes The record attributes, as a string-object map
Returns
  • the RecordRef of the new record

public AsyncStatusResult asyncFindRecords (SearchRecordTypeEnum recordType, String expression)

Searches for all records that match the given filtering expression, asynchronously. If no expression is specified, all records of the given type are retrieved Filtering expressions support both basic and joined syntax, that is, using in the filters attributes of both the target entity and the target entity associations. Advanced search is not supported. Search expressions are in the form operator(attribute, arguments...) for basic search, and operator(join.attribute, arguments...) for joined search, where operator is any of the string, long, double, and text operators supported by SuiteTalk - MultiSelect operators are not supported - plus the isTrue/isFalse boolean operators, and arguments are zero up to three operands that depend on the operator used. Examples:

Parameters
recordType The type of record to search
expression The filtering expression, in the form operator(attribute, arguments...) for basic search, and operator(join.attribute, arguments...) for joined search, where operator is any of the string, long, double, and text operators supported by SuiteTalk - MultiSelect operators are not supported - plus the isTrue/isFalse boolean operators, and arguments are zero up to three operands that depend on the operator used. Multiple filters can be combined using multiple predicates separated by commas.
Returns
  • the AsyncStatusResult of the query
Throws
Exception

public void attachRecord (RecordTypeEnum sourceRecordType, String sourceId, RecordIdType sourceIdType, RecordTypeEnum destinationRecordType, String destinationId, RecordIdType destinationIdType, RecordTypeEnum contanctRecordType, String contanctId, RecordIdType contanctIdType)

Attaches a source record - that is, the attachment - to another destination one, optionally specifying a contact for the attachment. Not all record type are supported as source, destination or contact. Please consult NetSuite documentation. Example:

Parameters
sourceRecordType The type of the target record to be attached
sourceId The id of the target record to be attached
sourceIdType The id type of the record to be attached
destinationRecordType The type of the record to be attached to
destinationId The id of the record to be attached to
destinationIdType The id type of the record to be attached to
contanctRecordType The record type of the optional contact record
contanctId The id of the optional contact record
contanctIdType The id type of the optional contact record

public AsyncStatusResult checkAsyncStatus (String jobId)

Answers the status of an asynchronous Web services submission. When a jobId is submitted, the status, percent complete, and estimated remaining duration are returned. Example:

Parameters
jobId The id of the job whose status to check
Returns
  • the AsyncStatusResult for the given job

public WriteResponseList deleteList (List<Map<String, Object>> records)

Used to delete one or more records in the system. The records to be deleted are identified through the provided unique identifiers.

Parameters
records The records with their attributes, as a string-object map
Returns
Throws
Exception

public void deleteRecord (RecordTypeEnum recordType, String id, RecordIdType idType)

Deletes a record. Not all records can be deleted. Please consult NetSuite documentation Example:

Parameters
recordType The type of the record to delete
id The id of the record to delete
idType The type of id of the record to delete

public void detachRecord (RecordTypeEnum sourceRecordType, String sourceId, RecordIdType sourceIdType, RecordTypeEnum destinationRecordType, String destinationId, RecordIdType destinationIdType)

Detaches a source record - that is, the attachment - from a destination record. Example:

Parameters
sourceRecordType The type of the target record to be detached
sourceId The id of the target record to be detached
sourceIdType The id type of the record to be detached
destinationRecordType The type of the record to be detached to
destinationId The id of the record to be detached to
destinationIdType The id type of the record to be detached to

public Record findFirstRecord (SearchRecordTypeEnum recordType, String expression)

Answers the first records that match the given filtering expression. If no expression is specified, the empty expression is used, which retrieves all records of the given type. Throws a NoSuchElementException if no record can be retrieved. Filtering expressions support both basic and joined syntax, that is, using in the filters attributes of both the target entity and the target entity associations. Advanced search is not supported. Search expressions are in the form operator(attribute, arguments...) for basic search, and operator(join.attribute, arguments...) for joined search, where operator is any of the string, long, double, and text operators supported by SuiteTalk - MultiSelect operators are not supported - plus the isTrue/isFalse boolean operators, and arguments are zero up to three operands that depend on the operator used. Examples:

Parameters
recordType The type of record to search
expression The filtering expression Multiple filters can be combined using multiple predicates separated by commas.
Returns
  • the first record that match the given filtering expression

public Iterable<Record> findRecords (SearchRecordTypeEnum recordType, String expression)

Answers all records that match the given filtering expression. If no expression is specified, the empty expression is used, which retrieves all records of the given type. Filtering expressions support both basic and joined syntax, that is, using in the filters attributes of both the target entity and the target entity associations. Advanced search is not supported. Search expressions are in the form operator(attribute, arguments...) for basic search, and operator(join.attribute, arguments...) for joined search, where operator is any of the string, long, double, and text operators supported by SuiteTalk - MultiSelect operators are not supported - plus the isTrue/isFalse boolean operators, and arguments are zero up to three operands that depend on the operator used. Examples:

Parameters
recordType The type of record to search
expression The filtering expression Multiple filters can be combined using multiple predicates separated by commas.
Returns
  • An iterable with the Records found

public String getAccount ()

public Record getAsyncFindFirstResult (String jobId)

Answers the the first result of an asynchronous asyncFind. Throws a NoSuchElement exception if there are no results. This Processor can be executed Processor up to 20 times within a 30 day time period to retrieve the results of an asynchronous job. Example:

Parameters
jobId The id of the job
Returns
  • the first Record

public Iterable<Record> getAsyncFindResult (String jobId)

Answers the results of an asynchronous web services submission. This Processor can be executed Processor up to 20 times within a 30 day time period to retrieve the results of an asynchronous job. Example:

Parameters
jobId The id of the job
Returns
  • An iterable with the Records found

public List<Object> getBudgetExchangeRates (String periodId, RecordIdType periodIdType, String fromSubsidiaryId, RecordIdType fromSubsidiaryIdType, String toSubsidiaryId, RecordIdType toSubsidiaryIdType)

Answers the list of budget exchange rates Example:

Parameters
periodId The id of the period
periodIdType The period id type
fromSubsidiaryId The id of the staring subsidiary
fromSubsidiaryIdType The starting subsidiary id type
toSubsidiaryId The the id of the optional ending subsidiary
toSubsidiaryIdType The id type of the optional ending subsidiary
Returns
  • a list of BudgetExchangeRate's

public NetSuiteClient<List<Object>, RuntimeException, Void> getClient ()

public List<Object> getConsolidatedExchangeRates (String periodId, RecordIdType periodIdType, String fromSubsidiaryId, RecordIdType fromSubsidiaryIdType, String toSubsidiaryId, RecordIdType toSubsidiaryIdType)

Answers the list of consolidated exchange rates Example:

Parameters
periodId The id of the period
periodIdType The period id type
fromSubsidiaryId The id of the staring subsidiary
fromSubsidiaryIdType The starting subsidiary id type
toSubsidiaryId The the id of the optional ending subsidiary
toSubsidiaryIdType The id type of the optional ending subsidiary
Returns
  • a list of ConsolidatedExchangeRate's

public List<Object> getCustomizationIds (GetCustomizationTypeEnum type, boolean includeInactives)

Answers the ids of available customizations for a given record type. Example:

Parameters
type The target record type
includeInactives If inactive customizations should also be returned
Returns
  • a list of CustomizationRef's

public List<Object> getDeletedRecords (RecordTypeEnum type, String whenExpression, Date date1, Date date2, SearchDateFieldOperatorEnum operator)

Answers a list of deleted records of a given record type that match a given date expression. This Processors accepts two different date expression passing styles: string oriented, and object oriented. If whenExpression is specified, it is parsed and used as date expression. Otherwise, a date expression is build from date1, date2 and operator parameters. The first style is more appropriate when the date expression can be harcdoded, while the second style is better when client code already has date objects. However, predefined search values like thisWeek, tomorrow or today can only be used with the first, string oriented, style. String oriented date expressions are in the form Processor( searchValue, arguments...), where Processor is any of the NetSuite supported date Processors, arguments are one or two operands for the given operator, and searchValue is some of the supported predefined search value as defined by NetSuite or any of the following expressions: isoDate( anIsoDate ), isoDateRante( anIsoDate, anotherIsoDate ) , dateTime( aQuotedDateTime, aQuoatedJavaDateFormat ), dateTimeRange( aQuotedDateTime, anotherQuotedDateTime, aQuoatedJavaDateFormat ). Supported predefined search values are: today, thisWeek, thisBusinessWeek, thisMonth,thisYear, yesterday, twoDaysAgo, lastWeek, lastMonth, threeMonthAgo,tomorrow, nextMonth , nextWeek Examples using both string and object oriented styles:

Parameters
type The type of the target deleted record to retrieve
whenExpression A predicate-style date filtering expression
date1 The first date to use
date2 The second date to use
operator The date operator
Returns
  • the list of DeletedRecord's that match the given date filtering expression

public String getEmail ()

public String getEndpoint ()

public List<Object> getItemAvailabilities (RecordTypeEnum recordType, String id, RecordIdType idType, Date ifModifiedSince)

Answers the availability for a given record reference. If the Multi-Location Inventory feature is enabled, this Processor returns results for all locations. For locations that do not have any items available, only location IDs and names are listed in results. Example:

Parameters
recordType The target record type
id The target record id
idType The id type of the given record id
ifModifiedSince An optional modified since date. If set, only items with quantity available changes recorded as of the specified date are returned.
Returns
  • A list of ItemAvailability's

public String getPassword ()

public Object getRecord (RecordTypeEnum recordType, String id, RecordIdType idType)

Answers a record given its id Example:

Parameters
recordType The target record type
id The target record id
idType The id type of the given record id
Returns
  • a Record

public List<Object> getRecords (RecordTypeEnum type)

Answers all the record of a given type Example:

Parameters
type The target record type
Returns
  • the list of Record's

public String getRoleId ()

public List<Object> getSavedSearch (RecordTypeEnum type)

Retrieves a list of existing saved searches for the given record type. Example:

Parameters
type The target record type
Returns
  • the list of RecordRedf's

public void init ()

public Record initialize (InitializeTypeEnum type, RecordTypeEnum recordType, String id, RecordIdType idType)

Populates fields on transaction line items with values from a related record, in a similar way empty text boxes are prepopulated within the Netsuite UI Example:

Parameters
type The type of record whose defaults values are used to populate the target record
recordType The target record type
id The target record id
idType The id type of the given record id
Returns
  • the initialized Record

public Iterable<Record> savedFindRecords (SearchRecordTypeEnum recordType, String searchId)

Answers all records of a given type for a saved search, given its search id. Examples:

Parameters
recordType The type of record to search
searchId The id of the save search
Returns
  • An iterable with the Records found

public void setAccount (String account)

Parameters
account

public void setClient (NetSuiteClient<?, ?, ?> client)

Parameters
client

public void setEmail (String email)

Parameters
email

public void setEndpoint (String endpoint)

Parameters
endpoint

public void setPassword (String password)

Parameters
password

public void setRoleId (String roleId)

Parameters
roleId

public void updateInviteeStatus (String eventId, RecordIdType eventIdType, CalendarEventAttendeeResponseEnum status)

Sets a new invitation status for a given event. Example: Example:

Parameters
eventId The target event id
eventIdType The id type of the given eventId
status The new status to set

public WriteResponseList updateList (RecordTypeEnum recordType, List<Map<String, Object>> records)

Used to update one or more existing records in the system by providing new values for the fields to be updated for each record. The records to be updated are identified through the provided unique identifiers.

Parameters
recordType The type of record to add
records The records with their attributes, as a string-object map
Returns
Throws
Exception

public void updateRecord (RecordTypeEnum recordType, String id, RecordIdType idType, Map<String, Object> attributes)

Updates an existing record. Example:

Parameters
recordType The target record type to update
id The target record id
idType The id type of the given record id
attributes The record attributes, as a string-object map
Throws
Exception