1 |
|
package com.loopback.androidapps.saveapp; |
2 |
|
|
3 |
|
import android.content.ContentValues; |
4 |
|
import android.database.Cursor; |
5 |
|
import android.util.Log; |
6 |
|
|
|
|
| 19,6% |
Uncovered Elements: 37 (46) |
Complexity: 15 |
Complexity Density: 0,54 |
|
7 |
|
public class Album implements SaveAppTable { |
8 |
|
private DBManager dbManager; |
9 |
|
private int id; |
10 |
|
private String description; |
11 |
|
Cursor cursor; |
12 |
|
public static SaveApp saveApp; |
13 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0,5 |
|
14 |
46
|
public Album() {... |
15 |
46
|
description = null; |
16 |
46
|
dbManager = saveApp.getDbManager(); |
17 |
|
} |
18 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0,5 |
|
19 |
0
|
public Album(int _id, String _description) {... |
20 |
0
|
description = _description; |
21 |
0
|
dbManager = saveApp.getDbManager(); |
22 |
|
} |
23 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
24 |
0
|
public void setId(int id) {... |
25 |
0
|
this.id = id; |
26 |
|
} |
27 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
28 |
0
|
public int getId() {... |
29 |
0
|
return id; |
30 |
|
} |
31 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
32 |
0
|
public void setDescription(String description) {... |
33 |
0
|
this.description = description; |
34 |
|
} |
35 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
36 |
0
|
public String getDescription() {... |
37 |
0
|
return description; |
38 |
|
} |
39 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0,33 |
|
40 |
0
|
public int insert() {... |
41 |
0
|
ContentValues cv = new ContentValues(); |
42 |
0
|
cv.put(DBManager.ALBUM_COLUMN_FILE, description); |
43 |
0
|
return dbManager.insert(DBManager.ALBUM_TABLE, cv); |
44 |
|
} |
45 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0,33 |
|
46 |
0
|
public void update() {... |
47 |
0
|
ContentValues cv = new ContentValues(); |
48 |
0
|
cv.put(DBManager.ALBUM_COLUMN_FILE, description); |
49 |
0
|
dbManager.update(id, DBManager.ALBUM_TABLE, cv); |
50 |
|
} |
51 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
52 |
0
|
public void delete() {... |
53 |
0
|
dbManager.delete(id, DBManager.ALBUM_TABLE); |
54 |
|
} |
55 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 3 |
Complexity Density: 0,38 |
|
56 |
0
|
public void inflate(int _id) {... |
57 |
0
|
id = _id; |
58 |
0
|
cursor = dbManager.select(id, DBManager.ALBUM_TABLE_ID); |
59 |
0
|
int i = 0; |
60 |
0
|
Log.i("AC" + "AL", "Read Cursor"); |
61 |
0
|
if (cursor.moveToFirst()) |
62 |
0
|
do { |
63 |
0
|
description = cursor.getString(cursor |
64 |
|
.getColumnIndexOrThrow(DBManager.ALBUM_COLUMN_FILE)); |
65 |
0
|
i++; |
66 |
0
|
} while (cursor.moveToNext()); |
67 |
|
} |
68 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
69 |
5
|
public boolean existDescription(String value) {... |
70 |
5
|
return dbManager.exist(DBManager.ALBUM_TABLE, |
71 |
|
DBManager.ALBUM_COLUMN_FILE, value); |
72 |
|
} |
73 |
|
|
|
|
| 50% |
Uncovered Elements: 3 (6) |
Complexity: 2 |
Complexity Density: 0,5 |
|
74 |
5
|
public int insertOrGetId(String value) {... |
75 |
5
|
if (existDescription(value)) |
76 |
5
|
return dbManager.getId(DBManager.ALBUM_TABLE, |
77 |
|
DBManager.ALBUM_COLUMN_FILE, value); |
78 |
|
else { |
79 |
0
|
description = value; |
80 |
0
|
return insert(); |
81 |
|
} |
82 |
|
} |
83 |
|
} |