Search in sources :

Example 1 with EmploymentPeriod

use of org.eclipse.persistence.testing.models.employee.domain.EmploymentPeriod in project eclipselink by eclipse-ee4j.

the class DeepNestedUnitOfWorkTest method changeFirstLevelUnitOfWorkWorkingCopy.

protected void changeFirstLevelUnitOfWorkWorkingCopy() {
    Employee employee = (Employee) this.unitOfWorkWorkingCopy[0];
    // Transformation
    employee.setNormalHours(new java.sql.Time[2]);
    employee.setStartTime(Helper.timeFromHourMinuteSecond(1, 1, 1));
    employee.setEndTime(Helper.timeFromHourMinuteSecond(1, 1, 1));
    // Aggregate
    employee.setPeriod(new EmploymentPeriod(Helper.dateFromYearMonthDate(1901, 1, 1), Helper.dateFromYearMonthDate(1902, 2, 2)));
}
Also used : EmploymentPeriod(org.eclipse.persistence.testing.models.employee.domain.EmploymentPeriod) Employee(org.eclipse.persistence.testing.models.employee.domain.Employee)

Example 2 with EmploymentPeriod

use of org.eclipse.persistence.testing.models.employee.domain.EmploymentPeriod in project eclipselink by eclipse-ee4j.

the class NestedUnitOfWorkTest method changeUnitOfWorkWorkingCopy.

protected void changeUnitOfWorkWorkingCopy() {
    Employee employee = (Employee) this.unitOfWorkWorkingCopy;
    // Transformation
    employee.setNormalHours(new java.sql.Time[2]);
    employee.setStartTime(Helper.timeFromHourMinuteSecond(1, 1, 1));
    employee.setEndTime(Helper.timeFromHourMinuteSecond(1, 1, 1));
    // Aggregate
    employee.setPeriod(new EmploymentPeriod(Helper.dateFromYearMonthDate(1901, 1, 1), Helper.dateFromYearMonthDate(1902, 2, 2)));
    // One to many private
    employee.setPhoneNumbers(new Vector());
    employee.addPhoneNumber(new PhoneNumber("home", "613", "2263374"));
    employee.addPhoneNumber(new PhoneNumber("office", "416", "8224599"));
    // Many to many
    employee.setProjects(new Vector());
    employee.addProject((Project) this.unitOfWork.readObject(SmallProject.class));
    employee.addProject((Project) this.unitOfWork.readObject(LargeProject.class));
    // Direct collection
    employee.setResponsibilitiesList(new Vector());
    employee.addResponsibility("make coffee");
    employee.addResponsibility("buy donuts");
    // One to one private/public
    employee.setAddress(new Address());
    // make sure that the employee is not his own manager
    employee.setManager((Employee) this.unitOfWork.readObject(Employee.class, (new ExpressionBuilder()).get("id").notEqual(employee.getId())));
}
Also used : EmploymentPeriod(org.eclipse.persistence.testing.models.employee.domain.EmploymentPeriod) Employee(org.eclipse.persistence.testing.models.employee.domain.Employee) Address(org.eclipse.persistence.testing.models.employee.domain.Address) PhoneNumber(org.eclipse.persistence.testing.models.employee.domain.PhoneNumber) ExpressionBuilder(org.eclipse.persistence.expressions.ExpressionBuilder) Vector(java.util.Vector)

Example 3 with EmploymentPeriod

use of org.eclipse.persistence.testing.models.employee.domain.EmploymentPeriod in project eclipselink by eclipse-ee4j.

the class NLSEmployeePopulator method employmentPeriodExample5.

public EmploymentPeriod employmentPeriodExample5() {
    EmploymentPeriod employmentPeriod = new EmploymentPeriod();
    employmentPeriod.setEndDate(Helper.dateFromYearMonthDate(1901, 11, 31));
    employmentPeriod.setStartDate(Helper.dateFromYearMonthDate(19 - 5, 0, 1));
    return employmentPeriod;
}
Also used : EmploymentPeriod(org.eclipse.persistence.testing.models.employee.domain.EmploymentPeriod)

Example 4 with EmploymentPeriod

use of org.eclipse.persistence.testing.models.employee.domain.EmploymentPeriod in project eclipselink by eclipse-ee4j.

the class NLSEmployeePopulator method employmentPeriodExample10.

public EmploymentPeriod employmentPeriodExample10() {
    EmploymentPeriod employmentPeriod = new EmploymentPeriod();
    employmentPeriod.setStartDate(Helper.dateFromYearMonthDate(1991, 10, 11));
    return employmentPeriod;
}
Also used : EmploymentPeriod(org.eclipse.persistence.testing.models.employee.domain.EmploymentPeriod)

Example 5 with EmploymentPeriod

use of org.eclipse.persistence.testing.models.employee.domain.EmploymentPeriod in project eclipselink by eclipse-ee4j.

the class NLSEmployeePopulator method employmentPeriodExample1.

public EmploymentPeriod employmentPeriodExample1() {
    EmploymentPeriod employmentPeriod = new EmploymentPeriod();
    employmentPeriod.setEndDate(Helper.dateFromYearMonthDate(1996, 0, 1));
    employmentPeriod.setStartDate(Helper.dateFromYearMonthDate(1993, 0, 1));
    return employmentPeriod;
}
Also used : EmploymentPeriod(org.eclipse.persistence.testing.models.employee.domain.EmploymentPeriod)

Aggregations

EmploymentPeriod (org.eclipse.persistence.testing.models.employee.domain.EmploymentPeriod)23 Employee (org.eclipse.persistence.testing.models.employee.domain.Employee)8 Vector (java.util.Vector)4 TestErrorException (org.eclipse.persistence.testing.framework.TestErrorException)3 PhoneNumber (org.eclipse.persistence.testing.models.employee.domain.PhoneNumber)3 ExpressionBuilder (org.eclipse.persistence.expressions.ExpressionBuilder)2 Address (org.eclipse.persistence.testing.models.employee.domain.Address)2 EmployeePopulator (org.eclipse.persistence.testing.models.employee.domain.EmployeePopulator)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 IOException (java.io.IOException)1 ObjectInputStream (java.io.ObjectInputStream)1 ObjectOutputStream (java.io.ObjectOutputStream)1 BigDecimal (java.math.BigDecimal)1 Date (java.sql.Date)1 DatabaseException (org.eclipse.persistence.exceptions.DatabaseException)1 QueryException (org.eclipse.persistence.exceptions.QueryException)1 DatabaseAccessor (org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor)1 UnitOfWorkChangeSet (org.eclipse.persistence.internal.sessions.UnitOfWorkChangeSet)1 UnitOfWorkImpl (org.eclipse.persistence.internal.sessions.UnitOfWorkImpl)1