Fixed assigning a playlist to a user

Signed-off-by: Andrew DeMaria <lostonamountain@gmail.com>
master
Andrew DeMaria 8 years ago
parent bec74fa70e
commit fac659eb24
No known key found for this signature in database
GPG Key ID: 0A3F5E91F8364EDF
  1. 7
      libresonic-main/src/main/java/org/libresonic/player/dao/MusicFolderDao.java
  2. 2
      libresonic-main/src/main/java/org/libresonic/player/dao/UserDao.java
  3. 1
      libresonic-main/src/main/webapp/WEB-INF/applicationContext-service.xml
  4. 1
      libresonic-main/src/test/java/org/libresonic/player/dao/DaoTestCaseBase.java

@ -40,6 +40,8 @@ public class MusicFolderDao extends AbstractDao {
private static final String QUERY_COLUMNS = "id, " + INSERT_COLUMNS; private static final String QUERY_COLUMNS = "id, " + INSERT_COLUMNS;
private final MusicFolderRowMapper rowMapper = new MusicFolderRowMapper(); private final MusicFolderRowMapper rowMapper = new MusicFolderRowMapper();
private UserDao userDao;
/** /**
* Returns all music folders. * Returns all music folders.
* *
@ -60,7 +62,7 @@ public class MusicFolderDao extends AbstractDao {
update(sql, musicFolder.getPath(), musicFolder.getName(), musicFolder.isEnabled(), musicFolder.getChanged()); update(sql, musicFolder.getPath(), musicFolder.getName(), musicFolder.isEnabled(), musicFolder.getChanged());
Integer id = queryForInt("select max(id) from music_folder", 0); Integer id = queryForInt("select max(id) from music_folder", 0);
update("insert into music_folder_user (music_folder_id, username) select ?, username from user", id); update("insert into music_folder_user (music_folder_id, username) select ?, username from " + userDao.getUserTable(), id);
LOG.info("Created music folder " + musicFolder.getPath()); LOG.info("Created music folder " + musicFolder.getPath());
} }
@ -105,4 +107,7 @@ public class MusicFolderDao extends AbstractDao {
} }
} }
public void setUserDao(UserDao userDao) {
this.userDao = userDao;
}
} }

@ -358,7 +358,7 @@ public class UserDao extends AbstractDao {
} }
} }
private String getUserTable() { String getUserTable() {
return userTableQuote + "user" + userTableQuote; return userTableQuote + "user" + userTableQuote;
} }

@ -45,6 +45,7 @@
<bean id="musicFolderDao" class="org.libresonic.player.dao.MusicFolderDao"> <bean id="musicFolderDao" class="org.libresonic.player.dao.MusicFolderDao">
<property name="daoHelper" ref="daoHelper"/> <property name="daoHelper" ref="daoHelper"/>
<property name="userDao" ref="userDao" />
</bean> </bean>
<bean id="userDao" class="org.libresonic.player.dao.UserDao"> <bean id="userDao" class="org.libresonic.player.dao.UserDao">

@ -59,6 +59,7 @@ public abstract class DaoTestCaseBase extends TestCase {
internetRadioDao.setDaoHelper(daoHelper); internetRadioDao.setDaoHelper(daoHelper);
ratingDao.setDaoHelper(daoHelper); ratingDao.setDaoHelper(daoHelper);
musicFolderDao.setDaoHelper(daoHelper); musicFolderDao.setDaoHelper(daoHelper);
musicFolderDao.setUserDao(userDao);
userDao.setDaoHelper(daoHelper); userDao.setDaoHelper(daoHelper);
transcodingDao.setDaoHelper(daoHelper); transcodingDao.setDaoHelper(daoHelper);
podcastDao.setDaoHelper(daoHelper); podcastDao.setDaoHelper(daoHelper);

Loading…
Cancel
Save