MCPcopy Create free account
hub / github.com/UniTime/unitime / Department

Class Department

JavaSource/org/unitime/timetable/model/Department.java:49–538  ·  view source on GitHub ↗

@author Tomas Muller, Stephanie Schluttenhofer, Zuzana Mullerova

Source from the content-addressed store, hash-verified

47 * @author Tomas Muller, Stephanie Schluttenhofer, Zuzana Mullerova
48 */
49@Entity
50@Table(name = "department")
51public class Department extends BaseDepartment implements Comparable<Department>, Qualifiable {
52 private static final long serialVersionUID = 1L;
53
54/*[CONSTRUCTOR MARKER BEGIN]*/
55 public Department () {
56 super();
57 }
58
59 /**
60 * Constructor for primary key
61 */
62 public Department (java.lang.Long uniqueId) {
63 super(uniqueId);
64 }
65
66/*[CONSTRUCTOR MARKER END]*/
67
68 /** Request attribute name for available departments **/
69 public static String DEPT_ATTR_NAME = "deptsList";
70 public static String EXTERNAL_DEPT_ATTR_NAME = "externalDepartments";
71
72 @SuppressWarnings("unchecked")
73 public static TreeSet<Department> findAll(Long sessionId) {
74 return new TreeSet<Department>((DepartmentDAO.getInstance()).
75 getSession().
76 createQuery("select distinct d from Department as d where d.session.uniqueId=:sessionId", Department.class).
77 setParameter("sessionId", sessionId.longValue()).
78 setCacheable(true).
79 list());
80 }
81
82 @SuppressWarnings("unchecked")
83 public static TreeSet<Department> findAllExternal(Long sessionId) {
84 return new TreeSet<Department>((DepartmentDAO.getInstance()).
85 getSession().
86 createQuery("select distinct d from Department as d where d.externalManager=true and d.session.uniqueId=:sessionId", Department.class).
87 setParameter("sessionId", sessionId.longValue()).
88 setCacheable(true).
89 list());
90 }
91
92 @SuppressWarnings("unchecked")
93 public static TreeSet<Department> findAllNonExternal(Long sessionId) {
94 return new TreeSet<Department>((DepartmentDAO.getInstance()).
95 getSession().
96 createQuery("select distinct d from Department as d where d.externalManager=false and d.session.uniqueId=:sessionId", Department.class).
97 setParameter("sessionId", sessionId.longValue()).
98 setCacheable(true).
99 list());
100 }
101
102 /**
103 *
104 * @param deptCode
105 * @param sessionId
106 * @return

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected