Clover Coverage Report - SaveApp Coverage Report
Coverage timestamp: mar dic 23 2014 15:53:11 EST
../../../../img/srcFileCovDistChart7.png 48% of files have more coverage
58   133   22   3,62
12   114   0,38   16
16     1,38  
1    
This report was generated with an evaluation server license. Purchase Clover or configure your license.
 
  Item       Line # 9 58 22 65,1% 0.6511628
 
No Tests
 
1    package com.loopback.androidapps.saveapp;
2   
3    import java.util.ArrayList;
4   
5    import android.content.ContentValues;
6    import android.database.Cursor;
7    import android.util.Log;
8   
 
9    public class Item implements SaveAppTable {
10    public static DBManager dbManager;
11    private int id;
12    private String type;
13    private String description;
14    private Cursor cursor;
15    public static SaveApp saveApp;
16   
 
17  70 toggle public Item() {
18  70 type = null;
19  70 description = null;
20  70 dbManager = saveApp.getDbManager();
21    }
22   
 
23  0 toggle public Item(int id, String type, String description) {
24  0 dbManager = saveApp.getDbManager();
25  0 this.id = id;
26  0 this.type = type;
27  0 this.description = description;
28    }
29   
 
30  0 toggle public void setId(int id) {
31  0 this.id = id;
32    }
33   
 
34  0 toggle public int getId() {
35  0 return id;
36    }
37   
 
38  0 toggle public void setSymbol(String symbol) {
39  0 this.type = symbol;
40    }
41   
 
42  0 toggle public String getSymbol() {
43  0 return type;
44    }
45   
 
46  0 toggle public void setDescription(String description) {
47  0 this.description = description;
48    }
49   
 
50  32 toggle public String getDescription() {
51  32 return description;
52    }
53   
 
54  3 toggle public int insert() {
55  3 Log.i("IT", "Inserting...");
56  3 ContentValues cv = new ContentValues();
57  3 cv.put(DBManager.ITEM_COLUMN_TYPE, type);
58  3 cv.put(DBManager.ITEM_COLUMN_DESC, description);
59  3 return dbManager.insert(DBManager.ITEM_TABLE, cv);
60    }
61   
 
62  0 toggle public void update() {
63  0 Log.i("IT", "Updating...");
64  0 ContentValues cv = new ContentValues();
65  0 cv.put(DBManager.ITEM_COLUMN_TYPE, type);
66  0 cv.put(DBManager.ITEM_COLUMN_DESC, description);
67  0 dbManager.update(id, DBManager.ITEM_TABLE, cv);
68    }
69   
 
70  0 toggle public void delete() {
71  0 Log.i("IT", "Deleting...");
72  0 dbManager.delete(id, DBManager.ITEM_TABLE);
73    }
74   
 
75  32 toggle public void inflate(int _id) {
76  32 id=_id;
77  32 Log.i("IT", "Selecting...");
78  32 cursor = dbManager.select(id, DBManager.ITEM_TABLE_ID);
79  32 int i = 0;
80  32 Log.i("IT", "Reading Cursor...");
81  32 if (cursor.moveToFirst())
82  32 do {
83  32 description = cursor.getString(cursor
84    .getColumnIndexOrThrow(DBManager.ITEM_COLUMN_DESC));
85  32 type = cursor.getString(cursor
86    .getColumnIndexOrThrow(DBManager.ITEM_COLUMN_TYPE));
87  32 i++;
88  32 } while (cursor.moveToNext());
89    }
90   
 
91  0 toggle public boolean existType(String value) {
92  0 Log.i("IT", "Exist?...");
93  0 return dbManager.exist(DBManager.ITEM_TABLE,
94    DBManager.ITEM_COLUMN_TYPE, value);
95    }
96   
 
97  5 toggle public boolean existDescription(String value) {
98  5 Log.i("IT", "Exist?...");
99  5 return dbManager.exist(DBManager.ITEM_TABLE,
100    DBManager.ITEM_COLUMN_DESC, value);
101    }
102   
 
103  5 toggle public int insertOrGetId(String value) {
104  5 Log.i("IT", "Inserting or Getting Id...");
105  5 if (existDescription(value)) {
106  2 Log.i("IT", "Getting Id...");
107  2 return dbManager.getId(DBManager.ITEM_TABLE,
108    DBManager.ITEM_COLUMN_DESC, value);
109    } else{
110  3 description=value;
111  3 return insert();
112    }
113    }
 
114  14 toggle public String[] selectItems() {
115  14 ArrayList<String> items = new ArrayList<String>();
116  14 cursor = dbManager.selectFilter(DBManager.ITEM_TABLE,DBManager.ITEM_COLUMN_DESC,1,"1");
117  14 int i = 0;
118  14 Log.i("AC", "Read Cursor");
119  14 if (cursor.moveToFirst())
120  14 do {
121  29 description = cursor.getString(cursor
122    .getColumnIndexOrThrow(DBManager.ITEM_COLUMN_DESC));
123  29 items.add(description);
124  29 i++;
125  29 } while (cursor.moveToNext());
126  14 String[] itemStrings = new String[items.size()];
127  43 for (int j = 0; j< items.size();j++) {
128  29 itemStrings[j]=items.get(j);
129    }
130  14 return itemStrings;
131    }
132    }
133