Clear properties are not saved, so make them dirty.
[demoscenemusic.git] / src / main / java / net / pterodactylus / demoscenemusic / data / DataManager.java
index ad01bfe..c0001c4 100644 (file)
@@ -515,6 +515,23 @@ public class DataManager {
        }
 
        /**
+        * Removes the given track derivative and all its properties from the
+        * database.
+        *
+        * @param trackDerivative
+        *            The track derivative to remove
+        * @throws DatabaseException
+        *             if a database error occurs
+        */
+       public void removeTrackDerivative(TrackDerivative trackDerivative) throws DatabaseException {
+               Query query = new Query(Type.DELETE, "TRACK_DERIVATIVES");
+               query.addWhereClause(new ValueFieldWhereClause(new ValueField("TRACK_DERIVATIVES.ID", new StringParameter(trackDerivative.getId()))));
+               database.update(query);
+               /* remove the properties. */
+               saveProperties(new Properties().set("dirty", "true").removeAll(), "TRACK_DERIVATIVE_PROPERTIES", "TRACK_DERIVATIVE", trackDerivative.getId());
+       }
+
+       /**
         * Returns all groups the artist with the given ID belongs to.
         *
         * @param artistId