| 
						
						
						
					 | 
				
			
			 | 
			 | 
			
				@ -1,8 +1,8 @@
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				package info.bukova.isspst.services;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import static ch.lambdaj.Lambda.filter;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import info.bukova.isspst.Constants;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import info.bukova.isspst.Module;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import info.bukova.isspst.ModuleUtils;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import info.bukova.isspst.SessionData;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import info.bukova.isspst.dao.BaseDao;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import info.bukova.isspst.dao.QueryDao;
 | 
			
		
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
			
			 | 
			 | 
			
				@ -73,6 +73,10 @@ public abstract class AbstractService<T extends DataModel> implements Service<T>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							throw new IsspstException("DAO is null");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						if (getModule() != null && !getModule().isActive()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							throw new ModuleNotActiveException();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						validate(entity);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						entity.setCreated(new Date());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						dao.add(entity);
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -86,6 +90,10 @@ public abstract class AbstractService<T extends DataModel> implements Service<T>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							throw new IsspstException("DAO is null");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						if (getModule() != null && !getModule().isActive()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							throw new ModuleNotActiveException();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						validate(entity);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						entity.setModified(new Date());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						dao.modify(entity);
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -99,6 +107,10 @@ public abstract class AbstractService<T extends DataModel> implements Service<T>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							throw new IsspstException("DAO is null");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						if (getModule() != null && !getModule().isActive()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							throw new ModuleNotActiveException();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						dao.delete(entity);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					
 | 
			
		
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
			
			 | 
			 | 
			
				@ -137,6 +149,10 @@ public abstract class AbstractService<T extends DataModel> implements Service<T>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							throw new IsspstException("DAO is null");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						if (getModule() != null && !getModule().isActive()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							throw new ModuleNotActiveException();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						return dao.getById(id);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -148,6 +164,10 @@ public abstract class AbstractService<T extends DataModel> implements Service<T>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							throw new IsspstException("DAO is null");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						if (getModule() != null && !getModule().isActive()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							throw new ModuleNotActiveException();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						return dao.getAll();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -159,6 +179,10 @@ public abstract class AbstractService<T extends DataModel> implements Service<T>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							throw new IsspstException("DAO is null");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						if (getModule() != null && !getModule().isActive()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							throw new ModuleNotActiveException();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						return dao.execQuery(query);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -171,6 +195,10 @@ public abstract class AbstractService<T extends DataModel> implements Service<T>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							throw new IsspstException("DAO is null");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						if (getModule() != null && !getModule().isActive()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							throw new ModuleNotActiveException();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						try {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							Query q = dao.getQuery(query);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							return (T) q.uniqueResult();
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -189,13 +217,7 @@ public abstract class AbstractService<T extends DataModel> implements Service<T>
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					@Override
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					public Module getModule() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						for (Module m : Constants.MODULES) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							if (Arrays.asList(this.getClass().getInterfaces()).contains(m.getServiceClass())) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								return m;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						return null;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						return ModuleUtils.getModule(this.getClass());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					public List<Report> getReports() {
 | 
			
		
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
			
			 | 
			 | 
			
				
 
 |