@Override public boolean add( Object entity ) { return next.add( entity ); }
@Override public boolean add( int i, Object entity ) { return next.add( i, entity ); }
@Override public Schedule scheduleCron( Task task, String cronExpression, long initialDelay, boolean durable ) { DateTime start = new DateTime( System.currentTimeMillis() + initialDelay ); Schedule schedule = scheduleFactory.newCronSchedule( task, cronExpression, start, durable ); if( durable ) { Schedules schedules = module.currentUnitOfWork().get( Schedules.class, getSchedulesIdentity( me ) ); schedules.schedules().add( schedule ); } dispatchForExecution( schedule ); return schedule; }
@Override public Schedule scheduleOnce( Task task, int initialSecondsDelay, boolean durable ) { long now = System.currentTimeMillis(); Schedule schedule = scheduleFactory.newOnceSchedule( task, new DateTime( now + initialSecondsDelay * 1000 ), durable ); if( durable ) { Schedules schedules = module.currentUnitOfWork().get( Schedules.class, getSchedulesIdentity( me ) ); schedules.schedules().add( schedule ); } dispatchForExecution( schedule ); return schedule; }
@Override public Schedule scheduleCron( Task task, String cronExpression, boolean durable ) { DateTime now = new DateTime(); Schedule schedule = scheduleFactory.newCronSchedule( task, cronExpression, now, durable ); if( durable ) { Schedules schedules = module.currentUnitOfWork().get( Schedules.class, getSchedulesIdentity( me ) ); schedules.schedules().add( schedule ); } dispatchForExecution( schedule ); return schedule; }
@Override public Schedule scheduleOnce( Task task, DateTime runAt, boolean durable ) { Schedule schedule = scheduleFactory.newOnceSchedule( task, runAt, durable ); dispatchForExecution( schedule ); if( durable ) { Schedules schedules = module.currentUnitOfWork().get( Schedules.class, getSchedulesIdentity( me ) ); schedules.schedules().add( schedule ); } return schedule; }
@Override public Schedule scheduleCron( Task task, @CronExpression String cronExpression, DateTime start, boolean durable ) { Schedule schedule = scheduleFactory.newCronSchedule( task, cronExpression, start, durable ); if( durable ) { Schedules schedules = module.currentUnitOfWork().get( Schedules.class, getSchedulesIdentity( me ) ); schedules.schedules().add( schedule ); } dispatchForExecution( schedule ); return schedule; }
@Test public void givenManyAssociationIsModifiedWhenUnitOfWorkCompletesThenStoreState() throws UnitOfWorkCompletionException { TestEntity testEntity; String version; { UnitOfWork unitOfWork = module.newUnitOfWork(); EntityBuilder<TestEntity> builder = unitOfWork.newEntityBuilder( TestEntity.class ); testEntity = builder.newInstance(); unitOfWork.complete(); } { UnitOfWork unitOfWork = module.newUnitOfWork(); testEntity = unitOfWork.get( testEntity ); testEntity.manyAssociation().add( 0, testEntity ); version = spi.entityStateOf( testEntity ).version(); unitOfWork.complete(); } { UnitOfWork unitOfWork = module.newUnitOfWork(); testEntity = unitOfWork.get( testEntity ); String newVersion = spi.entityStateOf( testEntity ).version(); assertThat( "version has changed", newVersion, not( equalTo( version ) ) ); unitOfWork.complete(); } }
proto.barManyAssociation().add( buildBarEntity( "bazar ONE in barManyAssociation" ) ); proto.barManyAssociation().add( buildBarEntity( "bazar TWO in barManyAssociation" ) ); proto.barEntityManyAssociation().add( buildBarEntity( "bazar ONE in barEntityManyAssociation" ) ); proto.barEntityManyAssociation().add( buildBarEntity( "bazar TWO in barEntityManyAssociation" ) ); proto.barNamedAssociation().put( "bazar", buildBarEntity( "bazar in barNamedAssociation" ) ); proto.barNamedAssociation().put( "cathedral", buildBarEntity( "cathedral in barNamedAssociation" ) );
instance.valueProperty().set( valueBuilder1.newInstance() ); instance.manyAssociation().add( 0, instance );
annDoe.placeOfBirth().set( kualaLumpur ); annDoe.yearOfBirth().set( 1975 ); annDoe.interests().add( 0, cooking ); annDoe.password().set( "passwordOfAnnDoe" ); annDoe.mainAccount().set( annsAccount ); joeDoe.yearOfBirth().set( 1990 ); joeDoe.mother().set( annDoe ); joeDoe.interests().add( 0, programming ); joeDoe.interests().add( 0, gaming ); joeDoe.email().set( "joe@thedoes.net" ); joeDoe.password().set( "passwordOfJoeDoe" ); jackDoe.placeOfBirth().set( penang ); jackDoe.yearOfBirth().set( 1970 ); jackDoe.interests().add( 0, cars ); jackDoe.wife().set( annDoe ); jackDoe.password().set( "passwordOfJohnDoe" );