private void populateTable() {
    DefaultTableModel model = (DefaultTableModel) billjTable1.getModel();

    model.setRowCount(0);
    for (Network n : business.getNetworkList()) {
      for (Enterprise enterprise : n.getEnterpriseDirectory().getEnterpriseList()) {

        if (enterprise instanceof DistributorEnterprise) {
          for (WorkRequest request : enterprise.getWorkQueue().getWorkRequestList()) {

            Object[] row = new Object[5];
            row[0] = request;
            // row[] = request.getSender().getEmployee().getName();
            row[1] =
                request.getReceiver() == null
                    ? null
                    : request.getReceiver().getEmployee().getName();
            row[2] = ((ProviderWorkRequest) request).getOrder();
            row[3] = ((ProviderWorkRequest) request).getTotalPrice();
            row[4] = request.getStatus();

            model.addRow(row);
          }
        }
      }
    }
  }
Ejemplo n.º 2
0
  private void populateNetworkTree() {

    DefaultTreeModel tree = (DefaultTreeModel) networkJTree.getModel();
    DefaultMutableTreeNode root = (DefaultMutableTreeNode) tree.getRoot();
    root.removeAllChildren();
    DefaultMutableTreeNode networkNode;
    DefaultMutableTreeNode stateNode;
    DefaultMutableTreeNode cityNode;
    ArrayList<Network> networkList = system.getNetworkList();
    for (int i = 0; i < networkList.size(); i++) {
      Network country = networkList.get(i);
      networkNode = new DefaultMutableTreeNode(country.getNetworkname());
      root.insert(networkNode, i);
      ArrayList<Network> stateList = country.getSubnetworklist();
      DefaultMutableTreeNode enterpriseNode;
      for (int j = 0; j < stateList.size(); j++) {
        Network state = stateList.get(j);
        stateNode = new DefaultMutableTreeNode(state.getNetworkname());
        networkNode.insert(stateNode, j);
        ArrayList<Network> cityList = state.getSubnetworklist();
        for (int k = 0; k < cityList.size(); k++) {
          Network city = cityList.get(k);
          cityNode = new DefaultMutableTreeNode(city.getNetworkname());
          stateNode.insert(cityNode, k);
        }
      }
    }
    tree.reload();
  }
Ejemplo n.º 3
0
  private void populateEnterpriseNetworkTable(Network n) {

    //        for (Network country : system.getNetworkList())
    //            for (Network state : country.getSubnetworklist())
    //                for (Network city : state.getSubnetworklist())

    DefaultTableModel model = (DefaultTableModel) InfoJTable.getModel();
    model.setRowCount(0);
    for (Enterprise ent : n.getEnterpriseDirectory().getEnterpriseList()) {
      Object row[] = new Object[3];
      row[0] = ent.getName();
      row[1] = n.getNetworkname() + " , " + n.getNetworkname() + " , " + n.getNetworkname();
      row[2] = ent.getEnterpriseType();
      model.addRow(row);
    }
  }
Ejemplo n.º 4
0
  private void submitJButtonActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_submitJButtonActionPerformed

    Enterprise.EnterpriseType entType =
        (Enterprise.EnterpriseType) enterpriseTypeJComboBox.getSelectedItem();
    if (entType.equals(Enterprise.EnterpriseType.RETAILER)) {

      Network citynet = (Network) cityJComboBox.getSelectedItem();

      for (Network country : system.getNetworkList()) {
        for (Network state : country.getSubnetworklist()) {
          for (Network city : state.getSubnetworklist()) {
            String name = enterpriseNameJTextField.getText();
            if (city.getNetworkname().equalsIgnoreCase(String.valueOf(citynet))) {

              Enterprise e =
                  city.getEnterpriseDirectory()
                      .createAndAddEnterprise(name, Enterprise.EnterpriseType.RETAILER);
              // e.setName(name);
              populateEnterpriseNetworkTable(citynet);
            }
          }
        }
      }
      JOptionPane.showMessageDialog(null, "created successfully");
      // populateEnterpriseNetworkTable();
    }
  } // GEN-LAST:event_submitJButtonActionPerformed
  public void populateTree() {

    DefaultTreeModel model = (DefaultTreeModel) JTree.getModel();

    ArrayList<Network> networkList = system.getNetworkList();
    ArrayList<Enterprise> enterpriseList;
    ArrayList<Organization> organizationList;

    Network network;
    Enterprise enterprise;
    Organization organization;

    DefaultMutableTreeNode networks = new DefaultMutableTreeNode("Networks");
    DefaultMutableTreeNode root = (DefaultMutableTreeNode) model.getRoot();
    root.removeAllChildren();
    root.insert(networks, 0);

    DefaultMutableTreeNode networkNode;
    DefaultMutableTreeNode enterpriseNode;
    DefaultMutableTreeNode organizationNode;

    for (int i = 0; i < networkList.size(); i++) {
      network = networkList.get(i);
      networkNode = new DefaultMutableTreeNode(network.getName());
      networks.insert(networkNode, i);

      enterpriseList = network.getEnterpriseDirectory().getEnterpriseList();

      for (int j = 0; j < enterpriseList.size(); j++) {
        enterprise = enterpriseList.get(j);
        enterpriseNode = new DefaultMutableTreeNode(enterprise.getName());
        networkNode.insert(enterpriseNode, j);

        organizationList = enterprise.getOrganizationDirectory().getOrganizationList();
        for (int k = 0; k < organizationList.size(); k++) {
          organization = organizationList.get(k);
          organizationNode = new DefaultMutableTreeNode(organization.getName());
          enterpriseNode.insert(organizationNode, k);
        }
      }
    }

    model.reload();
  }
Ejemplo n.º 6
0
 private void networkJTreeValueChanged(
     javax.swing.event.TreeSelectionEvent evt) { // GEN-FIRST:event_networkJTreeValueChanged
   // TODO add your handling code here:
   DefaultMutableTreeNode selectedNode =
       (DefaultMutableTreeNode) networkJTree.getLastSelectedPathComponent();
   if (selectedNode != null) {
     for (Network country : system.getNetworkList()) {
       if (selectedNode.toString().equalsIgnoreCase((country.getNetworkname()))) {
         network = country;
         break;
       }
       for (Network state : country.getSubnetworklist()) {
         if (selectedNode.toString().equalsIgnoreCase((state.getNetworkname()))) {
           network = state;
           break;
         }
       }
     }
   } else {
     network = null;
   }
 } // GEN-LAST:event_networkJTreeValueChanged
  private void forwardBilljButtonActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_forwardBilljButtonActionPerformed
    int selectedRow = billjTable1.getSelectedRow();
    if (selectedRow < 0) {
      return;
    } else {

      ProviderWorkRequest request2 = (ProviderWorkRequest) billjTable1.getValueAt(selectedRow, 0);

      if (request2.getStatus().equals("Pending")) {
        JOptionPane.showMessageDialog(null, "Order is Pending");
      } else if (request2.getStatus().equals("Completed")) {
        Enterprise ent = null;

        for (Enterprise ent1 : n.getEnterpriseDirectory().getEnterpriseList()) {
          if (ent1 instanceof CDCEnterprise) {
            ent = ent1;
            break;
          }
        }
        if (ent != null) {
          System.out.println(request2.getOrder() + "order check");
          int price = calculatePrice(request2.getOrder());

          request2.setTotalPrice(price);
          System.out.println(price + "dddd");
          ent.getWorkQueue().getWorkRequestList().add(request2);
          // userAccount.getWorkQueue().getWorkRequestList();
          // System.out.println(price +"sss");

        }
      } else {
        JOptionPane.showMessageDialog(null, "Order is Pending");
      }
    }

    // TODO add your handling code here:
  } // GEN-LAST:event_forwardBilljButtonActionPerformed
Ejemplo n.º 8
0
 private void populateCityCombo(Network net) {
   cityJComboBox.removeAllItems();
   for (Network city : net.getSubnetworklist()) {
     cityJComboBox.addItem(city);
   }
 }
Ejemplo n.º 9
0
 private void populateStateCombo(Network net) {
   stateJComboBox.removeAllItems();
   for (Network state : net.getSubnetworklist()) {
     stateJComboBox.addItem(state);
   }
 }
Ejemplo n.º 10
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;
  }