Skip to content

Instantly share code, notes, and snippets.

Mariano Gonzalez marianogonzalez

Block or report user

Report or block marianogonzalez

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View exceptionfactory.java
/**
* 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
View gist:8919594
<async>
<flow-ref name="crmSystemRoute" />
<flow-ref name="marketingSystemRoute" />
<flow-ref name="provisioningSystemRoute" />
<flow-ref name="stockSystemRoute" />
</async>
View gist:8920710
<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" />
View gist:8920756
<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" />
View gist:8939788
/**
* 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();
View gist:8939611
/**
* 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'
*/
View gist:8940667
@Start
public void init() {
this.muleContext.getRegistry().registerTransformer(new BatchResultToBulkOperationTransformer());
}
View gist:8940694
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;
View gist:8945304
<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" />
View gist:8940514
public List<BatchResult> batchContacts(String batchId, List<NestedProcessor> operations) throws Exception;
You can’t perform that action at this time.