/
styleDao.ts
58 lines (52 loc) · 1.57 KB
/
styleDao.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import { StyleTable } from './styleTable';
import { AttributesDao } from '../../../attributes/attributesDao';
import { StyleRow } from './styleRow';
import { AttributesResultSet } from '../../../attributes/attributesResultSet';
import { AttributesRow } from '../../../attributes/attributesRow';
import { StyleMappingRow } from './styleMappingRow';
/**
* Style DAO for reading style tables
*/
export class StyleDao extends AttributesDao {
constructor(dao: AttributesDao) {
super(dao.getDatabase(), dao.getGeoPackage(), new StyleTable(dao.getTable()));
}
getTable(): StyleTable {
return super.getTable() as StyleTable;
}
/**
* @inheritDoc
*/
public newRow(): StyleRow {
return new StyleRow(this.getTable());
}
/**
* Get the style row from the current result set location
* @param resultSet result set
* @return style row
*/
public getRowWithResultSet(resultSet: AttributesResultSet): StyleRow {
return this.getRow(resultSet.getRow());
}
/**
* Get a style row from the attributes row
* @param row attributes row
* @return style row
*/
public getRow(row: AttributesRow): StyleRow {
return new StyleRow(row);
}
/**
* Query for the style row from a style mapping row
* @param styleMappingRow style mapping row
* @return style row
*/
public queryForRow(styleMappingRow: StyleMappingRow): StyleRow {
let styleRow = null;
const attributesRow = this.queryForIdRow(styleMappingRow.getRelatedId());
if (attributesRow != null) {
styleRow = this.getRow(attributesRow);
}
return styleRow;
}
}