1 2 12 package com.versant.core.storagemanager.logging; 13 14 import com.versant.core.jdo.QueryDetails; 15 import com.versant.core.metadata.ModelMetaData; 16 import com.versant.core.metadata.ClassMetaData; 17 import com.versant.core.server.CompiledQuery; 18 19 22 public class SmQueryEvent extends SmStatesReturnedEvent { 23 24 private String language; 25 private String candidateClass; 26 private String filter; 27 private String imports; 28 private String variables; 29 private String ordering; 30 private boolean ignoreCache; 31 private String params; 32 33 private String fetchGroup; 34 private boolean randomAccess; 35 private boolean countStarOnSize; 36 private boolean bounded; 37 38 private String compiledQuery; 39 private int count; 40 private int skipAmount; 41 private int index; 42 private int fetchAmount; 43 44 public SmQueryEvent(int storageManagerId, int type, QueryDetails q, 45 CompiledQuery cq, ModelMetaData jmd) { 46 super(storageManagerId, type); 47 if (q == null && cq != null) { 48 q = cq.getQueryDetails(); 49 } 50 if (q != null) { 51 language = q.getLanguageStr(); 52 final Class c = q.getCandidateClass(); 53 candidateClass = c == null ? null : c.getName(); 54 filter = q.getFilter(); 55 imports = q.getImports(); 56 variables = q.getVariables(); 57 ordering = q.getOrdering(); 58 ignoreCache = q.isIgnoreCache(); 59 int fgi = q.getFetchGroupIndex(); 60 if (c != null && fgi >= 0) { 61 ClassMetaData cmd = jmd.getClassMetaData(c); 62 fetchGroup = cmd.fetchGroups[fgi].name; 63 } 64 randomAccess = q.isRandomAccess(); 65 countStarOnSize = q.isCountOnSize(); 66 bounded = q.isBounded(); 67 } 68 if (cq != null) { 69 compiledQuery = cq.toString(); 70 } 71 } 72 73 76 public String getDescription() { 77 StringBuffer s = new StringBuffer (); 78 s.append(language); 79 if (candidateClass != null) { 80 s.append(' '); 81 s.append(candidateClass); 82 } 83 if (filter != null) { 84 s.append(' '); 85 s.append(filter); 86 } 87 return s.toString(); 88 } 89 90 public String getLanguage() { 91 return language; 92 } 93 94 public String getCandidateClass() { 95 return candidateClass; 96 } 97 98 public String getFilter() { 99 return filter; 100 } 101 102 public String getImports() { 103 return imports; 104 } 105 106 public String getVariables() { 107 return variables; 108 } 109 110 public String getOrdering() { 111 return ordering; 112 } 113 114 public boolean isIgnoreCache() { 115 return ignoreCache; 116 } 117 118 public String getParams() { 119 return params; 120 } 121 122 public String getFetchGroup() { 123 return fetchGroup; 124 } 125 126 public boolean getRandomAccess() { 127 return randomAccess; 128 } 129 130 public boolean getCountStarOnSize() { 131 return countStarOnSize; 132 } 133 134 public int getCount() { 135 return count; 136 } 137 138 public void setCount(int count) { 139 this.count = count; 140 } 141 142 public void setFilter(String filter) { 143 this.filter = filter; 144 } 145 146 public void setImports(String imports) { 147 this.imports = imports; 148 } 149 150 public void setVariables(String variables) { 151 this.variables = variables; 152 } 153 154 public void setOrdering(String ordering) { 155 this.ordering = ordering; 156 } 157 158 public void setParams(String params) { 159 this.params = params; 160 } 161 162 public void setFetchGroup(String fetchGroup) { 163 this.fetchGroup = fetchGroup; 164 } 165 166 public void setCandidateClass(String candidateClass) { 167 this.candidateClass = candidateClass; 168 } 169 170 public boolean isBounded() { 171 return bounded; 172 } 173 174 public void setBounded(boolean bounded) { 175 this.bounded = bounded; 176 } 177 178 public String getCompiledQuery() { 179 return compiledQuery; 180 } 181 182 public int getSkipAmount() { 183 return skipAmount; 184 } 185 186 public void setSkipAmount(int skipAmount) { 187 this.skipAmount = skipAmount; 188 } 189 190 public int getIndex() { 191 return index; 192 } 193 194 public void setIndex(int index) { 195 this.index = index; 196 } 197 198 public int getFetchAmount() { 199 return fetchAmount; 200 } 201 202 public void setFetchAmount(int fetchAmount) { 203 this.fetchAmount = fetchAmount; 204 } 205 206 } 207 | Popular Tags |