PageRenderTime 57ms CodeModel.GetById 30ms RepoModel.GetById 1ms 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. package org.mule.transport.salesforce.op.base;
  11. import org.apache.commons.pool.impl.GenericKeyedObjectPool;
  12. import org.mule.transport.salesforce.SalesforceProperties;
  13. import org.mule.transport.salesforce.op.impl.ConvertLeadInvocation;
  14. import org.mule.transport.salesforce.op.impl.CreateInvocation;
  15. import org.mule.transport.salesforce.op.impl.DeleteInvocation;
  16. import org.mule.transport.salesforce.op.impl.DescribeGlobalInvocation;
  17. import org.mule.transport.salesforce.op.impl.DescribeLayoutInvocation;
  18. import org.mule.transport.salesforce.op.impl.DescribeSObjectsInvocation;
  19. import org.mule.transport.salesforce.op.impl.DescribeSoftphoneLayoutInvocation;
  20. import org.mule.transport.salesforce.op.impl.DescribeTabsInvocation;
  21. import org.mule.transport.salesforce.op.impl.EmptyRecycleBinInvocation;
  22. import org.mule.transport.salesforce.op.impl.GetDeletedInvocation;
  23. import org.mule.transport.salesforce.op.impl.GetServerTimestampInvocation;
  24. import org.mule.transport.salesforce.op.impl.GetUpdatedInvocation;
  25. import org.mule.transport.salesforce.op.impl.GetUserInfoInvocation;
  26. import org.mule.transport.salesforce.op.impl.InvalidateSessionsInvocation;
  27. import org.mule.transport.salesforce.op.impl.LoginInvocation;
  28. import org.mule.transport.salesforce.op.impl.LogoutInvocation;
  29. import org.mule.transport.salesforce.op.impl.MergeInvocation;
  30. import org.mule.transport.salesforce.op.impl.ProcessInvocation;
  31. import org.mule.transport.salesforce.op.impl.QueryAllInvocation;
  32. import org.mule.transport.salesforce.op.impl.QueryInvocation;
  33. import org.mule.transport.salesforce.op.impl.ResetPasswordInvocation;
  34. import org.mule.transport.salesforce.op.impl.RetrieveInvocation;
  35. import org.mule.transport.salesforce.op.impl.SearchInvocation;
  36. import org.mule.transport.salesforce.op.impl.SendEmailInvocation;
  37. import org.mule.transport.salesforce.op.impl.SetPasswordInvocation;
  38. import org.mule.transport.salesforce.op.impl.UndeleteInvocation;
  39. import org.mule.transport.salesforce.op.impl.UpdateInvocation;
  40. import org.mule.transport.salesforce.op.impl.UpsertInvocation;
  41. public class InvocationFactory
  42. {
  43. public static AbstractInvocation createInvocation(String operation,
  44. GenericKeyedObjectPool soapBindingPool,
  45. Object[] parameters)
  46. {
  47. if (null == operation)
  48. {
  49. return null;
  50. }
  51. else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_LOGIN))
  52. {
  53. return new LoginInvocation(soapBindingPool, parameters);
  54. }
  55. else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_DESCRIBE_SOBJECTS))
  56. {
  57. return new DescribeSObjectsInvocation(soapBindingPool, parameters);
  58. }
  59. else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_DESCRIBE_GLOBAL))
  60. {
  61. return new DescribeGlobalInvocation(soapBindingPool, parameters);
  62. }
  63. else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_DESCRIBE_LAYOUT))
  64. {
  65. return new DescribeLayoutInvocation(soapBindingPool, parameters);
  66. }
  67. else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_DESCRIBE_SOFTPHONE_LAYOUT))
  68. {
  69. return new DescribeSoftphoneLayoutInvocation(soapBindingPool, parameters);
  70. }
  71. else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_DESCRIBE_TABS))
  72. {
  73. return new DescribeTabsInvocation(soapBindingPool, parameters);
  74. }
  75. else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_CREATE))
  76. {
  77. return new CreateInvocation(soapBindingPool, parameters);
  78. }
  79. else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_UPDATE))
  80. {
  81. return new UpdateInvocation(soapBindingPool, parameters);
  82. }
  83. else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_UPSERT))
  84. {
  85. return new UpsertInvocation(soapBindingPool, parameters);
  86. }
  87. else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_MERGE))
  88. {
  89. return new MergeInvocation(soapBindingPool, parameters);
  90. }
  91. else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_DELETE))
  92. {
  93. return new DeleteInvocation(soapBindingPool, parameters);
  94. }
  95. else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_UNDELETE))
  96. {
  97. return new UndeleteInvocation(soapBindingPool, parameters);
  98. }
  99. else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_EMPTY_RECYCLE_BIN))
  100. {
  101. return new EmptyRecycleBinInvocation(soapBindingPool, parameters);
  102. }
  103. else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_RETRIEVE))
  104. {
  105. return new RetrieveInvocation(soapBindingPool, parameters);
  106. }
  107. else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_PROCESS))
  108. {
  109. return new ProcessInvocation(soapBindingPool, parameters);
  110. }
  111. else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_CONVERT_LEAD))
  112. {
  113. return new ConvertLeadInvocation(soapBindingPool, parameters);
  114. }
  115. else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_LOGOUT))
  116. {
  117. return new LogoutInvocation(soapBindingPool, parameters);
  118. }
  119. else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_INVALIDATE_SESSIONS))
  120. {
  121. return new InvalidateSessionsInvocation(soapBindingPool, parameters);
  122. }
  123. else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_GET_DELETED))
  124. {
  125. return new GetDeletedInvocation(soapBindingPool, parameters);
  126. }
  127. else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_GET_UPDATED))
  128. {
  129. return new GetUpdatedInvocation(soapBindingPool, parameters);
  130. }
  131. else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_QUERY))
  132. {
  133. return new QueryInvocation(soapBindingPool, parameters);
  134. }
  135. else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_QUERY_ALL))
  136. {
  137. return new QueryAllInvocation(soapBindingPool, parameters);
  138. }
  139. else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_SEARCH))
  140. {
  141. return new SearchInvocation(soapBindingPool, parameters);
  142. }
  143. else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_GET_SERVER_TIMESTAMP))
  144. {
  145. return new GetServerTimestampInvocation(soapBindingPool, parameters);
  146. }
  147. else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_SET_PASSWORD))
  148. {
  149. return new SetPasswordInvocation(soapBindingPool, parameters);
  150. }
  151. else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_RESET_PASSWORD))
  152. {
  153. return new ResetPasswordInvocation(soapBindingPool, parameters);
  154. }
  155. else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_GET_USER_INFO))
  156. {
  157. return new GetUserInfoInvocation(soapBindingPool, parameters);
  158. }
  159. else if (operation.equals(SalesforceProperties.SALESFORCE_OPERATION_SEND_EMAIL))
  160. {
  161. return new SendEmailInvocation(soapBindingPool, parameters);
  162. }
  163. return null;
  164. }
  165. }