1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
package com.loopback.androidapps.saveapp; |
5 |
|
|
6 |
|
import java.util.ArrayList; |
7 |
|
|
8 |
|
import android.content.ContentValues; |
9 |
|
import android.database.Cursor; |
10 |
|
import android.util.Log; |
11 |
|
|
|
|
| 56,2% |
Uncovered Elements: 32 (73) |
Complexity: 20 |
Complexity Density: 0,41 |
|
12 |
|
public class Currency implements SaveAppTable { |
13 |
|
private DBManager dbManager; |
14 |
|
private int id; |
15 |
|
private String symbol; |
16 |
|
private String description; |
17 |
|
private Cursor cursor; |
18 |
|
public static SaveApp saveApp; |
19 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0,25 |
|
20 |
10
|
public Currency() {... |
21 |
10
|
dbManager = saveApp.getDbManager(); |
22 |
10
|
this.id = 0; |
23 |
10
|
this.symbol =null; |
24 |
10
|
this.description = null; |
25 |
|
} |
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0,2 |
|
26 |
3
|
public Currency(int _id) {... |
27 |
3
|
dbManager = saveApp.getDbManager(); |
28 |
3
|
this.id = _id; |
29 |
3
|
this.symbol =null; |
30 |
3
|
this.description = null; |
31 |
3
|
inflate(id); |
32 |
|
} |
33 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0,25 |
|
34 |
0
|
public Currency(int id, String symbol, String description) {... |
35 |
0
|
dbManager = saveApp.getDbManager(); |
36 |
0
|
this.id = id; |
37 |
0
|
this.symbol = symbol; |
38 |
0
|
this.description = description; |
39 |
|
} |
40 |
|
|
41 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0,25 |
|
42 |
0
|
public int insert() {... |
43 |
0
|
ContentValues cv = new ContentValues(); |
44 |
0
|
cv.put(DBManager.CURRENCY_COLUMN_SYMBOL, symbol); |
45 |
0
|
cv.put(DBManager.CURRENCY_COLUMN_DESC, description); |
46 |
0
|
return dbManager.insert(DBManager.CURRENCY_TABLE, cv); |
47 |
|
} |
48 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0,25 |
|
49 |
0
|
public void update() {... |
50 |
0
|
ContentValues cv = new ContentValues(); |
51 |
0
|
cv.put(DBManager.CURRENCY_COLUMN_SYMBOL, symbol); |
52 |
0
|
cv.put(DBManager.CURRENCY_COLUMN_DESC, description); |
53 |
0
|
dbManager.update(id, DBManager.CURRENCY_TABLE, cv); |
54 |
|
} |
55 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
56 |
0
|
public void delete() {... |
57 |
0
|
dbManager.delete(id, DBManager.CURRENCY_TABLE); |
58 |
|
} |
59 |
|
|
|
|
| 84,6% |
Uncovered Elements: 2 (13) |
Complexity: 3 |
Complexity Density: 0,33 |
|
60 |
12
|
public void inflate(int _id) {... |
61 |
12
|
id=_id; |
62 |
12
|
cursor = dbManager.select(id, DBManager.CURRENCY_TABLE_ID); |
63 |
12
|
int i = 0; |
64 |
12
|
Log.i("CU", "Read Cursor"); |
65 |
12
|
if (cursor.moveToFirst()) |
66 |
12
|
do { |
67 |
12
|
description = cursor.getString(cursor |
68 |
|
.getColumnIndexOrThrow(DBManager.CURRENCY_COLUMN_DESC)); |
69 |
12
|
symbol = cursor |
70 |
|
.getString(cursor |
71 |
|
.getColumnIndexOrThrow(DBManager.CURRENCY_COLUMN_SYMBOL)); |
72 |
12
|
i++; |
73 |
12
|
} while (cursor.moveToNext()); |
74 |
|
} |
75 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
76 |
0
|
public boolean existSymbol(String value) {... |
77 |
0
|
return dbManager.exist(DBManager.CURRENCY_TABLE, |
78 |
|
DBManager.CURRENCY_COLUMN_SYMBOL, value); |
79 |
|
} |
80 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
81 |
0
|
public boolean existDescription(String value) {... |
82 |
0
|
return dbManager.exist(DBManager.CURRENCY_TABLE, |
83 |
|
DBManager.CURRENCY_COLUMN_DESC, value); |
84 |
|
} |
|
|
| 92,9% |
Uncovered Elements: 1 (14) |
Complexity: 3 |
Complexity Density: 0,3 |
|
85 |
2
|
public ArrayList<String> selectCurrencies() {... |
86 |
2
|
ArrayList<String> currencies = new ArrayList<String>(); |
87 |
2
|
cursor = dbManager.selectFilter(DBManager.CURRENCY_TABLE,DBManager.CURRENCY_COLUMN_DESC,1,"1"); |
88 |
2
|
int i = 0; |
89 |
2
|
Log.i("AC", "Read Cursor"); |
90 |
2
|
if (cursor.moveToFirst()) |
91 |
2
|
do { |
92 |
16
|
description = cursor.getString(cursor |
93 |
|
.getColumnIndexOrThrow(DBManager.CURRENCY_COLUMN_DESC)); |
94 |
16
|
currencies.add(description); |
95 |
16
|
i++; |
96 |
16
|
} while (cursor.moveToNext()); |
97 |
|
|
98 |
2
|
return currencies; |
99 |
|
} |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
100 |
0
|
public void setId(int id) {... |
101 |
0
|
this.id = id; |
102 |
|
} |
103 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
104 |
0
|
public int getId() {... |
105 |
0
|
return id; |
106 |
|
} |
107 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
108 |
0
|
public void setSymbol(String symbol) {... |
109 |
0
|
this.symbol = symbol; |
110 |
|
} |
111 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
112 |
9
|
public String getSymbol() {... |
113 |
9
|
return symbol; |
114 |
|
} |
115 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
116 |
0
|
public void setDescription(String description) {... |
117 |
0
|
this.description = description; |
118 |
|
} |
119 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
120 |
3
|
public String getDescription() {... |
121 |
3
|
return description; |
122 |
|
} |
123 |
|
|
124 |
|
|
125 |
|
} |