protected Identity newUnitOfWorkId() { return identityGenerator.generate( EntityStore.class ); }
protected Identity newUnitOfWorkId() { return identityGenerator.generate(EntityStore.class); }
protected Identity newUnitOfWorkId() { return identityGenerator.generate(EntityStore.class); }
protected Identity newUnitOfWorkId() { return identityGenerator.generate( EntityStore.class ); }
protected Identity newUnitOfWorkId() { return identityGenerator.generate( EntityStore.class ); }
protected Identity newUnitOfWorkId() { return identityGenerator.generate( EntityStore.class ); }
@Override public EntityStoreUnitOfWork newUnitOfWork( ModuleDescriptor module, Usecase usecase, Instant currentTime ) { Identity newIdentity; if( idGenerator == null ) { newIdentity = StringIdentity.identityOf( UUID.randomUUID().toString() ); } else { newIdentity = idGenerator.generate( UnitOfWork.class ); } return new DefaultEntityStoreUnitOfWork( module, this, newIdentity, usecase, currentTime ); }
@Override public Identity generate( Class type, String canonicalName ) { if( canonicalName == null ) { canonicalName = uuidService.generate( type ).toString(); } if( isIdentity( canonicalName ) ) { // This is already an ID, and we simply return it. return StringIdentity.identityOf( canonicalName ); } String prefix = findPrefix( type ); return StringIdentity.identityOf( prefix + SEPARATOR + canonicalName ); }
@Override public <T> EntityBuilder<T> newEntityBuilder( Class<T> type, Identity identity ) throws NoSuchEntityTypeException { EntityDescriptor model = module.typeLookup().lookupEntityModel( type ); if( model == null ) { throw new NoSuchEntityTypeException( type.getName(), module ); } ModuleDescriptor modelModule = model.module(); EntityStore entityStore = ( (ModuleSpi) modelModule.instance() ).entityStore(); // Generate id if necessary if( identity == null ) { IdentityGenerator idGen = ( (ModuleSpi) modelModule.instance() ).identityGenerator(); identity = idGen.generate( model.types().findFirst().orElse( null ) ); } EntityBuilder<T> builder; builder = new EntityBuilderInstance<>( model, this, uow.getEntityStoreUnitOfWork( entityStore ), identity ); return builder; }
identity = idGen.generate( model.types().findFirst().orElse( null ) );