1 7 package org.mmbase.applications.packaging.projects; 8 9 import java.util.ArrayList ; 10 import java.util.Iterator ; 11 12 18 public class packageStep { 19 20 private String userfeedback; 21 22 private ArrayList packagesteps; 23 24 private int timestamp; 25 26 private int type = 0; 27 28 private int errorcount = 0; 29 30 private int warningcount = 0; 31 32 private int parent = -1; 33 34 public final static int TYPE_ERROR = 1; 35 36 public final static int TYPE_WARNING = 2; 37 38 39 42 public packageStep() { 43 timestamp = (int) (System.currentTimeMillis() / 1000); 44 } 45 46 47 52 public void setUserFeedBack(String line) { 53 userfeedback = line; 54 } 55 56 57 58 63 public void setType(int type) { 64 this.type = type; 65 if (type == TYPE_WARNING) { 66 warningcount++; 67 } 68 if (type == TYPE_ERROR) { 69 errorcount++; 70 } 71 } 72 73 74 79 public String getUserFeedBack() { 80 return userfeedback; 81 } 82 83 84 89 public int getTimeStamp() { 90 return timestamp; 91 } 92 93 94 99 public int getErrorCount() { 100 if (packagesteps != null) { 102 int total = errorcount; 103 Iterator e = packagesteps.iterator(); 104 while (e.hasNext()) { 105 packageStep step = (packageStep) e.next(); 106 total += step.getErrorCount(); 107 } 108 return total; 109 } else { 110 return errorcount; 111 } 112 } 113 114 115 120 public int getWarningCount() { 121 if (packagesteps != null) { 122 int total = warningcount; 123 Iterator e = packagesteps.iterator(); 124 while (e.hasNext()) { 125 packageStep step = (packageStep) e.next(); 126 total += step.getWarningCount(); 127 } 128 return total; 129 } else { 130 return warningcount; 131 } 132 } 133 134 135 140 public Iterator getPackageSteps() { 141 if (packagesteps != null) { 142 return packagesteps.iterator(); 143 } else { 144 return null; 145 } 146 } 147 148 149 155 public Iterator getPackageSteps(int logid) { 156 if (logid == getId()) { 158 return getPackageSteps(); 159 } 160 161 Iterator e = getPackageSteps(); 163 if (e != null) { 164 while (e.hasNext()) { 165 packageStep step = (packageStep) e.next(); 166 Object o = step.getPackageSteps(logid); 167 if (o != null) { 168 return (Iterator ) o; 169 } 170 } 171 } 172 return null; 173 } 174 175 176 181 public packageStep getNextPackageStep() { 182 packageStep step = new packageStep(); 184 step.setParent(getId()); 185 if (packagesteps == null) { 186 packagesteps = new ArrayList (); 187 packagesteps.add(step); 188 return step; 189 } else { 190 packagesteps.add(step); 191 return step; 192 } 193 } 194 195 196 201 public int getId() { 202 return this.hashCode(); 203 } 204 205 206 211 public void setParent(int parent) { 212 this.parent = parent; 213 } 214 215 216 221 public boolean hasChilds() { 222 if (packagesteps != null) { 223 return true; 224 } 225 return false; 226 } 227 228 229 234 public int getParent() { 235 return parent; 236 } 237 } 238 239 | Popular Tags |