Skip to content

Instantly share code, notes, and snippets.

@creationmachine
Created June 9, 2015 18:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save creationmachine/b3f4f963f441cef5f713 to your computer and use it in GitHub Desktop.
Save creationmachine/b3f4f963f441cef5f713 to your computer and use it in GitHub Desktop.
package models;
import java.util.ArrayList;
import java.util.List;
/**
* Sample Department bean to demostrate main excel export features
*/
public class Department {
private String name;
private Employee chief;
private List<Employee> staff = new ArrayList<Employee>();
/**
*
* @param name
*/
public Department(String name) {
this.name = name;
}
/**
*
* @param name
* @param chief
* @param staff
*/
public Department(String name, Employee chief, List<Employee> staff) {
this.name = name;
this.chief = chief;
this.staff = staff;
}
/**
*
* @param depCount
* @param employeeCount
* @return
*/
public static List<Department> generate(int depCount, int employeeCount){
List<Department> departments = new ArrayList<Department>();
for(int index = 0; index < depCount; index++){
Department dep = new Department("Dep " + index);
dep.setChief( Employee.generateOne("ch" + index));
dep.setStaff( Employee.generate(employeeCount) );
departments.add( dep );
}
return departments;
}
/**
*
* @param employee
*/
public void addEmployee(Employee employee) {
staff.add(employee);
}
/**
*
* @return
*/
public String getName() {
return name;
}
/**
*
* @param name
*/
public void setName(String name) {
this.name = name;
}
/**
*
* @return
*/
public Employee getChief() {
return chief;
}
/**
*
* @param chief
*/
public void setChief(Employee chief) {
this.chief = chief;
}
/**
*
* @return
*/
public List<Employee> getStaff() {
return staff;
}
/**
*
* @param staff
*/
public void setStaff(List<Employee> staff) {
this.staff = staff;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment