Clover Coverage Report - itracker
Coverage timestamp: Tue May 1 2012 16:42:12 CEST
35   164   33   1.4
22   113   0.94   25
25     1.32  
1    
 
 
  ImportDataModel       Line # 24 35 33 0% 0.0
 
No Tests
 
1    /*
2    * This software was designed and created by Jason Carroll.
3    * Copyright (c) 2002, 2003, 2004 Jason Carroll.
4    * The author can be reached at jcarroll@cowsultants.com
5    * ITracker website: http://www.cowsultants.com
6    * ITracker forums: http://www.cowsultants.com/phpBB/index.php
7    *
8    * This program is free software; you can redistribute it and/or modify
9    * it only under the terms of the GNU General Public License as published by
10    * the Free Software Foundation; either version 2 of the License, or
11    * (at your option) any later version.
12    *
13    * This program is distributed in the hope that it will be useful,
14    * but WITHOUT ANY WARRANTY; without even the implied warranty of
15    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16    * GNU General Public License for more details.
17    */
18   
19    package org.itracker.model;
20   
21    import org.apache.commons.lang.builder.ToStringBuilder;
22    import org.apache.log4j.Logger;
23   
 
24    public class ImportDataModel extends AbstractEntity {
25   
26    /**
27    *
28    */
29    private static final long serialVersionUID = 1L;
30    private static final Logger log = Logger.getLogger(ImportDataModel.class);
31    private AbstractEntity[] dataModels;
32    private boolean[] existingModel;
33   
34    private boolean reuseConfig = true;
35    private boolean reuseFields = true;
36    private boolean reuseProjects = true;
37    private boolean reuseUsers = true;
38    private boolean createPasswords = true;
39   
40    private int[][] verifyStatistics = new int[7][2];
41   
 
42  0 toggle public ImportDataModel() {
43    }
44   
 
45  0 toggle public AbstractEntity[] getData() {
46  0 return (dataModels == null ? new AbstractEntity[0] : dataModels.clone());
47    }
48   
 
49  0 toggle public boolean[] getExistingModel() {
50  0 return (existingModel == null ? new boolean[0] : existingModel.clone());
51    }
52   
 
53  0 toggle public boolean getExistingModel(int i) {
54  0 return (existingModel != null && i < existingModel.length ? existingModel[i]
55    : false);
56    }
57   
 
58  0 toggle public void setExistingModel(int i, boolean value) {
59  0 if (existingModel != null && i < existingModel.length) {
60  0 existingModel[i] = value;
61    }
62    }
63   
 
64  0 toggle public void setData(AbstractEntity[] dataModels, boolean[] existingModel) {
65  0 if (dataModels != null && existingModel != null
66    && dataModels.length == existingModel.length) {
67  0 this.dataModels = dataModels.clone();
68  0 this.existingModel = existingModel.clone();
69  0 this.verifyStatistics = new int[7][2];
70    } else {
71  0 throw new IllegalArgumentException("Data model must not be null and existing model must not be null nor empty.");
72    }
73    }
74   
 
75  0 toggle public boolean getReuseConfig() {
76  0 return reuseConfig;
77    }
78   
 
79  0 toggle public void setReuseConfig(boolean value) {
80  0 reuseConfig = value;
81    }
82   
 
83  0 toggle public void setReuseConfig(Boolean value) {
84  0 reuseConfig = (value != null ? value.booleanValue() : true);
85    }
86   
 
87  0 toggle public boolean getReuseFields() {
88  0 return reuseFields;
89    }
90   
 
91  0 toggle public void setReuseFields(boolean value) {
92  0 reuseFields = value;
93    }
94   
 
95  0 toggle public void setReuseFields(Boolean value) {
96  0 reuseFields = (value != null ? value.booleanValue() : true);
97    }
98   
 
99  0 toggle public boolean getReuseProjects() {
100  0 return reuseProjects;
101    }
102   
 
103  0 toggle public void setReuseProjects(boolean value) {
104  0 reuseProjects = value;
105    }
106   
 
107  0 toggle public void setReuseProjects(Boolean value) {
108  0 reuseProjects = (value != null ? value.booleanValue() : true);
109    }
110   
 
111  0 toggle public boolean getReuseUsers() {
112  0 return reuseUsers;
113    }
114   
 
115  0 toggle public void setReuseUsers(boolean value) {
116  0 reuseUsers = value;
117    }
118   
 
119  0 toggle public void setReuseUsers(Boolean value) {
120  0 reuseUsers = (value != null ? value.booleanValue() : true);
121    }
122   
 
123  0 toggle public boolean getCreatePasswords() {
124  0 return createPasswords;
125    }
126   
 
127  0 toggle public void setCreatePasswords(boolean value) {
128  0 createPasswords = value;
129    }
130   
 
131  0 toggle public void setCreatePasswords(Boolean value) {
132  0 createPasswords = (value != null ? value.booleanValue() : true);
133    }
134   
 
135  0 toggle public int[][] getImportStatistics() {
136  0 return verifyStatistics;
137    }
138   
 
139  0 toggle public void addVerifyStatistic(int itemType, int category) {
140  0 try {
141  0 verifyStatistics[itemType][category]++;
142    } catch (RuntimeException e) {
143  0 log.error("addVerifyStatistic: faild with runtime exception", e);
144  0 throw e;
145    }
146    }
147   
 
148  0 toggle public String statsToString() {
149  0 StringBuffer buf = new StringBuffer();
150  0 for (int i = 0; i < verifyStatistics.length; i++) {
151  0 buf.append(i + ":[" + verifyStatistics[i][0] + ", "
152    + verifyStatistics[i][1] + "] ");
153    }
154  0 return buf.toString();
155    }
156   
 
157  0 toggle public String toString() {
158  0 return new ToStringBuilder(this).append("id", getId()).append(
159    "dataModels.length", getData().length).append("reuseUsers",
160    getReuseUsers()).append("reuseProjects", getReuseProjects()).append(
161    "reuseFields", getReuseFields()).append("reuseConfig", getReuseConfig())
162    .append("createPasswords", getCreatePasswords()).toString();
163    }
164    }