Skip to content

Commit

Permalink
Merge pull request traccar#3504 from Abyss777/remove_aliases
Browse files Browse the repository at this point in the history
Remove Attribute Aliases
  • Loading branch information
tananaev authored Sep 5, 2017
2 parents 36c62f0 + ba892a3 commit 3e51671
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 398 deletions.
17 changes: 17 additions & 0 deletions schema/changelog-3.15.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd"
logicalFilePath="changelog-3.15">

<changeSet author="author" id="changelog-3.15">

<dropForeignKeyConstraint baseTableName="attribute_aliases" constraintName="fk_attribute_aliases_deviceid" />
<dropUniqueConstraint tableName="attribute_aliases" constraintName="uk_deviceid_attribute" />

<dropTable tableName="attribute_aliases" />

</changeSet>
</databaseChangeLog>
1 change: 1 addition & 0 deletions schema/changelog-master.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@
<include file="changelog-3.11.xml" relativeToChangelogFile="true" />
<include file="changelog-3.12.xml" relativeToChangelogFile="true" />
<include file="changelog-3.14.xml" relativeToChangelogFile="true" />
<include file="changelog-3.15.xml" relativeToChangelogFile="true" />
</databaseChangeLog>
21 changes: 0 additions & 21 deletions setup/default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,27 +62,6 @@
DELETE FROM events WHERE serverTime &lt; :serverTime
</entry>

<entry key='database.selectAttributeAliases'>
SELECT * FROM attribute_aliases
</entry>

<entry key='database.insertAttributeAlias'>
INSERT INTO attribute_aliases (deviceId, attribute, alias)
VALUES (:deviceId, :attribute, :alias)
</entry>

<entry key='database.updateAttributeAlias'>
UPDATE attribute_aliases SET
deviceId = :deviceId,
attribute = :attribute,
alias = :alias
WHERE id = :id
</entry>

<entry key='database.deleteAttributeAlias'>
DELETE FROM attribute_aliases WHERE id = :id
</entry>

<entry key='database.selectStatistics'>
SELECT * FROM statistics WHERE captureTime BETWEEN :from AND :to ORDER BY captureTime
</entry>
Expand Down
9 changes: 0 additions & 9 deletions src/org/traccar/Context.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

import org.apache.velocity.app.VelocityEngine;
import org.eclipse.jetty.util.URIUtil;
import org.traccar.database.AliasesManager;
import org.traccar.database.CalendarManager;
import org.traccar.database.AttributesManager;
import org.traccar.database.BaseObjectManager;
Expand Down Expand Up @@ -202,12 +201,6 @@ public static EventForwarder getEventForwarder() {
return eventForwarder;
}

private static AliasesManager aliasesManager;

public static AliasesManager getAliasesManager() {
return aliasesManager;
}

private static AttributesManager attributesManager;

public static AttributesManager getAttributesManager() {
Expand Down Expand Up @@ -395,8 +388,6 @@ public static void init(String[] arguments) throws Exception {
eventForwarder = new EventForwarder();
}

aliasesManager = new AliasesManager(dataManager);

attributesManager = new AttributesManager(dataManager);

driversManager = new DriversManager(dataManager);
Expand Down
4 changes: 0 additions & 4 deletions src/org/traccar/api/BaseObjectResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,6 @@ public Response remove(@PathParam("id") long id) throws SQLException {
Context.getPermissionsManager().refreshAllExtendedPermissions();
}
}
// Next should be removed with Attribute Aliases
if (baseClass.equals(Device.class)) {
Context.getAliasesManager().removeDevice(id);
}
return Response.noContent().build();
}

Expand Down
93 changes: 0 additions & 93 deletions src/org/traccar/api/resource/AttributeAliasResource.java

This file was deleted.

113 changes: 0 additions & 113 deletions src/org/traccar/database/AliasesManager.java

This file was deleted.

24 changes: 0 additions & 24 deletions src/org/traccar/database/DataManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import org.traccar.Config;
import org.traccar.helper.Log;
import org.traccar.model.Attribute;
import org.traccar.model.AttributeAlias;
import org.traccar.model.Device;
import org.traccar.model.Driver;
import org.traccar.model.Event;
Expand Down Expand Up @@ -366,29 +365,6 @@ public Collection<Event> getEvents(long deviceId, Date from, Date to) throws SQL
.executeQuery(Event.class);
}

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();
}

public Collection<Statistics> getStatistics(Date from, Date to) throws SQLException {
return QueryBuilder.create(dataSource, getQuery("database.selectStatistics"))
.setDate("from", from)
Expand Down
51 changes: 0 additions & 51 deletions src/org/traccar/model/AttributeAlias.java

This file was deleted.

Loading

0 comments on commit 3e51671

Please sign in to comment.