Skip to content

Instantly share code, notes, and snippets.

/**
* A factory for {@link Exception}s which represents
* a validations which failed. Methods in this class
* should always be invoked using a {@link ValidationResult}
* object which {@@link ValidationResult#isError()} method
* returns {@code true}
*
* @since 3.7.0
*/
public interface ExceptionFactory
<set-variable variableName="startTime" value="#[System.currentTimeMillis()]" doc:name="Variable" />
<all>
<flow-ref name="to-salesforce" doc:name="to salesforce"/>
<flow-ref name="to-google" doc:name="to google"/>
</all>
<set-payload value="Elapsed time: #[(System.currentTimeMillis() - flowVars['startTime']) /1000] seconds" />
<set-variable variableName="startTime" value="#[System.currentTimeMillis()]" doc:name="Variable" />
<scatter-gather>
<flow-ref name="to-salesforce" doc:name="to salesforce"/>
<flow-ref name="to-google" doc:name="to google"/>
</scatter-gather>
<set-payload value="Elapsed time: #[(System.currentTimeMillis() - flowVars['startTime']) /1000] seconds" />
<async>
<flow-ref name="crmSystemRoute" />
<flow-ref name="marketingSystemRoute" />
<flow-ref name="provisioningSystemRoute" />
<flow-ref name="stockSystemRoute" />
</async>
<google-contacts:config-with-oauth name="Google_Contacts" consumerKey="${consumerKey}" consumerSecret="${consumerSecret}">
<google-contacts:oauth-callback-config domain="localhost" localPort="${https.port}" path="oauth2callback" connector-ref="https.connector" />
</google-contacts:config-with-oauth>
<objectstore:config name="tenantStore" partition="tenants" persistent="true" />
<flow name="authorize">
<https:inbound-endpoint path="authorize" port="${https.port}" exchange-pattern="request-response" />
<flow-ref name="loadTenantInformation" />
<google-contacts:authorize config-ref="Google_Contacts" />
@Start
public void init() {
this.muleContext.getRegistry().registerTransformer(new BatchResultToBulkOperationTransformer());
}
public class BatchResultToBulkOperationTransformer extends AbstractDiscoverableTransformer {
public BatchResultToBulkOperationTransformer() {
this.registerSourceType(DataTypeFactory.create(List.class, BatchResult.class, null));
this.setReturnDataType(DataTypeFactory.create(BulkOperationResult.class));
}
@Override
protected Object doTransform(Object src, String enc) throws TransformerException {
List<BatchResult> results = (List<BatchResult>) src;
public List<BatchResult> batchContacts(String batchId, List<NestedProcessor> operations) throws Exception;
/**
* This class represents an individual data piece in the context of a bulk operation
*/
public final class BulkItem<T> implements Serializable
{
/**
* The item id
*/
public Serializable getId();
/**
* This class is used to provide item level information about a bulk operation. This
* master entity represents the bulk operation as a whole, while the detail entity
* {@link BulkItem} represents the operation status for each individual data piece.
* The {@link #items} list defines a contract in which the ordering of those items
* needs to match the ordering of the original objects. For example, if the bulk
* operation consisted of 10 person objects in which number X corresponded to the
* person 'John Doe', then the Xth item in the {@link #items} list must reference to
* the result of procesing the same 'John Doe'
*/