org.apache.polygene.api.structure.Module.unitOfWorkFactory()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(129)

本文整理了Java中org.apache.polygene.api.structure.Module.unitOfWorkFactory()方法的一些代码示例,展示了Module.unitOfWorkFactory()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Module.unitOfWorkFactory()方法的具体详情如下:
包路径:org.apache.polygene.api.structure.Module
类名称:Module
方法名:unitOfWorkFactory

Module.unitOfWorkFactory介绍

[英]Returns the UnitOfWorkFactory for this Module.
[中]返回此模块的UnitOfWorkFactory。

代码示例

代码示例来源:origin: apache/attic-polygene-java

protected UnitOfWorkFactory unitOfWorkFactory()
{
  return moduleInstance.unitOfWorkFactory();
}

代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.bootstrap

protected UnitOfWorkFactory unitOfWorkFactory()
{
  return moduleInstance.unitOfWorkFactory();
}

代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.testsupport

@Override
public Person byId( Identity id )
{
  return module.unitOfWorkFactory().currentUnitOfWork().get( Person.class, id );
}

代码示例来源:origin: apache/attic-polygene-java

@Override
public Person byId( Identity id )
{
  return module.unitOfWorkFactory().currentUnitOfWork().get( Person.class, id );
}

代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.testsupport

@Override
public void rename( Identity id, String newName )
{
  module.unitOfWorkFactory().currentUnitOfWork().get( Person.class, id ).name().set( newName );
}

代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.testsupport

@Override
  public Iterable<Person> all()
  {
    return module.unitOfWorkFactory().currentUnitOfWork()
        .get( PersonList.class, PersonList.LIST_ID )
        .all().toList();
  }
}

代码示例来源:origin: apache/attic-polygene-java

@Override
public void rename( Identity id, String newName )
{
  module.unitOfWorkFactory().currentUnitOfWork().get( Person.class, id ).name().set( newName );
}

代码示例来源:origin: apache/attic-polygene-java

@Override
  public Iterable<Person> all()
  {
    return module.unitOfWorkFactory().currentUnitOfWork()
        .get( PersonList.class, PersonList.LIST_ID )
        .all().toList();
  }
}

代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.testsupport

@Override
public void setUp()
  throws Exception
{
  super.setUp();
  TestData.populate( module.instance() );
  this.unitOfWork = this.module.instance().unitOfWorkFactory().newUnitOfWork();
}

代码示例来源:origin: apache/attic-polygene-java

@Override
public void setUp()
  throws Exception
{
  super.setUp();
  TestData.populate( module.instance() );
  this.unitOfWork = this.module.instance().unitOfWorkFactory().newUnitOfWork();
}

代码示例来源:origin: apache/attic-polygene-java

public void initialize()
  throws ActivationException
{
  polygeneApplication = createApplication();
  activateApplication();
  entryModule = polygeneApplication.findModule( entryLayer(), entryModule() );
  serviceFinder = entryModule;
  objectFactory = entryModule;
  transientBuilderFactory = entryModule;
  unitOfWorkFactory = entryModule.unitOfWorkFactory();
  valueBuilderFactory = entryModule;
}

代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.api

public T newInstance( Module module )
  {
    EntityBuilder<T> builder = module.unitOfWorkFactory().currentUnitOfWork().newEntityBuilder( type );
    build( builder.instance() );
    return builder.newInstance();
  }
}

代码示例来源:origin: apache/attic-polygene-java

public T newInstance( Module module )
  {
    EntityBuilder<T> builder = module.unitOfWorkFactory().currentUnitOfWork().newEntityBuilder( type );
    build( builder.instance() );
    return builder.newInstance();
  }
}

代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.testsupport

@Override
public void activateService() throws Exception
{
  try (UnitOfWork uow = module.unitOfWorkFactory().newUnitOfWork( newUsecase( "Init Person List" ) ) )
  {
    try
    {
      uow.get( PersonList.class, PersonList.LIST_ID );
    }
    catch( NoSuchEntityException ex )
    {
      uow.newEntity( PersonList.class, PersonList.LIST_ID );
      uow.complete();
    }
  }
}

代码示例来源:origin: apache/attic-polygene-java

@Override
public void activateService() throws Exception
{
  try (UnitOfWork uow = module.unitOfWorkFactory().newUnitOfWork( newUsecase( "Init Person List" ) ) )
  {
    try
    {
      uow.get( PersonList.class, PersonList.LIST_ID );
    }
    catch( NoSuchEntityException ex )
    {
      uow.newEntity( PersonList.class, PersonList.LIST_ID );
      uow.complete();
    }
  }
}

代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.testsupport

@Override
  public void delete( Identity id )
  {
    UnitOfWork uow = module.unitOfWorkFactory().currentUnitOfWork();
    PersonList list = uow.get( PersonList.class, PersonList.LIST_ID );
    Person person = uow.get( Person.class, id );
    list.all().remove( person );
    uow.remove( person );
  }
}

代码示例来源:origin: apache/attic-polygene-java

@Override
  public void delete( Identity id )
  {
    UnitOfWork uow = module.unitOfWorkFactory().currentUnitOfWork();
    PersonList list = uow.get( PersonList.class, PersonList.LIST_ID );
    Person person = uow.get( Person.class, id );
    list.all().remove( person );
    uow.remove( person );
  }
}

代码示例来源:origin: apache/attic-polygene-java

@Override
public Person create( Identity id, String name )
{
  UnitOfWork uow = module.unitOfWorkFactory().currentUnitOfWork();
  PersonList list = uow.get( PersonList.class, PersonList.LIST_ID );
  EntityBuilder<Person> builder = uow.newEntityBuilder( Person.class, id );
  builder.instance().name().set( name );
  Person person = builder.newInstance();
  list.all().add( person );
  return person;
}

代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.testsupport

@Override
public Person create( Identity id, String name )
{
  UnitOfWork uow = module.unitOfWorkFactory().currentUnitOfWork();
  PersonList list = uow.get( PersonList.class, PersonList.LIST_ID );
  EntityBuilder<Person> builder = uow.newEntityBuilder( Person.class, id );
  builder.instance().name().set( name );
  Person person = builder.newInstance();
  list.all().add( person );
  return person;
}

代码示例来源:origin: apache/attic-polygene-java

@BeforeClass
public static void setup()
  throws Exception
{
  assembler = new SingletonAssembler(
    module -> {
      module.entities(
        CheckingAccountRolemap.class,
        SavingsAccountRolemap.class,
        CreditorRolemap.class );
      new EntityTestAssembler().assemble( module );
    }
  );
  uowf = assembler.module().unitOfWorkFactory();
  bootstrapData( assembler );
}

相关文章