public static void main(String args[]) {
    // declare all the object
    String username = null, password = null;
    Staff inputStaff = null;
    ArrayList<Staff> getList = null;
    boolean staffStatus = false;
    DatabaseStaff dbStaff = new DatabaseStaff();

    // scan the staff username and password
    System.out.println("------------------------");
    System.out.print("Username: "******"Password: "******"------------------------");
    inputStaff = new Staff(username, password);
    // processing database
    System.out.println("Check Database");
    System.out.println("process.....\n");
    getList = dbStaff.readFromDatabase("staff.dat");
    for (int i = 0; i < getList.size(); i++) {
      Staff printStaff = (Staff) getList.get(i);
      if (printStaff.EqualsStaff(inputStaff)) {
        staffStatus = true;
        break;
      }
    }

    if (staffStatus) {
      System.out.println("welcome Staff\n");
      viewCinemaFromDatabase();
    } else {
      System.out.println("Sorry your username and password is not match with our database");
    }
  }
 @Test
 public void shouldRespectReadExpression() {
   List<Number> revisions = getAuditReader().getRevisions(Staff.class, id);
   Assert.assertEquals(1, revisions.size());
   Number number = revisions.get(0);
   Staff staffRev = getAuditReader().find(Staff.class, id, number);
   Assert.assertEquals(HEIGHT_INCHES, staffRev.getSizeInInches(), 0.00000001);
 }
示例#3
0
  public static void main(String[] args) {

    ApplicationContext context =
        new FileSystemXmlApplicationContext("WebRoot/WEB-INF/beans-config.xml");
    IStaffDao staffDao = (IStaffDao) context.getBean("staffDao");
    Staff staff = staffDao.getStaff("zhuzhu", "zhuzhu");
    System.out.println(staff.getRealname());
  }
示例#4
0
 public Staff findUser(String username) {
   username.trim();
   for (Staff staff : this) {
     if (username.equalsIgnoreCase(staff.getUserName())) {
       return staff;
     }
   }
   return null;
 }
 @Test
 @Priority(10)
 public void initData() {
   EntityManager em = getEntityManager();
   em.getTransaction().begin();
   Staff staff = new Staff(HEIGHT_INCHES, 1);
   em.persist(staff);
   em.getTransaction().commit();
   id = staff.getId();
 }
示例#6
0
 public static void main(String[] args) {
   // kreiramo objekte, testiramo funkcije
   Person osoba = new Person("Neko");
   Student student = new Student("Student");
   Employee zaposlenik = new Employee("Zaposlen");
   Faculty profesor = new Faculty("Profesor");
   Staff staff = new Staff("staff");
   // to string
   System.out.println(osoba.toString());
   System.out.println(student.toString());
   System.out.println(zaposlenik.toString());
   System.out.println(profesor.toString());
   System.out.println(staff.toString());
 }
示例#7
0
 /**
  * Assigns / Updates the optician, responsible for this appointment
  *
  * @param optician optician to be assigned to the appointment
  */
 public void setOptician(Staff optician) {
   if (optician == null) {
     this.opticianId = null;
   } else {
     this.opticianId = optician.getId();
   }
 }
  private Staff getNameByStdInput(Staff staff) throws IOException {
    String name = "";
    BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
    System.out.print("社員名 : ");
    name = buf.readLine();

    staff.setName(name);
    return staff;
  }
  private Staff getCodeByStdInput(Staff staff) throws IOException {
    String code = "";
    BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
    System.out.print("社員コード : ");
    code = buf.readLine();

    staff.setCode(code);
    return staff;
  }
  /**
   * Generates and returns an ArrayList of all Overdue Videos.
   *
   * @return Overdue List
   */
  public static ArrayList<Video> getOverdueList(Staff staff) {
    if (staff.isManager()) {
      ArrayList<Video> overdue = new ArrayList<Video>();
      for (int i = 0; i < videos.size(); i++) {
        if (videos.get(i).isOverdue()) overdue.add(videos.get(i));
      }

      return overdue;
    }
    return null;
  }
示例#11
0
  private void insertDataStaff() {
    Connection c = null;
    try {
      Class.forName("org.sqlite.JDBC");
      c = DriverManager.getConnection("jdbc:sqlite:C:/Users/SRV/Desktop/project8");

      // Uses SQL Injection to insert data into Graduate Table
      String sql =
          "insert into staff (sid,lastname, firstname, phone, email, office) "
              + "values (?,?,?,?,?,?)";
      PreparedStatement prespstat = c.prepareStatement(sql);

      for (Staff tmpdata : StaffLst) {
        prespstat.setString(1, null);
        prespstat.setString(2, tmpdata.getLastname());
        prespstat.setString(3, tmpdata.getFirstname());
        prespstat.setInt(4, tmpdata.getPhone());
        prespstat.setString(5, tmpdata.getEmail());
        prespstat.setInt(6, tmpdata.getOffice());

        prespstat.addBatch();
      }

      prespstat.executeBatch();
      prespstat.close();
      c.close();
    } catch (Exception e) {
      System.err.println(e.getClass().getName() + ": " + e.getMessage());
      System.exit(0);
    }
    System.out.println("Database Inserted Successfully");
  }
示例#12
0
 public ArrayList<Notes> getNotes() throws IOException {
   ArrayList<Staff> staffs =
       SetUpImage.scrapeStaffs(
           SetUpImage.separateStaffs(SetUpImage.makeCurrentColorArray(file, activity)));
   mHelloService.say(staffs.size() + " Staffs");
   System.out.println("la");
   if (staffs.size() <= 0) {
     mHelloService.say("Take another picture!");
     return null;
   }
   ArrayList<Notes> arr = new ArrayList<Notes>();
   try {
     for (Staff s : staffs) {
       s.fillCoordinateArrays();
       s.fillScanStartPoints();
       arr.addAll(s.findColorConcentrations());
     }
   } catch (Exception e) {
   }
   mHelloService.say("Man");
   return arr;
 }
示例#13
0
  private MemberModel() {
    // init memberMap
    memberMap = new HashMap<>();
    // init entitledMap (1 to many relation between memberID and BookNumber)
    entitledMap = new HashMap<>();
    boolean readFlag = false;
    ObjectInputStream oin = null;
    Member tm;
    String[] sa = new String[3];
    try {
      oin = new ObjectInputStream(new FileInputStream("members1.dat"));
      readFlag = true;
    } catch (Exception e) {
      e.printStackTrace();
    }
    // read in from file
    while (readFlag) {
      try {
        // Read a member data from inputstream
        // Structure for reading
        // __________________________________________________________
        // |String|String|String|Boolean or Double|ArrayList<String>|
        // ----------------------------------------------------------

        sa[ID_INDEX] = oin.readUTF();
        sa[TITLE_INDEX] = oin.readUTF();
        sa[PHONENO_INDEX] = oin.readUTF();
        if (sa[ID_INDEX].indexOf("STA") != -1) {
          tm = new Staff(sa[ID_INDEX], sa[TITLE_INDEX], sa[PHONENO_INDEX]);
          ((Staff) tm).setBookOverdue(oin.readBoolean());
        } else {
          tm = new Student(sa[ID_INDEX], sa[TITLE_INDEX], sa[PHONENO_INDEX]);
          ((Student) tm).setFinesOwing(oin.readDouble());
        }
        // Raw data map without relationship to book
        memberMap.put(tm.getMemberID(), tm);
        // Map for storing relation
        entitledMap.put(tm.getMemberID(), (ArrayList<String>) oin.readObject());
      } catch (EOFException e) {
        Log.e(e.getMessage());
        readFlag = false;
      } catch (Exception e) {
        Log.e(e.getMessage());
      }
    }
    try {
      oin.close();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
  @Override
  public Object getValueAt(int row, int col) {
    Staff employee = employees.get(row);

    switch (col) {
      case NAME:
        return employee.getName();
      case NATINAL_ID_NUM:
        return employee.getNational_id_num();
      case STAFF_ID:
        return employee.getStaff_id();
      case RANK:
        return employee.getRank();

      case OBJECT_COL:
        return employee;

      default:
        return employee.getName();
    }
  }
示例#15
0
文件: Doctor.java 项目: Rupsbant/swop
 @Override
 public void visitConstraint(SchedulableVisitor tfConstraints) {
   super.visitConstraint(tfConstraints);
   tfConstraints.setDoctor(this);
 }
示例#16
0
 @Override
 public void endElement(String s, String s1, String element) throws SAXException {
   // if end of book element add to list
   if (element.equals("deptname")) {
     DeptNameLst.add(depttmp);
   }
   if (element.equals("gradstudent")) {
     GradStudentLst.add(gstmp);
   }
   if (element.equals("undergradstudent")) {
     UndGdStudentLst.add(undtmp);
   }
   if (element.equals("staff")) {
     StaffLst.add(stftmp);
   }
   if (element.equals("faculty")) {
     FacultyLst.add(fcttmp);
   }
   if (element.equals("deptname")) {
     depttmp.setDeptname(tempval);
   }
   if (element.equals("phone")) {
     if (flaggs) {
       gstmp.setPhone(Integer.parseInt(tempval));
     }
     if (flagstaff) {
       stftmp.setPhone(Integer.parseInt(tempval));
     }
     if (flagfaculty) {
       fcttmp.setPhone(Integer.parseInt(tempval));
     }
     if (flagund) {
       undtmp.setPhone(Integer.parseInt(tempval));
     }
   }
   if (element.equals("email")) {
     if (flaggs) {
       gstmp.setEmail(tempval);
     }
     if (flagstaff) {
       stftmp.setEmail(tempval);
     }
     if (flagfaculty) {
       fcttmp.setEmail(tempval);
     }
     if (flagund) {
       undtmp.setEmail(tempval);
     }
   }
   if (element.equals("office")) {
     if (flaggs) {
       gstmp.setOffice(Integer.parseInt(tempval));
     }
     if (flagstaff) {
       stftmp.setOffice(Integer.parseInt(tempval));
     }
     if (flagfaculty) {
       fcttmp.setOffice(Integer.parseInt(tempval));
     }
     if (flagund) {
       undtmp.setOffice(Integer.parseInt(tempval));
     }
   }
   if (element.equals("url")) {
     if (flaggs) {
       gstmp.setUrl(tempval);
     }
     if (flagund) {
       undtmp.setUrl(tempval);
     }
   }
   if (element.equals("gpa")) {
     if (flaggs) {
       gstmp.setGpa(tempval);
     }
     if (flagund) {
       undtmp.setGpa(tempval);
     }
   }
   if (element.equals("firstname")) {
     if (flaggs) {
       gstmp.setFirstname(tempval);
     }
     if (flagstaff) {
       stftmp.setFirstname(tempval);
     }
     if (flagfaculty) {
       fcttmp.setFirstname(tempval);
     }
     if (flagund) {
       undtmp.setFirstname(tempval);
     }
   }
   if (element.equals("lastname")) {
     if (flaggs) {
       gstmp.setLastname(tempval);
     }
     if (flagstaff) {
       stftmp.setLastname(tempval);
     }
     if (flagfaculty) {
       fcttmp.setLastname(tempval);
     }
     if (flagund) {
       undtmp.setLastname(tempval);
     }
   }
   if (element.equals("zip")) {
     if (flaggs) {
       gstmp.setZip(tempval);
     }
     if (flagund) {
       undtmp.setZip(tempval);
     }
   }
   if (element.equals("state")) {
     if (flaggs) {
       gstmp.setState(tempval);
     }
     if (flagund) {
       undtmp.setState(tempval);
     }
   }
   if (element.equals("city")) {
     if (flaggs) {
       gstmp.setCity(tempval);
     }
     if (flagund) {
       undtmp.setCity(tempval);
     }
   }
 }
  /**
   * Puts all the given staff into the given lessonPlans, avoiding all given lessonPlans. Returns
   * true if it successfully put the staff into the lessonPlans.
   *
   * @param lessonPlans The lessonPlans to have staff put in.
   * @param staffList The staff to put into the lessonPlans.
   * @param overloadedPeriods The lessonPlans which overlap.
   * @return True if successfully put the staff into the lessonPlans.
   */
  private boolean putStaffIntoLessonPlan(
      List<LessonPlan> lessonPlans,
      List<Staff> staffList,
      List<Set<LessonPlan>> overloadedPeriods) {
    boolean done = false;

    while (!done) {
      Set<SubjectSet> subjectSets = new HashSet<>();
      lessonPlans.forEach(lessonPlan -> subjectSets.add(lessonPlan.subjectSet));

      for (SubjectSet subjectSet : subjectSets) {
        List<LessonPlan> lessonsForSubjectSet =
            lessonPlans
                .stream() // Turn list into an iterating stream
                .filter(
                    lessonPlan ->
                        lessonPlan.subjectSet.id
                            == subjectSet
                                .id) // Only add lessonsPlans who's subjectSet is the subjectSet
                // currently being processed.
                .collect(
                    Collectors.toCollection(
                        ArrayList::new)); // Collect all which meet the filter into an ArrayList and
        // return it

        /*List<LessonPlan> lessonsForSubjectSet = new ArrayList<>();                //This is the equivalent of the above
        for (LessonPlan lessonPlan : lessonPlans) {
            if (lessonPlan.subjectSet.id == subjectSet.id) {
                lessonsForSubjectSet.add(lessonPlan);
            }
        }*/

        if (lessonsForSubjectSet.get(0).staff.id
            == -1) { // Only check first as all will be set if the first is set
          Set<SubjectSet> possibleConflicts =
              new HashSet<>(); // A set containing every subjectSet which happens at the same time
          // as the current subjectSet
          for (Set<LessonPlan> overloadedPeriod : overloadedPeriods) {
            if (overloadedPeriod
                .stream()
                .anyMatch(lessonPlan -> lessonPlan.subjectSet.id == subjectSet.id)) {
              // Only a set rather than List(Set) as do not need to know when the conflict is,
              overloadedPeriod.forEach(
                  lessonPlan ->
                      possibleConflicts.add(
                          lessonPlan.subjectSet)); // only there is a conflict between the current
              // subjectSet and the subjectSets
              // in the set
            }
          }

          for (Staff staff : staffList) {
            if (staff.currentHoursPerWeek >= staff.hoursPerWeek) {
              break;
            }

            Set<SubjectSet> subjectSetsForStaff =
                new HashSet<>(); // A set containing the subjectSets taught by the current staff
            lessonsForSubjectSet.forEach(
                lessonPlan -> {
                  if (lessonPlan.staff.id != -1 && lessonPlan.id != staff.id) {
                    subjectSetsForStaff.add(lessonPlan.subjectSet);
                  }
                });

            if (Collections.disjoint(
                possibleConflicts,
                subjectSetsForStaff)) { // disjoint returns true if the collections has no elements
              // in common
              staff.currentHoursPerWeek += lessonsForSubjectSet.size();
              for (LessonPlan lessonPlan : lessonPlans) {
                if (lessonPlan.subjectSet.id == subjectSet.id) {
                  LessonPlan lesson =
                      new LessonPlan(
                          lessonPlan.id,
                          staff,
                          lessonPlan.classroom,
                          lessonPlan.period,
                          lessonPlan.subjectSet);
                  lessonPlans.set(lessonPlans.indexOf(lessonPlan), lesson);
                }
              }
            }
          }
        }
      }

      done =
          lessonPlans
              .stream()
              .allMatch(
                  lessonPlan ->
                      lessonPlan.staff
                          != null); // Checks if every lessonPlan has a member of staff teaching it
    }

    return true;
  }
 @Override
 public int compare(Staff o1, Staff o2) {
   // TODO Auto-generated method stub
   return o2.getLevel() - o1.getLevel();
 }