-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bdc0820
commit 63d8a72
Showing
6 changed files
with
371 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package service; | ||
|
||
import dao.DaoAdmin; | ||
import model.Admin; | ||
import imp.IAction; | ||
import util.HibernateMovie; | ||
import imp.ICheckLogin; | ||
import imp.ICheckName; | ||
import imp.ICheckPassword; | ||
import java.util.List; | ||
import imp.IListName; | ||
import java.util.Date; | ||
|
||
/** | ||
* | ||
* @author gaone | ||
*/ | ||
public class ServiceAdmin implements ICheckLogin<Admin>, IAction<Admin>, IListName, ICheckName, ICheckPassword { | ||
|
||
private DaoAdmin daoAdmin; | ||
|
||
public ServiceAdmin() { | ||
daoAdmin = new DaoAdmin(HibernateMovie.openSession()); | ||
} | ||
|
||
@Override | ||
public Admin checkLogin(String username, String password) { | ||
return daoAdmin.checkLogin(username, password); | ||
} | ||
|
||
@Override | ||
public List<Admin> getAll() { | ||
return daoAdmin.getAll(); | ||
} | ||
|
||
@Override | ||
public Admin findById(int id) { | ||
return daoAdmin.findById(id); | ||
} | ||
|
||
@Override | ||
public void delete(Admin object) { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
public void update(Admin object) { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
public void update(int id, String fullName, String password, Date birthday, String gmail, Integer sdt) { | ||
daoAdmin.update(id, fullName, password, birthday, gmail, sdt); | ||
} | ||
|
||
@Override | ||
public void add(Admin object) { | ||
daoAdmin.add(object); | ||
} | ||
|
||
@Override | ||
public List<String> getAllUserName() { | ||
return daoAdmin.getAllUserName(); | ||
} | ||
|
||
@Override | ||
public boolean checkUserName(String username) { | ||
return daoAdmin.checkUserName(username); | ||
} | ||
|
||
@Override | ||
public boolean checkPassword(int id, String password) { | ||
Admin admin = findById(id); | ||
if (admin.getPassword().equals(password)) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
public int countAdmin() { | ||
|
||
return daoAdmin.countAdmin(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package service; | ||
|
||
import dao.DaoCategory; | ||
import model.Category; | ||
import imp.IAction; | ||
import java.util.HashSet; | ||
import java.util.List; | ||
import java.util.Set; | ||
import util.HibernateMovie; | ||
|
||
/** | ||
* | ||
* @author gaone | ||
*/ | ||
public class ServiceCategory implements IAction<Category>{ | ||
private DaoCategory daoCategory; | ||
|
||
public ServiceCategory() { | ||
daoCategory=new DaoCategory(HibernateMovie.openSession()); | ||
} | ||
|
||
|
||
@Override | ||
public List<Category> getAll() { | ||
return daoCategory.getAll(); | ||
} | ||
|
||
@Override | ||
public Category findById(int id) { | ||
return daoCategory.findById(id); | ||
} | ||
|
||
@Override | ||
public void delete(Category object) { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
public void update(Category object) { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
public void add(Category object) { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
public Set getAllByListId(char[] lsitIdCategory) { | ||
return daoCategory.getAllByListId(lsitIdCategory); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package service; | ||
|
||
import dao.DaoCategoryMovie; | ||
import imp.IAction; | ||
import java.util.List; | ||
import model.CategoryMoive; | ||
import util.HibernateMovie; | ||
|
||
/** | ||
* | ||
* @author gaone | ||
*/ | ||
public class ServiceCategoryMovie implements IAction<CategoryMoive>{ | ||
|
||
private DaoCategoryMovie daoCategoryMovie; | ||
|
||
public ServiceCategoryMovie() { | ||
daoCategoryMovie=new DaoCategoryMovie(HibernateMovie.openSession()); | ||
} | ||
|
||
@Override | ||
public List<CategoryMoive> getAll() { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
public CategoryMoive findById(int id) { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
public void delete(CategoryMoive object) { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
public void update(CategoryMoive object) { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
public void add(CategoryMoive object) { | ||
daoCategoryMovie.add(object); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package service; | ||
|
||
import dao.DaoFilmType; | ||
import model.Filmtype; | ||
import imp.IAction; | ||
import java.util.List; | ||
import util.HibernateMovie; | ||
|
||
/** | ||
* | ||
* @author gaone | ||
*/ | ||
public class ServiceFilmType implements IAction<Filmtype> { | ||
private DaoFilmType daoFilmType; | ||
|
||
public ServiceFilmType() { | ||
this.daoFilmType=new DaoFilmType(HibernateMovie.openSession()); | ||
} | ||
|
||
|
||
@Override | ||
public List<Filmtype> getAll() { | ||
return daoFilmType.getAll(); | ||
} | ||
|
||
@Override | ||
public Filmtype findById(int id) { | ||
return daoFilmType.findById(id); | ||
} | ||
|
||
@Override | ||
public void delete(Filmtype object) { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
public void update(Filmtype object) { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
public void add(Filmtype object) { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package service; | ||
|
||
import dao.DaoMovie; | ||
import dao.DaoMovieAdmin; | ||
import model.MovieAdmin; | ||
import imp.IAction; | ||
import java.util.List; | ||
import util.HibernateMovie; | ||
|
||
/** | ||
* | ||
* @author gaone | ||
*/ | ||
public class ServiceMovieAdmin implements IAction<MovieAdmin> { | ||
private DaoMovieAdmin daoMovieAdmin; | ||
|
||
public ServiceMovieAdmin() { | ||
daoMovieAdmin=new DaoMovieAdmin(HibernateMovie.openSession()); | ||
} | ||
|
||
|
||
@Override | ||
public List<MovieAdmin> getAll() { | ||
return daoMovieAdmin.getAll(); | ||
} | ||
|
||
@Override | ||
public MovieAdmin findById(int id) { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
public void delete(MovieAdmin object) { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
public void update(MovieAdmin object) { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
public void add(MovieAdmin object) { | ||
daoMovieAdmin.add(object); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package service; | ||
|
||
import dao.DaoMovie; | ||
import model.Movie; | ||
import imp.IAction; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import org.hibernate.Session; | ||
import util.HibernateMovie; | ||
|
||
/** | ||
* | ||
* @author gaone | ||
*/ | ||
public class ServicelMovie implements IAction<Movie> { | ||
|
||
private DaoMovie daoMovie; | ||
|
||
public ServicelMovie() { | ||
daoMovie = new DaoMovie(HibernateMovie.openSession()); | ||
} | ||
|
||
@Override | ||
public List<Movie> getAll() { | ||
return daoMovie.getAll(); | ||
} | ||
|
||
@Override | ||
public Movie findById(int id) { | ||
return daoMovie.findById(id); | ||
} | ||
|
||
@Override | ||
public void delete(Movie object) { | ||
daoMovie.delete(object); | ||
} | ||
public void delete(int id) { | ||
daoMovie.delete(id); | ||
} | ||
|
||
@Override | ||
public void update(Movie object) { | ||
daoMovie.update(object); | ||
} | ||
|
||
@Override | ||
public void add(Movie object) { | ||
daoMovie.add(object); | ||
} | ||
|
||
public List<Movie> findByName(String str, boolean flag) { | ||
return daoMovie.findByName(str, flag); | ||
} | ||
|
||
public List<Movie> seachMovie(String str) { | ||
return daoMovie.seachMovie(str); | ||
} | ||
|
||
public int countMovie() { | ||
return daoMovie.countMovie(); | ||
} | ||
|
||
public int countNewMovieAdd() { | ||
|
||
return daoMovie.countNewMovieAdd(); | ||
} | ||
|
||
} |