use of org.apache.ignite.console.demo.model.Country in project ignite by apache.
the class DemoCachesLoadService method cacheCountry.
/**
* Configure cacheCountry.
*/
private static CacheConfiguration cacheCountry() {
CacheConfiguration ccfg = cacheConfiguration(COUNTRY_CACHE_NAME);
// Configure cacheCountry types.
Collection<QueryEntity> qryEntities = new ArrayList<>();
// COUNTRY.
QueryEntity type = new QueryEntity();
qryEntities.add(type);
type.setKeyType(Integer.class.getName());
type.setValueType(Country.class.getName());
// Query fields for COUNTRY.
LinkedHashMap<String, String> qryFlds = new LinkedHashMap<>();
qryFlds.put("id", "java.lang.Integer");
qryFlds.put("name", "java.lang.String");
qryFlds.put("population", "java.lang.Integer");
type.setFields(qryFlds);
ccfg.setQueryEntities(qryEntities);
return ccfg;
}
use of org.apache.ignite.console.demo.model.Country in project ignite by apache.
the class DemoCachesLoadService method populateCacheEmployee.
/**
*/
private void populateCacheEmployee() {
if (ignite.log().isDebugEnabled())
ignite.log().debug("DEMO: Start employees population with data...");
IgniteCache<Integer, Country> cacheCountry = ignite.cache(COUNTRY_CACHE_NAME);
for (int i = 0, n = 1; i < CNTR_CNT; i++, n++) cacheCountry.put(i, new Country(i, "Country #" + n, n * 10000000));
IgniteCache<Integer, Department> cacheDepartment = ignite.cache(DEPARTMENT_CACHE_NAME);
IgniteCache<Integer, Employee> cacheEmployee = ignite.cache(EMPLOYEE_CACHE_NAME);
for (int i = 0, n = 1; i < DEP_CNT; i++, n++) {
cacheDepartment.put(i, new Department(n, rnd.nextInt(CNTR_CNT), "Department #" + n));
double r = rnd.nextDouble();
cacheEmployee.put(i, new Employee(i, rnd.nextInt(DEP_CNT), null, "First name manager #" + n, "Last name manager #" + n, "Email manager #" + n, "Phone number manager #" + n, new java.sql.Date((long) (r * range)), "Job manager #" + n, 1000 + AgentDemoUtils.round(r * 4000, 2)));
}
for (int i = 0, n = 1; i < EMPL_CNT; i++, n++) {
Integer depId = rnd.nextInt(DEP_CNT);
double r = rnd.nextDouble();
cacheEmployee.put(i, new Employee(i, depId, depId, "First name employee #" + n, "Last name employee #" + n, "Email employee #" + n, "Phone number employee #" + n, new java.sql.Date((long) (r * range)), "Job employee #" + n, 500 + AgentDemoUtils.round(r * 2000, 2)));
}
if (ignite.log().isDebugEnabled())
ignite.log().debug("DEMO: Finished employees population.");
}
Aggregations