/*This code was generated using the UMPLE modeling language! Date of generation: 2008/07/30 12:30:06*/ /*This class drives: Employee*/ package BankingSystem.core.humanResources; import java.util.*; import BankingSystem.*; import BankingSystem.core.intangableResources.*; import BankingSystem.core.tangableResources.*; import BankingSystem.json.*; public class Manager extends Employee { //Class datatypes //Class association variables private List employees; //Registry of our system. BankingSystemRegistry registry = BankingSystemRegistry.getInstance(); //Constructor public Manager(Person aPerson, Division aDivision) { super(aPerson, aDivision); employees = new ArrayList(); registry.add(employees); } public List getEmployees() { return employees; } public Employee addEmployee(Person aPerson, Division aDivision) { Employee newEmployee; newEmployee = new Employee(aPerson, aDivision); if (!employees.contains(newEmployee)) { registry.add(newEmployee); employees.add(newEmployee); } return newEmployee; } public Employee addEmployee(Employee aEmployee) { if (!employees.contains(aEmployee)) employees.add(aEmployee); return aEmployee; } public void delete() { //Delete all many ends first. for (Employee aEmployee : employees) { aEmployee.delete(); } employees.clear(); } public void deleteEmployee(Employee aEmployee) { if (employees.contains(aEmployee)) { employees.remove(aEmployee); //registry.removeObj(registry.getKey(aEmployee)); } else //Throw an UmpleException .. to be implemented. { } } public boolean areManyEndsNull() { if (employees.size() == 0) { return true; } else return false; } /*********************************** * Returns the attribute list along with the * class ID in JSON format. ***********************************/ public JSONObject getAttributes() throws JSONException { JSONObject obj = new JSONObject(); obj.put("CLASS_ID", registry.getKey(this)); return obj; } }