PageRenderTime 1ms CodeModel.GetById 27ms app.highlight 9ms RepoModel.GetById 13ms app.codeStats 0ms

/src/main/java/org/mule/transport/salesforce/op/base/InvocationFactory.java

https://github.com/Ricston/mule-transport-salesforce
Java | 201 lines | 156 code | 36 blank | 9 comment | 58 complexity | 53acfe2253cbcc37e7caec1a0d95f162 MD5 | raw file
  1/*
  2 * $Id: InvocationFactory.java 1036 2010-11-24 08:47:10Z jcalleja $
  3 * --------------------------------------------------------------------------------------
  4 * Copyright (c) Ricston Ltd.  All rights reserved.  http://www.ricston.com/
  5 *
  6 * The software in this package is published under the terms of the CPAL v1.0
  7 * license, a copy of which has been included with this distribution in the
  8 * LICENSE.txt file.
  9 */
 10
 11package org.mule.transport.salesforce.op.base;
 12
 13import org.apache.commons.pool.impl.GenericKeyedObjectPool;
 14import org.mule.transport.salesforce.SalesforceProperties;
 15import org.mule.transport.salesforce.op.impl.ConvertLeadInvocation;
 16import org.mule.transport.salesforce.op.impl.CreateInvocation;
 17import org.mule.transport.salesforce.op.impl.DeleteInvocation;
 18import org.mule.transport.salesforce.op.impl.DescribeGlobalInvocation;
 19import org.mule.transport.salesforce.op.impl.DescribeLayoutInvocation;
 20import org.mule.transport.salesforce.op.impl.DescribeSObjectsInvocation;
 21import org.mule.transport.salesforce.op.impl.DescribeSoftphoneLayoutInvocation;
 22import org.mule.transport.salesforce.op.impl.DescribeTabsInvocation;
 23import org.mule.transport.salesforce.op.impl.EmptyRecycleBinInvocation;
 24import org.mule.transport.salesforce.op.impl.GetDeletedInvocation;
 25import org.mule.transport.salesforce.op.impl.GetServerTimestampInvocation;
 26import org.mule.transport.salesforce.op.impl.GetUpdatedInvocation;
 27import org.mule.transport.salesforce.op.impl.GetUserInfoInvocation;
 28import org.mule.transport.salesforce.op.impl.InvalidateSessionsInvocation;
 29import org.mule.transport.salesforce.op.impl.LoginInvocation;
 30import org.mule.transport.salesforce.op.impl.LogoutInvocation;
 31import org.mule.transport.salesforce.op.impl.MergeInvocation;
 32import org.mule.transport.salesforce.op.impl.ProcessInvocation;
 33import org.mule.transport.salesforce.op.impl.QueryAllInvocation;
 34import org.mule.transport.salesforce.op.impl.QueryInvocation;
 35import org.mule.transport.salesforce.op.impl.ResetPasswordInvocation;
 36import org.mule.transport.salesforce.op.impl.RetrieveInvocation;
 37import org.mule.transport.salesforce.op.impl.SearchInvocation;
 38import org.mule.transport.salesforce.op.impl.SendEmailInvocation;
 39import org.mule.transport.salesforce.op.impl.SetPasswordInvocation;
 40import org.mule.transport.salesforce.op.impl.UndeleteInvocation;
 41import org.mule.transport.salesforce.op.impl.UpdateInvocation;
 42import org.mule.transport.salesforce.op.impl.UpsertInvocation;
 43
 44public class InvocationFactory
 45{
 46
 47    public static AbstractInvocation createInvocation(String operation,
 48                                                      GenericKeyedObjectPool soapBindingPool,
 49                                                      Object[] parameters)
 50    {
 51
 52        if (null == operation)
 53        {
 54            return null;
 55        }
 56        else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_LOGIN))
 57        {
 58            return new LoginInvocation(soapBindingPool, parameters);
 59
 60        }
 61        else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_DESCRIBE_SOBJECTS))
 62        {
 63            return new DescribeSObjectsInvocation(soapBindingPool, parameters);
 64
 65        }
 66        else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_DESCRIBE_GLOBAL))
 67        {
 68            return new DescribeGlobalInvocation(soapBindingPool, parameters);
 69
 70        }
 71        else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_DESCRIBE_LAYOUT))
 72        {
 73            return new DescribeLayoutInvocation(soapBindingPool, parameters);
 74
 75        }
 76        else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_DESCRIBE_SOFTPHONE_LAYOUT))
 77        {
 78            return new DescribeSoftphoneLayoutInvocation(soapBindingPool, parameters);
 79
 80        }
 81        else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_DESCRIBE_TABS))
 82        {
 83            return new DescribeTabsInvocation(soapBindingPool, parameters);
 84
 85        }
 86        else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_CREATE))
 87        {
 88            return new CreateInvocation(soapBindingPool, parameters);
 89
 90        }
 91        else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_UPDATE))
 92        {
 93            return new UpdateInvocation(soapBindingPool, parameters);
 94
 95        }
 96        else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_UPSERT))
 97        {
 98            return new UpsertInvocation(soapBindingPool, parameters);
 99
100        }
101        else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_MERGE))
102        {
103            return new MergeInvocation(soapBindingPool, parameters);
104
105        }
106        else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_DELETE))
107        {
108            return new DeleteInvocation(soapBindingPool, parameters);
109
110        }
111        else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_UNDELETE))
112        {
113            return new UndeleteInvocation(soapBindingPool, parameters);
114
115        }
116        else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_EMPTY_RECYCLE_BIN))
117        {
118            return new EmptyRecycleBinInvocation(soapBindingPool, parameters);
119
120        }
121        else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_RETRIEVE))
122        {
123            return new RetrieveInvocation(soapBindingPool, parameters);
124
125        }
126        else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_PROCESS))
127        {
128            return new ProcessInvocation(soapBindingPool, parameters);
129
130        }
131        else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_CONVERT_LEAD))
132        {
133            return new ConvertLeadInvocation(soapBindingPool, parameters);
134
135        }
136        else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_LOGOUT))
137        {
138            return new LogoutInvocation(soapBindingPool, parameters);
139
140        }
141        else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_INVALIDATE_SESSIONS))
142        {
143            return new InvalidateSessionsInvocation(soapBindingPool, parameters);
144
145        }
146        else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_GET_DELETED))
147        {
148            return new GetDeletedInvocation(soapBindingPool, parameters);
149
150        }
151        else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_GET_UPDATED))
152        {
153            return new GetUpdatedInvocation(soapBindingPool, parameters);
154
155        }
156        else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_QUERY))
157        {
158            return new QueryInvocation(soapBindingPool, parameters);
159
160        }
161        else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_QUERY_ALL))
162        {
163            return new QueryAllInvocation(soapBindingPool, parameters);
164
165        }
166        else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_SEARCH))
167        {
168            return new SearchInvocation(soapBindingPool, parameters);
169
170        }
171        else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_GET_SERVER_TIMESTAMP))
172        {
173            return new GetServerTimestampInvocation(soapBindingPool, parameters);
174
175        }
176        else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_SET_PASSWORD))
177        {
178            return new SetPasswordInvocation(soapBindingPool, parameters);
179
180        }
181        else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_RESET_PASSWORD))
182        {
183            return new ResetPasswordInvocation(soapBindingPool, parameters);
184
185        }
186        else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_GET_USER_INFO))
187        {
188            return new GetUserInfoInvocation(soapBindingPool, parameters);
189
190        }
191        else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_SEND_EMAIL))
192        {
193            return new SendEmailInvocation(soapBindingPool, parameters);
194
195        }
196
197        return null;
198
199    }
200
201}