1 18 19 package cowsultants.itracker.ejb.client.models; 20 21 public class ImportDataModel extends GenericModel { 22 private GenericModel[] dataModels; 23 private boolean[] existingModel; 24 25 private boolean reuseConfig = true; 26 private boolean reuseFields = true; 27 private boolean reuseProjects = true; 28 private boolean reuseUsers = true; 29 private boolean createPasswords = true; 30 31 private int[][] verifyStatistics = new int[7][2]; 32 33 public ImportDataModel() { 34 } 35 36 public GenericModel[] getData() { 37 return (dataModels == null ? new GenericModel[0] : dataModels); 38 } 39 40 public boolean[] getExistingModel() { 41 return (existingModel == null ? new boolean[0] : existingModel); 42 } 43 44 public boolean getExistingModel(int i) { 45 return (existingModel != null && i < existingModel.length ? existingModel[i] : false); 46 } 47 48 public void setExistingModel(int i, boolean value) { 49 if(existingModel != null && i < existingModel.length) { 50 existingModel[i] = value; 51 } 52 } 53 54 public void setData(GenericModel[] dataModels, boolean[] existingModel) { 55 if(dataModels != null && existingModel != null && dataModels.length == existingModel.length) { 56 this.dataModels = dataModels; 57 this.existingModel = existingModel; 58 this.verifyStatistics = new int[7][2]; 59 } 60 } 61 62 public boolean getReuseConfig() { 63 return reuseConfig; 64 } 65 66 public void setReuseConfig(boolean value) { 67 reuseConfig = value; 68 } 69 70 public void setReuseConfig(Boolean value) { 71 reuseConfig = (value != null ? value.booleanValue() : true); 72 } 73 74 public boolean getReuseFields() { 75 return reuseFields; 76 } 77 78 public void setReuseFields(boolean value) { 79 reuseFields = value; 80 } 81 82 public void setReuseFields(Boolean value) { 83 reuseFields = (value != null ? value.booleanValue() : true); 84 } 85 86 public boolean getReuseProjects() { 87 return reuseProjects; 88 } 89 90 public void setReuseProjects(boolean value) { 91 reuseProjects = value; 92 } 93 94 public void setReuseProjects(Boolean value) { 95 reuseProjects = (value != null ? value.booleanValue() : true); 96 } 97 98 public boolean getReuseUsers() { 99 return reuseUsers; 100 } 101 102 public void setReuseUsers(boolean value) { 103 reuseUsers = value; 104 } 105 106 public void setReuseUsers(Boolean value) { 107 reuseUsers = (value != null ? value.booleanValue() : true); 108 } 109 110 public boolean getCreatePasswords() { 111 return createPasswords; 112 } 113 114 public void setCreatePasswords(boolean value) { 115 createPasswords = value; 116 } 117 118 public void setCreatePasswords(Boolean value) { 119 createPasswords = (value != null ? value.booleanValue() : true); 120 } 121 122 public int[][] getImportStatistics() { 123 return verifyStatistics; 124 } 125 126 public void addVerifyStatistic(int itemType, int category) { 127 try { 128 verifyStatistics[itemType][category]++; 129 } catch(Exception e) { 130 } 131 } 132 133 public String statsToString() { 134 StringBuffer buf = new StringBuffer (); 135 for(int i = 0; i < verifyStatistics.length; i++) { 136 buf.append(i + ":[" + verifyStatistics[i][0] + ", " + verifyStatistics[i][1] + "] "); 137 } 138 return buf.toString(); 139 } 140 141 public String toString() { 142 return "ImportData Num Data Objects: " + getData().length + " Reuse Users: " + getReuseUsers() + 143 " Reuse Projects: " + getReuseProjects() + " Reuse Config: " + getReuseConfig() + 144 " Reuse Fields: " + getReuseFields() + " Create Passwords: " + getCreatePasswords() + 145 " Stats: " + statsToString(); 146 } 147 } 148 | Popular Tags |