@@ -52,7 +52,7 @@ public class UsageDaoImpl extends GenericDaoBase<UsageVO, Long> implements Usage
5252 private static final String DELETE_ALL = "DELETE FROM cloud_usage" ;
5353 private static final String DELETE_ALL_BY_ACCOUNTID = "DELETE FROM cloud_usage WHERE account_id = ?" ;
5454 private static final String DELETE_ALL_BY_INTERVAL = "DELETE FROM cloud_usage WHERE end_date < DATE_SUB(CURRENT_DATE(), INTERVAL ? DAY)" ;
55- private static final String INSERT_ACCOUNT = "INSERT INTO cloud_usage.account (id, account_name, type, role_id, domain_id, removed, cleanup_needed) VALUES (?,?,?,?,?,?,?)" ;
55+ private static final String INSERT_ACCOUNT = "INSERT INTO cloud_usage.account (id, account_name, uuid, type, role_id, domain_id, removed, cleanup_needed) VALUES (?, ?,?,?,?,?,?,?)" ;
5656 private static final String INSERT_USER_STATS = "INSERT INTO cloud_usage.user_statistics (id, data_center_id, account_id, public_ip_address, device_id, device_type, network_id, net_bytes_received,"
5757 + " net_bytes_sent, current_bytes_received, current_bytes_sent, agg_bytes_received, agg_bytes_sent) VALUES (?,?,?,?,?,?,?,?,?,?, ?, ?, ?)" ;
5858
@@ -129,25 +129,26 @@ public void saveAccounts(List<AccountVO> accounts) {
129129 for (AccountVO acct : accounts ) {
130130 pstmt .setLong (1 , acct .getId ());
131131 pstmt .setString (2 , acct .getAccountName ());
132- pstmt .setInt (3 , acct .getType ().ordinal ());
132+ pstmt .setString (3 , acct .getUuid ());
133+ pstmt .setInt (4 , acct .getType ().ordinal ());
133134
134135 //prevent autoboxing NPE by defaulting to User role
135136 if (acct .getRoleId () == null ){
136- pstmt .setLong (4 , RoleType .User .getId ());
137+ pstmt .setLong (5 , RoleType .User .getId ());
137138 }else {
138- pstmt .setLong (4 , acct .getRoleId ());
139+ pstmt .setLong (5 , acct .getRoleId ());
139140 }
140141
141- pstmt .setLong (5 , acct .getDomainId ());
142+ pstmt .setLong (6 , acct .getDomainId ());
142143
143144 Date removed = acct .getRemoved ();
144145 if (removed == null ) {
145- pstmt .setString (6 , null );
146+ pstmt .setString (7 , null );
146147 } else {
147- pstmt .setString (6 , DateUtil .getDateDisplayString (TimeZone .getTimeZone ("GMT" ), acct .getRemoved ()));
148+ pstmt .setString (7 , DateUtil .getDateDisplayString (TimeZone .getTimeZone ("GMT" ), acct .getRemoved ()));
148149 }
149150
150- pstmt .setBoolean (7 , acct .getNeedsCleanup ());
151+ pstmt .setBoolean (8 , acct .getNeedsCleanup ());
151152
152153 pstmt .addBatch ();
153154 }
0 commit comments