// Path: subsonic-main/src/main/java/net/sourceforge/subsonic/domain/Share.java
// public class Share {
// 
//     private int id;
//     private String name;
//     private String description;
//     private String username;
//     private Date created;
//     private Date expires;
//     private Date lastVisited;
//     private int visitCount;
// 
//     public Share() {
//     }
// 
//     public Share(int id, String name, String description, String username, Date created,
//             Date expires, Date lastVisited, int visitCount) {
//         this.id = id;
//         this.name = name;
//         this.description = description;
//         this.username = username;
//         this.created = created;
//         this.expires = expires;
//         this.lastVisited = lastVisited;
//         this.visitCount = visitCount;
//     }
// 
//     public int getId() {
//         return id;
//     }
// 
//     public void setId(int id) {
//         this.id = id;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     public String getDescription() {
//         return description;
//     }
// 
//     public void setDescription(String description) {
//         this.description = description;
//     }
// 
//     public String getUsername() {
//         return username;
//     }
// 
//     public void setUsername(String username) {
//         this.username = username;
//     }
// 
//     public Date getCreated() {
//         return created;
//     }
// 
//     public void setCreated(Date created) {
//         this.created = created;
//     }
// 
//     public Date getExpires() {
//         return expires;
//     }
// 
//     public void setExpires(Date expires) {
//         this.expires = expires;
//     }
// 
//     public Date getLastVisited() {
//         return lastVisited;
//     }
// 
//     public void setLastVisited(Date lastVisited) {
//         this.lastVisited = lastVisited;
//     }
// 
//     public int getVisitCount() {
//         return visitCount;
//     }
// 
//     public void setVisitCount(int visitCount) {
//         this.visitCount = visitCount;
//     }
// }


import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
import net.sourceforge.subsonic.domain.MusicFolder;
import net.sourceforge.subsonic.domain.Share;
/*
 This file is part of Subsonic.

 Subsonic is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.

 Subsonic is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with Subsonic.  If not, see <http://www.gnu.org/licenses/>.

 Copyright 2009 (C) Sindre Mehus
 */
package net.sourceforge.subsonic.dao;




/**
 * Provides database services for shared media.
 *
 * @author Sindre Mehus
 */
public class ShareDao extends AbstractDao {

    private static final String COLUMNS = "id, name, description, username, created, expires, last_visited, visit_count";

    private ShareRowMapper shareRowMapper = new ShareRowMapper();
    private ShareFileRowMapper shareFileRowMapper = new ShareFileRowMapper();

    /**
     * Creates a new share.
     *
     * @param share The share to create.  The ID of the share will be set by this method.
     */
// Path: subsonic-main/src/main/java/net/sourceforge/subsonic/domain/Share.java
// public class Share {
// 
//     private int id;
//     private String name;
//     private String description;
//     private String username;
//     private Date created;
//     private Date expires;
//     private Date lastVisited;
//     private int visitCount;
// 
//     public Share() {
//     }
// 
//     public Share(int id, String name, String description, String username, Date created,
//             Date expires, Date lastVisited, int visitCount) {
//         this.id = id;
//         this.name = name;
//         this.description = description;
//         this.username = username;
//         this.created = created;
//         this.expires = expires;
//         this.lastVisited = lastVisited;
//         this.visitCount = visitCount;
//     }
// 
//     public int getId() {
//         return id;
//     }
// 
//     public void setId(int id) {
//         this.id = id;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     public String getDescription() {
//         return description;
//     }
// 
//     public void setDescription(String description) {
//         this.description = description;
//     }
// 
//     public String getUsername() {
//         return username;
//     }
// 
//     public void setUsername(String username) {
//         this.username = username;
//     }
// 
//     public Date getCreated() {
//         return created;
//     }
// 
//     public void setCreated(Date created) {
//         this.created = created;
//     }
// 
//     public Date getExpires() {
//         return expires;
//     }
// 
//     public void setExpires(Date expires) {
//         this.expires = expires;
//     }
// 
//     public Date getLastVisited() {
//         return lastVisited;
//     }
// 
//     public void setLastVisited(Date lastVisited) {
//         this.lastVisited = lastVisited;
//     }
// 
//     public int getVisitCount() {
//         return visitCount;
//     }
// 
//     public void setVisitCount(int visitCount) {
//         this.visitCount = visitCount;
//     }
// }


// Path: subsonic-main/src/main/java/net/sourceforge/subsonic/dao/ShareDao.java
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
import net.sourceforge.subsonic.domain.MusicFolder;
import net.sourceforge.subsonic.domain.Share;

/*
 This file is part of Subsonic.

 Subsonic is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.

 Subsonic is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with Subsonic.  If not, see <http://www.gnu.org/licenses/>.

 Copyright 2009 (C) Sindre Mehus
 */
package net.sourceforge.subsonic.dao;




/**
 * Provides database services for shared media.
 *
 * @author Sindre Mehus
 */
public class ShareDao extends AbstractDao {

    private static final String COLUMNS = "id, name, description, username, created, expires, last_visited, visit_count";

    private ShareRowMapper shareRowMapper = new ShareRowMapper();
    private ShareFileRowMapper shareFileRowMapper = new ShareFileRowMapper();

    /**
     * Creates a new share.
     *
     * @param share The share to create.  The ID of the share will be set by this method.
     */
    public synchronized void createShare(Share share) {