Public Member Functions | |
| DataAccessLayer (CycAccess cyc) | |
| Collection | getDepartmentList (CycConstant mt) throws CycApiException, IOException |
| Collection | getCountryList (CycConstant mt) throws CycApiException, IOException |
| Collection | getCivilServantsList (CycConstant mt) throws CycApiException, IOException |
| Collection | getHeadOfDepartmentList (CycConstant mt) throws CycApiException, IOException |
| String[] | getRabinovichRoles (CycConstant mt) throws CycApiException, IOException |
| CivilServantData[] | getCivilServantsWithSubordinates (CycConstant mt) throws CycApiException, IOException |
| CivilServantData[] | getBossOfBagaturLobo (CycConstant mt) throws CycApiException, IOException |
Private Member Functions | |
| String | getPredicateValue (String predicateName, CycConstant item, CycConstant mt) throws CycApiException, IOException |
| String | getComment (CycConstant country, CycConstant mt) throws CycApiException, IOException |
| String | getFullHeadName (CycConstant person, CycConstant mt) throws CycApiException, IOException |
Private Attributes | |
| CycAccess | cyc |
| Logger | logger = Logger.getLogger(getClass()) |
Definition at line 31 of file DataAccessLayer.java.
|
|
Definition at line 34 of file DataAccessLayer.java. 00035 { 00036 this.cyc=cyc; 00037 }
|
|
|
Definition at line 285 of file DataAccessLayer.java. References com.dapissarenko.hierarchy.DataAccessLayer.getPredicateValue(), com.dapissarenko.hierarchy.civilServants.CivilServantData.setFamilyName(), com.dapissarenko.hierarchy.civilServants.CivilServantData.setFieldOfWork(), and com.dapissarenko.hierarchy.civilServants.CivilServantData.setGivenNames(). 00286 { 00287 CycList query = null; 00288 CycList response = null; 00289 CycVariable bossVariable = null; 00290 CycConstant item=null; 00291 CivilServantData civilServantData=null; 00292 ArrayList variables=null; 00293 Collection collection=null; 00294 Iterator iterator=null; 00295 00296 collection=new Vector(); 00297 00298 query = CycAccess.current().makeCycList("(#$superiors ?BOSS #$BagaturLobo)"); 00299 bossVariable = CycObjectFactory.makeCycVariable("?BOSS"); 00300 00301 response = CycAccess.current().askWithVariable(query, 00302 bossVariable, mt); 00303 00304 iterator=response.iterator(); 00305 while (iterator.hasNext()) 00306 { 00307 item=(CycConstant)iterator.next(); 00308 00309 civilServantData=new CivilServantData(); 00310 civilServantData.setFieldOfWork(this.getPredicateValue("fieldOfWork", item, mt)); 00311 civilServantData.setGivenNames(this.getPredicateValue("givenNames", item, mt)); 00312 civilServantData.setFamilyName(this.getPredicateValue("familyName", item, mt)); 00313 00314 collection.add(civilServantData); 00315 } 00316 00317 return (CivilServantData[])collection.toArray(new CivilServantData[collection.size()]); 00318 00319 }
|
|
|
Definition at line 127 of file DataAccessLayer.java. References com.dapissarenko.hierarchy.DataAccessLayer.getPredicateValue(), com.dapissarenko.hierarchy.civilServants.CivilServantData.setFamilyName(), com.dapissarenko.hierarchy.civilServants.CivilServantData.setFieldOfWork(), and com.dapissarenko.hierarchy.civilServants.CivilServantData.setGivenNames(). 00128 { 00129 CycList query = null; 00130 CycList response = null; 00131 CycVariable civilServantVariable = null; 00132 CycConstant item=null; 00133 CivilServantData civilServantData=null; 00134 Collection collection=null; 00135 Iterator iterator=null; 00136 00137 collection=new Vector(); 00138 00139 query = CycAccess.current().makeCycList("(#$isa ?CIVIL_SERVANT #$CivilServant)"); 00140 civilServantVariable = CycObjectFactory.makeCycVariable("?CIVIL_SERVANT"); 00141 00142 response = CycAccess.current().askWithVariable(query, 00143 civilServantVariable, mt); 00144 00145 iterator=response.iterator(); 00146 while (iterator.hasNext()) 00147 { 00148 item=(CycConstant)iterator.next(); 00149 00150 civilServantData=new CivilServantData(); 00151 civilServantData.setFieldOfWork(this.getPredicateValue("fieldOfWork", item, mt)); 00152 civilServantData.setGivenNames(this.getPredicateValue("givenNames", item, mt)); 00153 civilServantData.setFamilyName(this.getPredicateValue("familyName", item, mt)); 00154 00155 collection.add(civilServantData); 00156 } 00157 00158 return collection; 00159 }
|
|
|
Definition at line 244 of file DataAccessLayer.java. References com.dapissarenko.hierarchy.DataAccessLayer.getPredicateValue(), com.dapissarenko.hierarchy.civilServants.CivilServantData.setFamilyName(), com.dapissarenko.hierarchy.civilServants.CivilServantData.setFieldOfWork(), and com.dapissarenko.hierarchy.civilServants.CivilServantData.setGivenNames(). 00245 { 00246 CycList query = null; 00247 CycList response = null; 00248 CycVariable bossVariable = null; 00249 CycVariable subordinateVariable=null; 00250 CycList item=null; 00251 CivilServantData civilServantData=null; 00252 ArrayList variables=null; 00253 Collection collection=null; 00254 Iterator iterator=null; 00255 00256 collection=new Vector(); 00257 00258 query = CycAccess.current().makeCycList("(#$superiors ?BOSS ?SUBORD)"); 00259 bossVariable = CycObjectFactory.makeCycVariable("?BOSS"); 00260 subordinateVariable = CycObjectFactory.makeCycVariable("?SUBORD"); 00261 00262 variables=new ArrayList(); 00263 variables.add(bossVariable); 00264 variables.add(subordinateVariable); 00265 00266 response = CycAccess.current().askWithVariables(query, 00267 variables, mt); 00268 00269 iterator=response.iterator(); 00270 while (iterator.hasNext()) 00271 { 00272 item=(CycList)iterator.next(); 00273 00274 civilServantData=new CivilServantData(); 00275 civilServantData.setFieldOfWork(this.getPredicateValue("fieldOfWork", (CycConstant)item.first(), mt)); 00276 civilServantData.setGivenNames(this.getPredicateValue("givenNames", (CycConstant)item.first(), mt)); 00277 civilServantData.setFamilyName(this.getPredicateValue("familyName", (CycConstant)item.first(), mt)); 00278 00279 collection.add(civilServantData); 00280 } 00281 00282 return (CivilServantData[])collection.toArray(new CivilServantData[collection.size()]); 00283 00284 }
|
|
||||||||||||
|
Definition at line 123 of file DataAccessLayer.java. Referenced by com.dapissarenko.hierarchy.DataAccessLayer.getCountryList().
|
|
|
Definition at line 70 of file DataAccessLayer.java. References com.dapissarenko.hierarchy.DataAccessLayer.getComment(), com.dapissarenko.hierarchy.countries.CountryData.setCountryComment(), and com.dapissarenko.hierarchy.countries.CountryData.setCountryName(). 00071 { 00072 CycList query = null; 00073 CycList response = null; 00074 CycVariable countryVariable = null; 00075 CycConstant item=null; 00076 CountryData countryData=null; 00077 Collection collection=null; 00078 Iterator iterator=null; 00079 00080 collection=new Vector(); 00081 00082 query = CycAccess.current().makeCycList("(#$isa ?COUNTRY #$Country)"); 00083 countryVariable = CycObjectFactory.makeCycVariable("?COUNTRY"); 00084 00085 response = CycAccess.current().askWithVariable(query, 00086 countryVariable, mt); 00087 00088 iterator=response.iterator(); 00089 while (iterator.hasNext()) 00090 { 00091 item=(CycConstant)iterator.next(); 00092 00093 countryData=new CountryData(); 00094 countryData.setCountryName(item.getName()); 00095 countryData.setCountryComment(this.getComment(item, mt)); 00096 00097 collection.add(countryData); 00098 } 00099 00100 return collection; 00101 }
|
|
|
Definition at line 38 of file DataAccessLayer.java. References com.dapissarenko.hierarchy.DataAccessLayer.getPredicateValue(), com.dapissarenko.hierarchy.departments.DepartmentData.setFieldOfWork(), and com.dapissarenko.hierarchy.departments.DepartmentData.setName(). 00039 { 00040 CycList query = null; 00041 CycList response = null; 00042 CycVariable departmentVariable = null; 00043 CycConstant item=null; 00044 DepartmentData departmentData=null; 00045 Collection collection=null; 00046 Iterator iterator=null; 00047 00048 collection=new Vector(); 00049 00050 query = CycAccess.current().makeCycList("(#$isa ?DEPARTMENT #$Department)"); 00051 departmentVariable = CycObjectFactory.makeCycVariable("?DEPARTMENT"); 00052 00053 response = CycAccess.current().askWithVariable(query, 00054 departmentVariable, mt); 00055 00056 iterator=response.iterator(); 00057 while (iterator.hasNext()) 00058 { 00059 item=(CycConstant)iterator.next(); 00060 00061 departmentData=new DepartmentData(); 00062 departmentData.setName(item.getName()); 00063 departmentData.setFieldOfWork(this.getPredicateValue("fieldOfWork", item, mt)); 00064 collection.add(departmentData); 00065 } 00066 00067 return collection; 00068 00069 }
|
|
||||||||||||
|
Definition at line 207 of file DataAccessLayer.java. 00208 { 00209 String fullName=null; 00210 00211 fullName = this.getPredicateValue("givenNames", person, mt); 00212 fullName += " "; 00213 fullName += this.getPredicateValue("familyName", person, mt); 00214 00215 return fullName; 00216 }
|
|
|
Definition at line 160 of file DataAccessLayer.java. References com.dapissarenko.hierarchy.departments.DepartmentData.setHeadOfDepartment(), and com.dapissarenko.hierarchy.departments.DepartmentData.setName(). 00161 { 00162 CycList query = null; 00163 CycList response = null; 00164 CycVariable departmentVariable = null; 00165 CycVariable headVariable = null; 00166 CycList item=null; 00167 DepartmentData departmentData=null; 00168 Collection collection=null; 00169 ArrayList variables=null; 00170 Iterator iterator=null; 00171 CycConstant department=null; 00172 CycConstant head=null; 00173 String fullHeadName=null; 00174 00175 collection=new Vector(); 00176 00177 query = CycAccess.current().makeCycList("(#$headOfDepartment ?HEAD_OF_DEPARTMENT ?DEPARTMENT)"); 00178 departmentVariable = CycObjectFactory.makeCycVariable("?DEPARTMENT"); 00179 headVariable = CycObjectFactory.makeCycVariable("?HEAD_OF_DEPARTMENT"); 00180 00181 variables=new ArrayList(); 00182 variables.add(departmentVariable); 00183 variables.add(headVariable); 00184 00185 response = CycAccess.current().askWithVariables(query, 00186 variables, mt); 00187 00188 iterator=response.iterator(); 00189 while (iterator.hasNext()) 00190 { 00191 item=(CycList)iterator.next(); 00192 00193 head=(CycConstant)item.first(); 00194 department=(CycConstant)item.second(); 00195 fullHeadName=this.getFullHeadName(head, mt); 00196 00197 departmentData=new DepartmentData(); 00198 departmentData.setHeadOfDepartment(fullHeadName); 00199 departmentData.setName(department.getName()); 00200 00201 collection.add(departmentData); 00202 } 00203 00204 return collection; 00205 00206 }
|
|
||||||||||||||||
|
Definition at line 102 of file DataAccessLayer.java. Referenced by com.dapissarenko.hierarchy.DataAccessLayer.getBossOfBagaturLobo(), com.dapissarenko.hierarchy.DataAccessLayer.getCivilServantsList(), com.dapissarenko.hierarchy.DataAccessLayer.getCivilServantsWithSubordinates(), and com.dapissarenko.hierarchy.DataAccessLayer.getDepartmentList(). 00103 { 00104 CycList query = null; 00105 CycList response = null; 00106 CycVariable variable = null; 00107 String value=null; 00108 00109 value=null; 00110 query = CycAccess.current().makeCycList("(#$"+predicateName + " #$"+ item.getName() + " ?VAR)"); 00111 variable = CycObjectFactory.makeCycVariable("?VAR"); 00112 00113 response = CycAccess.current().askWithVariable(query, 00114 variable, mt); 00115 00116 if (response.size()>0) 00117 { 00118 value=(String)response.iterator().next(); 00119 } 00120 00121 return value; 00122 }
|
|
|
Definition at line 217 of file DataAccessLayer.java. 00218 { 00219 CycList query = null; 00220 CycList response = null; 00221 CycVariable propertyVariable = null; 00222 Object item=null; 00223 Vector collection=null; 00224 Iterator iterator=null; 00225 00226 collection=new Vector(); 00227 00228 query = CycAccess.current().makeCycList("(#$isa #$MokiiNilovichRabinovich ?PROPERTY)"); 00229 propertyVariable = CycObjectFactory.makeCycVariable("?PROPERTY"); 00230 00231 response = CycAccess.current().askWithVariable(query, 00232 propertyVariable, mt); 00233 00234 iterator=response.iterator(); 00235 while (iterator.hasNext()) 00236 { 00237 item=iterator.next(); 00238 00239 collection.add(item.toString()); 00240 } 00241 00242 return (String[])collection.toArray(new String[collection.size()]); 00243 }
|
|
|
Definition at line 32 of file DataAccessLayer.java. |
|
|
Definition at line 33 of file DataAccessLayer.java. |
1.4.4