package cn.myapps.runtime.rest.department.service;

import java.util.Collection;

import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSONObject;

import cn.myapps.authtime.common.dao.ConnectionManager;
import cn.myapps.runtime.rest.department.dao.AbstractDepartmentDAO;
import cn.myapps.runtime.rest.department.model.Department;
import cn.myapps.runtime.rest.util.DaoManager;

@Service("bpmDepartmentService")
public class DepartmentServiceImpl implements DepartmentService {

	public AbstractDepartmentDAO getDAO() throws Exception {
		return DaoManager.getDepartmentDAO(ConnectionManager.getConnection());
	}

	@Override
	public String add(Department department) throws Exception {
		return getDAO().add(department);
	}

	@Override
	public Department find(String id) throws Exception {
		return getDAO().find(id);
	}
	
	@Override
	public String update(JSONObject jsonObject) throws Exception {
		return getDAO().update(jsonObject);
	}
	
	@Override
	public String delete(String id) throws Exception {
		return getDAO().delete(id);
	}

	@Override
	public Collection<Department> get(String id) throws Exception {
		return getDAO().get(id);
	}

}
