private void createUserJButtonActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_createUserJButtonActionPerformed
    String userName = nameJTextField.getText();
    String password = passwordJTextField.getText();
    Organisation organization = (Organisation) organizationJComboBox.getSelectedItem();
    Person p = (Person) employeeJComboBox.getSelectedItem();
    Role role = (Role) roleJComboBox.getSelectedItem();

    organization.getUserAccountDirectory().createUserAccount(userName, password, p, role);

    popData();
  } // GEN-LAST:event_createUserJButtonActionPerformed
  public void popData() {

    DefaultTableModel model = (DefaultTableModel) userJTable.getModel();

    model.setRowCount(0);

    for (Organisation organization : business.getOrganisationDirectory().getOrganizationList()) {
      for (UserAccount ua : organization.getUserAccountDirectory().getUserAccountList()) {
        Object row[] = new Object[2];
        row[0] = ua;
        row[1] = ua.getRole();
        ((DefaultTableModel) userJTable.getModel()).addRow(row);
      }
    }
  }
  public void populateEmployeeComboBox(Organisation organization) {
    employeeJComboBox.removeAllItems();

    for (Person p : organization.getPersonDirectory().getPersonList()) {
      employeeJComboBox.addItem(p);
    }
  }
 private void populateRoleComboBox(Organisation organization) {
   roleJComboBox.removeAllItems();
   for (Role role : organization.getSupportedRole()) {
     roleJComboBox.addItem(role);
   }
 }
Exemplo n.º 5
0
  public static Enterprise getSystem() {
    // Step 1
    Enterprise systemEnterprise = new Business.System.System("System");
    String ssn = "1";
    Person sysAdminisPerson = systemEnterprise.getPersonDirectory().addNewPerson("1");

    Staff systemAdmin = systemEnterprise.getEnterpriseAdmin().addNewUser(sysAdminisPerson);
    systemAdmin.setUserName("s");
    systemAdmin.setPassword("s");

    SystemAdministratorWorkArea systemAdministratorWorkArea =
        new SystemAdministratorWorkArea("SystemAdministratorWorkArea");

    systemAdmin.setWorkArea(systemAdministratorWorkArea);
    systemEnterprise.setWorkArea(systemAdministratorWorkArea);

    // Step 2

    Network newNetwork = ((Business.System.System) systemEnterprise).AddNewNetwork("India");
    Enterprise enterprise = newNetwork.newEnterprise("HospitalEnterprise", "BostonGeneral");

    Person person5 = enterprise.getPersonDirectory().addNewPerson("5");

    Staff enterpriseAdministrator = enterprise.getEnterpriseAdmin().addNewUser(person5);
    enterpriseAdministrator.setUserName("e");
    enterpriseAdministrator.setPassword("e");

    EnterpriseAdministratorWorkArea enterpriseAdministratorWorkArea =
        new EnterpriseAdministratorWorkArea("EnterpriseAdministratorWorkArea");

    enterpriseAdministrator.setWorkArea(enterpriseAdministratorWorkArea);
    enterprise.setWorkArea(enterpriseAdministratorWorkArea);

    Person patientPerson = enterprise.getPersonDirectory().addNewPerson("2");
    Patient patientConfigured = enterprise.getPatientDirectory().newPatient(patientPerson);

    MedicalHistory medicalHistoryPatient = patientConfigured.addNewMedicalHistory();

    medicalHistoryPatient.setAge(22);
    medicalHistoryPatient.setBloodPressureRate("90/120mgh");
    MedicationOrder addNewMedicationOrder = medicalHistoryPatient.addNewMedicationOrder();
    addNewMedicationOrder.setDrugAdministered("SSN");
    // medicalHistoryPatient.setDrugAdministered("Crocin");
    medicalHistoryPatient.setVitalSigns("Fever");
    medicalHistoryPatient.setWeight(90);

    // step 3

    Organisation newOrganisation =
        enterprise.newOrganisation("HospitalEnterprise", "CausaltyOrganisation");
    // step 4
    Person person3 = enterprise.getPersonDirectory().addNewPerson("3");
    Staff organisationstaff = newOrganisation.getStaffDirectory().addNewUser(person3);
    organisationstaff.setUserName("o");
    organisationstaff.setPassword("o");

    Organisation newOrganisations =
        enterprise.newOrganisation("HospitalEnterprise", "DoctorManagementOrganisation");
    // step 4
    Person person4 = enterprise.getPersonDirectory().addNewPerson("4");
    Staff organisationstaffes = newOrganisations.getStaffDirectory().addNewUser(person4);
    organisationstaffes.setUserName("do");
    organisationstaffes.setPassword("do");

    // step 5

    DoctorManagementWorkArea dmwa = new DoctorManagementWorkArea("DoctorManagementWorkArea");
    CausaltyWorkArea causaltyWorkArea = new CausaltyWorkArea("CausaltyWorkArea");

    // step 6

    organisationstaff.setWorkArea(causaltyWorkArea);
    newOrganisation.setWorkArea(causaltyWorkArea);

    organisationstaffes.setWorkArea(dmwa);
    newOrganisations.setWorkArea(dmwa);

    return systemEnterprise;
  }