PageRenderTime 44ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/lib/xmlrpc/java/ApacheLib3/org/openads/proxy/AdvertiserService.java

https://github.com/orchestra-io/sample-openx
Java | 358 lines | 100 code | 26 blank | 232 comment | 0 complexity | 04094633c46642d254f01320f89a4019 MD5 | raw file
  1. /*
  2. +---------------------------------------------------------------------------+
  3. | OpenX v${RELEASE_MAJOR_MINOR} |
  4. | ======${RELEASE_MAJOR_MINOR_DOUBLE_UNDERLINE} |
  5. | |
  6. | Copyright (c) 2003-2010 OpenX Limited |
  7. | For contact details, see: http://www.openx.org/ |
  8. | |
  9. | This program is free software; you can redistribute it and/or modify |
  10. | it under the terms of the GNU Lesser General Public License as published |
  11. | by the Free Software Foundation; either version 2 of the License, or |
  12. | (at your option) any later version. |
  13. | |
  14. | This program is distributed in the hope that it will be useful, |
  15. | but WITHOUT ANY WARRANTY; without even the implied warranty of |
  16. | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
  17. | GNU Lesser General Public License for more details. |
  18. | |
  19. | You should have received a copy of the GNU Lesser General Public License |
  20. | along with this program; if not, write to the Free Software |
  21. | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
  22. +---------------------------------------------------------------------------+
  23. $Id:$
  24. */
  25. package org.openads.proxy;
  26. import java.util.Date;
  27. import java.util.Map;
  28. import org.apache.xmlrpc.XmlRpcException;
  29. import org.apache.xmlrpc.client.XmlRpcClient;
  30. /**
  31. * Base class for all advertiser web service tests.
  32. *
  33. */
  34. class AdvertiserService extends AbstractService {
  35. private static final String ADVERTISER_SERVICE = "AdvertiserXmlRpcService.php";
  36. private static final String ADD_ADVERTISER_METHOD = "addAdvertiser";
  37. private static final String DELETE_ADVERTISER_METHOD = "deleteAdvertiser";
  38. private static final String MODIFY_ADVERTISER_METHOD = "modifyAdvertiser";
  39. private static final String ADVERTISER_BANNER_STATISTICS_METHOD = "advertiserBannerStatistics";
  40. private static final String ADVERTISER_CAMPAIGN_STATISTICS_METHOD = "advertiserCampaignStatistics";
  41. private static final String ADVERTISER_DAILY_STATISTICS_METHOD = "advertiserDailyStatistics";
  42. private static final String ADVERTISER_PUBLISHER_STATISTICS_METHOD = "advertiserPublisherStatistics";
  43. private static final String ADVERTISER_ZONE_STATISTICS_METHOD = "advertiserZoneStatistics";
  44. private static final String GET_ADVERTISER_LIST_BY_AGENCY_ID_METHOD = "getAdvertiserListByAgencyId";
  45. private static final String GET_ADVERTISER_METHOD = "getAdvertiser";
  46. /**
  47. * Instantiates a new advertiser service.
  48. *
  49. * @param client the client
  50. * @param basepath the basepath
  51. */
  52. public AdvertiserService(XmlRpcClient client, String basepath) {
  53. super(client, basepath);
  54. }
  55. /* (non-Javadoc)
  56. * @see org.openads.proxy.AbstractService#getService()
  57. */
  58. @Override
  59. public String getService() {
  60. return ADVERTISER_SERVICE;
  61. }
  62. /**
  63. * Adds the advertiser.
  64. *
  65. * @param params the params
  66. *
  67. * @return the integer
  68. *
  69. * @throws XmlRpcException the xml rpc exception
  70. */
  71. public Integer addAdvertiser(Map params) throws XmlRpcException {
  72. return (Integer) execute(ADD_ADVERTISER_METHOD, params);
  73. }
  74. /**
  75. * Modify advertiser.
  76. *
  77. * @param params the params
  78. *
  79. * @return the boolean
  80. *
  81. * @throws XmlRpcException the xml rpc exception
  82. */
  83. public Boolean modifyAdvertiser(Map params) throws XmlRpcException {
  84. return (Boolean) execute(MODIFY_ADVERTISER_METHOD, params);
  85. }
  86. /**
  87. * Delete advertiser.
  88. *
  89. * @param id the id
  90. *
  91. * @return the boolean
  92. *
  93. * @throws XmlRpcException the xml rpc exception
  94. */
  95. public Boolean deleteAdvertiser(Integer id) throws XmlRpcException {
  96. return (Boolean) execute(DELETE_ADVERTISER_METHOD, id);
  97. }
  98. /**
  99. * Gets the advertiser.
  100. *
  101. * @param id the id
  102. *
  103. * @return the advertiser
  104. *
  105. * @throws XmlRpcException the xml rpc exception
  106. */
  107. public Map getAdvertiser(Integer id) throws XmlRpcException {
  108. return (Map) execute(GET_ADVERTISER_METHOD, id);
  109. }
  110. /**
  111. * Gets the advertiser list by agency id all fields.
  112. *
  113. * @param id the id
  114. *
  115. * @return the advertiser list by agency id all fields
  116. *
  117. * @throws XmlRpcException the xml rpc exception
  118. */
  119. public Map[] getAdvertiserListByAgencyIdAllFields(Integer id) throws XmlRpcException {
  120. return objectToArrayMaps(execute(GET_ADVERTISER_LIST_BY_AGENCY_ID_METHOD));
  121. }
  122. /**
  123. * Advertiser daily statistics.
  124. *
  125. * @param id the id
  126. *
  127. * @return the Map[]
  128. *
  129. * @throws XmlRpcException the xml rpc exception
  130. */
  131. public Map[] advertiserDailyStatistics(Integer id) throws XmlRpcException {
  132. return objectToArrayMaps( execute(ADVERTISER_DAILY_STATISTICS_METHOD, id));
  133. }
  134. /**
  135. * Advertiser daily statistics.
  136. *
  137. * @param id the id
  138. * @param startDate the start date
  139. *
  140. * @return the Map[]
  141. *
  142. * @throws XmlRpcException the xml rpc exception
  143. */
  144. public Map[] advertiserDailyStatistics(Integer id, Date startDate)
  145. throws XmlRpcException {
  146. return objectToArrayMaps( execute(ADVERTISER_DAILY_STATISTICS_METHOD, id, startDate));
  147. }
  148. /**
  149. * Advertiser daily statistics.
  150. *
  151. * @param id the id
  152. * @param startDate the start date
  153. * @param endDate the end date
  154. *
  155. * @return the Map[]
  156. *
  157. * @throws XmlRpcException the xml rpc exception
  158. */
  159. public Map[] advertiserDailyStatistics(Integer id, Date startDate,
  160. Date endDate) throws XmlRpcException {
  161. return objectToArrayMaps( execute(ADVERTISER_DAILY_STATISTICS_METHOD, id, startDate,
  162. endDate));
  163. }
  164. /**
  165. * Advertiser campaign statistics.
  166. *
  167. * @param id the id
  168. *
  169. * @return the Map[]
  170. *
  171. * @throws XmlRpcException the xml rpc exception
  172. */
  173. public Map[] advertiserCampaignStatistics(Integer id) throws XmlRpcException {
  174. return objectToArrayMaps( execute(ADVERTISER_CAMPAIGN_STATISTICS_METHOD, id));
  175. }
  176. /**
  177. * Advertiser campaign statistics.
  178. *
  179. * @param id the id
  180. * @param startDate the start date
  181. *
  182. * @return the Map[]
  183. *
  184. * @throws XmlRpcException the xml rpc exception
  185. */
  186. public Map[] advertiserCampaignStatistics(Integer id, Date startDate)
  187. throws XmlRpcException {
  188. return objectToArrayMaps( execute(ADVERTISER_CAMPAIGN_STATISTICS_METHOD, id, startDate));
  189. }
  190. /**
  191. * Advertiser campaign statistics.
  192. *
  193. * @param id the id
  194. * @param startDate the start date
  195. * @param endDate the end date
  196. *
  197. * @return the Map[]
  198. *
  199. * @throws XmlRpcException the xml rpc exception
  200. */
  201. public Map[] advertiserCampaignStatistics(Integer id, Date startDate,
  202. Date endDate) throws XmlRpcException {
  203. return objectToArrayMaps( execute(ADVERTISER_CAMPAIGN_STATISTICS_METHOD, id, startDate,
  204. endDate));
  205. }
  206. /**
  207. * Advertiser banner statistics.
  208. *
  209. * @param id the id
  210. *
  211. * @return the Map[]
  212. *
  213. * @throws XmlRpcException the xml rpc exception
  214. */
  215. public Map[] advertiserBannerStatistics(Integer id) throws XmlRpcException {
  216. return objectToArrayMaps( execute(ADVERTISER_BANNER_STATISTICS_METHOD, id));
  217. }
  218. /**
  219. * Advertiser banner statistics.
  220. *
  221. * @param id the id
  222. * @param startDate the start date
  223. *
  224. * @return the Map[]
  225. *
  226. * @throws XmlRpcException the xml rpc exception
  227. */
  228. public Map[] advertiserBannerStatistics(Integer id, Date startDate)
  229. throws XmlRpcException {
  230. return objectToArrayMaps( execute(ADVERTISER_BANNER_STATISTICS_METHOD, id, startDate));
  231. }
  232. /**
  233. * Advertiser banner statistics.
  234. *
  235. * @param id the id
  236. * @param startDate the start date
  237. * @param endDate the end date
  238. *
  239. * @return the Map[]
  240. *
  241. * @throws XmlRpcException the xml rpc exception
  242. */
  243. public Map[] advertiserBannerStatistics(Integer id, Date startDate,
  244. Date endDate) throws XmlRpcException {
  245. return objectToArrayMaps( execute(ADVERTISER_BANNER_STATISTICS_METHOD, id, startDate,
  246. endDate));
  247. }
  248. /**
  249. * Advertiser publisher statistics.
  250. *
  251. * @param id the id
  252. *
  253. * @return the Map[]
  254. *
  255. * @throws XmlRpcException the xml rpc exception
  256. */
  257. public Map[] advertiserPublisherStatistics(Integer id) throws XmlRpcException {
  258. return objectToArrayMaps( execute(ADVERTISER_PUBLISHER_STATISTICS_METHOD, id));
  259. }
  260. /**
  261. * Advertiser publisher statistics.
  262. *
  263. * @param id the id
  264. * @param startDate the start date
  265. *
  266. * @return the Map[]
  267. *
  268. * @throws XmlRpcException the xml rpc exception
  269. */
  270. public Map[] advertiserPublisherStatistics(Integer id, Date startDate)
  271. throws XmlRpcException {
  272. return objectToArrayMaps( execute(ADVERTISER_PUBLISHER_STATISTICS_METHOD, id, startDate));
  273. }
  274. /**
  275. * Advertiser publisher statistics.
  276. *
  277. * @param id the id
  278. * @param startDate the start date
  279. * @param endDate the end date
  280. *
  281. * @return the Map[]
  282. *
  283. * @throws XmlRpcException the xml rpc exception
  284. */
  285. public Map[] advertiserPublisherStatistics(Integer id, Date startDate,
  286. Date endDate) throws XmlRpcException {
  287. return objectToArrayMaps( execute(ADVERTISER_PUBLISHER_STATISTICS_METHOD, id, startDate,
  288. endDate));
  289. }
  290. /**
  291. * Advertiser zone statistics.
  292. *
  293. * @param id the id
  294. *
  295. * @return the Map[]
  296. *
  297. * @throws XmlRpcException the xml rpc exception
  298. */
  299. public Map[] advertiserZoneStatistics(Integer id) throws XmlRpcException {
  300. return objectToArrayMaps( execute(ADVERTISER_ZONE_STATISTICS_METHOD, id));
  301. }
  302. /**
  303. * Advertiser zone statistics.
  304. *
  305. * @param id the id
  306. * @param startDate the start date
  307. *
  308. * @return the Map[]
  309. *
  310. * @throws XmlRpcException the xml rpc exception
  311. */
  312. public Map[] advertiserZoneStatistics(Integer id, Date startDate)
  313. throws XmlRpcException {
  314. return objectToArrayMaps( execute(ADVERTISER_ZONE_STATISTICS_METHOD, id, startDate));
  315. }
  316. /**
  317. * Advertiser zone statistics.
  318. *
  319. * @param id the id
  320. * @param startDate the start date
  321. * @param endDate the end date
  322. *
  323. * @return the Map[]
  324. *
  325. * @throws XmlRpcException the xml rpc exception
  326. */
  327. public Map[] advertiserZoneStatistics(Integer id, Date startDate,
  328. Date endDate) throws XmlRpcException {
  329. return objectToArrayMaps( execute(ADVERTISER_ZONE_STATISTICS_METHOD, id, startDate,
  330. endDate));
  331. }
  332. }