1 package com.leonarduk.clearcheckbook.calls; 2 3 import java.util.List; 4 5 import org.apache.log4j.Logger; 6 7 import com.leonarduk.clearcheckbook.ClearCheckBookConnection; 8 import com.leonarduk.clearcheckbook.ClearcheckbookException; 9 import com.leonarduk.clearcheckbook.dto.AbstractDataType; 10 import com.leonarduk.clearcheckbook.dto.AccountDataType; 11 import com.leonarduk.clearcheckbook.dto.ParsedNameValuePair; 12 import com.leonarduk.clearcheckbook.dto.TransactionDataType; 13 14 public class AccountCall extends AbstractCall<AccountDataType> { 15 16 private static final Logger _logger = Logger.getLogger(AccountCall.class); 17 18 public static final String TYPE = "account"; 19 20 @Override 21 protected String getUrlSuffix() { 22 return TYPE; 23 } 24 25 public AccountCall(ClearCheckBookConnection connection) { 26 super(connection, AccountDataType.class); 27 } 28 29 @Override 30 public List<String> bulkProcess(List<AccountDataType> dataTypeList) 31 throws ClearcheckbookException { 32 return super.bulkProcess(dataTypeList); 33 } 34 35 /*** 36 * Returns an array of all accounts and account balances for this user. <br> 37 * Method: get <br> 38 * Call: accounts 39 * <p> 40 * Example: <br> 41 * https://username:password@www.clearcheckbook.com/api/accounts/ 42 * <p> 43 * Parameters: <br> 44 * Parameter Required Description <br> 45 * is_overview Optional Should be set to "true" if you want to return all 46 * accounts that just have a balance (Including transactions not assigned to 47 * an account) 48 * <p> 49 * Returned Values: <br> 50 * Value Description <br> 51 * id The account id <br> 52 * name the name of the account <br> 53 * type_id the type of account (1= Cash, 2= Checking Account, 3= Savings 54 * Account, 4= Credit Card, 5= Investment) <br> 55 * deposit the float value containing the amount of deposits in this 56 * account. <br> 57 * jive_deposit the float value containing the amount of jived deposits in 58 * this account. <br> 59 * withdrawal the float value containing the amount of withdrawals in this 60 * account. <br> 61 * jive_withdrawal the float value containing the amount of jived 62 * withdrawals in this account. 63 * 64 * @Override {@link AbstractCall#getAll()} 65 * @return returns a list of accounts. 66 */ 67 public List<AccountDataType> getAll() throws ClearcheckbookException { 68 return super.getAll(); 69 } 70 71 /*** 72 * 73 Returns an array of information for a single account <br> 74 * Method: get <br> 75 * Call: account 76 * <p> 77 * Example: <br> 78 * https://username:password@www.clearcheckbook.com/api/account/ 79 * <p> 80 * Parameters: vParameter Required Description <br> 81 * id Required the id of the account you're getting information for 82 * <p> 83 * Returned Values: <br> 84 * Value Description <br> 85 * id The account id <br> 86 * name the name of the account <br> 87 * type_id the type of account (1= Cash, 2= Checking Account, 3= Savings 88 * Account, 4= Credit Card, 5= Investment) <br> 89 * deposit the float value containing the amount of deposits in this 90 * account. <br> 91 * jive_deposit the float value containing the amount of jived deposits in 92 * this account. <br> 93 * withdrawal the float value containing the amount of withdrawals in this 94 * account. <br> 95 * jive_withdrawal the float value containing the amount of jived 96 * withdrawals in this account. 97 * 98 * @Override {@link AbstractCall#get(ParsedNameValuePair)} 99 * @param ParsedNameValuePair 100 * id 101 * @return AccountDataType 102 */ 103 @Override 104 public AccountDataType get(ParsedNameValuePair id) 105 throws ClearcheckbookException { 106 AccountDataType accountDataType = super.get(id); 107 _logger.debug("get: " + id + " -> " + accountDataType); 108 return accountDataType; 109 } 110 111 /*** 112 * 113 Adds an account to the site <br> 114 * Method: post <br> 115 * Call: account 116 * <p> 117 * Example: <br> 118 * https://username:password@www.clearcheckbook.com/api/account/ 119 * <p> 120 * Parameters: <br> 121 * Parameter Required Description <br> 122 * name Required The name of the account <br> 123 * type_id Required the type of account (1= Cash, 2= Checking Account, 3= 124 * Savings Account, 4= Credit Card, 5= Investment) <br> 125 * initial_balance Optional A float value identifying the existing balance 126 * in this account (if negative, put a '-' symbol before the number... 127 * -100.00) 128 * <p> 129 * Returned Values: <br> 130 * Value Description <br> 131 * Multiple Responses* The newly created id for the account on success or 132 * false/null on fail. 133 * 134 * @Override {@link AbstractCall#insert(AbstractDataType) 135 * @param AccountDataType input 136 * @return id 137 */ 138 public String insert(AccountDataType input) throws ClearcheckbookException { 139 return super.insert(input); 140 } 141 142 /*** 143 * Edit the details of an account <br> 144 * Method: put <br> 145 * Call: account 146 * <p> 147 * Example: <br> 148 * https://username:password@www.clearcheckbook.com/api/account/ 149 * <p> 150 * Parameters: <br> 151 * Parameter Required Description <br> 152 * id Required the id of the account being edited <br> 153 * name Required the new name of the account <br> 154 * type_id Required the new type_id of the account (1= Cash, 2= Checking 155 * Account, 3= Savings Account, 4= Credit Card, 5= Investment) 156 * <p> 157 * Returned Values: <br> 158 * Value Description <br> 159 * true/false returns true on a successful edit or false on fail. 160 * 161 * @Override {@link AbstractCall#edit(AbstractDataType)} 162 * @param AccountDataType 163 * input 164 * @return boolean - ok 165 * @throws ClearcheckbookException 166 */ 167 168 public boolean edit(AccountDataType input) throws ClearcheckbookException { 169 return super.edit(input); 170 } 171 172 /*** 173 * Deletes a specific account <br> 174 * Method: delete <br> 175 * Call: account 176 * <p> 177 * Example: <br> 178 * https://username:password@www.clearcheckbook.com/api/account/ 179 * <p> 180 * Parameters: <br> 181 * Parameter Required Description <br> 182 * id Required the id of the account being deleted 183 * <p> 184 * Returned Values: <br> 185 * Value Description <br> 186 * true / false returns true upon successfull delete or false/null on fail 187 * 188 * @Override {@link AbstractCall#delete(ParsedNameValuePair)} 189 * @param ParsedNameValuePair 190 * idParameter 191 * @return boolean - ok 192 * @throws ClearcheckbookException 193 */ 194 public boolean delete(ParsedNameValuePair idParameter) 195 throws ClearcheckbookException { 196 return super.delete(idParameter); 197 } 198 }