Package org.objectweb.speedo.j2eedo.database

Examples of org.objectweb.speedo.j2eedo.database.Department


   */
  public void newProjectWithEmployees(PollsSynchronizations pollsSync,
            StringBuffer outStr,
            PersistenceManager pm) {
        outStr.append("\nCreate new project with its members");
    Department d = (Department) pm.getObjectById(
          pm.newObjectIdInstance(
              Department.class,
              Long.toString(
                  DatabaseImpl.getDepartmentIdFromPool())),
                      false);
View Full Code Here


  public void newDepartmentWithEmployees(
            PollsSynchronizations pollsSync,
            StringBuffer outStr,
            PersistenceManager pm) {
        outStr.append("\nCreate new deparment with its employees");
    Department d = new Department("Dept-" + Alea.randomstring(4, 9));
    pm.makePersistent(d);
        pollsSync.addInPool(DatabaseImpl.poolOfDepartmentId, d.getDeptid());
    logger.log(BasicLevel.DEBUG,
        "Create a new department id :" + d.getDeptid());
    int nbEmployees = Alea.rand(MIN_EMPLOYEE_PER_DEPARTMENT, MAX_EMPLOYEE_PER_DEPARTMENT);
        outStr.append("\n\tAdd new Department : ").append(d.getDeptid());
        outStr.append(" with ").append(nbEmployees).append(" employees");
        Employee boss = null;
    for (int i = 0; i < nbEmployees; i++) {
      Calendar cal = Calendar.getInstance();
      cal.set(Alea.rand(1900, 2004), Alea.rand(1, 12), Alea.rand(1, 28));
View Full Code Here

   */
  public void getDepartment(StringBuffer outStr, PersistenceManager pm) {
    long id = DatabaseImpl.getDepartmentIdFromPool();
    logger.log(BasicLevel.DEBUG, "Get Department having id :" + id);
    outStr.append("\nGet the department id :").append(id);
    Department d = (Department) pm.getObjectById(
          pm.newObjectIdInstance(Department.class, Long.toString(id)),
          false);
    outStr.append(d.getAsString());
  }
View Full Code Here

    pm.setUserObject(pollsSync);

    outStr.append("\nRemove Dept : " + initialDeptid);
    logger.log(BasicLevel.DEBUG, "Delete the department id :" + initialDeptid);

    Department initialDepartment =
      (Department) pm.getObjectById(
          pm.newObjectIdInstance(
              Department.class,
              Long.toString(initialDeptid)),
              false);

    outStr.append("\nMerge with Dept : " + destinationDeptid);
    Department destinationDepartment =
      (Department) pm.getObjectById(
          pm.newObjectIdInstance(
              Department.class,
              Long.toString(destinationDeptid)),
              false);
View Full Code Here

    long initialDeptid = DatabaseImpl.getDepartmentIdFromPool();
    outStr.append("\nSplit Dept : " + initialDeptid);
    logger.log(BasicLevel.DEBUG,
        "Split the department id :" + initialDeptid);

    Department initialDepartment =
      (Department) pm.getObjectById(
          pm.newObjectIdInstance(
              Department.class,
              Long.toString(initialDeptid)),
              false);

    Department d = new Department(initialDepartment.getName()+"-splited");
    pm.makePersistent(d);

    pollsSync.addInPool(DatabaseImpl.poolOfDepartmentId, d.getDeptid());
    pm.setUserObject(pollsSync);

    outStr.append("\n with Dept : " + d.getDeptid() );

    // move projects
    Iterator projects = initialDepartment.getProjects().iterator();
    Project p = null;
    int nbProject = Math.round(initialDepartment.getProjects().size()/2);
View Full Code Here

   */
  public void setManagerForADepartment(
            StringBuffer outStr,
            PersistenceManager pm) {
        outStr.append("\nUpdate the boss for a department's employees");
    Department d = (Department) pm.getObjectById(
          pm.newObjectIdInstance(Department.class,
              Long.toString(DatabaseImpl.getDepartmentIdFromPool())),
              false);
    logger.log(BasicLevel.DEBUG,
        "Update manager for the department having id :" + d.getDeptid());
    // the first person from a department is the boss;
    Iterator persons = d.getEmployees().iterator();
    Employee boss = null;
    Employee otherEmp = null;
    if (persons.hasNext()) {
      boss = (Employee) persons.next();
      outStr.append("\nThe boss of the department '");
View Full Code Here

   */
  public void newEmployee(PollsSynchronizations pollsSync,
            StringBuffer outStr,
            PersistenceManager pm) {
    long id = DatabaseImpl.getDepartmentIdFromPool();
    Department d = (Department) pm.getObjectById(
          pm.newObjectIdInstance(Department.class, Long.toString(id)),
          false);
    Calendar cal = Calendar.getInstance();
    cal.set(Alea.rand(1900, 2004), Alea.rand(1, 12), Alea.rand(1, 28));
    Employee e =
View Full Code Here

TOP

Related Classes of org.objectweb.speedo.j2eedo.database.Department

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.