1 28 29 package com.idaremedia.antx.capture; 30 31 import java.util.Map ; 32 33 import org.apache.tools.ant.Project; 34 35 import com.idaremedia.antx.ExportedProperties; 36 import com.idaremedia.antx.parameters.IsA; 37 38 47 48 public final class ResultsHelper 49 { 50 60 public static void set(InterpretParameters config, String errs, String warnings, String result) 61 { 62 final Project P = config.getProject(); 63 if (config.updateProperties()) { 64 boolean unclean = !LogInterpreter.CLEAN.equals(result); 65 switch (config.getResultType().getIndex()) { 66 case IsA.VARIABLE_INDEX: { 67 if (unclean) { 68 ExportedProperties.set(config.getErrorCountProperty(),errs); 69 ExportedProperties.set(config.getWarningCountProperty(),warnings); 70 } else { 71 ExportedProperties.unset(config.getErrorCountProperty()); 72 ExportedProperties.unset(config.getWarningCountProperty()); 73 } 74 ExportedProperties.set(config.getUpdateProperty(),result); 75 break; 76 } 77 case IsA.REFERENCE_INDEX: { 78 Map refstable = P.getReferences(); 79 synchronized(refstable) { 80 if (unclean) { 81 refstable.put(config.getErrorCountProperty(),errs); 82 refstable.put(config.getWarningCountProperty(),warnings); 83 } else { 84 refstable.remove(config.getErrorCountProperty()); 85 refstable.remove(config.getWarningCountProperty()); 86 } 87 refstable.put(config.getUpdateProperty(),result); 88 } 89 break; 90 } 91 default: { 92 if (unclean) { 93 P.setNewProperty(config.getErrorCountProperty(),errs); 94 P.setNewProperty(config.getWarningCountProperty(),warnings); 95 } 96 P.setNewProperty(config.getUpdateProperty(),result); 97 } 98 } } } 101 102 103 104 109 public static void set(InterpretParameters config, int nErrs, int nWarnings, String result) 110 { 111 set(config,String.valueOf(nErrs),String.valueOf(nWarnings),result); 112 } 113 114 115 private ResultsHelper() 116 { 117 118 } 119 } 120 121 | Popular Tags |