diff options
Diffstat (limited to 'src/org/traccar/database/DataManager.java')
-rw-r--r-- | src/org/traccar/database/DataManager.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java index abc48f063..02adb0455 100644 --- a/src/org/traccar/database/DataManager.java +++ b/src/org/traccar/database/DataManager.java @@ -37,6 +37,7 @@ import liquibase.resource.ResourceAccessor; import org.traccar.Config; import org.traccar.helper.Log; +import org.traccar.model.AttributeAlias; import org.traccar.model.Device; import org.traccar.model.DevicePermission; import org.traccar.model.Event; @@ -460,4 +461,27 @@ public class DataManager { .setLong("id", notification.getId()) .executeUpdate(); } + + public Collection<AttributeAlias> getAttributeAliases() throws SQLException { + return QueryBuilder.create(dataSource, getQuery("database.selectAttributeAliases")) + .executeQuery(AttributeAlias.class); + } + + public void addAttributeAlias(AttributeAlias attributeAlias) throws SQLException { + attributeAlias.setId(QueryBuilder.create(dataSource, getQuery("database.insertAttributeAlias"), true) + .setObject(attributeAlias) + .executeUpdate()); + } + + public void updateAttributeAlias(AttributeAlias attributeAlias) throws SQLException { + QueryBuilder.create(dataSource, getQuery("database.updateAttributeAlias")) + .setObject(attributeAlias) + .executeUpdate(); + } + + public void removeAttributeAlias(long attributeAliasId) throws SQLException { + QueryBuilder.create(dataSource, getQuery("database.deleteAttributeAlias")) + .setLong("id", attributeAliasId) + .executeUpdate(); + } } |